mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
File - Import: Add "Import Pressure Depth Data"
* #9944 Add "Import Pressure Depth Data" to import menu Remove obsolete *InMenuFeatures and set all actions in menu to enabled when the signal aboutToShow() is triggered. This is useful for menus where no selection/context is available. * Use RiaApplication::enableDevelopmentFeatures() to control visibility
This commit is contained in:
@@ -18,6 +18,9 @@
|
||||
|
||||
#include "RiuTools.h"
|
||||
|
||||
#include "QMenu"
|
||||
#include "QObject"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -27,3 +30,18 @@ Qt::WindowFlags RiuTools::defaultDialogFlags()
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// When a cafCmdFeature is used to create an action, the enable state is controlled by cafCmdFeature::isCommandEnabled(). If an action is
|
||||
/// used in menus with no selection/context available, the enable state can be forced on before the menu is displayed.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuTools::enableAllActionsOnShow( QObject* object, QMenu* menu )
|
||||
{
|
||||
if ( object && menu )
|
||||
{
|
||||
object->connect( menu, &QMenu::aboutToShow, [menu]() {
|
||||
for ( auto act : menu->actions() )
|
||||
act->setEnabled( true );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user