QTfrontend/ui/page/AbstractPage.cpp
changeset 7781 6505805e7f98
parent 7779 0c5f822916a7
child 7794 ab7b94c03bc9
equal deleted inserted replaced
7780:a066a52411bc 7781:6505805e7f98
    92         btn->setFont(*font14);
    92         btn->setFont(*font14);
    93         btn->setText(name);
    93         btn->setText(name);
    94     }
    94     }
    95     return btn;
    95     return btn;
    96 }
    96 }
       
    97 QPushButton* AbstractPage::formattedSoundlessButton(const QString & name, bool hasIcon)
       
    98 {
       
    99     QPushButton* btn = new QPushButton(this);
       
   100 
       
   101     if (hasIcon)
       
   102     {
       
   103         const QIcon& lp=QIcon(name);
       
   104         QSize sz = lp.actualSize(QSize(65535, 65535));
       
   105         btn->setIcon(lp);
       
   106         btn->setFixedSize(sz);
       
   107         btn->setIconSize(sz);
       
   108         btn->setFlat(true);
       
   109         btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
       
   110     }
       
   111     else
       
   112     {
       
   113         btn->setFont(*font14);
       
   114         btn->setText(name);
       
   115     }
       
   116     return btn;
       
   117 }
    97 
   118 
    98 QPushButtonWithSound * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon)
   119 QPushButtonWithSound * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon)
    99 {
   120 {
   100     QPushButtonWithSound * btn = formattedButton(name, hasIcon);
   121     QPushButtonWithSound * btn = formattedButton(name, hasIcon);
   101     grid->addWidget(btn, row, column, rowSpan, columnSpan);
   122     grid->addWidget(btn, row, column, rowSpan, columnSpan);
   103 }
   124 }
   104 
   125 
   105 QPushButtonWithSound * AbstractPage::addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon)
   126 QPushButtonWithSound * AbstractPage::addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon)
   106 {
   127 {
   107     QPushButtonWithSound * btn = formattedButton(name, hasIcon);
   128     QPushButtonWithSound * btn = formattedButton(name, hasIcon);
       
   129     box->addWidget(btn, where);
       
   130     return btn;
       
   131 }
       
   132 
       
   133 QPushButton* AbstractPage::addSoundlessButton(const QString & name, QBoxLayout * box, int where, bool hasIcon)
       
   134 {
       
   135     QPushButton* btn = formattedSoundlessButton(name, hasIcon);
   108     box->addWidget(btn, where);
   136     box->addWidget(btn, where);
   109     return btn;
   137     return btn;
   110 }
   138 }
   111 
   139 
   112 void AbstractPage::setBackButtonVisible(bool visible)
   140 void AbstractPage::setBackButtonVisible(bool visible)