Skip to content
Permalink
Browse files

Rename actions

  • Loading branch information
nyalldawson committed Oct 16, 2018
1 parent f8863aa commit ca427d331676a953d73d5812f7f653f516d65e70
@@ -49,21 +49,21 @@ any other tabs.
.. seealso:: :py:func:`toggleUserVisible`
%End

void setLinkedAction( QAction *action );
void setToggleVisibilityAction( QAction *action );
%Docstring
Links an ``action`` to the dock, so that toggling the action will automatically set the dock's visibility
to suit (and changing the dock visibility will update the action's state).

.. seealso:: :py:func:`linkedAction`
.. seealso:: :py:func:`toggleVisibilityAction`

.. versionadded:: 3.4
%End

QAction *linkedAction();
QAction *toggleVisibilityAction();
%Docstring
Returns the action linked to the dock.

.. seealso:: :py:func:`setLinkedAction`
.. seealso:: :py:func:`setToggleVisibilityAction`

.. versionadded:: 3.4
%End
@@ -699,11 +699,11 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla

mAtlasDock = new QgsDockWidget( tr( "Atlas" ), this );
mAtlasDock->setObjectName( QStringLiteral( "AtlasDock" ) );
mAtlasDock->setLinkedAction( mActionAtlasSettings );
mAtlasDock->setToggleVisibilityAction( mActionAtlasSettings );

mReportDock = new QgsDockWidget( tr( "Report Organizer" ), this );
mReportDock->setObjectName( QStringLiteral( "ReportDock" ) );
mReportDock->setLinkedAction( mActionReportSettings );
mReportDock->setToggleVisibilityAction( mActionReportSettings );

const QList<QDockWidget *> docks = findChildren<QDockWidget *>();
for ( QDockWidget *dock : docks )
@@ -884,7 +884,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
connect( showBookmarksDock, &QShortcut::activated, mBookMarksDockWidget, &QgsDockWidget::toggleUserVisible );
showBookmarksDock->setObjectName( QStringLiteral( "ShowBookmarksPanel" ) );
showBookmarksDock->setWhatsThis( tr( "Show Bookmarks Panel" ) );
mBookMarksDockWidget->setLinkedAction( mActionShowBookmarks );
mBookMarksDockWidget->setToggleVisibilityAction( mActionShowBookmarks );

endProfile();

@@ -2116,7 +2116,7 @@ void QgisApp::createActions()
connect( mActionSvgAnnotation, &QAction::triggered, this, &QgisApp::addSvgAnnotation );
connect( mActionAnnotation, &QAction::triggered, this, &QgisApp::modifyAnnotation );
connect( mActionLabeling, &QAction::triggered, this, &QgisApp::labeling );
mStatisticalSummaryDockWidget->setLinkedAction( mActionStatisticalSummary );
mStatisticalSummaryDockWidget->setToggleVisibilityAction( mActionStatisticalSummary );

// Layer Menu Items

@@ -58,7 +58,7 @@ bool QgsDockWidget::isUserVisible() const
return mVisibleAndActive;
}

void QgsDockWidget::setLinkedAction( QAction *action )
void QgsDockWidget::setToggleVisibilityAction( QAction *action )
{
mAction = action;
if ( !mAction->isCheckable() )
@@ -74,7 +74,7 @@ void QgsDockWidget::setLinkedAction( QAction *action )
} );
}

QAction *QgsDockWidget::linkedAction()
QAction *QgsDockWidget::toggleVisibilityAction()
{
return mAction;
}
@@ -61,18 +61,18 @@ class GUI_EXPORT QgsDockWidget : public QDockWidget
* Links an \a action to the dock, so that toggling the action will automatically set the dock's visibility
* to suit (and changing the dock visibility will update the action's state).
*
* \see linkedAction()
* \see toggleVisibilityAction()
* \since QGIS 3.4
*/
void setLinkedAction( QAction *action );
void setToggleVisibilityAction( QAction *action );

/**
* Returns the action linked to the dock.
*
* \see setLinkedAction()
* \see setToggleVisibilityAction()
* \since QGIS 3.4
*/
QAction *linkedAction();
QAction *toggleVisibilityAction();

public slots:

@@ -236,13 +236,13 @@ void TestQgsDockWidget::testAction()
QAction *a1 = new QAction( w );
QAction *a2 = new QAction( w );

QVERIFY( ! d1->linkedAction() );
d1->setLinkedAction( a1 );
d2->setLinkedAction( a2 );
QVERIFY( ! d1->toggleVisibilityAction() );
d1->setToggleVisibilityAction( a1 );
d2->setToggleVisibilityAction( a2 );
QVERIFY( a1->isCheckable() );
QVERIFY( a2->isCheckable() );
QCOMPARE( d1->linkedAction(), a1 );
QCOMPARE( d2->linkedAction(), a2 );
QCOMPARE( d1->toggleVisibilityAction(), a1 );
QCOMPARE( d2->toggleVisibilityAction(), a2 );

QVERIFY( d2->isUserVisible() );
QVERIFY( a2->isChecked() );

0 comments on commit ca427d3

Please sign in to comment.
You can’t perform that action at this time.