Drawn map page: Move save and load buttons, fix points label overlap
authorWuzzy <Wuzzy2@mail.ru>
Wed, 14 Mar 2018 20:39:14 +0100
changeset 13210 c681492df36d
parent 13209 9565569e410c
child 13211 c66ae01ca5a4
Drawn map page: Move save and load buttons, fix points label overlap
QTfrontend/ui/page/pagedrawmap.cpp
QTfrontend/ui/page/pagedrawmap.h
QTfrontend/ui/widget/drawmapwidget.h
--- a/QTfrontend/ui/page/pagedrawmap.cpp	Wed Mar 14 20:00:09 2018 +0100
+++ b/QTfrontend/ui/page/pagedrawmap.cpp	Wed Mar 14 20:39:14 2018 +0100
@@ -32,22 +32,23 @@
 
     cbEraser = new QCheckBox(tr("Eraser"), this);
     pageLayout->addWidget(cbEraser, 0, 0);
-    pbUndo = addButton(tr("Undo"), pageLayout, 1, 0);
 
     rbPolyline = new QRadioButton(tr("Polyline"), this);
-    pageLayout->addWidget(rbPolyline, 2, 0);
+    pageLayout->addWidget(rbPolyline, 1, 0);
     rbRectangle = new QRadioButton(tr("Rectangle"), this);
-    pageLayout->addWidget(rbRectangle, 3, 0);
+    pageLayout->addWidget(rbRectangle, 2, 0);
     rbEllipse = new QRadioButton(tr("Ellipse"), this);
-    pageLayout->addWidget(rbEllipse, 4, 0);
+    pageLayout->addWidget(rbEllipse, 3, 0);
 
     rbPolyline->setChecked(true);
 
+    pbUndo = addButton(tr("Undo"), pageLayout, 4, 0);
     pbClear = addButton(tr("Clear"), pageLayout, 5, 0);
+
     pbOptimize = addButton(tr("Optimize"), pageLayout, 6, 0);
+    // The optimize button is quite buggy, so we disable it for now.
+    // TODO: Re-enable optimize button when it's finished.
     pbOptimize->setVisible(false);
-    pbLoad = addButton(tr("Load"), pageLayout, 7, 0);
-    pbSave = addButton(tr("Save"), pageLayout, 8, 0);
 
     drawMapWidget = new DrawMapWidget(this);
     pageLayout->addWidget(drawMapWidget, 0, 1, 10, 1);
@@ -55,6 +56,23 @@
     return pageLayout;
 }
 
+QLayout * PageDrawMap::footerLayoutDefinition()
+{
+    QHBoxLayout * bottomLayout = new QHBoxLayout();
+
+    bottomLayout->addStretch();
+
+    pbLoad = addButton(":/res/Load.png", bottomLayout, 0, true, Qt::AlignBottom);
+    pbLoad ->setWhatsThis(tr("Load"));
+    pbLoad->setStyleSheet("QPushButton{margin: 24px 0 0 0;}");
+
+    pbSave = addButton(":/res/Save.png", bottomLayout, 0, true, Qt::AlignBottom);
+    pbSave ->setWhatsThis(tr("Save"));
+    pbSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}");
+
+    return bottomLayout;
+}
+
 void PageDrawMap::connectSignals()
 {
     connect(cbEraser, SIGNAL(toggled(bool)), drawMapWidget, SLOT(setErasing(bool)));
--- a/QTfrontend/ui/page/pagedrawmap.h	Wed Mar 14 20:00:09 2018 +0100
+++ b/QTfrontend/ui/page/pagedrawmap.h	Wed Mar 14 20:39:14 2018 +0100
@@ -35,6 +35,7 @@
 
     protected:
         QLayout * bodyLayoutDefinition();
+        QLayout * footerLayoutDefinition();
         void connectSignals();
 
     private:
--- a/QTfrontend/ui/widget/drawmapwidget.h	Wed Mar 14 20:00:09 2018 +0100
+++ b/QTfrontend/ui/widget/drawmapwidget.h	Wed Mar 14 20:39:14 2018 +0100
@@ -59,11 +59,13 @@
             {
                 QVBoxLayout * vbox = new QVBoxLayout(drawMapWidget);
                 vbox->setMargin(0);
-                lblPoints = new QLabel("0", drawMapWidget);
                 QLayout * arLayout = new QVBoxLayout();
                 arLayout->setAlignment(Qt::AlignCenter);
                 vbox->addLayout(arLayout);
 
+                lblPoints = new QLabel("0", drawMapWidget);
+                arLayout->addWidget(lblPoints);
+
                 graphicsView = new DrawMapView(drawMapWidget);
                 graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
                 graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);