QTfrontend/ui/page/AbstractPage.cpp
changeset 6200 6a4ace88d85a
parent 6175 a80833ddaef0
child 6477 ad5741c252b9
equal deleted inserted replaced
6199:582e85254110 6200:6a4ace88d85a
    12  * GNU General Public License for more details.
    12  * GNU General Public License for more details.
    13  *
    13  *
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
       
    17  */
       
    18 
       
    19 /**
       
    20  * @file
       
    21  * @brief AbstractPage class implementation
    17  */
    22  */
    18 
    23 
    19 #include "AbstractPage.h"
    24 #include "AbstractPage.h"
    20 
    25 
    21 AbstractPage::AbstractPage(QWidget* parent)
    26 AbstractPage::AbstractPage(QWidget* parent)
    50     // connect signals
    55     // connect signals
    51     connect(btnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
    56     connect(btnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
    52     connectSignals();
    57     connectSignals();
    53 }
    58 }
    54 
    59 
    55 QPushButton * AbstractPage::formattedButton(const QString & btname, bool hasIcon)
    60 QPushButton * AbstractPage::formattedButton(const QString & name, bool hasIcon)
    56 {
    61 {
    57     QPushButton * btn = new QPushButton(this);
    62     QPushButton * btn = new QPushButton(this);
    58 
    63 
    59     if (hasIcon)
    64     if (hasIcon)
    60     {
    65     {
    61         const QIcon& lp=QIcon(btname);
    66         const QIcon& lp=QIcon(name);
    62         QSize sz = lp.actualSize(QSize(65535, 65535));
    67         QSize sz = lp.actualSize(QSize(65535, 65535));
    63         btn->setIcon(lp);
    68         btn->setIcon(lp);
    64         btn->setFixedSize(sz);
    69         btn->setFixedSize(sz);
    65         btn->setIconSize(sz);
    70         btn->setIconSize(sz);
    66         btn->setFlat(true);
    71         btn->setFlat(true);
    67         btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    72         btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    68     }
    73     }
    69     else
    74     else
    70     {
    75     {
    71         btn->setFont(*font14);
    76         btn->setFont(*font14);
    72         btn->setText(btname);
    77         btn->setText(name);
    73     }
    78     }
    74     return btn;
    79     return btn;
    75 }
    80 }
    76 
    81 
    77 QPushButton * AbstractPage::addButton(const QString & btname, QGridLayout* grid, int wy, int wx, bool hasIcon)
    82 QPushButton * AbstractPage::addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan, int columnSpan, bool hasIcon)
    78 {
    83 {
    79     QPushButton * btn = formattedButton(btname, hasIcon);
    84     QPushButton * btn = formattedButton(name, hasIcon);
    80     grid->addWidget(btn, wy, wx);
    85     grid->addWidget(btn, row, column, rowSpan, columnSpan);
    81     return btn;
    86     return btn;
    82 }
    87 }
    83 
    88 
    84 QPushButton * AbstractPage::addButton(const QString & btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool hasIcon)
    89 QPushButton * AbstractPage::addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon)
    85 {
    90 {
    86     QPushButton * btn = formattedButton(btname, hasIcon);
    91     QPushButton * btn = formattedButton(name, hasIcon);
    87     grid->addWidget(btn, wy, wx, rowSpan, columnSpan);
       
    88     return btn;
       
    89 }
       
    90 
       
    91 QPushButton * AbstractPage::addButton(const QString & btname, QBoxLayout* box, int where, bool hasIcon)
       
    92 {
       
    93     QPushButton * btn = formattedButton(btname, hasIcon);
       
    94     box->addWidget(btn, where);
    92     box->addWidget(btn, where);
    95     return btn;
    93     return btn;
    96 }
    94 }
    97 
    95 
    98 void AbstractPage::setBackButtonVisible(bool visible)
    96 void AbstractPage::setBackButtonVisible(bool visible)