Skip to content

Commit 3e7e1d3

Browse files
author
telwertowski
committedAug 24, 2008
Reorganize and expand menubar so that it contains all major commands. Reposition menu items to correspond to Gnome, Kde, Mac and Windows user interface guidelines. Fix window activation so that commands bring forword a window if it is already open. Add accessors for actions, menus and toolbars so that items can be added to menus and toolbars.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9157 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

5 files changed

+956
-561
lines changed

5 files changed

+956
-561
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 657 additions & 461 deletions
Large diffs are not rendered by default.

‎src/app/qgisapp.h

Lines changed: 272 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class QgsVectorLayer;
6161
#include <QPointer>
6262

6363
#include "qgsconfig.h"
64-
#include <qgspoint.h>
64+
#include "qgspoint.h"
6565

6666
/*! \class QgisApp
6767
* \brief Main window for the Qgis application
@@ -174,8 +174,170 @@ class QgisApp : public QMainWindow
174174
//default theme if the active theme does not have the required
175175
//icon.
176176
static QPixmap getThemePixmap( const QString theName );
177-
//private slots:
177+
178+
/** Add a dock widget to the main window. Overloaded from QMainWindow.
179+
* After adding the dock widget to the ui (by delegating to the QMainWindow
180+
* parent class, it will also add it to the View menu list of docks.*/
181+
void addDockWidget( Qt::DockWidgetArea area, QDockWidget * dockwidget );
182+
/** Add a toolbar to the main window. Overloaded from QMainWindow.
183+
* After adding the toolbar to the ui (by delegating to the QMainWindow
184+
* parent class, it will also add it to the View menu list of toolbars.*/
185+
QToolBar *addToolBar( QString name );
186+
187+
#ifdef Q_WS_MAC
188+
//! Add window item to Window menu
189+
void addWindow( QAction *action );
190+
#endif
191+
192+
//! Actions to be inserted in menus and toolbars
193+
QAction *actionNewProject() { return mActionNewProject; }
194+
QAction *actionOpenProject() { return mActionOpenProject; }
195+
QAction *actionFileSeparator1() { return mActionFileSeparator1; }
196+
QAction *actionSaveProject() { return mActionSaveProject; }
197+
QAction *actionSaveProjectAs() { return mActionSaveProjectAs; }
198+
QAction *actionSaveMapAsImage() { return mActionSaveMapAsImage; }
199+
QAction *actionFileSeparator2() { return mActionFileSeparator2; }
200+
QAction *actionProjectProperties() { return mActionProjectProperties; }
201+
QAction *actionFileSeparator3() { return mActionFileSeparator3; }
202+
QAction *actionPrintComposer() { return mActionPrintComposer; }
203+
QAction *actionFileSeparator4() { return mActionFileSeparator4; }
204+
QAction *actionExit() { return mActionExit; }
205+
206+
QAction *actionCutFeatures() { return mActionCutFeatures; }
207+
QAction *actionCopyFeatures() { return mActionCopyFeatures; }
208+
QAction *actionPasteFeatures() { return mActionPasteFeatures; }
209+
QAction *actionEditSeparator1() { return mActionEditSeparator1; }
210+
QAction *actionCapturePoint() { return mActionCapturePoint; }
211+
QAction *actionCaptureLine() { return mActionCaptureLine; }
212+
QAction *actionCapturePologon() { return mActionCapturePolygon; }
213+
QAction *actionDeleteSelected() { return mActionDeleteSelected; }
214+
QAction *actionMoveFeature() { return mActionMoveFeature; }
215+
QAction *actionSplitFeatures() { return mActionSplitFeatures; }
216+
QAction *actionAddVertex() { return mActionAddVertex; }
217+
QAction *actionDelerteVertex() { return mActionDeleteVertex; }
218+
QAction *actioMoveVertex() { return mActionMoveVertex; }
219+
QAction *actionAddRing() { return mActionAddRing; }
220+
QAction *actionAddIsland() { return mActionAddIsland; }
221+
QAction *actionEditSeparator2() { return mActionEditSeparator2; }
222+
223+
QAction *actionPan() { return mActionPan; }
224+
QAction *actionZoomIn() { return mActionZoomIn; }
225+
QAction *actionZoomOut() { return mActionZoomOut; }
226+
QAction *actionSelect() { return mActionSelect; }
227+
QAction *actionIdentify() { return mActionIdentify; }
228+
QAction *actionMeasure() { return mActionMeasure; }
229+
QAction *actionMeasureArea() { return mActionMeasureArea; }
230+
QAction *actionViewSeparator1() { return mActionViewSeparator1; }
231+
QAction *actionZoomFullExtent() { return mActionZoomFullExtent; }
232+
QAction *actionZoomToLayer() { return mActionZoomToLayer; }
233+
QAction *actionZoomToSelected() { return mActionZoomToSelected; }
234+
QAction *actionZoomLast() { return mActionZoomLast; }
235+
QAction *actionZoomActualSize() { return mActionZoomActualSize; }
236+
QAction *actionViewSeparator2() { return mActionViewSeparator2; }
237+
QAction *actionMapTips() { return mActionMapTips; }
238+
QAction *actionNewBookmark() { return mActionNewBookmark; }
239+
QAction *actionShowBookmarks() { return mActionShowBookmarks; }
240+
QAction *actionDraw() { return mActionDraw; }
241+
QAction *actionViewSeparator3() { return mActionViewSeparator3; }
242+
243+
QAction *actionNewVectorLayer() { return mActionNewVectorLayer; }
244+
QAction *actionAddOgrLayer() { return mActionAddOgrLayer; }
245+
QAction *actionAddRasterLayer() { return mActionAddRasterLayer; }
246+
QAction *actionAddPgLayer() { return mActionAddPgLayer; }
247+
QAction *actionAddWmsLayer() { return mActionAddWmsLayer; }
248+
QAction *actionLayerSeparator1() { return mActionLayerSeparator1; }
249+
QAction *actionOpenTable() { return mActionOpenTable; }
250+
QAction *actionToggleEditing() { return mActionToggleEditing; }
251+
QAction *actionLayerSaveAs() { return mActionLayerSaveAs; }
252+
QAction *actionLayerSelectionSaveAs() { return mActionLayerSelectionSaveAs; }
253+
QAction *actionRemoveLayer() { return mActionRemoveLayer; }
254+
QAction *actionLayerProperties() { return mActionLayerProperties; }
255+
QAction *actionLayerSeparator2() { return mActionLayerSeparator2; }
256+
QAction *actionAddToOverview() { return mActionAddToOverview; }
257+
QAction *actionAddAllToOverview() { return mActionAddAllToOverview; }
258+
QAction *actionRemoveAllFromOverview() { return mActionRemoveAllFromOverview; }
259+
QAction *actionLayerSeparator3() { return mActionLayerSeparator3; }
260+
QAction *actionHideAllLayers() { return mActionHideAllLayers; }
261+
QAction *actionShowAllLayers() { return mActionShowAllLayers; }
262+
263+
QAction *actionManagePlugins() { return mActionManagePlugins; }
264+
QAction *actionPluginSeparator1() { return mActionPluginSeparator1; }
265+
QAction *actionShowPythonDialog() { return mActionShowPythonDialog; }
266+
267+
QAction *actionToggleFullScreen() { return mActionToggleFullScreen; }
268+
QAction *actionSettingsSeparator1() { return mActionSettingsSeparator1; }
269+
QAction *actionOptions() { return mActionOptions; }
270+
QAction *actionCustomProjection() { return mActionCustomProjection; }
271+
272+
#ifdef Q_WS_MAC
273+
QAction *actionWindowMinimize() { return mActionWindowMinimize; }
274+
QAction *actionWindowZoom() { return mActionWindowZoom; }
275+
QAction *actionWindowSeparator1() { return mActionWindowSeparator1; }
276+
QAction *actionWindowAllToFront() { return mActionWindowAllToFront; }
277+
QAction *actionWindowSeparator2() { return mActionWindowSeparator2; }
278+
#endif
279+
280+
QAction *actionHelpContents() { return mActionHelpContents; }
281+
QAction *actionHelpSeparator1() { return mActionHelpSeparator1; }
282+
QAction *actionQgisHomePage() { return mActionQgisHomePage; }
283+
QAction *actionCheckQgisVersion() { return mActionCheckQgisVersion; }
284+
QAction *actionHelpSeparator2() { return mActionHelpSeparator2; }
285+
QAction *actionAbout() { return mActionAbout; }
286+
287+
//! Menus
288+
QMenu *fileMenu() { return mFileMenu; }
289+
QMenu *editMenu() { return mEditMenu; }
290+
QMenu *viewMenu() { return mViewMenu; }
291+
QMenu *layerMenu() { return mLayerMenu; }
292+
QMenu *settingsMenu() { return mSettingsMenu; }
293+
QMenu *pluginMenu() { return mPluginMenu; }
294+
#ifdef Q_WS_MAC
295+
QMenu *windowMenu() { return mWindowMenu; }
296+
#endif
297+
QMenu *helpMenu() { return mHelpMenu; }
298+
299+
//! Toolbars
300+
/** Get a reference to a toolbar. Mainly intended
301+
* to be used by plugins that want to specifically add
302+
* an icon into the file toolbar for consistency e.g.
303+
* addWFS and GPS plugins.
304+
*/
305+
QToolBar *fileToolBar() { return mFileToolBar; }
306+
QToolBar *layerToolBar() { return mLayerToolBar; }
307+
QToolBar *mapNavToolToolBar() { return mMapNavToolBar; }
308+
QToolBar *digitizeToolBar() { return mDigitizeToolBar; }
309+
QToolBar *attributesToolBar() { return mAttributesToolBar; }
310+
QToolBar *pluginToolBar() { return mPluginToolBar; }
311+
QToolBar *helpToolBar() { return mHelpToolBar; }
312+
178313
public slots:
314+
//! Zoom to full extent
315+
void zoomFull();
316+
//! Zoom to the previous extent
317+
void zoomPrevious();
318+
//! Zoom to selected features
319+
void zoomToSelected();
320+
321+
//! cuts selected features on the active layer to the clipboard
322+
/**
323+
\param layerContainingSelection The layer that the selection will be taken from
324+
(defaults to the active layer on the legend)
325+
*/
326+
void editCut( QgsMapLayer * layerContainingSelection = 0 );
327+
//! copies selected features on the active layer to the clipboard
328+
/**
329+
\param layerContainingSelection The layer that the selection will be taken from
330+
(defaults to the active layer on the legend)
331+
*/
332+
void editCopy( QgsMapLayer * layerContainingSelection = 0 );
333+
//! copies features on the clipboard to the active layer
334+
/**
335+
\param destinationLayer The layer that the clipboard will be pasted to
336+
(defaults to the active layer on the legend)
337+
*/
338+
void editPaste( QgsMapLayer * destinationLayer = 0 );
339+
340+
private slots:
179341
//! About QGis
180342
void about();
181343
//! Add a raster layer to the map (will prompt user for file name using dlg )
@@ -186,10 +348,6 @@ class QgisApp : public QMainWindow
186348
//#endif
187349
//! reimplements widget keyPress event so we can check if cancel was pressed
188350
void keyPressEvent( QKeyEvent * e );
189-
/** for when a menu bar item is activated
190-
Used to dynamically update pop-up menu items
191-
*/
192-
/* virtual */ void menubar_highlighted( int i );
193351
/** toggles whether the current selected layer is in overview or not */
194352
void inOverview();
195353
//! Slot to show the map coordinate position of the mouse cursor
@@ -202,6 +360,8 @@ class QgisApp : public QMainWindow
202360
void removeLayer();
203361
//! zoom to extent of layer
204362
void zoomToLayerExtent();
363+
//! zoom to actual size of raster layer
364+
void zoomActualSize();
205365
//! load any plugins used in the last qgis session
206366
void restoreSessionPlugins( QString thePluginDirString );
207367
//! plugin manager
@@ -288,12 +448,6 @@ class QgisApp : public QMainWindow
288448
void showBookmarks();
289449
//! Create a new spatial bookmark
290450
void newBookmark();
291-
//! Lets the user show all of the toolbars
292-
void showAllToolbars();
293-
//! Lets the user hide all of the toolbars
294-
void hideAllToolbars();
295-
//! Sets the visibility of the toolbars
296-
void setToolbarVisibility( bool visibility );
297451
//! activates the capture point tool
298452
void capturePoint();
299453
//! activates the capture line tool
@@ -334,11 +488,6 @@ class QgisApp : public QMainWindow
334488
Is called from the legend when the current legend item has changed*/
335489
void activateDeactivateLayerRelatedActions( QgsMapLayer* layer );
336490

