int WProcess::execute(const QString &command, const QStringList &arguments, const QString &title, bool close_when_finished) { grabKeyboard(); setWindowTitle(title); connect(cmd_p,SIGNAL(readyReadStandardOutput()),this,SLOT(readyReadStandardOutput())); connect(cmd_p,SIGNAL(readyReadStandardError()),this,SLOT(readyReadStandardError())); connect(cmd_p,SIGNAL(error(QProcess::ProcessError )),this,SLOT(error(QProcess::ProcessError ))); connect(cmd_p,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(finished(int,QProcess::ExitStatus))); close_p->setText(tr("Cancel")); text_p->clear(); status_p->setText(tr("Executing %1 ...").arg(command)); cmd_p->start(command,arguments); returned_code=-1; if (cmd_p->waitForStarted()) { status_p->setText(tr("%1 is running").arg(command)); this->close_when_finished=close_when_finished; if (! exec() ) returned_code=-1; } releaseKeyboard(); stdout_p=NULL; return returned_code; }
void IOWindow::OnDetectButtonPressed() { installEventFilter(BlockUserInputFilter::Instance()); grabKeyboard(); grabMouse(); std::thread([this] { auto* btn = m_type == IOWindow::Type::Input ? m_detect_button : m_test_button; const auto old_label = btn->text(); btn->setText(QStringLiteral("...")); const auto expr = MappingCommon::DetectExpression( m_reference, g_controller_interface.FindDevice(m_devq).get(), m_devq, MappingCommon::Quote::Off); btn->setText(old_label); if (!expr.isEmpty()) { const auto list = m_option_list->findItems(expr, Qt::MatchFixedString); if (list.size() > 0) m_option_list->setCurrentItem(list[0]); } releaseMouse(); releaseKeyboard(); removeEventFilter(BlockUserInputFilter::Instance()); }) .detach(); }
void MainWindow::toggleFullscreen() { if (fullScreen_) { fullScreen_ = false; fsGlWidget_->showNormal(); fsGlWidget_->hide(); releaseKeyboard(); mainGlWidget_->makeCurrent(); // mainGlWidget_->show(); } else { fullScreen_ = true; grabKeyboard(); // mainGlWidget_->hide(); fsGlWidget_->makeCurrent(); fsGlWidget_->showFullScreen(); int numScreens = QApplication::desktop()->numScreens(); if (numScreens >= 2) { // Two Screens used by output widget QRect s2 = QApplication::desktop()->screenGeometry(0); s2 = s2.united(QApplication::desktop()->screenGeometry(1)); fsGlWidget_->setGeometry(s2); } } }
void CDisplay::mousePressEvent(QMouseEvent *event) { // Grab keyboard entry if (event->button() == Qt::LeftButton) { // Activate radio from rect if (rectFreq1.contains(event->pos())) { radio = 0; emit radioChanged(radio); } if (rectFreq2.contains(event->pos())) { radio = 1; emit radioChanged(radio); } } if (event->button() == Qt::RightButton) { //setIncrement(ts/10); } if (event->button() == Qt::MiddleButton) { grabKeyboard(); if (radio == 0) frequency1 = ""; else frequency2 = ""; } repaint(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); settings = Settings::getInstance(); // make sure only ME gets keys grabKeyboard(); startScreen(); // initialize finder and capture, check if they start if (!finder.init(source.size) || !capture.init(source.size)) { QMessageBox::warning(this, tr("Can't initialize finder"), finder.error, QMessageBox::Ok); } whatWeSee = source.frame; ui->CVWindow->setImage(&whatWeSee); // set start flags viewMode = NORMAL; recMode = INPUT_; // call hearbeat to initialize image heartBeat(); }
void TabSwitcherWidget::showEvent(QShowEvent *event) { grabKeyboard(); for (int i = 0; i < m_windowsManager->getWindowCount(); ++i) { Window *window = m_windowsManager->getWindowByIndex(i); if (window) { m_model->appendRow(createRow(window)); } } m_model->sort(1, Qt::DescendingOrder); m_tabsView->setCurrentIndex(m_model->index(0, 0)); const int contentsHeight = (m_model->rowCount() * 22); m_tabsView->setMinimumHeight(qMin(contentsHeight, int(height() * 0.9))); QWidget::showEvent(event); connect(m_windowsManager, SIGNAL(windowAdded(qint64)), this, SLOT(tabAdded(qint64))); connect(m_windowsManager, SIGNAL(windowRemoved(qint64)), this, SLOT(tabRemoved(qint64))); }
void QuickButton::mouseMoveEvent(QMouseEvent *e) { if((e->state() & LeftButton) == 0) return; QPoint p(e->pos() - _dragPos); if(p.manhattanLength() <= KGlobalSettings::dndEventDelay()) return; DEBUGSTR << "dragstart" << endl << flush; setDown(false); if(_dragEnabled) { KURL::List uris; uris.append(_qurl->kurl()); DEBUGSTR << "creating KURLDrag" << endl << flush; KURLDrag *dd = new KURLDrag(uris, this); dd->setPixmap(_icon); // PIX DEBUGSTR << "ready to drag" << endl << flush; grabKeyboard(); dd->drag(); releaseKeyboard(); } else { setCursor(Qt::ForbiddenCursor); } }
void MainWindow::fullScreenMode(bool mode) { isFullScreenMouse = mode; if(mode) { _toolbar->hide(); menuBar()->hide(); //setWindowFlags(Qt::FramelessWindowHint); //showMaximized(); showFullScreen(); grabKeyboard(); } else { _toolbar->show(); menuBar()->show(); // setWindowFlags((Qt::WindowFlags)(~Qt::FramelessWindowHint)); showNormal(); releaseKeyboard(); } show(); }
void KeyButton::keyPressEvent(QKeyEvent *keyEvent) { std::string keyText = QKeyUtil::keyName(keyEvent); if (keyEvent->key() == Key_Return) { grabKeyboard(); return; } if (keyEvent->key() == Key_Up || keyEvent->key() == Key_Down) { clearFocus(); releaseKeyboard(); return; } if (!keyText.empty()) { myKeyView.myCurrentKey = keyText; myKeyView.myLabel->setText("Action For " + QString::fromUtf8(keyText.c_str())); myKeyView.myLabel->show(); #if 0 QSizePolicy pol = myKeyView.myLabel->sizePolicy(); pol.setHorData(QSizePolicy::Fixed); myKeyView.myLabel->setSizePolicy(pol); myKeyView.myLabel->setLineWidth(80); pol = myKeyView.myComboBox->sizePolicy(); pol.setHorData(QSizePolicy::Fixed); myKeyView.myComboBox->setSizePolicy(pol); #endif myKeyView.myComboBox->setCurrentItem(((ZLKeyOptionEntry*)myKeyView.myOption)->actionIndex(keyText)); myKeyView.myComboBox->show(); } }
void PixelWidget::keyPressEvent(QKeyEvent *e) { switch (e->key()) { case Qt::Key_Plus: increaseZoom(); break; case Qt::Key_Minus: decreaseZoom(); break; case Qt::Key_PageUp: setGridSize(m_gridSize + 1); break; case Qt::Key_PageDown: setGridSize(m_gridSize - 1); break; case Qt::Key_G: toggleGrid(); break; case Qt::Key_C: if (e->modifiers() & Qt::ControlModifier) copyToClipboard(); break; case Qt::Key_S: if (e->modifiers() & Qt::ControlModifier) { releaseKeyboard(); saveToFile(); } break; case Qt::Key_Control: grabKeyboard(); break; } }
void EditSingleShortcut::startRecording_() { if(!is_recording_) { grabKeyboard(); is_recording_ = true; } }
SelectionOverlay::SelectionOverlay(QWidget *parent) : QGraphicsView(parent) { setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setStyleSheet( "QGraphicsView { border-style: none; }" ); Qt::WindowStates state = windowState(); state |= Qt::WindowFullScreen; state |= Qt::WindowActive; grabKeyboard(); grabMouse(); scene = new QGraphicsScene(this); scene->setItemIndexMethod(QGraphicsScene::NoIndex); rubberBand = new TransparentRubberBand(QRubberBand::Rectangle, this); rubberBand->setGeometry(0,0,0,0); rubberBandRect = new QGraphicsRectItem(rubberBand->geometry()); rubberBandRect->setBrush(QBrush(QColor(100,100,100,0))); rbGeometryBeforeResize = QRect(0,0,0,0); resizingFrom = MOUSE_OUT; selRectStart = QPoint(0,0); selRectEnd = QPoint(0,0); rbDistX = 0; rbDistY = 0; drawingRubberBand = resizingRubberBand = movingRubberBand = false; setScene(scene); setWindowState( state ); setMouseTracking(true); //Set mau5 cursor setCursor(crossShape); }
long GUISUMOAbstractView::onKeyPress(FXObject* o, FXSelector sel, void* data) { FXEvent* e = (FXEvent*) data; if ((e->state & ALTMASK) != 0) { setDefaultCursor(getApp()->getDefaultCursor(DEF_CROSSHAIR_CURSOR)); grabKeyboard(); } /* switch(e->code) { case KEY_Left: myChanger->move((SUMOReal) -p2m((SUMOReal) getWidth()/10), 0); break; case KEY_Right: myChanger->move((SUMOReal) p2m((SUMOReal) getWidth()/10), 0); break; case KEY_Up: myChanger->move(0, (SUMOReal) -p2m((SUMOReal) getHeight()/10)); break; case KEY_Down: myChanger->move(0, (SUMOReal) p2m((SUMOReal) getHeight()/10)); break; default: break; } */ return FXGLCanvas::onKeyPress(o, sel, data); }
bool HotkeyWidget::event(QEvent *event) { if (event->type() == QEvent::LanguageChange) { setHotkeyText(); } else if (event->type() == QEvent::KeyPress) { keyPressEvent(static_cast<QKeyEvent *>(event)); return true; } else if (event->type() == QEvent::FocusIn) { QFocusEvent *focusEvent = static_cast<QFocusEvent *>(event); if (focusEvent->reason() != Qt::TabFocusReason) { setText(tr("Type your hotkey")); mKeyboardFocus = false; grabKeyboard(); } else { mKeyboardFocus = true; } } else if (event->type() == QEvent::FocusOut) { if (text() == tr("Invalid hotkey")) { emit invalidHotkeyError(); showError(); } releaseKeyboard(); setHotkeyText(); // Reset the text } else if ((event->type() == QEvent::KeyPress || event->type() == QEvent::ShortcutOverride || event->type() == QEvent::Shortcut) && hasFocus()) { event->accept(); return true; } return QPushButton::event(event); }
void LineEdit::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { setCursor(Qt::IBeamCursor); grabKeyboard(); d->mState = PrivateLineEdit::FOCUSED; update(); }
RotationSettings::RotationSettings( QWidget* parent, Qt::WFlags fl ) : QDialog( parent, fl ), changeRotTo(-1) { setupUi(this); reset(); rot0->setIcon(QIcon(":icon/up")); connect(rot0, SIGNAL(clicked()),this, SLOT(applyRotation())); rot90->setIcon(QIcon(":icon/left")); connect(rot90, SIGNAL(clicked()),this, SLOT(applyRotation())); rot180->setIcon(QIcon(":icon/down")); connect(rot180, SIGNAL(clicked()),this, SLOT(applyRotation())); rot270->setIcon(QIcon(":icon/right")); connect(rot270, SIGNAL(clicked()),this, SLOT(applyRotation())); rotation_message->setAlignment(Qt::AlignCenter); rotation_message->setWordWrap(true); grabKeyboard(); QString display = qgetenv("QWS_DISPLAY"); qLog(Hardware) << display; // transformed can be capitalized or not. if ( display.indexOf("ransformed:") == -1 ) rotation_message->setText(tr("Rotion will not work because the Transformed driver is not in use.")); }
void QKeyButton::startGrab() { if (m_bGrab) return; m_bGrab = true; grabKeyboard(); grabMouse(QCursor(IbeamCursor)); }
void PreferencesDialog::setAccelKey() { KeyActionListViewItem* item = (KeyActionListViewItem*)keyboardAccelListView->currentItem(); if( item == NULL ) return; item->setText( 1, tr( "<press key>" ) ); grabAccelKeyFor = item; grabKeyboard(); }
void Frame::showFullScreen() { QDesktopWidget * desktop = qApp->desktop(); setFixedSize(desktop->geometry().size()); show(); grabKeyboard(); grabMouse(); }
void KeySequenceWidget::startRecording() { keySequence() = KeySequence(); setDown(true); setFocus(); grabKeyboard(); setStatus(Recording); }
// // Set the mode (Design/Operate) // void VirtualConsole::slotModeChanged() { QString config; // // Key repeat // _app->settings()->get(KEY_VIRTUAL_CONSOLE_KEYREPEAT, config); if (config == Settings::trueValue()) { Display* display; display = XOpenDisplay(NULL); ASSERT(display != NULL); if (_app->mode() == App::Design) { XAutoRepeatOn(display); } else { XAutoRepeatOff(display); } XCloseDisplay(display); } // // Grab keyboard // _app->settings()->get(KEY_VIRTUAL_CONSOLE_GRABKB, config); if (config == Settings::trueValue()) { if (_app->mode() == App::Design) { releaseKeyboard(); } else { grabKeyboard(); } } if (_app->mode() == App::Operate) { // Don't allow editing in operate mode m_editMenu->setEnabled(false); m_addMenu->setEnabled(false); m_toolsMenu->setItemEnabled(KVCMenuToolsSettings, false); } else { // Allow editing in design mode m_editMenu->setEnabled(true); m_addMenu->setEnabled(true); m_toolsMenu->setItemEnabled(KVCMenuToolsSettings, true); } }
void ColorPickerWidget::slotSetupEventFilter() { emit disableCurrentFilter(true); m_filterActive = true; setFocus(); installEventFilter(this); grabMouse(QCursor(KoIconUtils::themedIcon(QStringLiteral("color-picker")).pixmap(32, 32), 16, 2)); grabKeyboard(); }
void VirtualKeyboardQt::Show(void) { grabKeyboard(); MythDialog::Show(); if (m_parentEdit) m_parentEdit->setFocus(); }
GameWidget::GameWidget(Scene *scene, QWidget *parent) : QGraphicsView(parent), m_scene(scene), m_timeLabel(this), m_checkpointRemainingLabel(this), m_paused(false), m_cameraScale(1.f), m_frameCount(0), m_timeBeforeStartLabel(this) { if (!scene) { QMessageBox::information(nullptr, "Erreur (GameWidget)", "Aucune scène a afficher!", 0); } else if (!scene->loaded()) { QMessageBox::information(nullptr, "Erreur (GameWidget)", "Le niveau n'a pas été chargé!", 0); } else { this->setCursor(Qt::BlankCursor); //Placement du label du timer m_timeLabel.setGeometry(0,0,500,50); m_timeLabel.setStyleSheet("color: white;font: 24pt \"Leelawadee UI\";"); //Placement du label du nombre de checkpoints restants m_checkpointRemainingLabel.setGeometry(parent->width()-250,0,250,50); m_checkpointRemainingLabel.setStyleSheet("color: white;font: 14pt \"Leelawadee UI\";"); //Placement du label du affichant le temps avant le début de la partie m_timeBeforeStartLabel.setGeometry(350,250,100,100); m_timeBeforeStartLabel.setStyleSheet("font: 72pt \"Leelawadee UI\";"); // prépare la scène pour l'affichage this->setScene(scene->graphicsScene()); this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // réglages du clavier grabKeyboard(); scene->setPlayerInput(&m_playerInput); // démarrage du timer de rafraichissement du jeu startTimer(sf::seconds(1/60.f).asMilliseconds()); //Centrage de la caméra View view = m_scene->calcViewPoint(); centerOn(view.position()); //Démarrage du timer de début de course ( 3,2,1 -> Go) m_preStartTimer = new PreStartTimer(this); m_preStartTimer->startTimer(); connect(m_preStartTimer,SIGNAL(startGame()),this,SLOT(startGame())); } }
HotkeyDialog::HotkeyDialog(quint32 key, quint32 mod, QWidget *parent) : QDialog(parent) { ui.setupUi(this); m_key = key; m_modifiers = mod; ui.keyLineEdit->setText(HotkeyManager::getKeyString(m_key, m_modifiers)); grabKeyboard(); }
GameWindow::GameWindow(QWidget *parent) : QDialog(parent), m_scene(nullptr), ui(new Ui::GameWindow) { ui->setupUi(this); grabKeyboard(); startTimer(sf::seconds(1/60.f).asMilliseconds()); }
void RemoteView::focusInEvent(QFocusEvent *event) { if (m_grabAllKeys) { m_keyboardIsGrabbed = true; grabKeyboard(); } QWidget::focusInEvent(event); }
void ColorPicker::showEvent(QShowEvent *) { updatePosition(); mTimer->start(); QTimer::singleShot(100, this, [this]() { grabKeyboard(); grabMouse(Qt::CrossCursor); }); }
void ScreenSelector::startSelection() { m_selectionInProgress = false; if (!m_eventFilter) m_eventFilter = new EventFilter(this); QApplication::instance()->installEventFilter(m_eventFilter); grabMouse(); grabKeyboard(); MAIN.setCursor(Qt::CrossCursor); }
void QgsCompoundColorWidget::on_mSampleButton_clicked() { //activate picker color QPixmap samplerPixmap = QPixmap( ( const char ** ) sampler_cursor ); setCursor( QCursor( samplerPixmap, 0, 0 ) ); grabMouse(); grabKeyboard(); mPickingColor = true; setMouseTracking( true ); }