Skip to content

Commit

Permalink
Really hide actions menu from forms when empty
Browse files Browse the repository at this point in the history
because actions() does something else
  • Loading branch information
elpaso authored and nyalldawson committed Feb 19, 2020
1 parent dbf999b commit bcf0e48
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/gui/qgsactionmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,8 @@ QgsExpressionContextScope QgsActionMenu::expressionContextScope() const
{
return mExpressionContextScope;
}

QList<QgsAction> QgsActionMenu::menuActions()
{
return mActions;
}
7 changes: 7 additions & 0 deletions src/gui/qgsactionmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ class GUI_EXPORT QgsActionMenu : public QMenu
*/
QgsExpressionContextScope expressionContextScope() const;

/**
* Returns menu actions
*
* \since QGIS 3.12
*/
QList<QgsAction> menuActions();

signals:
void reinit();

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsattributedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void QgsAttributeDialog::init( QgsVectorLayer *layer, QgsFeature *feature, const
connect( layer, &QObject::destroyed, this, &QWidget::close );

mMenu = new QgsActionMenu( layer, mAttributeForm->feature(), QStringLiteral( "Feature" ), this );
if ( !mMenu->actions().isEmpty() )
if ( !mMenu->menuActions().isEmpty() )
{
QMenuBar *menuBar = new QMenuBar( this );
menuBar->addMenu( mMenu );
Expand Down

0 comments on commit bcf0e48

Please sign in to comment.