337-
public slots:
338-
/** Add a dock widget to the main window. Overloaded from QMainWindow.
339-
* After adding the dock widget to the ui (by delegating to the QMainWindow
340-
* parent class, it will also add it to the view menu list of docks.*/
341-
void addDockWidget( Qt::DockWidgetArea area, QDockWidget * dockwidget );
342491
void showProgress( int theProgress, int theTotalSteps );
343492
void extentsViewToggled( bool theFlag );
344493
void showExtents();
@@ -357,12 +506,6 @@ class QgisApp : public QMainWindow
357506
void zoomOut();
358507
//! Set map tool to Zoom in
359508
void zoomIn();
360-
//! Zoom to full extent
361-
void zoomFull();
362-
//! Zoom to the previous extent
363-
void zoomPrevious();
364-
//! Zoom to selected features
365-
void zoomToSelected();
366509
//! Set map tool to pan
367510
void pan();
368511
//! Identify feature(s) on the currently selected layer
@@ -378,28 +521,16 @@ class QgisApp : public QMainWindow
378521
//! starts/stops editing mode of a layer
379522
void toggleEditing( QgsMapLayer *layer );
380523

524+
//! save current vector layer
525+
void saveAsShapefile();
526+
void saveSelectionAsShapefile();
527+
528+
//! open the properties dialog for the currently selected layer
529+
void layerProperties();
530+
381531
//! show python console
382532
void showPythonDialog();
383533

