__interrupt void PORT2_ISR(void) { if (P2IFG == BIT0) button0(); if (P2IFG == BIT1) button1(); if (P2IFG == BIT2) button2(); if (P2IFG == BIT3) button3(); if (P2IFG == BIT4) button4(); if (P2IFG == BIT5) button5(); if (P2IFG == BIT6) button6(); if (P2IFG == BIT7) button7(); }
//----------------------------------------------------------------------------- int ctkCheckablePushButtonTest1(int argc, char * argv [] ) { QApplication app(argc, argv); QWidget topLevel; ctkCheckablePushButton button1(QObject::tr("My very long text on button")); ctkCheckablePushButton button2(QObject::tr("Button2")); ctkCheckablePushButton button3(QObject::tr("Button3")); ctkCheckablePushButton button4(QObject::tr("Button4")); ctkCheckablePushButton button5(QObject::tr("Button5")); ctkCheckablePushButton button6(QObject::tr("Button6")); ctkCheckablePushButton button7(QObject::tr("Checkable PushButton")); ctkCheckablePushButton button8(QObject::tr("Connected, Not User Checkable")); ctkCheckablePushButton button9(QObject::tr("Connected, Not User Checkable")); ctkCheckablePushButton button10(QObject::tr("Not Connected, User Checkable")); ctkCheckablePushButton button11(QObject::tr("Not Connected, User Checkable")); ctkCheckablePushButton button12(QObject::tr("Checkbox Not User Checkable\nButton Checkable")); ctkCheckablePushButton button13(QObject::tr("Checkbox and Button User Checkable")); QVBoxLayout *layout= new QVBoxLayout; layout->addWidget(&button1); layout->addWidget(&button2); layout->addWidget(&button3); layout->addWidget(&button4); layout->addWidget(&button5); layout->addWidget(&button6); layout->addWidget(&button7); layout->addWidget(&button8); layout->addWidget(&button9); layout->addWidget(&button10); layout->addWidget(&button11); layout->addWidget(&button12); layout->addWidget(&button13); topLevel.setLayout(layout); topLevel.show(); button1.setButtonTextAlignment(Qt::AlignRight | Qt::AlignVCenter); if (button1.buttonTextAlignment() != (Qt::AlignRight | Qt::AlignVCenter)) { std::cerr << "ctkCheckablePushButton::setButtonTextAlignment failed." << std::endl; return EXIT_FAILURE; } button2.setIndicatorAlignment(Qt::AlignRight); if (button2.indicatorAlignment() != Qt::AlignRight) { std::cerr << "ctkCheckablePushButton::setIndicatorAlignment failed." << std::endl; return EXIT_FAILURE; } button3.setButtonTextAlignment(Qt::AlignCenter); button3.setIndicatorAlignment(Qt::AlignCenter); button3.setCheckable(true); button4.setCheckable(true); button4.toggle(); button5.setButtonTextAlignment(Qt::AlignCenter); button5.setIndicatorAlignment(Qt::AlignRight); button6.setIndicatorAlignment(Qt::AlignTop); button7.setButtonTextAlignment(Qt::AlignCenter); button7.setIndicatorAlignment(Qt::AlignLeft); // Connected to button, not user checkable: button8.setCheckBoxUserCheckable(false); button8.setCheckState(Qt::Checked); button9.setCheckBoxUserCheckable(false); button9.setCheckState(Qt::Unchecked); // Not connected to button, user checkable: button10.setCheckBoxControlsButton(false); button10.setCheckState(Qt::Checked); button11.setCheckBoxControlsButton(false); button11.setCheckState(Qt::PartiallyChecked); button12.setCheckBoxControlsButton(false); button12.setCheckBoxUserCheckable(false); button12.setCheckable(true); button13.setCheckBoxControlsButton(false); button13.setCheckBoxUserCheckable(true); button13.setCheckable(true); if (argc < 2 || QString(argv[1]) != "-I" ) { QTimer::singleShot(200, &app, SLOT(quit())); } return app.exec(); }
void QtCalculator::pb6toggled(bool myboolean){ if(myboolean) button6(); if(pb6->isOn() && (!key_pressed)) pb6->setOn(FALSE); }
bool PlayerInputStruct::pollEvents(PlayerInputStruct &oldInputs, GameEvent &e) { //Check if the given event is already a game input event. if(e.type() != GameEvent::GameInput) { e = event::GameInput(); } if(oldInputs.action() != action()) { e.gameInput.setControl(GameControl::ACTION); e.gameInput.setState(action()); oldInputs.setAction(action()); return true; } if(oldInputs.up() != up()) { e.gameInput.setControl(GameControl::UP); e.gameInput.setValue(up()); oldInputs.setUp(up()); return true; } if(oldInputs.down() != down()) { e.gameInput.setControl(GameControl::DOWN); e.gameInput.setValue(down()); oldInputs.setDown(down()); return true; } if(oldInputs.left() != left()) { e.gameInput.setControl(GameControl::LEFT); e.gameInput.setValue(left()); oldInputs.setLeft(left()); return true; } if(oldInputs.right() != right()) { e.gameInput.setControl(GameControl::RIGHT); e.gameInput.setValue(right()); oldInputs.setRight(right()); return true; } if(oldInputs.button1() != button1()) { e.gameInput.setControl(GameControl::BUTTON1); e.gameInput.setState(button1()); oldInputs.setButton1(button1()); return true; } if(oldInputs.button2() != button2()) { e.gameInput.setControl(GameControl::BUTTON2); e.gameInput.setState(button2()); oldInputs.setButton2(button2()); return true; } if(oldInputs.button3() != button3()) { e.gameInput.setControl(GameControl::BUTTON3); e.gameInput.setState(button3()); oldInputs.setButton3(button3()); return true; } if(oldInputs.button4() != button4()) { e.gameInput.setControl(GameControl::BUTTON4); e.gameInput.setState(button4()); oldInputs.setButton4(button4()); return true; } if(oldInputs.button5() != button5()) { e.gameInput.setControl(GameControl::BUTTON5); e.gameInput.setState(button5()); oldInputs.setButton5(button5()); return true; } if(oldInputs.button6() != button6()) { e.gameInput.setControl(GameControl::BUTTON6); e.gameInput.setState(button6()); oldInputs.setButton6(button6()); return true; } return false; }