1.1 --- a/mapeditor.cpp Fri Dec 08 20:18:58 2006 +0000
1.2 +++ b/mapeditor.cpp Thu Dec 14 17:01:44 2006 +0000
1.3 @@ -72,7 +72,7 @@
1.4
1.5 setScene (mapScene);
1.6
1.7 - /* FIXME not needed in QT4?
1.8 + /* FIXME scrollview handles not needed in QT4?
1.9 // Maybe check QAbstractScrollArea...
1.10 // Always show scroll bars (automatic would flicker sometimes)
1.11 setVScrollBarMode ( QScrollView::AlwaysOn );
1.12 @@ -173,7 +173,7 @@
1.13 void MapEditor::adjustCanvasSize()
1.14 {
1.15
1.16 -/* FIXME QT4 probably not needed any longer!
1.17 +/* FIXME QT4 adjustcanvassize probably not needed any longer!
1.18
1.19 // To adjust the scene to map, viewport size and position, we have to
1.20 // do some coordinate magic...
1.21 @@ -335,11 +335,6 @@
1.22 else if ( typeid(*saveSel) == typeid(FloatImageObj) )
1.23 // Save image
1.24 s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix);
1.25 -
1.26 - else if (selection && typeid(*selection)==typeid(BranchObj))
1.27 - // Save selected branch is saved from mainwindow //FIXME maybe use "subtree" above?
1.28 - // FIXME is this possible at all? BO is already above...
1.29 - s+=((BranchObj*)selection)->saveToDir(tmpdir,prefix,offset);
1.30 }
1.31
1.32 // Save local settings
1.33 @@ -1226,10 +1221,9 @@
1.34 double mapAspect = (double)totalBBox.width() / (double)totalBBox.height();
1.35
1.36 QRectF mapRect=totalBBox;
1.37 -/* FIXME todo for QT4
1.38 - Q3CanvasRectangle *frame=NULL;
1.39 - Q3CanvasText *footerFN=NULL;
1.40 - Q3CanvasText *footerDate=NULL;
1.41 + QGraphicsRectItem *frame=NULL;
1.42 + QGraphicsTextItem *footerFN=NULL;
1.43 + QGraphicsTextItem *footerDate=NULL;
1.44 if (printFrame || printFooter)
1.45 {
1.46
1.47 @@ -1238,10 +1232,8 @@
1.48 // Print frame around map
1.49 mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10,
1.50 totalBBox.width()+20, totalBBox.height()+20);
1.51 - frame=new Q3CanvasRectangle (mapRect,mapScene);
1.52 - frame->setBrush (QColor(Qt::white));
1.53 - frame->setPen (QColor(Qt::black));
1.54 - frame->setZ(0);
1.55 + frame=mapScene->addRect (mapRect, QPen(Qt::black),QBrush(Qt::red));
1.56 + frame->setZValue(0);
1.57 frame->show();
1.58 }
1.59 // TODO remove after testing
1.60 @@ -1256,26 +1248,23 @@
1.61 // Print footer below map
1.62 QFont font;
1.63 font.setPointSize(10);
1.64 - footerFN=new Q3CanvasText (mapScene);
1.65 - footerFN->setText ("VYM - " + fileName);
1.66 - footerFN->setFont(font);
1.67 - footerFN->move (mapRect.x(), mapRect.y() + mapRect.height() );
1.68 - footerFN->setZ(Z_TEXT);
1.69 + footerFN=mapScene->addText ("VYM - " + fileName,font);
1.70 + footerFN->setPos (mapRect.x(), mapRect.y() + mapRect.height() );
1.71 + footerFN->setZValue (Z_TEXT);
1.72 footerFN->show();
1.73 - footerDate=new Q3CanvasText (mapScene);
1.74 - footerDate->setText (QDate::currentDate().toString(Qt::TextDate));
1.75 - footerDate->setFont(font);
1.76 - footerDate->move (mapRect.x()+mapRect.width()-footerDate->boundingRect().width(), mapRect.y() + mapRect.height() );
1.77 - footerDate->setZ(Z_TEXT);
1.78 + footerDate=mapScene->addText (QDate::currentDate().toString(Qt::TextDate),font);
1.79 + footerDate->setPos(mapRect.x()+mapRect.width()-footerDate->boundingRect().width(), mapRect.y() + mapRect.height() );
1.80 + footerDate->setZValue(Z_TEXT);
1.81 footerDate->show();
1.82 }
1.83 - pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20);
1.84 + //pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20);
1.85 } else
1.86 {
1.87 - pp.setWindow (mapRect);
1.88 + //pp.setWindow (mapRect);
1.89 + //pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20);
1.90 }
1.91 -*/
1.92 -
1.93 +
1.94 +/*
1.95 if (mapAspect>=paperAspect)
1.96 {
1.97 // Fit horizontally to paper width
1.98 @@ -1285,8 +1274,11 @@
1.99 // Fit vertically to paper height
1.100 pp.setViewport(0,0,(int)(metrics.height()*mapAspect),metrics.height());
1.101 }
1.102 -
1.103 - mapScene->render(&pp); // draw scene to printer
1.104 +*/
1.105 + QRect viewport=rect();
1.106 + render (&pp, QRect(),QRect());
1.107 +
1.108 + //mapScene->render(&pp); // draw scene to printer
1.109
1.110 /*
1.111 // Delete Frame and footer
1.112 @@ -1295,8 +1287,8 @@
1.113 delete (footerFN);
1.114 delete (footerDate);
1.115 }
1.116 - if (frame) delete (frame);
1.117 */
1.118 +// if (frame) delete (frame);
1.119
1.120 // Restore selection
1.121 if (oldselection)
1.122 @@ -1322,7 +1314,7 @@
1.123
1.124 QPixmap MapEditor::getPixmap()
1.125 {
1.126 -/* FIXME not ported yet to QT4
1.127 +/* FIXME getPixmap not ported yet to QT4
1.128 QRectF mapRect=mapCenter->getTotalBBox();
1.129 QPixmap pix (mapRect.size());
1.130 QPainter pp (&pix);
1.131 @@ -2216,13 +2208,14 @@
1.132
1.133 s=s.left (s.length() -num.length());
1.134
1.135 + int n=num.toInt()-1;
1.136 +
1.137 // Go to next lmo
1.138 - num=QString ("%1").arg(num.toUInt()-1);
1.139 -
1.140 + num=QString ("%1").arg(n);
1.141 s=s+num;
1.142
1.143 // Try to select this one
1.144 - if (select (s)) return;
1.145 + if (n>=0 && select (s)) return;
1.146
1.147 // We have no direct precessor,
1.148 // try to decrease the parental number in order to
1.149 @@ -2244,15 +2237,15 @@
1.150 if (d>1)
1.151 {
1.152 // decrease number of parent
1.153 - num=QString ("%1").arg(num.toUInt()-1);
1.154 + num=QString ("%1").arg(num.toInt()-1);
1.155 s=s.section (",",0,d-2) + ","+ typ+num;
1.156 } else
1.157 {
1.158 // Special case, look at orientation
1.159 if (selection->getOrientation()==OrientRightOfCenter)
1.160 - num=QString ("%1").arg(num.toUInt()-1);
1.161 + num=QString ("%1").arg(num.toInt()-1);
1.162 else
1.163 - num=QString ("%1").arg(num.toUInt()+1);
1.164 + num=QString ("%1").arg(num.toInt()+1);
1.165 s=typ+num;
1.166 }
1.167
1.168 @@ -2627,7 +2620,7 @@
1.169 {
1.170 // transform to sceneView Coord:
1.171 QPointF p=matrix().map(movingCenter);
1.172 - //FIXME not ported yet to QT4 (center ist TextStream there)
1.173 + //FIXME setViewCenter not ported yet to QT4 (center ist TextStream there)
1.174 //center ( p.x(), p.y());
1.175 }
1.176
1.177 @@ -3565,7 +3558,7 @@
1.178
1.179 void MapEditor::keyPressEvent(QKeyEvent* e)
1.180 {
1.181 - if (e->modifiers() && Qt::ControlModifier)
1.182 + if (e->modifiers() & Qt::ControlModifier)
1.183 {
1.184 switch (mainWindow->getModMode())
1.185 {
1.186 @@ -3587,7 +3580,7 @@
1.187
1.188 void MapEditor::keyReleaseEvent(QKeyEvent* e)
1.189 {
1.190 - if (!(e->modifiers() && Qt::ControlModifier))
1.191 + if (!(e->modifiers() & Qt::ControlModifier))
1.192 setCursor (Qt::ArrowCursor);
1.193 }
1.194
1.195 @@ -3843,8 +3836,7 @@
1.196 }
1.197
1.198 // Move sceneView
1.199 - //if (!movingObj && !pickingColor &&!drawingLink && e->button() == Qt::LeftButton )
1.200 - if (e->buttons() == Qt::LeftButton )
1.201 + if (!movingObj && !pickingColor &&!drawingLink && e->buttons() == Qt::LeftButton )
1.202 {
1.203 QPointF p=e->globalPos();
1.204 movingVec.setX(-p.x() + movingObj_start.x() );