384-
//! cuts selected features on the active layer to the clipboard
385-
/**
386-
\param layerContainingSelection The layer that the selection will be taken from
387-
(defaults to the active layer on the legend)
388-
*/
389-
void editCut( QgsMapLayer * layerContainingSelection = 0 );
390-
//! copies selected features on the active layer to the clipboard
391-
/**
392-
\param layerContainingSelection The layer that the selection will be taken from
393-
(defaults to the active layer on the legend)
394-
*/
395-
void editCopy( QgsMapLayer * layerContainingSelection = 0 );
396-
//! copies features on the clipboard to the active layer
397-
/**
398-
\param destinationLayer The layer that the clipboard will be pasted to
399-
(defaults to the active layer on the legend)
400-
*/
401-
void editPaste( QgsMapLayer * destinationLayer = 0 );
402-
403534
//! Shows a warning when an old project file is read.
404535
void warnOlderProjectVersion( QString );
405536

@@ -412,15 +543,15 @@ class QgisApp : public QMainWindow
412543
//! Toggle full screen mode
413544
void toggleFullScreen();
414545

546+
//! Toggle maximized mode
547+
void toggleMaximized();
548+
549+
//! Bring forward all open windows
550+
void bringAllToFront();
551+
415552
//! Stops rendering of the main map
416553
void stopRendering();
417554

