select_feature_option.diff

Jeremy Palmer, 2010-08-18 09:21 PM

Download (5.99 KB)

View differences:

src/app/qgisapp.cpp (working copy)
879 879
  mActionZoomOut->setStatusTip( tr( "Zoom Out" ) );
880 880
  connect( mActionZoomOut, SIGNAL( triggered() ), this, SLOT( zoomOut() ) );
881 881

  
882
  mActionSelect = new QAction( getThemeIcon( "mActionSelect.png" ), tr( "Select Features" ) , this );
882
  mActionSelect = new QAction( getThemeIcon( "mActionSelect.png" ), tr( "Select single features" ) , this );
883 883
  shortcuts->registerAction( mActionSelect );
884
  mActionSelect->setStatusTip( tr( "Select Features" ) );
884
  mActionSelect->setStatusTip( tr( "Select single feature" ) );
885 885
  connect( mActionSelect, SIGNAL( triggered() ), this, SLOT( select() ) );
886 886
  mActionSelect->setEnabled( false );
887 887

  
src/app/qgsmaptoolselectutils.cpp (working copy)
22 22
#include "qgsfeature.h"
23 23
#include "qgsgeometry.h"
24 24
#include "qgsrubberband.h"
25
#include "qgsexception.h"
25 26
#include "qgscsexception.h"
26 27
#include "qgslogger.h"
27 28
#include "qgis.h"
......
29 30
#include <QMouseEvent>
30 31
#include <QApplication>
31 32
#include <QMessageBox>
33
#include <QSettings>
32 34

  
33 35
QgsVectorLayer* QgsMapToolSelectUtils::getCurrentVectorLayer( QgsMapCanvas* canvas )
34 36
{
......
196 198

  
197 199
void QgsMapToolSelectUtils::setSelectFeatures( QgsMapCanvas* canvas, QgsGeometry* selectGeometry, QMouseEvent * e )
198 200
{
199
  bool doContains = e->modifiers() & Qt::AltModifier ? false : true;
201
  QSettings settings;
202
  QString defaultSelectionMethod = settings.value( "/qgis/defaultSelectionMethod", "Intersects" ).toString();
203
  bool doContains;
204
  if ( defaultSelectionMethod == "Contains" )
205
  {
206
    doContains = true;
207
  }
208
  else if ( defaultSelectionMethod == "Intersects" )
209
  {
210
    doContains = false;
211
  }
212
  else
213
  {
214
    throw QgsException( "Invalid defaultSelectionMethod setting: " + defaultSelectionMethod );
215
  }
216
  if ( e->modifiers() & Qt::AltModifier )
217
  {
218
    doContains = !doContains;
219
  }
200 220
  bool addSelection = e->modifiers() & Qt::ControlModifier ? true : false;
201 221
  bool substractSelection = e->modifiers() & Qt::ShiftModifier ? true : false;
202 222
  setSelectFeatures( canvas, selectGeometry, doContains, addSelection, substractSelection );
src/app/qgsoptions.cpp (working copy)
264 264
  cmbWheelAction->setCurrentIndex( settings.value( "/qgis/wheel_action", 0 ).toInt() );
265 265
  spinZoomFactor->setValue( settings.value( "/qgis/zoom_factor", 2 ).toDouble() );
266 266

  
267
  // populate the select method radio boxes
268
  QString defaultSelectionMethod = settings.value( "/qgis/defaultSelectionMethod", "Intersects" ).toString();
269
  if ( defaultSelectionMethod == "Intersects" )
270
  {
271
    mSelectIntersectsRadioButton->setChecked( true );
272
  }
273
  else
274
  {
275
    mSelectContainsRadioButton->setChecked( true );
276
  }
277

  
267 278
  //
268 279
  // Locale settings
269 280
  //
......
603 614
  settings.setValue( "/qgis/wheel_action", cmbWheelAction->currentIndex() );
604 615
  settings.setValue( "/qgis/zoom_factor", spinZoomFactor->value() );
605 616

  
617

  
618
  //set selection tool options
619
  if ( mSelectIntersectsRadioButton->isChecked() )
620
  {
621
    settings.setValue( "qgis/defaultSelectionMethod", "Intersects" );
622
  }
623
  else if ( mSelectContainsRadioButton->isChecked() )
624
  {
625
    settings.setValue( "qgis/defaultSelectionMethod", "Contains" );
626
  }
627

  
606 628
  //digitizing
607 629
  settings.setValue( "/qgis/digitizing/line_width", mLineWidthSpinBox->value() );
608 630
  QColor digitizingColor = mLineColorToolButton->color();
src/ui/qgsoptionsbase.ui (working copy)
891 891
        </widget>
892 892
       </item>
893 893
       <item>
894
        <widget class="QGroupBox" name="mSelectToolsGroupBox">
895
         <property name="title">
896
          <string>Map select tools</string>
897
         </property>
898
         <layout class="QGridLayout" name="mSelectToolsGridLayout">
899
          <item row="0" column="0">
900
           <widget class="QLabel" name="mSelectMethodLabel">
901
            <property name="text">
902
             <string>Default feature select method</string>
903
            </property>
904
           </widget>
905
          </item>
906
          <item row="0" column="1">
907
           <spacer name="mDefaultSelectMethodSpacer">
908
            <property name="orientation">
909
             <enum>Qt::Horizontal</enum>
910
            </property>
911
            <property name="sizeHint" stdset="0">
912
             <size>
913
              <width>406</width>
914
              <height>20</height>
915
             </size>
916
            </property>
917
           </spacer>
918
          </item>
919
          <item row="1" column="0" colspan="3">
920
           <widget class="QLabel" name="mSelectMethodNoteLabel">
921
            <property name="text">
922
             <string>&lt;b&gt;Note:&lt;/b&gt; When using the region select tools press the Alt key to use the other select method</string>
923
            </property>
924
            <property name="wordWrap">
925
             <bool>true</bool>
926
            </property>
927
           </widget>
928
          </item>
929
          <item row="0" column="2">
930
           <widget class="QRadioButton" name="mSelectIntersectsRadioButton">
931
            <property name="text">
932
             <string>Intersects</string>
933
            </property>
934
           </widget>
935
          </item>
936
          <item row="0" column="3">
937
           <widget class="QRadioButton" name="mSelectContainsRadioButton">
938
            <property name="text">
939
             <string>Contains</string>
940
            </property>
941
           </widget>
942
          </item>
943
         </layout>
944
        </widget>
945
       </item>
946
       <item>
894 947
        <spacer>
895 948
         <property name="orientation">
896 949
          <enum>Qt::Vertical</enum>