crude workaround for problem inu reported with sound button
authornemo
Sun, 21 Oct 2012 13:19:16 -0400
changeset 7781 6505805e7f98
parent 7780 a066a52411bc
child 7782 a611da4d1667
crude workaround for problem inu reported with sound button
QTfrontend/ui/page/AbstractPage.cpp
QTfrontend/ui/page/AbstractPage.h
QTfrontend/ui/page/pageeditteam.cpp
--- a/QTfrontend/ui/page/AbstractPage.cpp	Sun Oct 21 12:28:05 2012 -0400
+++ b/QTfrontend/ui/page/AbstractPage.cpp	Sun Oct 21 13:19:16 2012 -0400
@@ -94,6 +94,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)
 {
@@ -109,6 +130,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);
--- a/QTfrontend/ui/page/AbstractPage.h	Sun Oct 21 12:28:05 2012 -0400
+++ b/QTfrontend/ui/page/AbstractPage.h	Sun Oct 21 13:19:16 2012 -0400
@@ -138,6 +138,7 @@
          * @return the button.
          */
         QPushButtonWithSound * formattedButton(const QString & name, bool hasIcon = false);
+        QPushButton * formattedSoundlessButton(const QString & name, bool hasIcon = false);
 
         /**
          * @brief Creates a default formatted button and adds it to a
@@ -167,6 +168,7 @@
          * @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);
 
         /**
          * @brief Changes visibility of the back-button.
--- a/QTfrontend/ui/page/pageeditteam.cpp	Sun Oct 21 12:28:05 2012 -0400
+++ b/QTfrontend/ui/page/pageeditteam.cpp	Sun Oct 21 13:19:16 2012 -0400
@@ -134,7 +134,7 @@
     CBVoicepack = new QComboBox(GBoxTeam);
 
     hbox->addWidget(CBVoicepack, 100);
-    btnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true);
+    btnTestSound = addSoundlessButton(":/res/PlaySound.png", hbox, 1, true);
     hbox->setStretchFactor(btnTestSound, 1);
 
     GBTLayout->addLayout(hbox, 4, 1);