418-
/** Get a reference to the file toolbar. Mainly intended
419-
* to be used by plugins that want to specifically add
420-
* an icon into the file toolbar for consistency e.g.
421-
* addWFS and GPS plugins.
422-
*/
423-
QToolBar * fileToolBar();
424555
signals:
425556
/** emitted when a key is pressed and we want non widget sublasses to be able
426557
to pick up on this (e.g. maplayer) */
@@ -465,12 +596,12 @@ class QgisApp : public QMainWindow
465596
void updateRecentProjectPaths();
466597
//! Read Well Known Binary stream from PostGIS
467598
//void readWKB(const char *, QStringList tables);
468-
//! test function
469-
void testButton();
470599
//! shows the paste-transformations dialog
471600
void pasteTransformations();
472601
//! check to see if file is dirty and if so, prompt the user th save it
473602
bool saveDirty();
603+
//! Handle state changes
604+
virtual void changeEvent( QEvent* event );
474605
//! Have some control over closing of the application
475606
virtual void closeEvent( QCloseEvent* event );
476607

@@ -492,43 +623,35 @@ class QgisApp : public QMainWindow
492623
void createCanvas();
493624
bool createDB();
494625
void createMapTips();
495-
//toolbars ----------------------------------------
626+
627+
// toolbars ---------------------------------------
496628
QToolBar *mFileToolBar;
497629
QToolBar *mLayerToolBar;
498630
QToolBar *mMapNavToolBar;
499631
QToolBar *mDigitizeToolBar;
500632
QToolBar *mAttributesToolBar;
501633
QToolBar *mPluginToolBar;
502634
QToolBar *mHelpToolBar;
503-
//
504-
//toolbar buttons ---------------------------------
505-
QAction *mActionFileNew;
506-
QAction *mActionFileSave;
507-
QAction *mActionFileSaveAs;
508-
QAction *mActionFileOpen;
509-
QAction *mActionFilePrint;
635+
636+
// actions for menus and toolbars -----------------
637+
638+
QAction *mActionNewProject;
639+
QAction *mActionOpenProject;
640+
QAction *mActionFileSeparator1;
641+
QAction *mActionSaveProject;
642+
QAction *mActionSaveProjectAs;
510643
QAction *mActionSaveMapAsImage;
511-
QAction *mActionExportMapServer;
512-
QAction *mActionFileExit;
513-
QAction *mActionAddOgrLayer;
514-
QAction *mActionAddRasterLayer;
515-
QAction *mActionAddLayer;
516-
QAction *mActionRemoveLayer;
517-
QAction *mActionNewVectorLayer;
518-
QAction *mActionAddAllToOverview;
519-
QAction *mActionHideAllLayers;
520-
QAction *mActionShowAllLayers;
521-
QAction *mActionRemoveAllFromOverview;
522-
QAction *mActionLayerProperties;
644+
QAction *mActionFileSeparator2;
523645
QAction *mActionProjectProperties;
524-
QAction *mActionShowPluginManager;
525-
QAction *mActionCheckQgisVersion;
526-
QAction *mActionOptions;
527-
QAction *mActionHelpContents;
528-
QAction *mActionQgisHomePage;
529-
QAction *mActionHelpAbout;
530-
QAction *mArawAction;
531-
QAction *mActionToggleEditing;
646+
QAction *mActionFileSeparator3;
647+
QAction *mActionPrintComposer;
648+
QAction *mActionFileSeparator4;
649+
QAction *mActionExit;
650+
651+
QAction *mActionCutFeatures;
652+
QAction *mActionCopyFeatures;
653+
QAction *mActionPasteFeatures;
654+
QAction *mActionEditSeparator1;
532655
QAction *mActionCapturePoint;
533656
QAction *mActionCaptureLine;
534657
QAction *mActionCapturePolygon;
@@ -540,49 +663,99 @@ class QgisApp : public QMainWindow
540663
QAction *mActionMoveVertex;
541664
QAction *mActionAddRing;
542665
QAction *mActionAddIsland;
543-
QAction *mActionEditCut;
544-
QAction *mActionEditCopy;
545-
QAction *mActionEditPaste;
666+
QAction *mActionEditSeparator2;
667+
668+
QAction *mActionPan;
546669
QAction *mActionZoomIn;
547670
QAction *mActionZoomOut;
671+
QAction *mActionSelect;
672+
QAction *mActionIdentify;
673+
QAction *mActionMeasure;
674+
QAction *mActionMeasureArea;
675+
QAction *mActionViewSeparator1;
548676
QAction *mActionZoomFullExtent;
677+
QAction *mActionZoomToLayer;
549678
QAction *mActionZoomToSelected;
550-
QAction *mActionPan;
551679
QAction *mActionZoomLast;
552-
QAction *mActionZoomToLayer;
553-
QAction *mActionIdentify;
680+
QAction *mActionZoomActualSize;
681+
QAction *mActionViewSeparator2;
554682
QAction *mActionMapTips;
555-
QAction *mActionSelect;
556-
QAction *mActionOpenTable;
557-
QAction *mActionMeasure;
558-
QAction *mActionMeasureArea;
559-
QAction *mActionShowBookmarks;
560683
QAction *mActionNewBookmark;
561-
QAction *mActionCustomProjection;
562-
QAction *mActionAddWmsLayer;
563-
QAction *mActionInOverview;
684+
QAction *mActionShowBookmarks;
564685
QAction *mActionDraw;
565-
QAction *mActionShowAllToolbars;
566-
QAction *mActionHideAllToolbars;
567-
QAction *mActionToggleFullScreen;
686+
QAction *mActionViewSeparator3;
687+
688+
QAction *mActionNewVectorLayer;
689+
QAction *mActionAddOgrLayer;
690+
QAction *mActionAddRasterLayer;
691+
QAction *mActionAddPgLayer;
692+
QAction *mActionAddWmsLayer;
693+
QAction *mActionLayerSeparator1;
694+
QAction *mActionOpenTable;
695+
QAction *mActionToggleEditing;
696+
QAction *mActionLayerSaveAs;
697+
QAction *mActionLayerSelectionSaveAs;
698+
QAction *mActionRemoveLayer;
699+
QAction *mActionLayerProperties;
700+
QAction *mActionLayerSeparator2;
701+
QAction *mActionAddToOverview;
702+
QAction *mActionAddAllToOverview;
703+
QAction *mActionRemoveAllFromOverview;
704+
QAction *mActionLayerSeparator3;
705+
QAction *mActionHideAllLayers;
706+
QAction *mActionShowAllLayers;
707+
708+
QAction *mActionManagePlugins;
709+
QAction *mActionPluginSeparator1;
568710
QAction *mActionShowPythonDialog;
569711

