bool ccGraphicalSegmentationTool::linkWith(ccGLWindow* win) { assert(m_segmentationPoly); ccGLWindow* oldWin = m_associatedWin; if (!ccOverlayDialog::linkWith(win)) return false; if (oldWin) { disconnect(m_associatedWin, SIGNAL(leftButtonClicked(int,int)), this, SLOT(addPointToPolyline(int,int))); disconnect(m_associatedWin, SIGNAL(rightButtonClicked(int,int)), this, SLOT(closePolyLine(int,int))); disconnect(m_associatedWin, SIGNAL(mouseMoved(int,int,Qt::MouseButtons)), this, SLOT(updatePolyLine(int,int,Qt::MouseButtons))); disconnect(m_associatedWin, SIGNAL(buttonReleased()), this, SLOT(closeRectangle())); if (m_segmentationPoly) m_segmentationPoly->setDisplay(0); } if (m_associatedWin) { connect(m_associatedWin, SIGNAL(leftButtonClicked(int,int)), this, SLOT(addPointToPolyline(int,int))); connect(m_associatedWin, SIGNAL(rightButtonClicked(int,int)), this, SLOT(closePolyLine(int,int))); connect(m_associatedWin, SIGNAL(mouseMoved(int,int,Qt::MouseButtons)), this, SLOT(updatePolyLine(int,int,Qt::MouseButtons))); connect(m_associatedWin, SIGNAL(buttonReleased()), this, SLOT(closeRectangle())); if (m_segmentationPoly) m_segmentationPoly->setDisplay(m_associatedWin); } return true; }
void GameOverLayer::controllerEvent(ControllerEvent &evt) { if (input) { if (evt.isKeyFresh(ControllerEvent::X_B)) { removeChild(input); input = NULL; btnReplay->setActive(true); btnMenu->setActive(true); } } else { if (evt.isKeyFresh(ControllerEvent::X_A)) { buttonReleased(btnReplay); } else if (evt.isKeyFresh(ControllerEvent::X_B)) { buttonReleased(btnMenu); } } }
void RaspiLcdWidget::registerKey(QAbstractButton *butt, keyType key) { m_butList.append(butt); m_keyList.append(key); connect(butt,SIGNAL(pressed()),this,SLOT(buttonPressed())); connect(butt,SIGNAL(released()),this,SLOT(buttonReleased())); }
int QwtCounter::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: buttonReleased((*reinterpret_cast< double(*)>(_a[1]))); break; case 1: valueChanged((*reinterpret_cast< double(*)>(_a[1]))); break; case 2: btnReleased(); break; case 3: btnClicked(); break; case 4: textChanged(); break; } _id -= 5; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = numButtons(); break; case 1: *reinterpret_cast< double*>(_v) = step(); break; case 2: *reinterpret_cast< double*>(_v) = minVal(); break; case 3: *reinterpret_cast< double*>(_v) = maxVal(); break; case 4: *reinterpret_cast< int*>(_v) = stepButton1(); break; case 5: *reinterpret_cast< int*>(_v) = stepButton2(); break; case 6: *reinterpret_cast< int*>(_v) = stepButton3(); break; case 7: *reinterpret_cast< double*>(_v) = value(); break; case 8: *reinterpret_cast< bool*>(_v) = editable(); break; } _id -= 9; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setNumButtons(*reinterpret_cast< int*>(_v)); break; case 1: setStep(*reinterpret_cast< double*>(_v)); break; case 2: setMinValue(*reinterpret_cast< double*>(_v)); break; case 3: setMaxValue(*reinterpret_cast< double*>(_v)); break; case 4: setStepButton1(*reinterpret_cast< int*>(_v)); break; case 5: setStepButton2(*reinterpret_cast< int*>(_v)); break; case 6: setStepButton3(*reinterpret_cast< int*>(_v)); break; case 7: setValue(*reinterpret_cast< double*>(_v)); break; case 8: setEditable(*reinterpret_cast< bool*>(_v)); break; } _id -= 9; } else if (_c == QMetaObject::ResetProperty) { _id -= 9; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 9; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 9; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 9; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 9; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 9; } #endif // QT_NO_PROPERTIES return _id; }
/* Call the correct function for mouse released */ static void widgReleased(WIDGET *psWidget, UDWORD key, W_CONTEXT *psContext) { switch (psWidget->type) { case WIDG_FORM: formReleased((W_FORM *)psWidget, key, psContext); break; case WIDG_LABEL: break; case WIDG_BUTTON: buttonReleased(psContext->psScreen, (W_BUTTON *)psWidget, key); break; case WIDG_EDITBOX: editBoxReleased((W_EDITBOX *)psWidget); break; case WIDG_BARGRAPH: break; case WIDG_SLIDER: sliderReleased((W_SLIDER *)psWidget); break; default: ASSERT(!"Unknown widget type", "Unknown widget type"); break; } }
int QButtonGroup::insert( QButton *button, int id ) { if ( button->group() ) button->group()->remove( button ); static int seq_no = -2; QButtonItem *bi = new QButtonItem; Q_CHECK_PTR( bi ); if ( id < -1 ) bi->id = seq_no--; else if ( id == -1 ) bi->id = buttons->count(); else bi->id = id; bi->button = button; button->setGroup(this); buttons->append( bi ); connect( button, SIGNAL(pressed()) , SLOT(buttonPressed()) ); connect( button, SIGNAL(released()), SLOT(buttonReleased()) ); connect( button, SIGNAL(clicked()) , SLOT(buttonClicked()) ); connect( button, SIGNAL(toggled(bool)) , SLOT(buttonToggled(bool)) ); if ( button->isToggleButton() && !button->isOn() && selected() && (selected()->focusPolicy() & TabFocus) != 0 ) button->setFocusPolicy( (FocusPolicy)(button->focusPolicy() & ~TabFocus) ); return bi->id; }
// BEGIN_TUTORIAL // The DriveWidget constructor does the normal Qt thing of // passing the parent widget to the superclass constructor, then // initializing the member variables. DriveWidget::DriveWidget(QWidget* parent) : QWidget(parent), linear_velocity_(0), angular_velocity_(0), linear_scale_(5), angular_scale_(2) { // create push button objects pushButton_1 = new QPushButton("Forward", this); // pushButton_1->setShortcut(); pushButton_2 = new QPushButton("Backward", this); pushButton_3 = new QPushButton("LeftTurn", this); pushButton_4 = new QPushButton("RightTurn", this); // pushButton_4->setCheckable(true); // pushButton_5 = new QPushButton("Stop",this); connect(pushButton_1, SIGNAL( pressed()), this, SLOT( buttonPressed())); connect(pushButton_2, SIGNAL( pressed()), this, SLOT( buttonPressed())); connect(pushButton_3, SIGNAL( pressed()), this, SLOT( buttonPressed())); connect(pushButton_4, SIGNAL( pressed()), this, SLOT( buttonPressed())); connect(pushButton_1, SIGNAL( released()), this, SLOT( buttonReleased())); connect(pushButton_2, SIGNAL( released()), this, SLOT( buttonReleased())); connect(pushButton_3, SIGNAL( released()), this, SLOT( buttonReleased())); connect(pushButton_4, SIGNAL( released()), this, SLOT( buttonReleased())); }
bool ccPointPropertiesDlg::linkWith(ccGLWindow* win) { assert(m_label && m_rect2DLabel); ccGLWindow* oldWin = m_associatedWin; if (!ccPointPickingGenericInterface::linkWith(win)) return false; //old window? if (oldWin) { oldWin->removeFromOwnDB(m_label); oldWin->removeFromOwnDB(m_rect2DLabel); oldWin->setInteractionMode(ccGLWindow::TRANSFORM_CAMERA); disconnect(oldWin, SIGNAL(mouseMoved(int,int,Qt::MouseButtons)), this, SLOT(update2DZone(int,int,Qt::MouseButtons))); disconnect(oldWin, SIGNAL(leftButtonClicked(int,int)), this, SLOT(processClickedPoint(int,int))); disconnect(oldWin, SIGNAL(buttonReleased()), this, SLOT(close2DZone())); } m_rect2DLabel->setVisible(false); //=invalid m_rect2DLabel->setSelected(true); //=closed m_label->clear(); //new window? if (m_associatedWin) { m_associatedWin->addToOwnDB(m_label); m_associatedWin->addToOwnDB(m_rect2DLabel); connect(m_associatedWin, SIGNAL(mouseMoved(int,int,Qt::MouseButtons)), this, SLOT(update2DZone(int,int,Qt::MouseButtons))); connect(m_associatedWin, SIGNAL(leftButtonClicked(int,int)), this, SLOT(processClickedPoint(int,int))); connect(m_associatedWin, SIGNAL(buttonReleased()), this, SLOT(close2DZone())); } return true; }
void ccGraphicalSegmentationTool::linkWith(ccGLWindow* win) { assert(m_polyVertices && m_segmentationPoly); if (m_associatedWin) stop(); m_associatedWin = win; connect(m_associatedWin, SIGNAL(leftButtonClicked(int,int)), this, SLOT(addPointToPolyline(int,int))); connect(m_associatedWin, SIGNAL(rightButtonClicked(int,int)), this, SLOT(closePolyLine(int,int))); connect(m_associatedWin, SIGNAL(mouseMoved(int,int,Qt::MouseButtons)), this, SLOT(updatePolyLine(int,int,Qt::MouseButtons))); connect(m_associatedWin, SIGNAL(buttonReleased()), this, SLOT(closeRectangle())); m_segmentationPoly->setDisplay(m_associatedWin); }
bool Pendant::update() { now = millis(); if (buttonPressedAt) { // Cycle modes when held for a long time if (now > (buttonPressedAt + PENDANT_CYCLE_DELAY)) { toggleCycleMode(); } else if (now > (buttonPressedAt + PENDANT_SLEEP_DELAY)) { sleepOnRelease = true; } } // Update pushed button state. updateButtonState(); // Handle button release. if (buttonReleased()) { if (sleepOnRelease) { sleepNow(); } else if (changeModeOnRelease) { mode++; if (cyclingMode) lastCycle = now; } else { changeModeOnRelease = true; } } // Cycle mode if we are cycling, and it's time. if (cyclingMode && (now > (lastCycle + PENDANT_CYCLE_DURATION))) { lastCycle = now; mode++; } // Go black to indicate power off. if (sleepOnRelease) { FastLED.showColor(CRGB::Black); } // Do the animations! // YAY! else { if (mode >= modes) mode = 0; return true; } return false; }
int Q3ButtonGroup::insert_helper(QAbstractButton *button, int id) { if (isExclusive() || !qobject_cast<QRadioButton*>(button)) group.addButton(button); static int seq_no = -2; if (id < -1) id = seq_no--; else if (id == -1) id = buttonIds.count(); buttonIds.insert(id, button); connect(button, SIGNAL(pressed()) , SLOT(buttonPressed())); connect(button, SIGNAL(released()), SLOT(buttonReleased())); connect(button, SIGNAL(clicked()) , SLOT(buttonClicked())); connect(button, SIGNAL(destroyed()) , SLOT(buttonDestroyed())); return id; }
int ButtonGroup::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: buttonClicked((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: buttonReleased((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: buttonPressed((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 3; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = getCheckedId(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: checkId(*reinterpret_cast< int*>(_v)); break; } _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
void buttonPanel::mouseReleaseEvent(QMouseEvent *e) { QPoint mousePos = e->pos(); int x=mousePos.x(); if ((x>0)&&(x<90)) mButtonPressed=buttonPanel::BUT1; else if ((x>90)&&(x<180)) mButtonPressed=buttonPanel::BUT2; else if ((x>180)&&(x<270)) mButtonPressed=buttonPanel::BUT3; else if ((x>270)&&(x<360)) mButtonPressed=buttonPanel::BUT4; mHighLightRect=heighLightRect; mHighLightRect.setLeft(heighLightRect.left()+(90*(mButtonPressed-1))); mHighLightRect.setWidth(heighLightWidth); update(); emit buttonReleased(mButtonPressed); }
KeyboardDialog::KeyboardDialog(const QString &text, enum QLineEdit::EchoMode echoMode, QWidget *parent) : QDialog(parent), ui(new Ui::KeyboardDialog), m_modNumbers(false), m_shift(false) { ui->setupUi(this); setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog); this->setStyleSheet(DARK_BUTTONS_STYLE); ui->lineEdit->setEchoMode(echoMode); if (echoMode == QLineEdit::Password) { m_modNumbers = true; } if (text.isEmpty()) { ui->lineEdit->clear(); } else { ui->lineEdit->setText(text); } changeLayout(m_modNumbers, m_shift); QPushButton *btn; for (int i = 0; i < SOFTKEYS; i++) { btn = findChild<QPushButton *>(QString("btn_%1").arg(i)); if (btn) { connect(btn, SIGNAL(clicked()), this, SLOT(buttonClicked())); connect(btn, SIGNAL(pressed()), this, SLOT(buttonPressed())); connect(btn, SIGNAL(released()), this, SLOT(buttonReleased())); } } }
MainWindow::MainWindow() { setupUi(this); if (tr("LTR") == "RTL") { qApp->setLayoutDirection(Qt::RightToLeft); } #ifndef Q_OS_WIN32 testPageSplitter->setPalette(this->palette()); #endif remainingTimeLcdNumber->setVisible(false); remainingTimeProgressBar->setVisible(false); label_minutes->setVisible(false); questionTextSvgSplitter->setCollapsible(0, false); questionTextSvgSplitter->setCollapsible(1, true); tcpSocket = new QTcpSocket(this); progress_dialog = NULL; current_test_use_groups = false; current_connection_local = false; QObject::connect(&timer, SIGNAL(timeout()), this, SLOT(updateTime())); QObject::connect(tbtnQuit, SIGNAL(released()), this, SLOT(close())); QObject::connect(tbtnAbout, SIGNAL(released()), this, SLOT(about())); QObject::connect(tbtnGetReady, SIGNAL(released()), this, SLOT(getReady())); QObject::connect(tbtnStart, SIGNAL(released()), this, SLOT(start())); QObject::connect(tbtnBrowse_DBPath, SIGNAL(released()), this, SLOT(browse_i())); QObject::connect(tbtnBrowse_savePath, SIGNAL(released()), this, SLOT(browse_o())); QObject::connect(tbtnLoad, SIGNAL(released()), this, SLOT(loadFile())); QObject::connect(useDefaultOutputCheckBox, SIGNAL(toggled(bool)), savePathLineEdit, SLOT(setDisabled(bool))); QObject::connect(useDefaultOutputCheckBox, SIGNAL(toggled(bool)), tbtnBrowse_savePath, SLOT(setDisabled(bool))); QObject::connect(serverNameLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableConnectButton())); QObject::connect(serverPortLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableConnectButton())); QObject::connect(DBPathLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableLoadButton())); QObject::connect(tbtnConnect, SIGNAL(released()), this, SLOT(connectSocket())); QObject::connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readIncomingData())); QObject::connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError(QAbstractSocket::SocketError))); QObject::connect(LQListWidget, SIGNAL(currentTextChanged(QString)), this, SLOT(setCurrentQuestion())); QObject::connect(svgDisplayWidget, SIGNAL(titleClicked(const QString &)), this, SLOT(previewSvg(const QString &))); QObject::connect(btnNext, SIGNAL(released()), this, SLOT(nextQuestion())); QObject::connect(btnLast, SIGNAL(released()), this, SLOT(lastQuestion())); QObject::connect(btnFinish, SIGNAL(released()), this, SLOT(finish())); QObject::connect(btnNewTest, SIGNAL(released()), this, SLOT(newTest())); QObject::connect(btnQuit, SIGNAL(released()), this, SLOT(close())); rbtngrpInputType = new QButtonGroup (this); rbtngrpInputType->addButton(rbtnNetwork); rbtngrpInputType->addButton(rbtnFromFile); QObject::connect(rbtngrpInputType, SIGNAL(buttonReleased(QAbstractButton *)), this, SLOT(toggleInputType(QAbstractButton *))); QObject::connect(answersView, SIGNAL(buttonReleased(Question::Answers)), this, SLOT(setQuestionAnswered(Question::Answers))); for (int i = 0; i < 8; ++i) { infoTableWidget->setItem(i, 0, new QTableWidgetItem); } ITW_test_name = infoTableWidget->item(0, 0); ITW_test_date = infoTableWidget->item(1, 0); ITW_test_timestamp = infoTableWidget->item(2, 0); ITW_test_time = infoTableWidget->item(3, 0); ITW_test_qnum = infoTableWidget->item(4, 0); ITW_test_fnum = infoTableWidget->item(5, 0); ITW_test_categories = infoTableWidget->item(6, 0); ITW_test_passmark = infoTableWidget->item(7, 0); ITW_test_comments = new QTextBrowser (infoTableWidget); infoTableWidget->setCellWidget(8, 0, ITW_test_comments); infoTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); infoTableWidget->verticalHeader()->setSectionResizeMode(8, QHeaderView::Stretch); resultsTableWidget->setColumnCount(1); resultsTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); resultsTableWidget->horizontalHeader()->hide(); loadSettings(); // Check app args ---------------------------------------------------------- if (qApp->arguments().count() > 2) { if (qApp->arguments().at(1) == "-port") { serverNameLineEdit->setText("Localhost"); serverPortLineEdit->setText(qApp->arguments().at(2)); connectSocket(); } } else if (qApp->arguments().count() > 1) { openFile(qApp->arguments().at(1)); } }
void SliderBase::timerEvent(QTimerEvent*) { double newval; double inc = step(); switch (d_scrollMode) { case ScrMouse: if (d_mass > 0.0) { d_speed *= exp(-double(d_updTime) * 0.001 / d_mass); newval = exactValue() + d_speed * double(d_updTime); DoubleRange::fitValue(newval); // stop if d_speed < one step per second if (fabs(d_speed) < 0.001 * fabs(step())) { d_speed = 0; stopMoving(); buttonReleased(); } } else stopMoving(); break; case ScrPage: DoubleRange::incPages(d_direction); if (value() != prevValue()) { emit sliderMoved(value(), _id); emit sliderMoved((int)value(), _id); } if (!d_timerTick) { killTimer(d_tmrID); d_tmrID = startTimer(d_updTime); } break; case ScrTimer: DoubleRange::fitValue(value() + double(d_direction) * inc); if (value() != prevValue()) { emit sliderMoved(value(), _id); } if (!d_timerTick) { killTimer(d_tmrID); d_tmrID = startTimer(d_updTime); } break; default: stopMoving(); break; } d_timerTick = 1; }
//! Button released void QwtCounter::btnReleased() { Q_EMIT buttonReleased( value() ); }
void dtkVrFlystickRecognizerPrivate::handle_button(const vrpn_BUTTONCB callback) { callback.state ? emit buttonPressed(callback.button) : emit buttonReleased(callback.button); }
QWidget* ButtonProperty::createEditor(QWidget* parent, const QStyleOptionViewItem& option) { QPushButton* button = new QPushButton(label_, parent); connect(button, SIGNAL(released()), this, SLOT(buttonReleased())); return button; }
void PSMoveQt::onTimeout() { int ax, ay, az, gx, gy, gz, mx, my, mz, buttons, battery; while (psmove_poll(_move)) { setTrigger(psmove_get_trigger(_move)); psmove_get_gyroscope(_move, &gx, &gy, &gz); if (gx != _gx || gy != _gy || gz != _gz) { _gx = gx; _gy = gy; _gz = gz; emit gyroChanged(); } psmove_get_accelerometer(_move, &ax, &ay, &az); if (ax != _ax || ay != _ay || az != _az) { _ax = ax; _ay = ay; _az = az; emit accelerometerChanged(); } psmove_get_magnetometer(_move, &mx, &my, &mz); if (mx != _mx || my != _my || mz != _mz) { _mx = mx; _my = my; _mz = mz; emit magnetometerChanged(); } buttons = psmove_get_buttons(_move); if (buttons != _buttons) { unsigned int pressed, released; psmove_get_button_events(_move, &pressed, &released); for (int i=1; i<=PSMoveQt::T; i <<= 1) { if (pressed & i) { emit buttonPressed(i); } else if (released & i) { emit buttonReleased(i); } } _buttons = buttons; } battery = psmove_get_battery(_move); if (battery != _battery) { bool charging = (battery == Batt_CHARGING || _battery == Batt_CHARGING); _battery = battery; if (charging) { emit chargingChanged(); } else if (_battery != Batt_CHARGING) { emit batteryChanged(_battery); } } } }
void ofxGamepad::buttonChanged(int button, bool value) { buttonValues[button]=value; value?buttonPressed(button):buttonReleased(button); }
void SliderBase::mouseReleaseEvent(QMouseEvent *e) { int ms = 0; /*double inc = step(); */ // prevent compiler warning: unused variable _ignoreMouseMove = false; const Qt::MouseButton button = e->button(); switch (d_scrollMode) { case ScrMouse: if (button == Qt::RightButton) { d_scrollMode = ScrNone; break; } if (_cursorHoming && button == Qt::LeftButton) d_scrollMode = ScrNone; else { setPosition(e->pos()); d_direction = 0; d_mouseOffset = 0; if (d_mass > 0.0) { ms = d_time.elapsed(); if ((fabs(d_speed) > 0.0) && (ms < 50)) d_tmrID = startTimer(d_updTime); } else { d_scrollMode = ScrNone; buttonReleased(); } } emit sliderReleased(_id); break; case ScrDirect: setPosition(e->pos()); d_direction = 0; d_mouseOffset = 0; d_scrollMode = ScrNone; buttonReleased(); break; case ScrPage: stopMoving(); d_timerTick = 0; buttonReleased(); d_scrollMode = ScrNone; break; case ScrTimer: stopMoving(); d_timerTick = 0; buttonReleased(); d_scrollMode = ScrNone; break; default: d_scrollMode = ScrNone; buttonReleased(); } }