QTfrontend/ui/page/AbstractPage.cpp
branchphysfslayer
changeset 7928 88fde28bbda6
parent 7794 ab7b94c03bc9
child 8149 237802cf4610
--- a/QTfrontend/ui/page/AbstractPage.cpp	Sun Oct 21 01:28:33 2012 +0400
+++ b/QTfrontend/ui/page/AbstractPage.cpp	Sat Nov 03 00:34:35 2012 +0400
@@ -25,8 +25,8 @@
 #include <QLabel>
 #include <QSize>
 #include <QFontMetricsF>
-#include <qpushbuttonwithsound.h>
-#include <QMessageBox>
+
+#include "qpushbuttonwithsound.h"
 
 AbstractPage::AbstractPage(QWidget* parent)
 {
@@ -93,6 +93,27 @@
     }
     return btn;
 }
+QPushButton* AbstractPage::formattedSoundlessButton(const QString & name, bool hasIcon)
+{
+    QPushButton* btn = new QPushButton(this);
+
+    if (hasIcon)
+    {
+        const QIcon& lp=QIcon(name);
+        QSize sz = lp.actualSize(QSize(65535, 65535));
+        btn->setIcon(lp);
+        btn->setFixedSize(sz);
+        btn->setIconSize(sz);
+        btn->setFlat(true);
+        btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+    }
+    else
+    {
+        btn->setFont(*font14);
+        btn->setText(name);
+    }
+    return btn;
+}
 
 QPushButtonWithSound * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon)
 {
@@ -108,6 +129,13 @@
     return btn;
 }
 
+QPushButton* AbstractPage::addSoundlessButton(const QString & name, QBoxLayout * box, int where, bool hasIcon)
+{
+    QPushButton* btn = formattedSoundlessButton(name, hasIcon);
+    box->addWidget(btn, where);
+    return btn;
+}
+
 void AbstractPage::setBackButtonVisible(bool visible)
 {
     btnBack->setVisible(visible);