570-
//
571-
//tool groups -------------------------------------
712+
QAction *mActionToggleFullScreen;
713+
QAction *mActionSettingsSeparator1;
714+
QAction *mActionOptions;
715+
QAction *mActionCustomProjection;
716+
717+
#ifdef Q_WS_MAC
718+
QAction *mActionWindowMinimize;
719+
QAction *mActionWindowZoom;
720+
QAction *mActionWindowSeparator1;
721+
QAction *mActionWindowAllToFront;
722+
QAction *mActionWindowSeparator2;
723+
QActionGroup *mWindowActions;
724+
#endif
725+
726+
QAction *mActionHelpContents;
727+
QAction *mActionHelpSeparator1;
728+
QAction *mActionQgisHomePage;
729+
QAction *mActionCheckQgisVersion;
730+
QAction *mActionHelpSeparator2;
731+
QAction *mActionAbout;
732+
733+
// action groups ----------------------------------
572734
QActionGroup *mMapToolGroup;
573-
//
574-
//menus -----------------------------------------
735+
736+
// menus ------------------------------------------
575737
QMenu *mFileMenu;
738+
QMenu *mEditMenu;
576739
QMenu *mRecentProjectsMenu;
577740
QMenu *mViewMenu;
741+
QMenu *mPanelMenu;
578742
QMenu *mToolbarMenu;
579743
QMenu *mLayerMenu;
580744
QMenu *mSettingsMenu;
745+
#ifdef Q_WS_MAC
746+
QMenu *mWindowMenu;
747+
#endif
581748
QMenu *mHelpMenu;
582749

