void Wiimote::parseButtons(uint16_t buttons) { for (int l=0; l<16; l++) if ((buttons & (1<<l)) != (buttons_old & (1<<l))) { if (buttons & (1<<l)) { //qDebug("button %d pressed",l); emit buttonToggled(l,true); } else { //qDebug("button %d released",l); emit buttonToggled(l,false); } } buttons_old = buttons; }
caScriptButton::caScriptButton(QWidget *parent) : QWidget(parent) { QGridLayout *l = new QGridLayout; l->setMargin(0); displayScript = new QCheckBox(); displayScript->setText(""); displayScript->setGeometry(0,0,15,15); displayScript->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); buttonScript = new EPushButton( "Action", this ); buttonScript->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setFontScaleModeL(EPushButton::WidthAndHeight); l->addWidget(buttonScript, 0, 0); l->addWidget(displayScript, 0, 1); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); setLayout(l); thisForeColor = Qt::black; thisBackColor = Qt::gray; thisShowExecution = false; connect(displayScript, SIGNAL(clicked()), this, SLOT(buttonToggled()) ); connect(buttonScript, SIGNAL(clicked()), this, SLOT(scriptButtonClicked()) ); installEventFilter(this); setAccessW(true); setElevation(on_top); setCheckboxDisplay(true); }
caToggleButton::caToggleButton(QWidget *parent) : QCheckBox(parent), FontScalingWidget(this) { setCheckable(true); setTristate(true); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); thisPalette = palette(); thisBackColor = defaultBackColor = QColor(200,200,200,0); thisForeColor = defaultForeColor = Qt::black; thisColorMode=Static; setBackground(defaultBackColor); setForeground(defaultForeColor); installEventFilter(this); connect(this, SIGNAL(clicked()), this, SLOT(buttonToggled()) ); setTrueValue("1"); setFalseValue("0"); setAccessW(true); setFontScaleMode(WidthAndHeight); }