Skip to content

Commit

Permalink
Port ability to switch designer to full screen
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 11, 2017
1 parent 76beef4 commit 1c8b17f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
24 changes: 16 additions & 8 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,11 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
connect( mVerticalRuler, &QgsLayoutRuler::cursorPosChanged, this, &QgsLayoutDesignerDialog::updateStatusCursorPos );

// Panel and toolbar submenus
QMenu *toolbarMenu = new QMenu( tr( "&Toolbars" ), this );
toolbarMenu->setObjectName( QStringLiteral( "mToolbarMenu" ) );
mMenuView->addSeparator();
mMenuView->addMenu( toolbarMenu );
mToolbarMenu->addAction( mLayoutToolbar->toggleViewAction() );
mToolbarMenu->addAction( mNavigationToolbar->toggleViewAction() );
mToolbarMenu->addAction( mToolsToolbar->toggleViewAction() );

// toolBar already exists, add other widgets as they are created
toolbarMenu->addAction( mLayoutToolbar->toggleViewAction() );
toolbarMenu->addAction( mNavigationToolbar->toggleViewAction() );
toolbarMenu->addAction( mToolsToolbar->toggleViewAction() );
connect( mActionToggleFullScreen, &QAction::toggled, this, &QgsLayoutDesignerDialog::toggleFullScreen );

restoreWindowState();
}
Expand Down Expand Up @@ -396,6 +392,18 @@ void QgsLayoutDesignerDialog::updateStatusCursorPos( QPointF position )
mStatusCursorPageLabel->setText( QString( tr( "page: %1" ) ).arg( currentPage ) );
}

void QgsLayoutDesignerDialog::toggleFullScreen( bool enabled )
{
if ( enabled )
{
showFullScreen();
}
else
{
showNormal();
}
}

QgsLayoutView *QgsLayoutDesignerDialog::view()
{
return mView;
Expand Down
2 changes: 2 additions & 0 deletions src/app/layout/qgslayoutdesignerdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner
//! Updates cursor position in status bar
void updateStatusCursorPos( QPointF position );

void toggleFullScreen( bool enabled );

private:

QgsAppLayoutDesignerInterface *mInterface = nullptr;
Expand Down
24 changes: 23 additions & 1 deletion src/ui/layout/qgslayoutdesignerbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,23 @@
</widget>
<widget class="QMenu" name="mMenuView">
<property name="title">
<string>View</string>
<string>&amp;View</string>
</property>
<widget class="QMenu" name="mToolbarMenu">
<property name="title">
<string>&amp;Toolbars</string>
</property>
</widget>
<addaction name="mActionZoomIn"/>
<addaction name="mActionZoomOut"/>
<addaction name="mActionZoomActual"/>
<addaction name="mActionZoomAll"/>
<addaction name="mActionZoomToWidth"/>
<addaction name="separator"/>
<addaction name="mActionShowRulers"/>
<addaction name="separator"/>
<addaction name="mToolbarMenu"/>
<addaction name="mActionToggleFullScreen"/>
</widget>
<addaction name="mLayoutMenu"/>
<addaction name="mMenuView"/>
Expand Down Expand Up @@ -269,6 +277,20 @@
<string>Ctrl+R</string>
</property>
</action>
<action name="mActionToggleFullScreen">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Toggle Full Scr&amp;een</string>
</property>
<property name="toolTip">
<string>Toggle full screen mode</string>
</property>
<property name="shortcut">
<string>F11</string>
</property>
</action>
</widget>
<resources>
<include location="../../../images/images.qrc"/>
Expand Down

0 comments on commit 1c8b17f

Please sign in to comment.