Neatly align all the bottom buttons on the same height
authorWuzzy <almikes@aol.com>
Fri, 06 May 2016 19:23:26 +0200
changeset 11818 b421923c2577
parent 11817 5f21387edff1
child 11819 7642955690bc
Neatly align all the bottom buttons on the same height
QTfrontend/ui/page/AbstractPage.cpp
QTfrontend/ui/page/AbstractPage.h
QTfrontend/ui/page/pagemain.cpp
QTfrontend/ui/page/pagemultiplayer.cpp
QTfrontend/ui/page/pagenetgame.cpp
--- a/QTfrontend/ui/page/AbstractPage.cpp	Fri May 06 18:49:41 2016 +0200
+++ b/QTfrontend/ui/page/AbstractPage.cpp	Fri May 06 19:23:26 2016 +0200
@@ -127,24 +127,24 @@
     return btn;
 }
 
-QPushButtonWithSound * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon)
+QPushButtonWithSound * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon, Qt::Alignment alignment)
 {
     QPushButtonWithSound * btn = formattedButton(name, hasIcon);
-    grid->addWidget(btn, row, column, rowSpan, columnSpan);
+    grid->addWidget(btn, row, column, rowSpan, columnSpan, alignment);
     return btn;
 }
 
-QPushButtonWithSound * AbstractPage::addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon)
+QPushButtonWithSound * AbstractPage::addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon, Qt::Alignment alignment)
 {
     QPushButtonWithSound * btn = formattedButton(name, hasIcon);
-    box->addWidget(btn, where);
+    box->addWidget(btn, where, alignment);
     return btn;
 }
 
-QPushButton* AbstractPage::addSoundlessButton(const QString & name, QBoxLayout * box, int where, bool hasIcon)
+QPushButton* AbstractPage::addSoundlessButton(const QString & name, QBoxLayout * box, int where, bool hasIcon, Qt::Alignment alignment)
 {
     QPushButton* btn = formattedSoundlessButton(name, hasIcon);
-    box->addWidget(btn, where);
+    box->addWidget(btn, where, alignment);
     return btn;
 }
 
--- a/QTfrontend/ui/page/AbstractPage.h	Fri May 06 18:49:41 2016 +0200
+++ b/QTfrontend/ui/page/AbstractPage.h	Fri May 06 19:23:26 2016 +0200
@@ -185,10 +185,11 @@
          * @param rowSpan how many layout rows the button will span.
          * @param columnSpan how many layout columns the button will span.
          * @param hasIcon set to true if this is a picture button.
+         * @param alignment alignment of the button in the layout.
          *
          * @return the button.
          */
-        QPushButtonWithSound * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false);
+        QPushButtonWithSound * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false, Qt::Alignment alignment = 0);
 
         /**
          * @brief Creates a default formatted button and adds it to a
@@ -198,11 +199,12 @@
          * @param box pointer of the box layout in which to insert the button.
          * @param where layout ndex in which to insert the button.
          * @param hasIcon set to true if this is a picture button.
+         * @param alignment alignment of the button in the layout.
          *
          * @return the button.
          */
-        QPushButtonWithSound * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false);
-        QPushButton* addSoundlessButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false);
+        QPushButtonWithSound * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false, Qt::Alignment alignment = 0);
+        QPushButton* addSoundlessButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false, Qt::Alignment alignment = 0);
 
         /**
          * @brief Changes visibility of the back-button.
--- a/QTfrontend/ui/page/pagemain.cpp	Fri May 06 18:49:41 2016 +0200
+++ b/QTfrontend/ui/page/pagemain.cpp	Fri May 06 19:23:26 2016 +0200
@@ -109,11 +109,11 @@
     btnBack->setWhatsThis(tr("Exit game"));
 
 #ifdef VIDEOREC
-    BtnVideos = addButton(":/res/Videos.png", bottomLayout, 1, true);
+    BtnVideos = addButton(":/res/Videos.png", bottomLayout, 1, true, Qt::AlignBottom);
     BtnVideos->setWhatsThis(tr("Manage videos recorded from game"));
 #endif
 
-    BtnSetup = addButton(":/res/Settings.png", bottomLayout, 2, true);
+    BtnSetup = addButton(":/res/Settings.png", bottomLayout, 2, true, Qt::AlignBottom);
     BtnSetup->setWhatsThis(tr("Edit game preferences"));
 
     return bottomLayout;
--- a/QTfrontend/ui/page/pagemultiplayer.cpp	Fri May 06 18:49:41 2016 +0200
+++ b/QTfrontend/ui/page/pagemultiplayer.cpp	Fri May 06 19:23:26 2016 +0200
@@ -46,7 +46,7 @@
 {
     QHBoxLayout * bottomLeftLayout = new QHBoxLayout();
 
-    btnSetup = addButton(":/res/Settings.png", bottomLeftLayout, 0, true);
+    btnSetup = addButton(":/res/Settings.png", bottomLeftLayout, 0, true, Qt::AlignBottom);
     btnSetup->setWhatsThis(tr("Edit game preferences"));
 
     return bottomLeftLayout;
--- a/QTfrontend/ui/page/pagenetgame.cpp	Fri May 06 18:49:41 2016 +0200
+++ b/QTfrontend/ui/page/pagenetgame.cpp	Fri May 06 19:23:26 2016 +0200
@@ -114,7 +114,7 @@
 {
     QHBoxLayout * bottomLeftLayout = new QHBoxLayout();
 
-    btnSetup = addButton(":/res/Settings.png", bottomLeftLayout, 0, true);
+    btnSetup = addButton(":/res/Settings.png", bottomLeftLayout, 0, true, Qt::AlignBottom);
     btnSetup->setWhatsThis(tr("Edit game preferences"));
 
     return bottomLeftLayout;