[QGIS Commit] r12840 - in trunk/qgis/src: app/composer core/composer ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Jan 28 04:39:10 EST 2010


Author: mhugent
Date: 2010-01-28 04:39:08 -0500 (Thu, 28 Jan 2010)
New Revision: 12840

Modified:
   trunk/qgis/src/app/composer/qgscomposertablewidget.cpp
   trunk/qgis/src/app/composer/qgscomposertablewidget.h
   trunk/qgis/src/core/composer/qgscomposertable.cpp
   trunk/qgis/src/core/composer/qgscomposertable.h
   trunk/qgis/src/ui/qgscomposertablewidgetbase.ui
Log:
[FEATURE]: possibility to show only visible features in composer table or all features

Modified: trunk/qgis/src/app/composer/qgscomposertablewidget.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposertablewidget.cpp	2010-01-28 09:26:59 UTC (rev 12839)
+++ trunk/qgis/src/app/composer/qgscomposertablewidget.cpp	2010-01-28 09:39:08 UTC (rev 12840)
@@ -281,6 +281,15 @@
   {
     mShowGridCheckBox->setCheckState( Qt::Unchecked );
   }
+
+  if ( mComposerTable->displayOnlyVisibleFeatures() )
+  {
+    mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Checked );
+  }
+  else
+  {
+    mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Unchecked );
+  }
   blockAllSignals( false );
 }
 
@@ -293,6 +302,7 @@
   mGridColorButton->blockSignals( b );
   mGridStrokeWidthSpinBox->blockSignals( b );
   mShowGridCheckBox->blockSignals( b );
+  mShowOnlyVisibleFeaturesCheckBox->blockSignals( b );
 }
 
 void QgsComposerTableWidget::setMaximumNumberOfFeatures( int n )
@@ -302,5 +312,16 @@
   mMaximumColumnsSpinBox->blockSignals( false );
 }
 
+void QgsComposerTableWidget::on_mShowOnlyVisibleFeaturesCheckBox_stateChanged( int state )
+{
+  if ( !mComposerTable )
+  {
+    return;
+  }
 
+  bool showOnlyVisibleFeatures = ( state == Qt::Checked );
+  mComposerTable->setDisplayOnlyVisibleFeatures( showOnlyVisibleFeatures );
+  mComposerTable->update();
+}
 
+

Modified: trunk/qgis/src/app/composer/qgscomposertablewidget.h
===================================================================
--- trunk/qgis/src/app/composer/qgscomposertablewidget.h	2010-01-28 09:26:59 UTC (rev 12839)
+++ trunk/qgis/src/app/composer/qgscomposertablewidget.h	2010-01-28 09:39:08 UTC (rev 12840)
@@ -48,6 +48,7 @@
     void on_mHeaderFontPushButton_clicked();
     void on_mContentFontPushButton_clicked();
     void on_mShowGridCheckBox_stateChanged( int state );
+    void on_mShowOnlyVisibleFeaturesCheckBox_stateChanged( int state );
 
     /**Inserts a new maximum number of features into the spin box (without the spinbox emitting a signal)*/
     void setMaximumNumberOfFeatures( int n );

Modified: trunk/qgis/src/core/composer/qgscomposertable.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposertable.cpp	2010-01-28 09:26:59 UTC (rev 12839)
+++ trunk/qgis/src/core/composer/qgscomposertable.cpp	2010-01-28 09:39:08 UTC (rev 12840)
@@ -23,7 +23,7 @@
 #include <QPainter>
 
 QgsComposerTable::QgsComposerTable( QgsComposition* composition ): QgsComposerItem( composition ), mVectorLayer( 0 ), mComposerMap( 0 ), \
-    mMaximumNumberOfFeatures( 5 ), mLineTextDistance( 1.0 ), mShowGrid( true ), mGridStrokeWidth( 0.5 ), mGridColor( QColor( 0, 0, 0 ) )
+    mMaximumNumberOfFeatures( 5 ), mLineTextDistance( 1.0 ), mShowGrid( true ), mGridStrokeWidth( 0.5 ), mGridColor( QColor( 0, 0, 0 ) ), mShowOnlyVisibleFeatures( true )
 {
 
 }
@@ -175,6 +175,7 @@
   composerTableElem.setAttribute( "gridColorGreen", mGridColor.green() );
   composerTableElem.setAttribute( "gridColorBlue", mGridColor.blue() );
   composerTableElem.setAttribute( "showGrid", mShowGrid );
