Skip to content
Permalink
Browse files

[FEATURE][composer] New action for toggling visibility of panels

This change adds a new action to the composer which hides or shows
all panels from the window. It's useful for maximising the space
available to interact with a composition. A shortcut (F10) and menu
item can be used to toggle this option, or via pressing 'tab' while
the main composer view is focused.
  • Loading branch information
nyalldawson committed Oct 20, 2014
1 parent 220bc84 commit 48e0a591828a6dd31f63931b897e06674f67a387
Showing with 36 additions and 0 deletions.
  1. +19 −0 src/app/composer/qgscomposer.cpp
  2. +3 −0 src/app/composer/qgscomposer.h
  3. +14 −0 src/ui/qgscomposerbase.ui
@@ -343,6 +343,7 @@ QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
mToolbarMenu->setObjectName( "mToolbarMenu" );
viewMenu->addSeparator();
viewMenu->addAction( mActionToggleFullScreen );
viewMenu->addAction( mActionHidePanels );
viewMenu->addMenu( mPanelMenu );
viewMenu->addMenu( mToolbarMenu );
// toolBar already exists, add other widgets as they are created
@@ -1246,6 +1247,16 @@ void QgsComposer::on_mActionToggleFullScreen_triggered()
}
}

void QgsComposer::on_mActionHidePanels_triggered()
{
bool showPanels = !mActionHidePanels->isChecked();
mItemDock->setVisible( showPanels );
mGeneralDock->setVisible( showPanels );
mUndoDock->setVisible( showPanels );
mAtlasDock->setVisible( showPanels );
mItemsDock->setVisible( showPanels );
}

void QgsComposer::disablePreviewMode()
{
if ( !mView )
@@ -3568,6 +3579,14 @@ void QgsComposer::createComposerView()
mView->setHorizontalRuler( mHorizontalRuler );
mView->setVerticalRuler( mVerticalRuler );
mViewLayout->addWidget( mView, 1, 1 );

//view does not accept focus via tab
mView->setFocusPolicy( Qt::ClickFocus );
//instead, if view is focused and tab is pressed than mActionHidePanels is triggered,
//to toggle display of panels
QShortcut* tab = new QShortcut( Qt::Key_Tab, mView );
tab->setContext( Qt::WidgetWithChildrenShortcut );
connect( tab, SIGNAL( activated() ), mActionHidePanels, SLOT( trigger() ) );
}

void QgsComposer::writeWorldFile( QString worldFileName, double a, double b, double c, double d, double e, double f ) const
@@ -362,6 +362,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
//! Toggle full screen mode
void on_mActionToggleFullScreen_triggered();

//! Toggle panels
void on_mActionHidePanels_triggered();

//! Save window state
void saveWindowState();

@@ -1037,6 +1037,20 @@
<string>F11</string>
</property>
</action>
<action name="mActionHidePanels">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Hide Panels</string>
</property>
<property name="toolTip">
<string>Hide panels</string>
</property>
<property name="shortcut">
<string>F10</string>
</property>
</action>
</widget>
<resources>
<include location="../../python/plugins/fTools/resources.qrc"/>

0 comments on commit 48e0a59

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