[QGIS Commit] r14652 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Nov 14 14:08:48 EST 2010


Author: jef
Date: 2010-11-14 11:08:48 -0800 (Sun, 14 Nov 2010)
New Revision: 14652

Modified:
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgisapp.h
   trunk/qgis/src/app/qgssnappingdialog.cpp
   trunk/qgis/src/app/qgssnappingdialog.h
Log:
show snapping menu entry also when docked

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2010-11-14 18:30:59 UTC (rev 14651)
+++ trunk/qgis/src/app/qgisapp.cpp	2010-11-14 19:08:48 UTC (rev 14652)
@@ -431,7 +431,7 @@
   addDockWidget( Qt::LeftDockWidgetArea, mUndoWidget );
   mUndoWidget->hide();
 
-  mSnappingDialog = new QgsSnappingDialog( this,  mMapCanvas );
+  mSnappingDialog = new QgsSnappingDialog( this, mMapCanvas );
   mSnappingDialog->setObjectName( "SnappingOption" );
 
   mInternalClipboard = new QgsClipboard; // create clipboard
@@ -1450,18 +1450,11 @@
   mEditMenu->addAction( mActionNodeTool );
   mEditMenu->addAction( mActionRotatePointSymbols );
 
-  QSettings myQsettings;
-  bool myDockFlag = myQsettings.value( "/qgis/dockSnapping", false ).toBool();
-  if ( !myDockFlag )
-  {
-    mActionEditSeparator4 = mEditMenu->addSeparator();
-    mEditMenu->addAction( mActionSnappingOptions );
-  }
-
   if ( layout == QDialogButtonBox::GnomeLayout || layout == QDialogButtonBox::MacLayout )
   {
     mActionEditSeparator3 = mEditMenu->addSeparator();
     mEditMenu->addAction( mActionOptions );
+    mEditMenu->addAction( mActionSnappingOptions );
     mEditMenu->addAction( mActionConfigureShortcuts );
     mEditMenu->addAction( mActionStyleManagerV2 );
     mEditMenu->addAction( mActionCustomProjection );
@@ -1587,6 +1580,7 @@
     mSettingsMenu->addAction( mActionStyleManagerV2 );
     mSettingsMenu->addAction( mActionConfigureShortcuts );
     mSettingsMenu->addAction( mActionOptions );
+    mSettingsMenu->addAction( mActionSnappingOptions );
   }
 #endif
 
@@ -1737,6 +1731,7 @@
   mAttributesToolBar->addAction( mActionIdentify );
 
   QToolButton *bt = new QToolButton( mAttributesToolBar );
+  bt->setObjectName( "SelectTool" );
   bt->setPopupMode( QToolButton::MenuButtonPopup );
   bt->addAction( mActionSelect );
   bt->addAction( mActionSelectRectangle );
@@ -1775,6 +1770,7 @@
   mAttributesToolBar->addAction( mActionOpenTable );
 
   bt = new QToolButton( mAttributesToolBar );
+  bt->setObjectName( "MeasureTool" );
   bt->setPopupMode( QToolButton::MenuButtonPopup );
   bt->addAction( mActionMeasure );
   bt->addAction( mActionMeasureArea );
@@ -1804,6 +1800,7 @@
 
   // Annotation tools
   bt = new QToolButton();
+  bt->setObjectName( "AnnotationTool" );
   bt->setPopupMode( QToolButton::MenuButtonPopup );
   bt->addAction( mActionTextAnnotation );
   bt->addAction( mActionFormAnnotation );

Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h	2010-11-14 18:30:59 UTC (rev 14651)
+++ trunk/qgis/src/app/qgisapp.h	2010-11-14 19:08:48 UTC (rev 14652)
@@ -245,7 +245,6 @@
     QAction *actionNodeTool() { return mActionNodeTool; }
     QAction *actionEditSeparator2() { return mActionEditSeparator2; }
     QAction *actionSnappingOptions() { return mActionSnappingOptions; }
-    QAction *actionEditSeparator4() { return mActionEditSeparator4; }
 
     QAction *actionPan() { return mActionPan; }
     QAction *actionZoomIn() { return mActionZoomIn; }
@@ -914,7 +913,6 @@
     QAction *mActionRotatePointSymbols;
     QAction *mActionEditSeparator3;
     QAction *mActionSnappingOptions;
-    QAction *mActionEditSeparator4;
 
     QAction *mActionPan;
     QAction *mActionZoomIn;

Modified: trunk/qgis/src/app/qgssnappingdialog.cpp
===================================================================
--- trunk/qgis/src/app/qgssnappingdialog.cpp	2010-11-14 18:30:59 UTC (rev 14651)
+++ trunk/qgis/src/app/qgssnappingdialog.cpp	2010-11-14 19:08:48 UTC (rev 14652)
@@ -45,7 +45,7 @@
 
 };
 
-QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ): QDialog( parent ), mMapCanvas( canvas )
+QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ): QDialog( parent ), mMapCanvas( canvas ), mDock( 0 )
 {
   setupUi( this );
 
@@ -90,7 +90,7 @@
 {
   QDialog::closeEvent( event );
 
-  if ( mDock == NULL )
+  if ( !mDock )
   {
     QSettings settings;
     settings.setValue( "/Windows/BetterSnapping/geometry", saveGeometry() );
@@ -219,3 +219,11 @@
   QgsProject::instance()->writeEntry( "Digitizing", "/LayerSnappingToleranceUnitList", toleranceUnitList );
   QgsProject::instance()->writeEntry( "Digitizing", "/LayerSnappingEnabledList", enabledList );
 }
+
+void QgsSnappingDialog::show()
+{
+  if( mDock )
+    mDock->setVisible( true );
+  else
+    QDialog::show();
+}

Modified: trunk/qgis/src/app/qgssnappingdialog.h
===================================================================
--- trunk/qgis/src/app/qgssnappingdialog.h	2010-11-14 18:30:59 UTC (rev 14651)
+++ trunk/qgis/src/app/qgssnappingdialog.h	2010-11-14 19:08:48 UTC (rev 14652)
@@ -38,17 +38,15 @@
     ~QgsSnappingDialog();
 
   public slots:
-    /**
-     * apply the changes
-     */
+    //! apply the changes
     void apply();
-    /**
-     * update the Dialog
-     */
+
+    //! update the Dialog
     void update();
 
+    //! show dialog or dock
+    void show();
 
-
   protected:
     /**Constructor
     @param canvas pointer to the map canvas (for detecting which vector layers are loaded



More information about the QGIS-commit mailing list