[QGIS Commit] r9004 -
branches/advanced_printing_branch/src/app/composer
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Aug 6 08:50:54 EDT 2008
Author: mhugent
Date: 2008-08-06 08:50:54 -0400 (Wed, 06 Aug 2008)
New Revision: 9004
Modified:
branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp
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/app/composer/qgsticksscalebarstyle.cpp
Log:
Fixed some problems with composer scale bar xml reading
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp 2008-08-06 12:44:24 UTC (rev 9003)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp 2008-08-06 12:50:54 UTC (rev 9004)
@@ -261,13 +261,13 @@
void QgsComposer::on_mActionZoomIn_activated(void)
{
mView->scale(2, 2);
- mView->update();
+ //mView->update();
}
void QgsComposer::on_mActionZoomOut_activated(void)
{
mView->scale(.5, .5);
- mView->update();
+ //mView->update();
}
void QgsComposer::on_mActionRefreshView_activated(void)
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp 2008-08-06 12:44:24 UTC (rev 9003)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp 2008-08-06 12:50:54 UTC (rev 9004)
@@ -183,12 +183,8 @@
double scale = 1.0 * QGraphicsRectItem::rect().width() / mCachePixmap.width();
painter->save();
-
- painter->translate(0, 0); //do we need this?
painter->scale(scale,scale);
-
painter->drawPixmap(0,0, mCachePixmap);
-
painter->restore();
}
else if ( mComposition->plotStyle() == QgsComposition::Print ||
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp 2008-08-06 12:44:24 UTC (rev 9003)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp 2008-08-06 12:50:54 UTC (rev 9004)
@@ -272,6 +272,7 @@
composerScaleBarElem.setAttribute("numMapUnitsPerScaleBarUnit", mNumMapUnitsPerScaleBarUnit);
composerScaleBarElem.setAttribute("font", mFont.toString());
composerScaleBarElem.setAttribute("outlineWidth", mPen.widthF());
+ composerScaleBarElem.setAttribute("unitLabel", mUnitLabeling);
//style
if(mStyle)
@@ -312,6 +313,7 @@
mNumUnitsPerSegment = itemElem.attribute("numUnitsPerSegment", "1.0").toDouble();
mNumMapUnitsPerScaleBarUnit = itemElem.attribute("numMapUnitsPerScaleBarUnit", "1.0").toDouble();
mPen.setWidthF(itemElem.attribute("outlineWidth", "1.0").toDouble());
+ mUnitLabeling = itemElem.attribute("unitLabel");
QString fontString = itemElem.attribute("font", "");
if(!fontString.isEmpty())
{
@@ -322,26 +324,7 @@
delete mStyle;
mStyle = 0;
QString styleString = itemElem.attribute("style", "");
- if(!styleString.isEmpty())
- {
- if(styleString == "Line with Ticks")
- {
- mStyle = new QgsTicksScaleBarStyle(this);
- }
- else if(styleString == "Single Box")
- {
- mStyle = new QgsSingleBoxScaleBarStyle(this);
- }
- else if(styleString == "Double Box")
- {
- mStyle = new QgsDoubleBoxScaleBarStyle(this);
- }
- else //numeric
- {
- mStyle = new QgsNumericScaleBarStyle(this);
- }
- }
-
+ setStyle(tr(styleString.toLocal8Bit().data()));
//map
int mapId = itemElem.attribute("mapId", "-1").toInt();
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.cpp 2008-08-06 12:44:24 UTC (rev 9003)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.cpp 2008-08-06 12:50:54 UTC (rev 9004)
@@ -25,6 +25,7 @@
{
setupUi(this);
+ blockMemberSignals(true);
mStyleComboBox->insertItem(0, tr("Single Box"));
mStyleComboBox->insertItem(1, tr("Double Box"));
mStyleComboBox->insertItem(2, tr("Line Ticks Middle"));
@@ -33,6 +34,7 @@
mStyleComboBox->insertItem(5, tr("Numeric"));
setGuiElements(); //set the GUI elements to the state of scaleBar
+ blockMemberSignals(false);
}
QgsComposerScaleBarWidget::~QgsComposerScaleBarWidget()
@@ -125,7 +127,6 @@
return;
}
- blockSignals(true);
mNumberOfSegmentsSpinBox->setValue(mComposerScaleBar->numSegments());
mSegmentsLeftSpinBox->setValue(mComposerScaleBar->numSegmentsLeft());
mSegmentSizeSpinBox->setValue(mComposerScaleBar->numUnitsPerSegment());
@@ -134,6 +135,7 @@
mMapUnitsPerBarUnitSpinBox->setValue(mComposerScaleBar->numMapUnitsPerScaleBarUnit());
mLabelBarSpaceSpinBox->setValue(mComposerScaleBar->labelBarSpace());
mBoxSizeSpinBox->setValue(mComposerScaleBar->boxContentSpace());
+ mUnitLabelLineEdit->setText(mComposerScaleBar->unitLabeling());
//map combo box
if(mComposerScaleBar->composerMap())
@@ -156,10 +158,9 @@
mBoxCheckBox->setCheckState(Qt::Unchecked);
}
- //todo: style...
-
-
- blockSignals(false);
+ //style...
+ QString style = mComposerScaleBar->style();
+ mStyleComboBox->setCurrentIndex(mStyleComboBox->findText(tr(style.toLocal8Bit().data())));
}
//slots
@@ -329,3 +330,19 @@
mComposerScaleBar->setBoxContentSpace(d);
mComposerScaleBar->update();
}
+
+void QgsComposerScaleBarWidget::blockMemberSignals(bool block)
+{
+ mSegmentSizeSpinBox->blockSignals(block);
+ mNumberOfSegmentsSpinBox->blockSignals(block);
+ mSegmentsLeftSpinBox->blockSignals(block);
+ mStyleComboBox->blockSignals(block);
+ mUnitLabelLineEdit->blockSignals(block);
+ mMapUnitsPerBarUnitSpinBox->blockSignals(block);
+ mMapComboBox->blockSignals(block);
+ mHeightSpinBox->blockSignals(block);
+ 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-06 12:44:24 UTC (rev 9003)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerscalebarwidget.h 2008-08-06 12:50:54 UTC (rev 9004)
@@ -54,6 +54,8 @@
void refreshMapComboBox();
void setGuiElements();
+ /**Enables/disables the signals of the input gui elements*/
+ void blockMemberSignals(bool enable);
};
#endif //QGSCOMPOSERSCALEBARWIDGET_H
Modified: branches/advanced_printing_branch/src/app/composer/qgsticksscalebarstyle.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgsticksscalebarstyle.cpp 2008-08-06 12:44:24 UTC (rev 9003)
+++ branches/advanced_printing_branch/src/app/composer/qgsticksscalebarstyle.cpp 2008-08-06 12:50:54 UTC (rev 9004)
@@ -35,7 +35,15 @@
QString QgsTicksScaleBarStyle::name() const
{
- return "Line with Ticks";
+ switch(mTickPosition)
+ {
+ case UP:
+ return "Line Ticks Up";
+ case DOWN:
+ return "Line Ticks Down";
+ case MIDDLE:
+ return "Line Ticks Middle";
+ }
}
void QgsTicksScaleBarStyle::draw(QPainter* p, double xOffset) const
More information about the QGIS-commit
mailing list