750+
// docks ------------------------------------------
583751
QDockWidget *mLegendDock;
584752
QDockWidget *mOverviewDock;
585753

754+
#ifdef Q_WS_MAC
755+
//! Window menu action to select this window
756+
QAction *mWindowAction;
757+
#endif
758+
586759
class Tools
587760
{
588761
public:

‎src/app/qgsattributetabledisplay.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,13 @@ QgsAttributeTableDisplay::QgsAttributeTableDisplay( QgsVectorLayer* layer )
129129
}
130130

131131
setWindowTitle( tr( "Attribute table - " ) + layer->name() );
132+
133+
#ifdef Q_WS_MAC
134+
// Create action to select this window and add it to Window menu
135+
mWindowAction = new QAction( windowTitle(), this );
136+
connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) );
137+
QgisApp::instance()->addWindow( mWindowAction );
138+
#endif
132139
}
133140

134141
QgsAttributeTableDisplay::~QgsAttributeTableDisplay()
@@ -374,7 +381,7 @@ QgsAttributeTableDisplay *QgsAttributeTableDisplay::attributeTable( QgsVectorLay
374381
{
375382
QgsAttributeTableDisplay *td = smTables[layer];
376383
td->setAttributeActions( *layer->actions() );
377-
td->raise();
384+
td->activate();
378385

379386
return td;
380387
}
@@ -409,6 +416,13 @@ QgsAttributeTableDisplay *QgsAttributeTableDisplay::attributeTable( QgsVectorLay
409416
return td;
410417
}
411418

419+
void QgsAttributeTableDisplay::activate()
420+
{
421+
raise();
422+
setWindowState( windowState() & ~Qt::WindowMinimized );
423+
activateWindow();
424+
}
425+
412426
void QgsAttributeTableDisplay::selectionChanged()
413427
{
414428
// select rows which should be selected

‎src/app/qgsattributetabledisplay.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,21 @@ class QgsAttributeTableDisplay : public QDialog, private Ui::QgsAttributeTableBa
7979
signals:
8080
void editingToggled( QgsMapLayer * );
8181

82+
private slots:
83+
void activate();
84+
8285
private:
8386
/** Set the icon theme for this dialog */
8487
void setTheme();
8588

8689
void restorePosition();
8790
void saveWindowLocation();
8891

92+
#ifdef Q_WS_MAC
93+
/** Window menu action to select this window */
94+
QAction *mWindowAction;
95+
#endif
96+
8997
QString mSearchString;
9098

9199
QDockWidget *mDock;

‎src/app/qgspythondialog.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ QgsPythonDialog::QgsPythonDialog( QgisInterface* pIface, QgsPythonUtils* pythonU
2424
: QDialog( parent )
2525
{
2626
setupUi( this );
27+
#ifdef Q_WS_MAC
28+
// Qt4.3+ bug?: Mac window minimize control isn't enabled
29+
setWindowFlags( windowFlags() | Qt::WindowMinimizeButtonHint );
30+
#endif
2731
mIface = pIface;
2832
mPythonUtils = pythonUtils;
2933
}

0 commit comments

Comments
 (0)
Please sign in to comment.