9 #include "ui_togglebutton.h"
12 #include <QApplication>
15 #include <QStyleOption>
21 ui->pushButton0->setCheckable(
true);
22 ui->pushButton1->setCheckable(
true);
23 connect(
ui->pushButton0, SIGNAL(clicked()),
this, SLOT(
toggle()));
24 connect(
ui->pushButton1, SIGNAL(clicked()),
this, SLOT(
toggle()));
36 {
ui->pushButton1->setText(label); }
39 {
ui->pushButton0->setText(label); }
42 {
direction=Dir; QWidget::setLayoutDirection(Dir); }
56 ui->pushButton1->move(this->width()-
ui->pushButton1->width() -
ui->pushButton0->x(),
ui->pushButton1->y());
58 ui->pushButton0->move(this->width()-
ui->pushButton0->width()-
ui->pushButton1->x(),
ui->pushButton0->y());
59 style()->drawPrimitive(QStyle::PE_Widget, &opt, &p,
this);
67 this->setFixedWidth(this->width());
68 double large = this->width()*.55;
69 double small = this->width()*.4;
72 ui->pushButton0->setFixedWidth(large);
73 ui->pushButton1->setFixedWidth(small);
75 ui->pushButton0->setFixedWidth(small);
76 ui->pushButton1->setFixedWidth(large);
82 ui->pushButton0->setChecked(!
state);
83 ui->pushButton1->setChecked(
state);
86 ui->pushButton0->stackUnder(
ui->pushButton1);
88 ui->pushButton1->stackUnder(
ui->pushButton0);