[QGIS Commit] r9086 - in branches/advanced_printing_branch/src: app/composer ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Aug 20 05:52:32 EDT 2008


Author: mhugent
Date: 2008-08-20 05:52:32 -0400 (Wed, 20 Aug 2008)
New Revision: 9086

Modified:
   branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp
   branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.cpp
   branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.h
   branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui
Log:
Changed composer scalebar widget to embed composer item widget

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp	2008-08-20 09:39:06 UTC (rev 9085)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp	2008-08-20 09:52:32 UTC (rev 9086)
@@ -40,11 +40,14 @@
 
 void QgsComposerScaleBar::paint (QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget)
 {
-  if(!mStyle)
+  if(!mStyle || !painter)
     {
       return;
     }
 
+  drawBackground(painter);
+  painter->setPen(QPen(QColor(0, 0, 0))); //draw all text black
+
   //calculate half of first label width as labels are drawn centered
   QFontMetricsF fontMetrics(mFont);
   QString firstLabel = firstLabelString();

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.cpp	2008-08-20 09:39:06 UTC (rev 9085)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.cpp	2008-08-20 09:52:32 UTC (rev 9086)
@@ -15,6 +15,7 @@
  ***************************************************************************/
 
 #include "qgscomposerscalebarwidget.h"
+#include "qgscomposeritemwidget.h"
 #include "qgscomposermap.h"
 #include "qgscomposerscalebar.h"
 #include <QColorDialog>
@@ -25,6 +26,10 @@
 {
   setupUi(this);
 
+  //add widget for general composer item properties
+  QgsComposerItemWidget* itemPropertiesWidget = new QgsComposerItemWidget(this, scaleBar);
+  gridLayout->addWidget(itemPropertiesWidget, 14, 0, 1, 3);
+
   blockMemberSignals(true);
   mStyleComboBox->insertItem(0, tr("Single Box"));
   mStyleComboBox->insertItem(1, tr("Double Box"));
@@ -148,16 +153,6 @@
 	}
     }
 
-  //frame
-  if(mComposerScaleBar->frame())
-    {
-      mBoxCheckBox->setCheckState(Qt::Checked);
-    }
-  else
-    {
-      mBoxCheckBox->setCheckState(Qt::Unchecked);
-    }
-
   //style...
   QString style = mComposerScaleBar->style();
   mStyleComboBox->setCurrentIndex(mStyleComboBox->findText(tr(style.toLocal8Bit().data())));
@@ -280,24 +275,6 @@
   mComposerScaleBar->update();
 }
 
-void QgsComposerScaleBarWidget::on_mBoxCheckBox_stateChanged(int state)
-{
-  if(!mComposerScaleBar)
-    {
-      return;
-    }
-
-  if(state == Qt::Checked)
-    {
-      mComposerScaleBar->setFrame(true);
-    }
-  else
-    {
-      mComposerScaleBar->setFrame(false);
-    }
-  mComposerScaleBar->update();
-}
-
 void QgsComposerScaleBarWidget::on_mStyleComboBox_currentIndexChanged(const QString& text)
 {
   if(!mComposerScaleBar)
@@ -344,5 +321,4 @@
   mLineWidthSpinBox->blockSignals(block);
   mLabelBarSpaceSpinBox->blockSignals(block);
   mBoxSizeSpinBox->blockSignals(block);
-  mBoxCheckBox->blockSignals(block);
 }

Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.h	2008-08-20 09:39:06 UTC (rev 9085)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.h	2008-08-20 09:52:32 UTC (rev 9086)
@@ -43,7 +43,6 @@
   void on_mMapUnitsPerBarUnitSpinBox_valueChanged(double d);
   void on_mColorPushButton_clicked();
   void on_mFontButton_clicked();
-  void on_mBoxCheckBox_stateChanged(int state);
   void on_mStyleComboBox_currentIndexChanged(const QString& text);
   void on_mLabelBarSpaceSpinBox_valueChanged(double d);
   void on_mBoxSizeSpinBox_valueChanged(double d);

Modified: branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui
===================================================================
--- branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui	2008-08-20 09:39:06 UTC (rev 9085)
+++ branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui	2008-08-20 09:52:32 UTC (rev 9086)
@@ -6,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>367</width>
-    <height>575</height>
+    <height>428</height>
    </rect>
   </property>
   <property name="sizePolicy" >
@@ -216,14 +216,7 @@
      </property>
     </widget>
    </item>
-   <item row="12" column="0" >
-    <widget class="QCheckBox" name="mBoxCheckBox" >
-     <property name="text" >
-      <string>Box</string>
-     </property>
-    </widget>
-   </item>
-   <item row="13" column="1" >
+   <item row="12" column="1" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
@@ -231,7 +224,7 @@
      <property name="sizeHint" >
       <size>
        <width>20</width>
-       <height>21</height>
+       <height>16</height>
       </size>
      </property>
     </spacer>



More information about the QGIS-commit mailing list