[QGIS Commit] r8657 - in branches/advanced_printing_branch/src: app
app/composer ui
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Jun 19 04:33:23 EDT 2008
Author: mhugent
Date: 2008-06-19 04:33:23 -0400 (Thu, 19 Jun 2008)
New Revision: 8657
Added:
branches/advanced_printing_branch/src/app/composer/qgscompositionwidget.cpp
branches/advanced_printing_branch/src/app/composer/qgscompositionwidget.h
branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui
branches/advanced_printing_branch/src/ui/qgscompositionwidgetbase.ui
Removed:
branches/advanced_printing_branch/src/ui/qgscomposerscalebarbase.ui
Modified:
branches/advanced_printing_branch/src/app/CMakeLists.txt
branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposer.h
branches/advanced_printing_branch/src/app/composer/qgscomposeritem.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposeritem.h
branches/advanced_printing_branch/src/app/composer/qgscomposeritemgroup.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposeritemgroup.h
branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.h
branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposermap.h
branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.h
branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.h
branches/advanced_printing_branch/src/app/composer/qgscomposervectorlegend.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposervectorlegend.h
branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposerview.h
branches/advanced_printing_branch/src/app/composer/qgscomposition.cpp
branches/advanced_printing_branch/src/app/composer/qgscomposition.h
branches/advanced_printing_branch/src/ui/CMakeLists.txt
Log:
Redesigned QgsComposition. It is now derived from QGraphicsScene and not from QWidget, so gui independent
Modified: branches/advanced_printing_branch/src/app/CMakeLists.txt
===================================================================
--- branches/advanced_printing_branch/src/app/CMakeLists.txt 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/CMakeLists.txt 2008-06-19 08:33:23 UTC (rev 8657)
@@ -60,13 +60,15 @@
composer/qgscomposeritemgroup.cpp
composer/qgscomposerlabel.cpp
composer/qgscomposerlabelwidget.cpp
- composer/qgscomposerpicture.cpp
+ #composer/qgscomposerpicture.cpp
composer/qgscomposermap.cpp
composer/qgscomposermapwidget.cpp
- composer/qgscomposerscalebar.cpp
- composer/qgscomposervectorlegend.cpp
+ #composer/qgscomposerscalebar.cpp
+ #composer/qgscomposerscalebarwidget.cpp
+ #composer/qgscomposervectorlegend.cpp
composer/qgscomposerview.cpp
composer/qgscomposition.cpp
+ composer/qgscompositionwidget.cpp
legend/qgslegendgroup.cpp
legend/qgslegend.cpp
@@ -122,11 +124,12 @@
composer/qgscomposerlabelwidget.h
composer/qgscomposermap.h
composer/qgscomposermapwidget.h
- composer/qgscomposerpicture.h
- composer/qgscomposerscalebar.h
- composer/qgscomposervectorlegend.h
+ #composer/qgscomposerpicture.h
+ #composer/qgscomposerscalebarwidget.h
+ #composer/qgscomposervectorlegend.h
composer/qgscomposerview.h
- composer/qgscomposition.h
+ composer/qgscomposeritemgroup.h
+ composer/qgscompositionwidget.h
legend/qgslegend.h
legend/qgslegendlayer.h
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposer.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -20,6 +20,11 @@
#include "qgsapplication.h"
#include "qgscomposerview.h"
#include "qgscomposition.h"
+#include "qgscompositionwidget.h"
+#include "qgscomposerlabel.h"
+#include "qgscomposerlabelwidget.h"
+#include "qgscomposermap.h"
+#include "qgscomposermapwidget.h"
#include "qgsexception.h"
#include "qgsproject.h"
#include "qgsmessageviewer.h"
@@ -79,20 +84,34 @@
setMouseTracking(true);
mSplitter->setMouseTracking(true);
mViewFrame->setMouseTracking(true);
- mView = new QgsComposerView ( this, mViewFrame);
+
+ //create composer view
+ mView = new QgsComposerView (mViewFrame);
+ connect(mView, SIGNAL(selectedItemChanged(const QgsComposerItem*)), this, SLOT(showItemOptions(const QgsComposerItem*)));
+ connect(mView, SIGNAL(composerLabelAdded(QgsComposerLabel*)), this, SLOT(addComposerLabel(QgsComposerLabel*)));
+ connect(mView, SIGNAL(composerMapAdded(QgsComposerMap*)), this, SLOT(addComposerMap(QgsComposerMap*)));
+ connect(mView, SIGNAL(itemRemoved(QgsComposerItem*)), this, SLOT(deleteItem(QgsComposerItem*)));
+
+ mComposition = new QgsComposition(mQgis->getMapCanvas());
+ mView->setComposition(mComposition);
+
+ QgsCompositionWidget* compositionWidget = new QgsCompositionWidget(mCompositionOptionsFrame, mComposition);
+ compositionWidget->show();
+
+ mCompositionOptionsLayout = new QGridLayout( mCompositionOptionsFrame );
+ mCompositionOptionsLayout->setMargin(0);
+ mCompositionOptionsLayout->addWidget(compositionWidget);
+
mPrinter = 0;
QGridLayout *l = new QGridLayout(mViewFrame );
l->setMargin(0);
l->addWidget( mView, 0, 0 );
- mCompositionOptionsLayout = new QGridLayout( mCompositionOptionsFrame );
- mCompositionOptionsLayout->setMargin(0);
-
mCompositionNameComboBox->insertItem( tr("Map 1") );
- mComposition = new QgsComposition( this, 1 );
- mComposition->setActive ( true );
+ //mComposition = new QgsComposition( this, 1 );
+ //mComposition->setActive ( true );
// Create size grip (needed by Mac OS X for QMainWindow if QStatusBar is not visible)
mSizeGrip = new QSizeGrip(this);
@@ -146,7 +165,7 @@
void QgsComposer::open ( void )
{
if ( mFirstTime ) {
- mComposition->createDefault();
+ //mComposition->createDefault();
mFirstTime = false;
show();
zoomFull(); // zoomFull() does not work properly until we have called show()
@@ -173,6 +192,8 @@
if(!item)
{
mItemStackedWidget->removeWidget(currentWidget);
+ mItemStackedWidget->setCurrentWidget(0);
+ return;
}
QMap<QgsComposerItem*, QWidget*>::iterator it = mItemWidgetMap.find(const_cast<QgsComposerItem*>(item));
@@ -182,6 +203,7 @@
}
QWidget* newWidget = it.value();
+
if(!newWidget || newWidget == currentWidget) //bail out if new widget does not exist or is already there
{
return;
@@ -189,25 +211,10 @@
mItemStackedWidget->removeWidget(currentWidget);
mItemStackedWidget->addWidget(newWidget);
+ mItemStackedWidget->setCurrentWidget(newWidget);
+ //newWidget->show();
}
-void QgsComposer::addItem(QgsComposerItem* item, QWidget* widget)
-{
- mItemWidgetMap.insert(item, widget);
-}
-
-void QgsComposer::removeItem(QgsComposerItem* item)
-{
- QMap<QgsComposerItem*, QWidget*>::iterator it = mItemWidgetMap.find(item);
- if(it != mItemWidgetMap.end())
- {
- delete it.value();
- mView->scene()->removeItem(item);
- mItemWidgetMap.remove(item);
- delete item;
- }
-}
-
QgsMapCanvas *QgsComposer::mapCanvas(void)
{
return mQgis->getMapCanvas();
@@ -218,10 +225,10 @@
return mView;
}
-QgsComposition *QgsComposer::composition(void)
+/*QgsComposition *QgsComposer::composition(void)
{
return mComposition;
-}
+ }*/
void QgsComposer::zoomFull(void)
{
@@ -247,12 +254,56 @@
void QgsComposer::on_mActionRefreshView_activated(void)
{
+ /*
mComposition->refresh();
mView->update();
+ */
}
void QgsComposer::on_mActionPrint_activated(void)
{
+ if(!mComposition)
+ {
+ return;
+ }
+
+ QPrinter printer;
+
+ //try to set most of the print dialog settings based on composer properties
+ if(mComposition->paperHeight() > mComposition->paperWidth())
+ {
+ printer.setOrientation(QPrinter::Portrait);
+ }
+ else
+ {
+ printer.setOrientation(QPrinter::Landscape);
+ }
+
+ //set resolution based on composer setting
+
+
+ printer.setFullPage(true);
+ printer.setColorMode(QPrinter::Color);
+
+ QPrintDialog printDialog(&printer);
+
+ if(printDialog.exec() == QDialog::Accepted)
+ {
+ QPainter p(&printer);
+ QRectF paperRect(0, 0, mComposition->paperWidth(), mComposition->paperHeight());
+ QRect pageRect = printer.pageRect();
+ //better in case of custom page size, but only possible with Qt>4.4
+ //with Qt4.4: QRectF paperRect = printer.pageRect(QPrinter::Millimeter)
+
+
+ QgsComposition::PlotStyle savedPlotStyle = mComposition->plotStyle();
+ mComposition->setPlotStyle(QgsComposition::Print);
+
+ mComposition->render(&p, pageRect, paperRect);
+
+ mComposition->setPlotStyle(savedPlotStyle);
+ }
+#if 0
/* Uff!!! It is impossible to set a custom page size for QPrinter.
* Only the sizes hardcoded in Qt library can be used.
* 'Fortunately', it seems that everything is written to postscript output file,
@@ -596,7 +647,7 @@
{
raise();
}
-
+#endif //0
}
@@ -617,6 +668,7 @@
void QgsComposer::on_mActionExportAsImage_activated(void)
{
+#if 0
// Image size
int width = (int) (mComposition->resolution() * mComposition->paperWidth() / 25.4);
int height = (int) (mComposition->resolution() * mComposition->paperHeight() / 25.4);
@@ -737,12 +789,12 @@
mView->setScene(mComposition->canvas());
pixmap.save ( myOutputFileNameQString, myFilterMap[myFilterString].toLocal8Bit().data() );
+#endif //0
}
void QgsComposer::on_mActionExportAsSVG_activated(void)
{
-
QString myQSettingsLabel = "/UI/displaySVGWarning";
QSettings myQSettings;
@@ -792,7 +844,7 @@
myQSettings.writeEntry("/UI/lastSaveAsSvgFile", myOutputFileNameQString);
- mView->setScene(0);//don't redraw the scene on the display while we render
+ //mView->setScene(0);//don't redraw the scene on the display while we render
mComposition->setPlotStyle ( QgsComposition::Print );
#if QT_VERSION < 0x040300
@@ -803,16 +855,16 @@
QSvgGenerator generator;
generator.setFileName(myOutputFileNameQString);
generator.setSize(QSize( (int)mComposition->paperWidth(), (int)mComposition->paperHeight() ));
- generator.setResolution((int)(mComposition->resolution() / 25.4)); //because the rendering is done in mm, convert the dpi
+ //generator.setResolution((int)(mComposition->resolution() / 25.4)); //because the rendering is done in mm, convert the dpi
QPainter p(&generator);
QRectF renderArea(0,0, mComposition->paperWidth(), mComposition->paperHeight());
#endif
- mComposition->canvas()->render(&p, renderArea);
+ mComposition->render(&p, renderArea);
p.end();
mComposition->setPlotStyle ( QgsComposition::Preview );
- mView->setScene(mComposition->canvas()); //now that we're done, set the view to show the scene again
+ //mView->setScene(mComposition->canvas()); //now that we're done, set the view to show the scene again
#if QT_VERSION < 0x040300
QRect br = pic.boundingRect();
@@ -824,6 +876,7 @@
void QgsComposer::setToolActionsOff(void)
{
+#if 0
mActionOpenTemplate->setOn ( false );
mActionSaveTemplateAs->setOn ( false );
mActionExportAsImage->setOn ( false );
@@ -839,70 +892,83 @@
mActionAddNewVectLegend->setOn ( false );
mActionAddNewScalebar->setOn ( false );
mActionSelectMoveItem->setOn ( false );
+#endif //0
}
void QgsComposer::selectItem(void)
{
+#if 0
mComposition->setTool ( QgsComposition::Select );
setToolActionsOff();
mActionSelectMoveItem->setOn ( true );
+#endif //0
}
void QgsComposer::on_mActionSelectMoveItem_activated(void)
{
- selectItem();
+ if(mView)
+ {
+ mView->setCurrentTool(QgsComposerView::Select);
+ }
}
void QgsComposer::on_mActionAddNewMap_activated(void)
{
- mComposition->setTool ( QgsComposition::AddMap );
- setToolActionsOff();
- mActionAddNewMap->setOn ( true );
- mView->setCursor(QCursor(cross_hair_cursor));
+ if(mView)
+ {
+ mView->setCurrentTool(QgsComposerView::AddMap);
+ }
}
void QgsComposer::on_mActionAddNewVectLegend_activated(void)
{
+#if 0
mComposition->setTool ( QgsComposition::AddVectorLegend );
setToolActionsOff();
mActionAddNewVectLegend->setOn ( true );
+#endif //0
}
void QgsComposer::on_mActionAddNewLabel_activated(void)
{
- mComposition->setTool ( QgsComposition::AddLabel );
- setToolActionsOff();
- mActionAddNewLabel->setOn ( true );
+ if(mView)
+ {
+ mView->setCurrentTool(QgsComposerView::AddLabel);
+ }
}
void QgsComposer::on_mActionAddNewScalebar_activated(void)
{
+#if 0
mComposition->setTool ( QgsComposition::AddScalebar );
setToolActionsOff();
mActionAddNewScalebar->setOn ( true );
+#endif //0
}
void QgsComposer::on_mActionAddImage_activated(void)
{
+#if 0
mComposition->setTool ( QgsComposition::AddPicture );
setToolActionsOff();
mActionAddImage->setOn ( true );
mView->setCursor(QCursor(cross_hair_cursor));
+#endif //0
}
void QgsComposer::groupItems(void)
{
- if(mComposition)
+ if(mView)
{
- mComposition->groupItems();
+ mView->groupItems();
}
}
void QgsComposer::ungroupItems(void)
{
- if(mComposition)
+ if(mView)
{
- mComposition->ungroupItems();
+ mView->ungroupItems();
}
}
@@ -953,8 +1019,8 @@
#ifdef QGISDEBUG
std::cout << "QgsComposer::projectRead" << std::endl;
#endif
- if ( mComposition ) delete mComposition;
- mComposition = new QgsComposition( this, 1 );
+ //if ( mComposition ) delete mComposition;
+ //mComposition = new QgsComposition( this, 1 );
// Read composition if it is defined in project
QStringList l = QgsProject::instance()->subkeyList ( "Compositions", "" );
@@ -969,18 +1035,18 @@
}
if ( found ) {
- mComposition->readSettings ( );
+ //mComposition->readSettings ( );
mFirstTime = false;
} else {
if ( isVisible() ) {
- mComposition->createDefault();
+ //mComposition->createDefault();
mFirstTime = false;
} else {
mFirstTime = true;
}
}
- mComposition->setActive ( true );
+ //mComposition->setActive ( true );
}
void QgsComposer::newProject(void)
@@ -988,14 +1054,14 @@
#ifdef QGISDEBUG
std::cout << "QgsComposer::newProject" << std::endl;
#endif
- if ( mComposition ) delete mComposition;
+ //if ( mComposition ) delete mComposition;
- mComposition = new QgsComposition( this, 1 );
- mComposition->setActive ( true );
+ //mComposition = new QgsComposition( this, 1 );
+ //mComposition->setActive ( true );
// If composer is visible, create default immediately, otherwise wait for the first open()
if ( isVisible() ) {
- mComposition->createDefault();
+ //mComposition->createDefault();
mFirstTime = false;
} else {
mFirstTime = true;
@@ -1042,3 +1108,37 @@
return true;
}
+void QgsComposer::addComposerMap(QgsComposerMap* map)
+{
+ if(!map)
+ {
+ return;
+ }
+
+ QgsComposerMapWidget* mapWidget= new QgsComposerMapWidget(map);
+ mItemWidgetMap.insert(map, mapWidget);
+}
+
+void QgsComposer::addComposerLabel(QgsComposerLabel* label)
+{
+ if(!label)
+ {
+ return;
+ }
+
+ QgsComposerLabelWidget* labelWidget = new QgsComposerLabelWidget(label);
+ mItemWidgetMap.insert(label, labelWidget);
+}
+
+void QgsComposer::deleteItem(QgsComposerItem* item)
+{
+ QMap<QgsComposerItem*, QWidget*>::iterator it = mItemWidgetMap.find(item);
+
+ if(it == mItemWidgetMap.end())
+ {
+ return;
+ }
+
+ delete (it.value());
+ mItemWidgetMap.remove(it.key());
+}
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposer.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposer.h 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposer.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -21,6 +21,8 @@
#include "qgscomposeritem.h"
class QgisApp;
+class QgsComposerLabel;
+class QgsComposerMap;
class QgsComposerView;
class QgsComposition;
class QgsMapCanvas;
@@ -71,13 +73,10 @@
QgsComposerView *view ( void );
//! Return current composition
- QgsComposition *composition(void);
+ //QgsComposition *composition(void);
//! Show composition options in widget
void showCompositionOptions ( QWidget *w );
-
- //! Show item options in widget
- void showItemOptions(const QgsComposerItem* i);
/** \brief stores statei in project */
bool writeSettings ( void );
@@ -94,15 +93,6 @@
//! Restore the window and toolbar state
void restoreWindowState();
- /** Adds an item and its configuration widget to the composer. \
- QgsComposer takes ownership of these objects and deletes them \
- if not needed any more.
- */
- void addItem(QgsComposerItem* item, QWidget* widget);
-
- /**Removes (and deletes) the item and its configuration widget from the composer*/
- void removeItem(QgsComposerItem* item);
-
//! Move event
void moveEvent ( QMoveEvent * );
@@ -170,6 +160,20 @@
//! Slot for when the close button is clicked
void on_closePButton_clicked();
+ /**Add a composer map to the item/widget map and creates a configuration widget for it*/
+ void addComposerMap(QgsComposerMap* map);
+
+ /**Adds a composer label to the item/widget map and creates a configuration widget for it*/
+ void addComposerLabel(QgsComposerLabel* label);
+
+ /**Removes item from the item/widget map and deletes the configuration widget*/
+ void deleteItem(QgsComposerItem* item);
+
+ /**Shows the configuration widget for a composer item*/
+ void showItemOptions(const QgsComposerItem* i);
+
+
+
private:
//! Set teh pixmap / icons on the toolbar buttons
void setupTheme();
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposeritem.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposeritem.cpp 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposeritem.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -26,16 +26,14 @@
#include <iostream>
#include "qgsrect.h" //just for debugging
-QgsComposerItem::QgsComposerItem(QGraphicsItem* parent): QGraphicsRectItem(0), mBoundingResizeRectangle(0), mFrame(true)
+QgsComposerItem::QgsComposerItem(QgsComposition* composition): QGraphicsRectItem(0), mComposition(composition), mBoundingResizeRectangle(0), mFrame(true)
{
- mPlotStyle = QgsComposition::Preview;
setFlag(QGraphicsItem::ItemIsSelectable, true);
setAcceptsHoverEvents(true);
}
-QgsComposerItem::QgsComposerItem(qreal x, qreal y, qreal width, qreal height, QGraphicsItem* parent): QGraphicsRectItem(0, 0, width, height, parent), mBoundingResizeRectangle(0), mFrame(true)
+QgsComposerItem::QgsComposerItem(qreal x, qreal y, qreal width, qreal height, QgsComposition* composition): QGraphicsRectItem(0, 0, width, height, 0), mComposition(composition), mBoundingResizeRectangle(0), mFrame(true)
{
- mPlotStyle = QgsComposition::Preview;
setFlag(QGraphicsItem::ItemIsSelectable, true);
setAcceptsHoverEvents(true);
@@ -48,11 +46,6 @@
{
}
-void QgsComposerItem::setPlotStyle ( QgsComposition::PlotStyle d ) { mPlotStyle = d; }
-
-QgsComposition::PlotStyle QgsComposerItem::plotStyle ( void ) { return mPlotStyle; }
-
-
void QgsComposerItem::setSelected( bool s )
{
std::cout << "QgsComposerItem::setSelected" << std::endl;
@@ -60,8 +53,6 @@
update(); //to draw selection boxes
}
-int QgsComposerItem::id(void) { return mId; }
-
bool QgsComposerItem::writeSettings ( void ) { return true; }
bool QgsComposerItem::readSettings ( void ) { return true; }
@@ -290,8 +281,13 @@
void QgsComposerItem::drawSelectionBoxes(QPainter* p)
{
- if(plotStyle() == QgsComposition::Preview)
+ if(!mComposition)
{
+ return;
+ }
+
+ if(mComposition->plotStyle() == QgsComposition::Preview)
+ {
p->setPen(QPen(QColor(0, 0, 255)));
p->setBrush(QBrush(QColor(0, 0, 255)));
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposeritem.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposeritem.h 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposeritem.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -45,24 +45,15 @@
resizeDRightDown
};
- QgsComposerItem(QGraphicsItem* parent = 0);
- QgsComposerItem(qreal x, qreal y, qreal width, qreal height, QGraphicsItem* parent = 0);
+ QgsComposerItem(QgsComposition* composition);
+ QgsComposerItem(qreal x, qreal y, qreal width, qreal height, QgsComposition* composition);
virtual ~QgsComposerItem();
- /** \brief Set plot style */
- void setPlotStyle ( QgsComposition::PlotStyle p );
-
- /** \brief get plot style */
- QgsComposition::PlotStyle plotStyle ( void );
-
/** \brief Set selected, selected item should be highlighted */
virtual void setSelected( bool s );
/** \brief Is selected */
virtual bool selected( void ){return QGraphicsRectItem::isSelected();}
-
- /** item id */
- int id ( void );
/** stores state in project */
virtual bool writeSettings ( void );
@@ -99,8 +90,8 @@
virtual void removeItems() {}
protected:
- QgsComposition::PlotStyle mPlotStyle;
- int mId;
+
+ QgsComposition* mComposition;
QgsComposerItem::mouseMoveAction mCurrentMouseMoveAction;
/**Start point of the last mouse move action (in scene coordinates)*/
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposeritemgroup.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposeritemgroup.cpp 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposeritemgroup.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -21,32 +21,19 @@
#include <QPen>
#include <QPainter>
-QgsComposerItemGroup::QgsComposerItemGroup(QgsComposition* c, QGraphicsItem* parent): QgsComposerItem(parent), mComposition(c)
+QgsComposerItemGroup::QgsComposerItemGroup(QgsComposition* c): QgsComposerItem(c)
{
- setZValue(50);
+ setZValue(90);
show();
}
QgsComposerItemGroup::~QgsComposerItemGroup()
{
- //todo: notify composition to delete child items too
- //QgsComposer::removeItem(QgsComposerItem* item)
-
- if(!mComposition)
- {
- return;
- }
-
- QgsComposer* composer = mComposition->composer();
- if(!composer)
- {
- return;
- }
-
QSet<QgsComposerItem*>::iterator itemIt = mItems.begin();
for(; itemIt != mItems.end(); ++itemIt)
{
- composer->removeItem(*itemIt);
+ emit childItemDeleted(*itemIt);
+ delete (*itemIt);
}
}
@@ -109,6 +96,7 @@
for(; item_it != mItems.end(); ++item_it)
{
(*item_it)->setFlag(QGraphicsItem::ItemIsSelectable, true); //enable item selection again
+ (*item_it)->setSelected(true);
}
mItems.clear();
}
@@ -161,8 +149,13 @@
void QgsComposerItemGroup::drawFrame(QPainter* p)
{
- if(mFrame && plotStyle() == QgsComposition::Preview)
+ if(!mComposition)
{
+ return;
+ }
+
+ if(mFrame && mComposition->plotStyle() == QgsComposition::Preview)
+ {
QPen newPen(pen());
newPen.setStyle(Qt::DashLine);
newPen.setColor(QColor(128, 128, 128, 128));
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposeritemgroup.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposeritemgroup.h 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposeritemgroup.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -16,13 +16,16 @@
***************************************************************************/
#include "qgscomposeritem.h"
+#include <QObject>
#include <QSet>
+
class QgsComposition;
-class QgsComposerItemGroup: public QgsComposerItem
+class QgsComposerItemGroup: public QObject, public QgsComposerItem
{
+ Q_OBJECT
public:
- QgsComposerItemGroup(QgsComposition* c, QGraphicsItem* parent = 0);
+ QgsComposerItemGroup(QgsComposition* c);
~QgsComposerItemGroup();
/**Adds an item to the group. All the group members are deleted
if the group is deleted*/
@@ -37,12 +40,14 @@
/** resizes an item in x- and y direction (scene coordinates)*/
void resize(double dx, double dy);
+ signals:
+ void childItemDeleted(QgsComposerItem* item);
+
protected:
void drawFrame(QPainter* p);
private:
QSet<QgsComposerItem*> mItems;
- QgsComposition* mComposition;
QRectF mSceneBoundingRectangle;
};
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.cpp 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -18,14 +18,12 @@
#include "qgscomposerlabel.h"
#include <QPainter>
-QgsComposerLabel::QgsComposerLabel( QgsComposition *composition, int id): QgsComposerItem(0), mMargin(0.0)
+QgsComposerLabel::QgsComposerLabel( QgsComposition *composition): QgsComposerItem(composition), mMargin(0.0)
{
- mId = id;
}
QgsComposerLabel::~QgsComposerLabel()
{
- //todo
}
void QgsComposerLabel::paint(QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget)
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.h 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerlabel.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -22,7 +22,7 @@
class QgsComposerLabel: public QgsComposerItem
{
public:
- QgsComposerLabel( QgsComposition *composition, int id);
+ QgsComposerLabel( QgsComposition *composition);
~QgsComposerLabel();
/** \brief Reimplementation of QCanvasItem::paint*/
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposermap.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -36,19 +36,15 @@
#include <iostream>
#include <cmath>
-QgsComposerMap::QgsComposerMap ( QgsComposition *composition, int id, int x, int y, int width, int height )
- : QgsComposerItem(x, y, width,height,0)
+QgsComposerMap::QgsComposerMap ( QgsComposition *composition, int x, int y, int width, int height )
+ : QgsComposerItem(x, y, width, height, composition)
{
mComposition = composition;
- mId = id;
mMapCanvas = mComposition->mapCanvas();
- mName = QString(tr("Map %1").arg(mId));
+ mName = "Map"; //QString(tr("Map %1").arg(mId)); //todo: make static member as counter
// Cache
mCacheUpdated = false;
-
- //mCalculate = Scale;
- setPlotStyle ( QgsComposition::Preview );
mDrawing = false;
//calculate mExtent based on width/height ratio and map canvas extent
@@ -60,25 +56,16 @@
connect ( mMapCanvas, SIGNAL(layersChanged()), this, SLOT(mapCanvasChanged()) );
// Add to scene
- mComposition->canvas()->addItem(this);
QGraphicsRectItem::show();
-
- //writeSettings();
}
-QgsComposerMap::QgsComposerMap ( QgsComposition *composition, int id )
- : QgsComposerItem(0,0,10,10,0)
+QgsComposerMap::QgsComposerMap ( QgsComposition *composition)
+ : QgsComposerItem(0, 0, 10, 10, composition)
{
mComposition = composition;
- mId = id;
mMapCanvas = mComposition->mapCanvas();
- mName = QString(tr("Map %1").arg(mId));
-
- readSettings();
-
- // Add to scene
- mComposition->canvas()->addItem(this);
+ mName = "Map"; //QString(tr("Map %1").arg(mId)); //todo: make static member as counter
QGraphicsRectItem::show();
}
@@ -161,6 +148,11 @@
return;
}
+ if(!mComposition)
+ {
+ return;
+ }
+
mDrawing = true;
QRectF thisPaintRect = QRectF( 0, 0, QGraphicsRectItem::rect().width(), QGraphicsRectItem::rect().height());
@@ -169,7 +161,7 @@
double currentScaleFactorX = horizontalViewScaleFactor();
- if( plotStyle() == QgsComposition::Preview && mPreviewMode == Render /*&& screen resolution different than last time*/)
+ if( mComposition->plotStyle() == QgsComposition::Preview && mPreviewMode == Render /*&& screen resolution different than last time*/)
{
if(currentScaleFactorX != mLastScaleFactorX)
{
@@ -177,7 +169,7 @@
}
}
- if ( plotStyle() == QgsComposition::Preview && mPreviewMode != Rectangle)
+ if ( mComposition->plotStyle() == QgsComposition::Preview && mPreviewMode != Rectangle)
{ // Draw from cache
if ( !mCacheUpdated || mMapCanvas->layerCount() != mNumCachedLayers )
{
@@ -196,8 +188,8 @@
painter->restore();
}
- else if ( plotStyle() == QgsComposition::Print ||
- plotStyle() == QgsComposition::Postscript)
+ else if ( mComposition->plotStyle() == QgsComposition::Print ||
+ mComposition->plotStyle() == QgsComposition::Postscript)
{
QPaintDevice* thePaintDevice = painter->device();
if(!thePaintDevice)
@@ -246,78 +238,6 @@
return mName;
}
-bool QgsComposerMap::writeSettings ( void )
-{
- QString path;
- path.sprintf("/composition_%d/map_%d/", mComposition->id(), mId );
-
- QgsProject::instance()->writeEntry( "Compositions", path+"x", mComposition->toMM((int)QGraphicsRectItem::pos().x()) );
- QgsProject::instance()->writeEntry( "Compositions", path+"y", mComposition->toMM((int)QGraphicsRectItem::pos().y()) );
-
-
- QgsProject::instance()->writeEntry( "Compositions", path+"width", mComposition->toMM((int)QGraphicsRectItem::rect().width()) );
- QgsProject::instance()->writeEntry( "Compositions", path+"height", mComposition->toMM((int)QGraphicsRectItem::rect().height()) );
-
- /*
- if ( mCalculate == Scale ) {
- QgsProject::instance()->writeEntry( "Compositions", path+"calculate", QString("scale") );
- } else {
- QgsProject::instance()->writeEntry( "Compositions", path+"calculate", QString("extent") );
- }*/
-
- QgsProject::instance()->writeEntry( "Compositions", path+"frame", mFrame );
-
- QgsProject::instance()->writeEntry( "Compositions", path+"previewmode", mPreviewMode );
-
- return true;
-}
-
-bool QgsComposerMap::readSettings ( void )
-{
- bool ok;
- QString path;
- path.sprintf("/composition_%d/map_%d/", mComposition->id(), mId );
-
- double x = mComposition->fromMM(QgsProject::instance()->readDoubleEntry( "Compositions", path+"x", 0, &ok));
- double y = mComposition->fromMM(QgsProject::instance()->readDoubleEntry( "Compositions", path+"y", 0, &ok));
- int w = mComposition->fromMM(QgsProject::instance()->readDoubleEntry( "Compositions", path+"width", 100, &ok)) ;
- int h = mComposition->fromMM(QgsProject::instance()->readDoubleEntry( "Compositions", path+"height", 100, &ok)) ;
- QGraphicsRectItem::setRect(0, 0, w, h);
- QGraphicsRectItem::setPos(x, y);
-
- QString calculate = QgsProject::instance()->readEntry("Compositions", path+"calculate", "scale", &ok);
- if ( calculate == "extent" )
- {
- //mCalculate = Extent;
- }else
- {
- //mCalculate = Scale;
- }
-
- mFrame = QgsProject::instance()->readBoolEntry("Compositions", path+"frame", true, &ok);
-
- mPreviewMode = (PreviewMode) QgsProject::instance()->readNumEntry("Compositions", path+"previewmode", Cache, &ok);
-
- return true;
-}
-
-bool QgsComposerMap::removeSettings ( void )
-{
- QString path;
- path.sprintf("/composition_%d/map_%d", mComposition->id(), mId );
- return QgsProject::instance()->removeEntry ( "Compositions", path );
-}
-
-bool QgsComposerMap::writeXML( QDomNode & node, QDomDocument & document, bool temp )
-{
- return true;
-}
-
-bool QgsComposerMap::readXML( QDomNode & node )
-{
- return true;
-}
-
void QgsComposerMap::resize(double dx, double dy)
{
//setRect
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposermap.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposermap.h 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposermap.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -41,9 +41,9 @@
public:
/** Constructor. */
- QgsComposerMap( QgsComposition *composition, int id, int x, int y, int width, int height );
+ QgsComposerMap( QgsComposition *composition, int x, int y, int width, int height );
/** Constructor. Settings are read from project. */
- QgsComposerMap( QgsComposition *composition, int id );
+ QgsComposerMap( QgsComposition *composition);
~QgsComposerMap();
/** \brief Preview style */
@@ -55,13 +55,6 @@
/** \brief Initialise GUI and other settings, shared by constructors */
void init ( void );
-
- // Reimplement QgsComposerItem:
- bool writeSettings ( void );
- bool readSettings ( void );
- bool removeSettings ( void );
- bool writeXML( QDomNode & node, QDomDocument & document, bool temp = false );
- bool readXML( QDomNode & node );
/** \brief Draw to paint device
@param extent map extent
@@ -117,9 +110,6 @@
private:
- // Pointer to composition
- QgsComposition *mComposition;
-
// Pointer to map canvas
QgsMapCanvas *mMapCanvas;
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.cpp 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -16,6 +16,8 @@
***************************************************************************/
/* $Id$ */
+#if 0
+
#include "qgscomposerpicture.h"
#include "qgsproject.h"
@@ -569,3 +571,5 @@
{
return true;
}
+
+#endif //0
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.h 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerpicture.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -17,6 +17,9 @@
#ifndef QGSCOMPOSERPICTURE_H
#define QGSCOMPOSERPICTURE_H
+
+#if 0
+
#include "ui_qgscomposerpicturebase.h"
#include "qgscomposeritem.h"
#include <QAbstractGraphicsShapeItem>
@@ -147,4 +150,6 @@
void adjustPictureSize();
};
+#endif //0
+
#endif
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -16,9 +16,9 @@
#include "qgscomposerscalebar.h"
-QgsComposerScaleBar::QgsComposerScaleBar(QgsComposition* composition)
+QgsComposerScaleBar::QgsComposerScaleBar(QgsComposition* composition): QgsComposerItem(0)
{
-
+
}
QgsComposerScaleBar::~QgsComposerScaleBar()
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.h 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerscalebar.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -38,7 +38,32 @@
/** \brief Reimplementation of QCanvasItem::paint*/
void paint (QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget);
+ //getters and setters
+ int numSegments() const {return mNumSegments;}
+ void setNumSegments(int nSegments){mNumSegments = nSegments;}
+ int numSegmentsLeft() const {return mNumSegmentsLeft;}
+ void setNumSegmentsLeft(int nSegmentsLeft) {mNumSegmentsLeft = nSegmentsLeft;}
+
+ double numUnitsPerSegment() const {return mNumUnitsPerSegment;}
+ void setNumUnitsPerSegment(double units) {mNumUnitsPerSegment = units;}
+
+ QString unitLabeling() const {return mUnitLabeling;}
+ void setUnitLabeling(const QString& label){mUnitLabeling = label;}
+
+ QFont font() const {return mFont;}
+ void setFont(const QFont& font){mFont = font;}
+
+ QPen pen() const {return mPen;}
+ void setPen(const QPen& pen){mPen = pen;}
+
+ QBrush brush() const {return mBrush;}
+ void setBrush(const QBrush& brush){mBrush = brush;}
+
+ double height() const {return mHeight;}
+ void setHeight(double h) {mHeight = h;}
+
+
protected:
/**Reference to composer map object*/
@@ -48,7 +73,7 @@
/**Number of segments on left side*/
int mNumSegmentsLeft;
/**Size of a segment (in map units)*/
- int mNumUnitsPerSegment;
+ double mNumUnitsPerSegment;
/**Labeling of map units*/
QString mUnitLabeling;
/**Font*/
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposervectorlegend.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposervectorlegend.cpp 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposervectorlegend.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -36,6 +36,8 @@
#include <iostream>
#include <vector>
+#if 0
+
QgsComposerVectorLegend::QgsComposerVectorLegend ( QgsComposition *composition, int id,
int x, int y, int fontSize )
: QWidget(composition), QgsComposerItem(x,y,10,10,0)
@@ -954,3 +956,5 @@
{
return true;
}
+
+#endif //0
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposervectorlegend.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposervectorlegend.h 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposervectorlegend.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -17,6 +17,8 @@
#ifndef QGSCOMPOSERVECTORLEGEND_H
#define QGSCOMPOSERVECTORLEGEND_H
+#if 0
+
/*
* |<>| - mMargin
*
@@ -212,4 +214,6 @@
bool mFrame;
};
+#endif //0
+
#endif
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerview.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -14,25 +14,18 @@
* (at your option) any later version. *
* *
***************************************************************************/
-#include <iostream>
-#include <QMatrix>
-#include <QEvent>
#include <QMouseEvent>
#include <QKeyEvent>
-#include "qgsrect.h"
-#include "qgscomposer.h"
-#include "qgscomposeritem.h"
#include "qgscomposerview.h"
+#include "qgscomposerlabel.h"
#include "qgscomposermap.h"
+#include "qgscomposeritemgroup.h"
-// Note: |WRepaintNoErase|WResizeNoErase|WStaticContents doeen't make it faster
-QgsComposerView::QgsComposerView( QgsComposer *composer, QWidget* parent, const char* name, Qt::WFlags f) :
- QGraphicsView(parent), mShiftKeyPressed(false)
-//,name,f|Qt::WNoAutoErase|Qt::WResizeNoErase|Qt::WStaticContents
+QgsComposerView::QgsComposerView( QWidget* parent, const char* name, Qt::WFlags f) :
+ QGraphicsView(parent), mShiftKeyPressed(false), mRubberBandItem(0)
{
- mComposer = composer;
setResizeAnchor ( QGraphicsView::AnchorViewCenter );
setMouseTracking(true);
viewport()->setMouseTracking ( true );
@@ -40,29 +33,149 @@
void QgsComposerView::mousePressEvent(QMouseEvent* e)
{
- mComposer->composition()->mousePressEvent(e, mShiftKeyPressed);
- if(mComposer->composition()->tool() == QgsComposition::Select)
+ if(!composition())
{
+ return;
+ }
+
+ QPointF scenePoint = mapToScene(e->pos());
+
+ switch(mCurrentTool)
+ {
+ //select/deselect items and pass mouse event further
+ case Select:
+ {
+ if(!mShiftKeyPressed) //keep selection if shift key pressed
+ {
+ composition()->clearSelection();
+ }
+
+ //select topmost item at position of event
+ QgsComposerItem* selectedItem = composition()->composerItemAt(scenePoint);
+ if(selectedItem)
+ {
+ selectedItem->setSelected(true);
+ }
+
+ emit selectedItemChanged(selectedItem);
QGraphicsView::mousePressEvent(e);
}
+ break;
+
+ //create rubber band
+ case AddMap:
+ {
+ QTransform t;
+ mRubberBandItem = new QGraphicsRectItem(0, 0, 0, 0);
+ t.translate(scenePoint.x(), scenePoint.y());
+ mRubberBandItem->setTransform(t);
+ mRubberBandItem->setZValue(100);
+
+ scene()->addItem(mRubberBandItem);
+ scene()->update();
+ }
+ break;
+
+ case AddLabel:
+ {
+ QgsComposerLabel* newLabelItem = new QgsComposerLabel(composition());
+ newLabelItem->setText("Quantum GIS");
+ newLabelItem->adjustSizeToText();
+ scene()->addItem(newLabelItem);
+ emit composerLabelAdded(newLabelItem);
+ scene()->clearSelection();
+ newLabelItem->setSceneRect(QRectF(scenePoint.x(), scenePoint.y(), newLabelItem->rect().width(), newLabelItem->rect().height()));
+ newLabelItem->setZValue(60);
+ newLabelItem->setSelected(true);
+ emit selectedItemChanged(newLabelItem);
+ }
+ break;
+
+ default:
+ break;
+ }
}
void QgsComposerView::mouseReleaseEvent(QMouseEvent* e)
{
- mComposer->composition()->mouseReleaseEvent(e);
- if(mComposer->composition()->tool() == QgsComposition::Select)
+ if(!composition())
+ {
+ return;
+ }
+
+ switch(mCurrentTool)
+ {
+ case Select:
+ QGraphicsView::mouseReleaseEvent(e);
+ break;
+
+ case AddMap:
{
- QGraphicsView::mouseReleaseEvent(e);
+ if(!mRubberBandItem || mRubberBandItem->rect().width() < 0.1 || mRubberBandItem->rect().width() < 0.1)
+ {
+ scene()->removeItem(mRubberBandItem);
+ delete mRubberBandItem;
+ return;
+ }
+
+ QgsComposerMap* composerMap = new QgsComposerMap(composition(), mRubberBandItem->transform().dx(), mRubberBandItem->transform().dy(), mRubberBandItem->rect().width(), mRubberBandItem->rect().height());
+
+ emit composerMapAdded(composerMap);
+
+ composerMap->setZValue(50);
+ scene()->addItem(composerMap);
+ scene()->clearSelection();
+
+ scene()->removeItem(mRubberBandItem);
+ delete mRubberBandItem;
+
+ composerMap->setSelected(true);
+ emit selectedItemChanged(composerMap);
}
+ break;
+
+ default:
+ break;
+ }
}
void QgsComposerView::mouseMoveEvent(QMouseEvent* e)
{
- mComposer->composition()->mouseMoveEvent(e);
- if(mComposer->composition()->tool() == QgsComposition::Select)
+ if(!composition())
{
- QGraphicsView::mouseMoveEvent(e);
+ return;
}
+
+ if(e->buttons() == Qt::NoButton)
+ {
+ if(mCurrentTool == Select)
+ {
+ QGraphicsView::mouseMoveEvent(e);
+ }
+ }
+ else
+ {
+ QPointF scenePoint = mapToScene(e->pos());
+ double newWidth, newHeight; //for rubber band
+
+ switch(mCurrentTool)
+ {
+ case Select:
+ QGraphicsView::mouseMoveEvent(e);
+ break;
+
+ case AddMap:
+ //adjust rubber band item
+ newWidth = scenePoint.x() - mRubberBandItem->transform().dx();
+ newHeight = scenePoint.y() - mRubberBandItem->transform().dy();
+ mRubberBandItem->setRect(0, 0, newWidth, newHeight);
+
+ break;
+
+ default:
+ break;
+ }
+ }
}
void QgsComposerView::keyPressEvent ( QKeyEvent * e )
@@ -71,7 +184,54 @@
{
mShiftKeyPressed = true;
}
- mComposer->composition()->keyPressEvent ( e );
+
+ if(!composition())
+ {
+ return;
+ }
+
+ QList<QgsComposerItem*> composerItemList = composition()->selectedComposerItems();
+ QList<QgsComposerItem*>::iterator itemIt = composerItemList.begin();
+
+ //delete selected items
+ if(e->key() == Qt::Key_Delete)
+ {
+ for(; itemIt != composerItemList.end(); ++itemIt)
+ {
+ composition()->removeItem(*itemIt);
+ delete (*itemIt);
+ emit itemRemoved(*itemIt);
+ }
+ }
+
+ else if(e->key() == Qt::Key_Left)
+ {
+ for(; itemIt != composerItemList.end(); ++itemIt)
+ {
+ (*itemIt)->move(-1.0, 0.0);
+ }
+ }
+ else if(e->key() == Qt::Key_Right)
+ {
+ for(; itemIt != composerItemList.end(); ++itemIt)
+ {
+ (*itemIt)->move(1.0, 0.0);
+ }
+ }
+ else if(e->key() == Qt::Key_Down)
+ {
+ for(; itemIt != composerItemList.end(); ++itemIt)
+ {
+ (*itemIt)->move(0.0, 1.0);
+ }
+ }
+ else if(e->key() == Qt::Key_Up)
+ {
+ for(; itemIt != composerItemList.end(); ++itemIt)
+ {
+ (*itemIt)->move(0.0, -1.0);
+ }
+ }
}
void QgsComposerView::keyReleaseEvent ( QKeyEvent * e )
@@ -82,18 +242,75 @@
}
}
-void QgsComposerView::resizeEvent ( QResizeEvent * )
+void QgsComposerView::setComposition(QgsComposition* c)
{
-#ifdef QGISDEBUG
- std::cout << "QgsComposerView::resizeEvent()" << std::endl;
-#endif
+ setScene(c);
+}
-/* BUG: When QT adds scrollbars because we're zooming in, it causes a resizeEvent.
- * If we call zoomFull(), we reset the view size, which keeps us from zooming in.
- * Really, we should do something like re-center the window.
-*/
- //mComposer->zoomFull();
+QgsComposition* QgsComposerView::composition()
+{
+ if(scene())
+ {
+ QgsComposition* c = dynamic_cast<QgsComposition*>(scene());
+ if(c)
+ {
+ return c;
+ }
+ }
+ return 0;
}
-//TODO: add mouse wheel event forwarding
+void QgsComposerView::groupItems()
+{
+ if(!composition())
+ {
+ return;
+ }
+ QList<QgsComposerItem*> selectionList = composition()->selectedComposerItems();
+ if(selectionList.size() < 2)
+ {
+ return; //not enough items for a group
+ }
+
+ QgsComposerItemGroup* itemGroup = new QgsComposerItemGroup(composition());
+ //connect signal/slot to let item group tell if child items get removed
+ connect(itemGroup, SIGNAL(childItemDeleted(QgsComposerItem*)), this, SLOT(sendItemRemovedSignal(QgsComposerItem*)));
+
+ QList<QgsComposerItem*>::iterator itemIter = selectionList.begin();
+ for(; itemIter != selectionList.end(); ++itemIter)
+ {
+ itemGroup->addItem(*itemIter);
+ }
+ composition()->addItem(itemGroup);
+ itemGroup->setSelected(true);
+ emit selectedItemChanged(itemGroup);
+}
+
+void QgsComposerView::ungroupItems()
+{
+ if(!composition())
+ {
+ return;
+ }
+
+ QList<QgsComposerItem*> selectionList = composition()->selectedComposerItems();
+ QList<QgsComposerItem*>::iterator itemIter = selectionList.begin();
+ for(; itemIter != selectionList.end(); ++itemIter)
+ {
+ QgsComposerItemGroup* itemGroup = dynamic_cast<QgsComposerItemGroup*>(*itemIter);
+ if(itemGroup)
+ {
+ itemGroup->removeItems();
+ composition()->removeItem(*itemIter);
+ delete (*itemIter);
+ emit itemRemoved(*itemIter);
+ }
+ }
+
+}
+
+void QgsComposerView::sendItemRemovedSignal(QgsComposerItem* item)
+{
+ emit itemRemoved(item);
+}
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposerview.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposerview.h 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposerview.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -18,34 +18,78 @@
#ifndef QGSCOMPOSERVIEW_H
#define QGSCOMPOSERVIEW_H
-
-#include <QGraphicsScene>
#include <QGraphicsView>
-class QgsComposer;
class QKeyEvent;
class QMouseEvent;
+class QgsComposition;
+class QgsComposerItem;
+class QgsComposerLabel;
+class QgsComposerMap;
+/**Widget to display the composer items. Manages the composer tools and the mouse/key events.
+ Creates the composer items according to the current map tools and keeps track off the rubber band item*/
class QgsComposerView: public QGraphicsView
{
Q_OBJECT
public:
- QgsComposerView (QgsComposer *composer, QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
-protected:
- void mousePressEvent(QMouseEvent*);
- void mouseReleaseEvent(QMouseEvent*);
- void mouseMoveEvent(QMouseEvent*);
+ /**Current tool*/
+ enum Tool {
+ Select = 0, // Select/Move item
+ AddMap, // add new map
+ AddVectorLegend, // add vector legend
+ AddLabel, // add label
+ AddScalebar, // add scalebar
+ AddPicture // add raster/vector picture
+ };
+
+ QgsComposerView(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
- void keyPressEvent ( QKeyEvent * e );
- void keyReleaseEvent ( QKeyEvent * e );
- void resizeEvent ( QResizeEvent * );
+ /**Add an item group containing the selected items*/
+ void groupItems();
-private:
- QgsComposer *mComposer;
- bool mShiftKeyPressed;
+ /**Ungroups the selected items*/
+ void ungroupItems();
+ QgsComposerView::Tool currentTool() const {return mCurrentTool;}
+ void setCurrentTool(QgsComposerView::Tool t) {mCurrentTool = t;}
+
+ /**Sets composition (derived from QGraphicsScene)*/
+ void setComposition(QgsComposition* c);
+ /**Returns the composition or 0 in case of error*/
+ QgsComposition* composition();
+
+ protected:
+ void mousePressEvent(QMouseEvent*);
+ void mouseReleaseEvent(QMouseEvent*);
+ void mouseMoveEvent(QMouseEvent*);
+
+ void keyPressEvent ( QKeyEvent * e );
+ void keyReleaseEvent ( QKeyEvent * e );
+
+ private:
+ /**Status of shift key (used for multiple selection)*/
+ bool mShiftKeyPressed;
+ /**Current composer tool*/
+ QgsComposerView::Tool mCurrentTool;
+ /**Rubber band item*/
+ QGraphicsRectItem* mRubberBandItem;
+
+ public slots:
+ /**For QgsComposerItemGroup to send its signals to QgsComposer (or other classes that keep track of input widgets)*/
+ void sendItemRemovedSignal(QgsComposerItem* item);
+
+ signals:
+ /**Is emitted when selected item changed. If 0, no item is selected*/
+ void selectedItemChanged(const QgsComposerItem* selected);
+ /**Ist emittted when new composer label has been added to the view*/
+ void composerLabelAdded(QgsComposerLabel* label);
+ /**Is emitted when new composer map has been added to the view*/
+ void composerMapAdded(QgsComposerMap* map);
+ /**Is emitted when a composer item has been removed from the scene*/
+ void itemRemoved(QgsComposerItem*);
};
#endif
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposition.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposition.cpp 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposition.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -13,6 +13,87 @@
* (at your option) any later version. *
* *
***************************************************************************/
+
+#include "qgscomposition.h"
+#include "qgscomposeritem.h"
+#include <QGraphicsRectItem>
+
+QgsComposition::QgsComposition(QgsMapCanvas* mapCanvas): QGraphicsScene(0), mMapCanvas(mapCanvas), mPlotStyle(QgsComposition::Preview), mPaperItem(0)
+{
+ setBackgroundBrush(Qt::gray);
+
+ //set paper item
+ mPaperItem = new QGraphicsRectItem( 0, 0, 297, 210, 0); //default size A4
+ mPaperItem->setBrush(Qt::white);
+ addItem(mPaperItem);
+ mPaperItem->setZValue(0);
+}
+
+QgsComposition::QgsComposition(): QGraphicsScene(0), mMapCanvas(0), mPlotStyle(QgsComposition::Preview), mPaperItem(0)
+{
+
+}
+
+QgsComposition::~QgsComposition()
+{
+ delete mPaperItem;
+}
+
+void QgsComposition::setPaperSize(double width, double height)
+{
+ if(mPaperItem)
+ {
+ mPaperItem->setRect(QRectF(0, 0, width, height));
+ }
+}
+
+double QgsComposition::paperHeight() const
+{
+ return mPaperItem->rect().height();
+}
+
+double QgsComposition::paperWidth() const
+{
+ return mPaperItem->rect().width();
+}
+
+QgsComposerItem* QgsComposition::composerItemAt(const QPointF & position)
+{
+ QList<QGraphicsItem *> itemList = items(position);
+ QList<QGraphicsItem *>::iterator itemIt = itemList.begin();
+
+ for(; itemIt != itemList.end(); ++itemIt)
+ {
+ QgsComposerItem* composerItem = dynamic_cast<QgsComposerItem*>(*itemIt);
+ if(composerItem)
+ {
+ return composerItem;
+ }
+ }
+ return 0;
+}
+
+QList<QgsComposerItem*> QgsComposition::selectedComposerItems()
+{
+ QList<QgsComposerItem*> composerItemList;
+
+ QList<QGraphicsItem *> graphicsItemList = selectedItems();
+ QList<QGraphicsItem *>::iterator itemIter = graphicsItemList.begin();
+
+ for(; itemIter != graphicsItemList.end(); ++itemIter)
+ {
+ QgsComposerItem* composerItem = dynamic_cast<QgsComposerItem*>(*itemIter);
+ if(composerItem)
+ {
+ composerItemList.push_back(composerItem);
+ }
+ }
+
+ return composerItemList;
+}
+
+#if 0
+
#include <typeinfo>
#include "qgscomposition.h"
@@ -283,7 +364,7 @@
case AddLabel:
if(mToolStep == 0)
{
- QgsComposerLabel* newLabelItem = new QgsComposerLabel(this, mNextItemId++);
+ QgsComposerLabel* newLabelItem = new QgsComposerLabel(this);
newLabelItem->setText("Quantum GIS");
newLabelItem->adjustSizeToText();
newLabelItem->setSceneRect(QRectF(p.x(), p.y(), newLabelItem->rect().width(), newLabelItem->rect().height()));
@@ -461,7 +542,7 @@
{
mComposer->selectItem(); // usually just one map
- m = new QgsComposerMap ( this, mNextItemId++, x, y, w, h );
+ m = new QgsComposerMap ( this, x, y, w, h );
QgsComposerMapWidget* w = new QgsComposerMapWidget(m);
mComposer->addItem(m, w);
mItems.push_back(m);
@@ -693,6 +774,7 @@
//does this even work?
void QgsComposition::refresh()
{
+#if 0
// TODO add signals to map canvas
for (std::list < QgsComposerItem * >::iterator it = mItems.begin(); it != mItems.end(); ++it) {
QgsComposerItem *ci = (*it);
@@ -704,6 +786,7 @@
vl->recalculate();
}
}
+#endif //0
mCanvas->update();
}
@@ -843,7 +926,7 @@
return; //not enough items for a group
}
- QgsComposerItemGroup* itemGroup = new QgsComposerItemGroup(this, 0);
+ QgsComposerItemGroup* itemGroup = new QgsComposerItemGroup(this);
QList<QGraphicsItem *>::iterator itemIt = selectedItems.begin();
for(; itemIt != selectedItems.end(); ++itemIt)
@@ -891,17 +974,6 @@
return v;
}
-QgsComposerMap* QgsComposition::map ( int id )
-{
- for (std::list < QgsComposerItem * >::iterator it = mItems.begin(); it != mItems.end(); ++it) {
- QgsComposerItem *ci = (*it);
- if ( ci->id() == id ) {
- return ( dynamic_cast<QgsComposerMap*>(ci) );
- }
- }
- return 0;
-}
-
double QgsComposition::selectionBoxSize ( void )
{
// Scale rectangle based on the zoom level, so we keep the rectangle a fixed size on the screen
@@ -1031,3 +1103,4 @@
return true;
}
+#endif //0
Modified: branches/advanced_printing_branch/src/app/composer/qgscomposition.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscomposition.h 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/app/composer/qgscomposition.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -16,6 +16,59 @@
#ifndef QGSCOMPOSITION_H
#define QGSCOMPOSITION_H
+#include <QGraphicsScene>
+
+class QgsComposerItem;
+class QGraphicsRectItem;
+class QgsMapCanvas;
+
+/**Graphics scene for map printing. It manages the paper item which always is the item in the back (z-value 0)*/
+class QgsComposition: public QGraphicsScene
+{
+ public:
+
+ /** \brief Plot type */
+ enum PlotStyle
+ {
+ Preview = 0, // Use cache etc
+ Print, // Render well
+ Postscript // Fonts need different scaling!
+ };
+
+ QgsComposition(QgsMapCanvas* mapCanvas);
+ ~QgsComposition();
+
+ /**Changes size of paper item*/
+ void setPaperSize(double width, double height);
+
+ /**Returns height of paper item*/
+ double paperHeight() const;
+
+ /**Returns width of paper item*/
+ double paperWidth() const;
+
+ /**Returns the topmose composer item. Ignores mPaperItem*/
+ QgsComposerItem* composerItemAt(const QPointF & position);
+
+ QList<QgsComposerItem*> selectedComposerItems();
+
+ /**Returns pointer to qgis map canvas*/
+ QgsMapCanvas* mapCanvas(){return mMapCanvas;}
+
+ QgsComposition::PlotStyle plotStyle() const {return mPlotStyle;}
+ void setPlotStyle(QgsComposition::PlotStyle style) {mPlotStyle = style;}
+
+ private:
+ QgsMapCanvas* mMapCanvas;
+ QgsComposition::PlotStyle mPlotStyle;
+ QGraphicsRectItem* mPaperItem;
+
+ QgsComposition(); //default constructor is forbidden
+};
+
+#endif
+
+#if 0
#include "ui_qgscompositionbase.h"
#include <list>
@@ -205,12 +258,6 @@
/** \brief vector of pointers to maps available in composition */
std::vector<QgsComposerMap*> maps(void);
- /** \brief Find a map by id
- * \param id canvas item id
- * \return pointer to existing map or 0
- */
- QgsComposerMap * map (int id);
-
/** \brief stores statei in project */
bool writeSettings ( void );
Added: branches/advanced_printing_branch/src/app/composer/qgscompositionwidget.cpp
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscompositionwidget.cpp (rev 0)
+++ branches/advanced_printing_branch/src/app/composer/qgscompositionwidget.cpp 2008-06-19 08:33:23 UTC (rev 8657)
@@ -0,0 +1,205 @@
+/***************************************************************************
+ qgscompositionwidget.cpp
+ --------------------------
+ begin : June 11 2008
+ copyright : (C) 2008 by Marco Hugentobler
+ email : marco dot hugentobler at karto dot baug dot ethz dot ch
+ ***************************************************************************/
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "qgscompositionwidget.h"
+#include "qgscomposition.h"
+#include <QWidget>
+
+QgsCompositionWidget::QgsCompositionWidget(QWidget* parent, QgsComposition* c): QWidget(parent), mComposition(c)
+{
+ setupUi(this);
+ createPaperEntries();
+
+ //orientation
+ mPaperOrientationComboBox->blockSignals(true);
+ mPaperOrientationComboBox->insertItem(0, tr("Landscape"));
+ mPaperOrientationComboBox->insertItem(1, tr("Portrait"));
+ mPaperOrientationComboBox->blockSignals(false);
+ mPaperOrientationComboBox->setCurrentItem(0);
+
+ applyCurrentPaperSettings();
+}
+
+QgsCompositionWidget::QgsCompositionWidget(): QWidget(0), mComposition(0)
+{
+ setupUi(this);
+}
+
+QgsCompositionWidget::~QgsCompositionWidget()
+{
+
+}
+
+void QgsCompositionWidget::createPaperEntries()
+{
+ mPaperSizeComboBox->blockSignals(true);
+ mPaperSizeComboBox->insertItem(0, tr("Custom"));
+ mPaperMap.insert ( tr("A5 (148x210 mm)"), QgsCompositionPaper( tr("A5 (148x210 mm)"), 148, 210 ) );
+ mPaperSizeComboBox->insertItem(1, tr("A5 (148x210 mm)"));
+ mPaperMap.insert ( tr("A4 (210x297 mm)"), QgsCompositionPaper( tr("A4 (210x297 mm)"), 210, 297 ) );
+ mPaperSizeComboBox->insertItem(2, tr("A4 (210x297 mm)"));
+ mPaperMap.insert ( tr("A3 (297x420 mm)"), QgsCompositionPaper( tr("A3 (297x420 mm)"), 297, 420 ) );
+ mPaperSizeComboBox->insertItem(3, tr("A3 (297x420 mm)"));
+ mPaperMap.insert ( tr("A2 (420x594 mm)"), QgsCompositionPaper( tr("A2 (420x594 mm)"), 420, 594 ) );
+ mPaperSizeComboBox->insertItem(4, tr("A2 (420x594 mm)"));
+ mPaperMap.insert ( tr("A1 (594x841 mm)"), QgsCompositionPaper( tr("A1 (594x841 mm)"), 594, 841 ) );
+ mPaperSizeComboBox->insertItem(5, tr("A1 (594x841 mm)"));
+ mPaperMap.insert ( tr("A0 (841x1189 mm)"), QgsCompositionPaper( tr("A0 (841x1189 mm)"), 841, 1189 ) );
+ mPaperSizeComboBox->insertItem(6, tr("A0 (841x1189 mm)"));
+ mPaperMap.insert ( tr("B5 (176 x 250 mm)"), QgsCompositionPaper( tr("B5 (176 x 250 mm)"), 176, 250 ) );
+ mPaperSizeComboBox->insertItem(7, tr("B5 (176 x 250 mm)"));
+ mPaperMap.insert ( tr("B4 (250 x 353 mm)"), QgsCompositionPaper( tr("B4 (250 x 353 mm)"), 250, 353 ) );
+ mPaperSizeComboBox->insertItem(8, tr("B4 (250 x 353 mm)"));
+ mPaperMap.insert ( tr("B3 (353 x 500 mm)"), QgsCompositionPaper( tr("B3 (353 x 500 mm)"), 353, 500 ) );
+ mPaperSizeComboBox->insertItem(9, tr("B3 (353 x 500 mm)"));
+ mPaperMap.insert ( tr("B2 (500 x 707 mm)"), QgsCompositionPaper( tr("B2 (500 x 707 mm)"), 500, 707 ) );
+ mPaperSizeComboBox->insertItem(10, tr("B2 (500 x 707 mm)"));
+ mPaperMap.insert ( tr("B1 (707 x 1000 mm)"), QgsCompositionPaper( tr("B1 (707 x 1000 mm)"), 707, 1000 ) );
+ mPaperSizeComboBox->insertItem(11, tr("B1 (707 x 1000 mm)"));
+ mPaperMap.insert ( tr("B0 (1000 x 1414 mm)"), QgsCompositionPaper( tr("B0 (1000 x 1414 mm)"), 1000, 1414 ) );
+ mPaperSizeComboBox->insertItem(12, tr("B0 (1000 x 1414 mm)"));
+ mPaperMap.insert ( tr("Letter (8.5x11 inches)"), QgsCompositionPaper( tr("Letter (8.5x11 inches)"), 216, 279 ) );
+ mPaperSizeComboBox->insertItem(13, tr("Letter (8.5x11 inches)"));
+ mPaperMap.insert ( tr("Legal (8.5x14 inches)"), QgsCompositionPaper( tr("Legal (8.5x14 inches)"), 216, 356 ) );
+ mPaperSizeComboBox->insertItem(14, tr("Legal (8.5x14 inches)"));
+ mPaperSizeComboBox->blockSignals(false);
+
+ mPaperSizeComboBox->setCurrentIndex(2); //A4 default
+}
+
+void QgsCompositionWidget::on_mPaperSizeComboBox_currentIndexChanged(const QString& text)
+{
+ if(mPaperSizeComboBox->currentText() == tr("Custom"))
+ {
+ mPaperWidthLineEdit->setEnabled(true);
+ mPaperHeightLineEdit->setEnabled(true);
+ }
+ else
+ {
+ mPaperWidthLineEdit->setEnabled(false);
+ mPaperHeightLineEdit->setEnabled(false);
+ }
+ applyCurrentPaperSettings();
+}
+
+void QgsCompositionWidget::on_mPaperOrientationComboBox_currentIndexChanged(const QString& text)
+{
+ if(mPaperSizeComboBox->currentText() == tr("Custom"))
+ {
+ adjustOrientation();
+ applyWidthHeight();
+ }
+ else
+ {
+ adjustOrientation();
+ applyCurrentPaperSettings();
+ }
+}
+
+void QgsCompositionWidget::adjustOrientation()
+{
+ double width, height;
+ bool conversionSuccess;
+
+ width = mPaperWidthLineEdit->text().toDouble(&conversionSuccess);
+ if(!conversionSuccess)
+ {
+ return;
+ }
+
+ height = mPaperHeightLineEdit->text().toDouble(&conversionSuccess);
+ if(!conversionSuccess)
+ {
+ return;
+ }
+
+ if(height > width) //change values such that width > height
+ {
+ double tmp = width;
+ width = height;
+ height = tmp;
+ }
+
+ bool lineEditsEnabled = mPaperWidthLineEdit->isEnabled();
+
+ mPaperWidthLineEdit->setEnabled(true);
+ mPaperHeightLineEdit->setEnabled(true);
+ if(mPaperOrientationComboBox->currentText() == tr("Landscape"))
+ {
+ mPaperWidthLineEdit->setText(QString::number(width));
+ mPaperHeightLineEdit->setText(QString::number(height));
+ }
+ else
+ {
+ mPaperWidthLineEdit->setText(QString::number(height));
+ mPaperHeightLineEdit->setText(QString::number(width));
+ }
+ mPaperWidthLineEdit->setEnabled(lineEditsEnabled);
+ mPaperHeightLineEdit->setEnabled(lineEditsEnabled);
+}
+
+void QgsCompositionWidget::applyCurrentPaperSettings()
+{
+ if(mComposition)
+ {
+ //find entry in mPaper map to set width and height
+ QMap<QString, QgsCompositionPaper>::iterator it = mPaperMap.find(mPaperSizeComboBox->currentText());
+ if(it == mPaperMap.end())
+ {
+ return;
+ }
+
+ mPaperWidthLineEdit->setEnabled(true);
+ mPaperHeightLineEdit->setEnabled(true);
+ mPaperWidthLineEdit->setText(QString::number(it->mWidth));
+ mPaperHeightLineEdit->setText(QString::number(it->mHeight));
+ mPaperWidthLineEdit->setEnabled(false);
+ mPaperHeightLineEdit->setEnabled(false);
+
+ adjustOrientation();
+ applyWidthHeight();
+ }
+}
+
+void QgsCompositionWidget::applyWidthHeight()
+{
+ double width, height;
+ bool conversionSuccess;
+
+ width = mPaperWidthLineEdit->text().toDouble(&conversionSuccess);
+ if(!conversionSuccess)
+ {
+ return;
+ }
+
+ height = mPaperHeightLineEdit->text().toDouble(&conversionSuccess);
+ if(!conversionSuccess)
+ {
+ return;
+ }
+
+ mComposition->setPaperSize(width, height);
+}
+
+void QgsCompositionWidget::on_mPaperWidthLineEdit_editingFinished()
+{
+ applyWidthHeight();
+}
+
+void QgsCompositionWidget::on_mPaperHeightLineEdit_editingFinished()
+{
+ applyWidthHeight();
+}
Added: branches/advanced_printing_branch/src/app/composer/qgscompositionwidget.h
===================================================================
--- branches/advanced_printing_branch/src/app/composer/qgscompositionwidget.h (rev 0)
+++ branches/advanced_printing_branch/src/app/composer/qgscompositionwidget.h 2008-06-19 08:33:23 UTC (rev 8657)
@@ -0,0 +1,57 @@
+/***************************************************************************
+ qgscompositionwidget.h
+ ------------------------
+ begin : June 11 2008
+ copyright : (C) 2008 by Marco Hugentobler
+ email : marco dot hugentobler at karto dot baug dot ethz dot ch
+ ***************************************************************************/
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "ui_qgscompositionwidgetbase.h"
+
+class QgsComposition;
+
+struct QgsCompositionPaper
+{
+ QgsCompositionPaper(QString name, double width, double height){mName = name; mWidth = width; mHeight = height;}
+ QString mName;
+ double mWidth;
+ double mHeight;
+};
+
+/**Input widget for QgsComposition*/
+class QgsCompositionWidget: public QWidget, private Ui::QgsCompositionWidgetBase
+{
+ Q_OBJECT
+ public:
+ QgsCompositionWidget(QWidget* parent, QgsComposition* c);
+ ~QgsCompositionWidget();
+
+ public slots:
+ void on_mPaperSizeComboBox_currentIndexChanged(const QString& text);
+ void on_mPaperOrientationComboBox_currentIndexChanged(const QString& text);
+ void on_mPaperWidthLineEdit_editingFinished();
+ void on_mPaperHeightLineEdit_editingFinished();
+
+ private:
+ QgsComposition* mComposition;
+ QMap<QString, QgsCompositionPaper> mPaperMap;
+
+ QgsCompositionWidget(); //default constructor is forbidden
+ /**Sets width/height to chosen paper format and updates paper item*/
+ void applyCurrentPaperSettings();
+ /**Applies the current width and height values*/
+ void applyWidthHeight();
+ /**Makes sure width/height values for custom paper matches the current orientation*/
+ void adjustOrientation();
+
+ void createPaperEntries();
+ void insertPaperEntries();
+};
Modified: branches/advanced_printing_branch/src/ui/CMakeLists.txt
===================================================================
--- branches/advanced_printing_branch/src/ui/CMakeLists.txt 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/ui/CMakeLists.txt 2008-06-19 08:33:23 UTC (rev 8657)
@@ -10,9 +10,10 @@
qgscomposerlabelwidgetbase.ui
qgscomposermapwidgetbase.ui
qgscomposerpicturebase.ui
- qgscomposerscalebarbase.ui
+ qgscomposerscalebarwidgetbase.ui
qgscomposervectorlegendbase.ui
qgscompositionbase.ui
+ qgscompositionwidgetbase.ui
qgscontinuouscolordialogbase.ui
qgscustomprojectiondialogbase.ui
qgsdbsourceselectbase.ui
Deleted: branches/advanced_printing_branch/src/ui/qgscomposerscalebarbase.ui
===================================================================
--- branches/advanced_printing_branch/src/ui/qgscomposerscalebarbase.ui 2008-06-18 17:26:13 UTC (rev 8656)
+++ branches/advanced_printing_branch/src/ui/qgscomposerscalebarbase.ui 2008-06-19 08:33:23 UTC (rev 8657)
@@ -1,228 +0,0 @@
-<ui version="4.0" >
- <class>QgsComposerScalebarBase</class>
- <widget class="QWidget" name="QgsComposerScalebarBase" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>303</width>
- <height>487</height>
- </rect>
- </property>
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>7</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="windowTitle" >
- <string>Barscale Options</string>
- </property>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="2" column="0" >
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <widget class="QLabel" name="textLabel1_4" >
- <property name="text" >
- <string>Line width</string>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- <property name="buddy" >
- <cstring>mLineWidthSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDoubleSpinBox" name="mLineWidthSpinBox" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimum" >
- <double>0.010000000000000</double>
- </property>
- <property name="singleStep" >
- <double>0.100000000000000</double>
- </property>
- <property name="value" >
- <double>0.200000000000000</double>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="0" >
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item row="0" column="1" colspan="2" >
- <widget class="QLineEdit" name="mSegmentLengthLineEdit" />
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="textLabel1_2" >
- <property name="text" >
- <string>Unit label</string>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- <property name="buddy" >
- <cstring>mUnitLabelLineEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="2" >
- <widget class="QLineEdit" name="mUnitLabelLineEdit" />
- </item>
- <item row="4" column="2" >
- <widget class="QComboBox" name="mMapComboBox" >
- <property name="enabled" >
- <bool>true</bool>
- </property>
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="textLabel1" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Map</string>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- <property name="buddy" >
- <cstring>mMapComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="textLabel1_3" >
- <property name="text" >
- <string>Segment size</string>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- <property name="buddy" >
- <cstring>mSegmentLengthLineEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <widget class="QLineEdit" name="mNumSegmentsLineEdit" />
- </item>
- <item row="2" column="2" >
- <widget class="QLineEdit" name="mMapUnitsPerUnitLineEdit" />
- </item>
- <item row="2" column="0" colspan="2" >
- <widget class="QLabel" name="textLabel2_2" >
- <property name="text" >
- <string>Map units per scalebar unit</string>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- <property name="buddy" >
- <cstring>mMapUnitsPerUnitLineEdit</cstring>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2" >
- <widget class="QLabel" name="textLabel2" >
- <property name="text" >
- <string>Number of segments</string>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- <property name="buddy" >
- <cstring>mNumSegmentsLineEdit</cstring>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0" >
- <widget class="QPushButton" name="mFontButton" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Font</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>204</width>
- <height>231</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="6" margin="11" />
- <tabstops>
- <tabstop>mSegmentLengthLineEdit</tabstop>
- <tabstop>mNumSegmentsLineEdit</tabstop>
- <tabstop>mMapUnitsPerUnitLineEdit</tabstop>
- <tabstop>mUnitLabelLineEdit</tabstop>
- <tabstop>mMapComboBox</tabstop>
- <tabstop>mFontButton</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
Copied: branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui (from rev 8627, branches/advanced_printing_branch/src/ui/qgscomposerscalebarbase.ui)
===================================================================
--- branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui (rev 0)
+++ branches/advanced_printing_branch/src/ui/qgscomposerscalebarwidgetbase.ui 2008-06-19 08:33:23 UTC (rev 8657)
@@ -0,0 +1,201 @@
+<ui version="4.0" >
+ <class>QgsComposerScaleBarWidgetBase</class>
+ <widget class="QWidget" name="QgsComposerScaleBarWidgetBase" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>303</width>
+ <height>487</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Barscale Options</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="mSegmentSizeLabel" >
+ <property name="text" >
+ <string>Segment size (map units):</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2" >
+ <widget class="QDoubleSpinBox" name="mSegmentSizeSpinBox" />
+ </item>
+ <item row="1" column="0" colspan="2" >
+ <widget class="QLabel" name="mNumbereOfSegmentsLabel" >
+ <property name="text" >
+ <string>Number of segments:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" >
+ <widget class="QSpinBox" name="mNumberOfSegmentsSpinBox" />
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <widget class="QLabel" name="mSegmentsLeftLabel" >
+ <property name="text" >
+ <string>Segments left:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" >
+ <widget class="QSpinBox" name="mSegmentsLeftSpinBox" />
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="mStyleLabel" >
+ <property name="text" >
+ <string>Style:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2" >
+ <widget class="QComboBox" name="mStyleComboBox" />
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="mUnitLabelLabel" >
+ <property name="text" >
+ <string>Unit label:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>mUnitLabelLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2" >
+ <widget class="QLineEdit" name="mUnitLabelLineEdit" />
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="mMapLabel" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Map:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>mMapComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2" >
+ <widget class="QComboBox" name="mMapComboBox" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" >
+ <widget class="QLabel" name="mHeightLabel" >
+ <property name="text" >
+ <string>Height (mm):</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="2" >
+ <widget class="QSpinBox" name="mHeightSpinBox" />
+ </item>
+ <item row="7" column="0" >
+ <widget class="QLabel" name="mLineWidthLabel" >
+ <property name="text" >
+ <string>Line width:</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>mLineWidthSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="2" >
+ <widget class="QDoubleSpinBox" name="mLineWidthSpinBox" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimum" >
+ <double>0.010000000000000</double>
+ </property>
+ <property name="singleStep" >
+ <double>0.100000000000000</double>
+ </property>
+ <property name="value" >
+ <double>0.200000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0" >
+ <widget class="QPushButton" name="mFontButton" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Font...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="2" >
+ <widget class="QPushButton" name="mColorPushButton" >
+ <property name="text" >
+ <string>Color...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>51</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <tabstops>
+ <tabstop>mUnitLabelLineEdit</tabstop>
+ <tabstop>mMapComboBox</tabstop>
+ <tabstop>mFontButton</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
Added: branches/advanced_printing_branch/src/ui/qgscompositionwidgetbase.ui
===================================================================
--- branches/advanced_printing_branch/src/ui/qgscompositionwidgetbase.ui (rev 0)
+++ branches/advanced_printing_branch/src/ui/qgscompositionwidgetbase.ui 2008-06-19 08:33:23 UTC (rev 8657)
@@ -0,0 +1,232 @@
+<ui version="4.0" >
+ <class>QgsCompositionWidgetBase</class>
+ <widget class="QWidget" name="QgsCompositionWidgetBase" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>243</width>
+ <height>422</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Composition</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>6</number>
+ </property>
+ <property name="verticalSpacing" >
+ <number>6</number>
+ </property>
+ <item row="0" column="0" colspan="2" >
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Paper</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>6</number>
+ </property>
+ <property name="verticalSpacing" >
+ <number>6</number>
+ </property>
+ <item row="4" column="1" >
+ <widget class="QComboBox" name="mPaperOrientationComboBox" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QLineEdit" name="mPaperHeightLineEdit" />
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLineEdit" name="mPaperWidthLineEdit" />
+ </item>
+ <item row="1" column="1" >
+ <widget class="QComboBox" name="mPaperUnitsComboBox" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QComboBox" name="mPaperSizeComboBox" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="textLabel7" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Orientation</string>
+ </property>
+ <property name="buddy" >
+ <cstring>mPaperOrientationComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="textLabel6" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Height</string>
+ </property>
+ <property name="buddy" >
+ <cstring>mPaperHeightLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="textLabel4" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Width</string>
+ </property>
+ <property name="buddy" >
+ <cstring>mPaperWidthLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="textLabel5" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Units</string>
+ </property>
+ <property name="buddy" >
+ <cstring>mPaperUnitsComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="textLabel3" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Size</string>
+ </property>
+ <property name="buddy" >
+ <cstring>mPaperSizeComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeType" >
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>223</width>
+ <height>41</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="textLabel1" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Resolution (dpi)</string>
+ </property>
+ <property name="buddy" >
+ <cstring>mResolutionLineEdit</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="mResolutionLineEdit" />
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <resources/>
+ <connections/>
+</ui>
More information about the QGIS-commit
mailing list