+  composerTableElem.setAttribute( "showOnlyVisibleFeatures", mShowOnlyVisibleFeatures );
 
   if ( mComposerMap )
   {
@@ -229,6 +230,7 @@
   mLineTextDistance = itemElem.attribute( "lineTextDist", "1.0" ).toDouble();
   mGridStrokeWidth = itemElem.attribute( "gridStrokeWidth", "0.5" ).toDouble();
   mShowGrid = itemElem.attribute( "showGrid", "1" ).toInt();
+  mShowOnlyVisibleFeatures = itemElem.attribute( "showOnlyVisibleFeatures", "1" ).toInt();
 
   //grid color
   int gridRed = itemElem.attribute( "gridColorRed", "0" ).toInt();
@@ -320,7 +322,7 @@
   attributes.clear();
 
   QgsRectangle selectionRect;
-  if ( mComposerMap )
+  if ( mComposerMap && mShowOnlyVisibleFeatures )
   {
     selectionRect = mComposerMap->extent();
   }

Modified: trunk/qgis/src/core/composer/qgscomposertable.h
===================================================================
--- trunk/qgis/src/core/composer/qgscomposertable.h	2010-01-28 09:26:59 UTC (rev 12839)
+++ trunk/qgis/src/core/composer/qgscomposertable.h	2010-01-28 09:39:08 UTC (rev 12840)
@@ -66,6 +66,9 @@
     void setGridColor( const QColor& c ) { mGridColor = c; }
     QColor gridColor() const { return mGridColor; }
 
+    void setDisplayOnlyVisibleFeatures( bool b ) { mShowOnlyVisibleFeatures = b; }
+    bool displayOnlyVisibleFeatures() const { return mShowOnlyVisibleFeatures; }
+
     QSet<int> displayAttributes() const { return mDisplayAttributes; }
     void setDisplayAttributes( const QSet<int>& attr ) { mDisplayAttributes = attr;}
 
@@ -91,6 +94,8 @@
     bool mShowGrid;
     double mGridStrokeWidth;
     QColor mGridColor;
+    /**Shows only the features that are visible in the associated composer map (true by default)*/
+    bool mShowOnlyVisibleFeatures;
 
     /**List of attribute indices to display (or all attributes if list is empty)*/
     QSet<int> mDisplayAttributes;

Modified: trunk/qgis/src/ui/qgscomposertablewidgetbase.ui
===================================================================
--- trunk/qgis/src/ui/qgscomposertablewidgetbase.ui	2010-01-28 09:26:59 UTC (rev 12839)
+++ trunk/qgis/src/ui/qgscomposertablewidgetbase.ui	2010-01-28 09:39:08 UTC (rev 12840)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>258</width>
-    <height>317</height>
+    <width>269</width>
+    <height>346</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -24,8 +24,8 @@
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>240</width>
-        <height>273</height>
+        <width>251</width>
+        <height>302</height>
        </rect>
       </property>
       <attribute name="label">
@@ -53,7 +53,27 @@
          </property>
         </widget>
        </item>
+       <item row="1" column="1">
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
        <item row="2" column="0" colspan="2">
+        <widget class="QCheckBox" name="mShowOnlyVisibleFeaturesCheckBox">
+         <property name="text">
+          <string>Show only visible features</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="0" colspan="2">
         <layout class="QHBoxLayout" name="horizontalLayout_3">
          <item>
           <widget class="QLabel" name="mComposerMapLabel">
@@ -67,7 +87,7 @@
          </item>
         </layout>
        </item>
-       <item row="3" column="0" colspan="2">
+       <item row="4" column="0" colspan="2">
         <layout class="QHBoxLayout" name="horizontalLayout_2">
          <item>
           <widget class="QLabel" name="mMaxNumFeaturesLabel">
@@ -81,7 +101,7 @@
          </item>
         </layout>
        </item>
-       <item row="4" column="0" colspan="2">
+       <item row="5" column="0" colspan="2">
         <layout class="QHBoxLayout" name="horizontalLayout">
          <item>
           <widget class="QLabel" name="mMarginLabel">
@@ -95,14 +115,14 @@
          </item>
         </layout>
        </item>
-       <item row="5" column="0">
+       <item row="6" column="0" colspan="2">
         <widget class="QCheckBox" name="mShowGridCheckBox">
          <property name="text">
           <string>Show grid</string>
          </property>
         </widget>
        </item>
-       <item row="6" column="0" colspan="2">
+       <item row="7" column="0" colspan="2">
         <layout class="QHBoxLayout" name="horizontalLayout_5">
          <item>
           <widget class="QLabel" name="mGridStrokeWidthLabel">
@@ -116,14 +136,14 @@
          </item>
         </layout>
        </item>
-       <item row="7" column="0">
+       <item row="8" column="0">
         <widget class="QLabel" name="mGridColorLabel">
          <property name="text">
           <string>Grid color</string>
          </property>
         </widget>
        </item>
-       <item row="7" column="1">
+       <item row="8" column="1">
         <widget class="QgsColorButton" name="mGridColorButton">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -136,33 +156,20 @@
          </property>
         </widget>
        </item>
-       <item row="8" column="0">
+       <item row="9" column="0">
         <widget class="QPushButton" name="mHeaderFontPushButton">
          <property name="text">
           <string>Header Font...</string>
          </property>
         </widget>
        </item>
-       <item row="8" column="1">
+       <item row="9" column="1">
         <widget class="QPushButton" name="mContentFontPushButton">
          <property name="text">
           <string>Content Font...</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="1">
-        <spacer name="horizontalSpacer">
-         <property name="orientation">
-          <enum>Qt::Horizontal</enum>
-         </property>
-         <property name="sizeHint" stdset="0">
-          <size>
-           <width>40</width>
-           <height>20</height>
-          </size>
-         </property>
-        </spacer>
-       </item>
       </layout>
      </widget>
     </widget>



More information about the QGIS-commit mailing list