Skip to content

Commit

Permalink
Rename actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 16, 2018
1 parent f8863aa commit ca427d3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions python/gui/auto_generated/qgsdockwidget.sip.in
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Expand Up @@ -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 )
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgisapp.cpp
Expand Up @@ -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();

Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsdockwidget.cpp
Expand Up @@ -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() )
Expand All @@ -74,7 +74,7 @@ void QgsDockWidget::setLinkedAction( QAction *action )
} );
}

QAction *QgsDockWidget::linkedAction()
QAction *QgsDockWidget::toggleVisibilityAction()
{
return mAction;
}
Expand Down
8 changes: 4 additions & 4 deletions src/gui/qgsdockwidget.h
Expand Up @@ -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:

Expand Down
10 changes: 5 additions & 5 deletions tests/src/gui/testqgsdockwidget.cpp
Expand Up @@ -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() );
Expand Down

0 comments on commit ca427d3

Please sign in to comment.