ShortcutEditorWidget::ShortcutEditorWidget(const QString &action, const QString &shortcut, QWidget *parent) : QWidget(parent), m_action(action), m_sequenceEdit(new QKeySequenceEdit(this)), m_clearButton(new QToolButton(this)), m_restoreButton(new QToolButton(this)) { QHBoxLayout *layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_sequenceEdit); layout->addWidget(m_clearButton); layout->addWidget(m_restoreButton); m_sequenceEdit->setToolTip(tr("Shortcut")); m_sequenceEdit->setKeySequence(shortcut); m_clearButton->setToolTip(tr("Clear")); m_clearButton->setIcon(QIcon(":/icons/edit-clear-locationbar-rtl.png")); m_restoreButton->setToolTip(tr("Restore Default")); m_restoreButton->setIcon(QIcon(":/icons/edit-undo.png")); shortcutChanged(); setLayout(layout); setFocusPolicy(Qt::StrongFocus); connect(m_sequenceEdit, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(shortcutChanged())); connect(m_clearButton, SIGNAL(clicked()), m_sequenceEdit, SLOT(clear())); connect(m_restoreButton, SIGNAL(clicked()), this, SIGNAL(restore())); }
void MyMenuItem::setShortcut(const QString &shortcut) { if( m_shortcut->setShortcut (QKeySequence(shortcut)) ){ QAction::setShortcut (QKeySequence(shortcut)); emit shortcutChanged (shortcut); }else{ qDebug()<<"设置"+shortcut+"热键出错"; emit shortcutChanged ("set shortcut error"); } }
ConfigureDialog::ConfigureDialog(QSettings *settings, QWidget *parent) : QDialog(parent), ui(new Ui::ConfigureDialog), mSettings(settings), mOldSettings(new RazorSettingsCache(settings)) { ui->setupUi(this); connect(ui->buttonBox->button(QDialogButtonBox::Reset), SIGNAL(clicked()), this, SLOT(resetSettings())); // Position ................................. ui->positionCbx->addItem(tr("Top edge of screen"), QVariant(ConfigureDialog::PositionTop)); ui->positionCbx->addItem(tr("Center of screen"), QVariant(ConfigureDialog::PositionCenter)); connect(ui->positionCbx, SIGNAL(currentIndexChanged(int)), this, SLOT(positionCbxChanged(int))); // Monitor .................................. QDesktopWidget *desktop = qApp->desktop(); ui->monitorCbx->addItem(tr("Monitor where the mouse"), QVariant(0)); int monCnt = desktop->screenCount(); for (int i=0; i<monCnt; ++i) { ui->monitorCbx->addItem(tr("Always on %1 monitor").arg(i+1), QVariant(i+1)); } ui->monitorCbx->setEnabled(monCnt > 1); connect(ui->monitorCbx, SIGNAL(currentIndexChanged(int)), this, SLOT(monitorCbxChanged(int))); // Shortcut ................................. connect(ui->shortcutEd, SIGNAL(keySequenceChanged(QString)), this, SLOT(shortcutChanged(QString))); settingsChanged(); }
LXQtMainMenuConfiguration::LXQtMainMenuConfiguration(QSettings &settings, GlobalKeyShortcut::Action * shortcut, const QString &defaultShortcut, QWidget *parent) : QDialog(parent), ui(new Ui::LXQtMainMenuConfiguration), mSettings(settings), mOldSettings(settings), mDefaultShortcut(defaultShortcut), mShortcut(shortcut) { setAttribute(Qt::WA_DeleteOnClose); setObjectName("MainMenuConfigurationWindow"); ui->setupUi(this); ui->chooseMenuFilePB->setIcon(XdgIcon::fromTheme("folder")); connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*))); loadSettings(); connect(ui->showTextCB, SIGNAL(toggled(bool)), this, SLOT(showTextChanged(bool))); connect(ui->textLE, SIGNAL(textEdited(QString)), this, SLOT(textButtonChanged(QString))); connect(ui->chooseMenuFilePB, SIGNAL(clicked()), this, SLOT(chooseMenuFile())); connect(ui->menuFilePathLE, &QLineEdit::textChanged, [this] (QString const & file) { mSettings.setValue(QLatin1String("menu_file"), file); }); connect(ui->shortcutEd, SIGNAL(shortcutGrabbed(QString)), this, SLOT(shortcutChanged(QString))); connect(ui->shortcutEd->addMenuAction(tr("Reset")), SIGNAL(triggered()), this, SLOT(shortcutReset())); connect(ui->customFontCB, SIGNAL(toggled(bool)), this, SLOT(customFontChanged(bool))); connect(ui->customFontSizeSB, SIGNAL(valueChanged(int)), this, SLOT(customFontSizeChanged(int))); connect(mShortcut, &GlobalKeyShortcut::Action::shortcutChanged, this, &LXQtMainMenuConfiguration::globalShortcutChanged); }
void QQuickMenuItem::unbindFromAction(QObject *o) { if (!o) return; if (o == m_boundAction) m_boundAction = 0; QQuickAction *action = qobject_cast<QQuickAction *>(o); if (!action) return; disconnect(action, SIGNAL(destroyed(QObject*)), this, SLOT(unbindFromAction(QObject*))); disconnect(action, SIGNAL(triggered()), this, SIGNAL(triggered())); disconnect(action, SIGNAL(toggled(bool)), this, SLOT(updateChecked())); disconnect(action, SIGNAL(exclusiveGroupChanged()), this, SIGNAL(exclusiveGroupChanged())); disconnect(action, SIGNAL(enabledChanged()), this, SLOT(updateEnabled())); disconnect(action, SIGNAL(textChanged()), this, SLOT(updateText())); disconnect(action, SIGNAL(shortcutChanged(QVariant)), this, SLOT(updateShortcut())); disconnect(action, SIGNAL(checkableChanged()), this, SIGNAL(checkableChanged())); disconnect(action, SIGNAL(iconNameChanged()), this, SLOT(updateIcon())); disconnect(action, SIGNAL(iconNameChanged()), this, SIGNAL(iconNameChanged())); disconnect(action, SIGNAL(iconSourceChanged()), this, SLOT(updateIcon())); disconnect(action, SIGNAL(iconSourceChanged()), this, SIGNAL(iconSourceChanged())); }
void StelShortcut::setText(const QString &text) { m_text = text; m_action->setText(text); m_action->setProperty("englishText", QVariant(text)); emit shortcutChanged(this); }
UIConfig::UIConfig(QWidget *parent) : QDialog(parent), ui(new Ui::UIConfig) { ui->setupUi(this); _removing_thumbnails = false; settings = new QSettings("settings.ini", QSettings::IniFormat); timeoutValueEditor = new UIListEditor(this); timeoutValueEditor->setModal(true); dialogFolderShortcut = new DialogFolderShortcut(this); dialogFolderShortcut->setModal(true); userAgentStrings.insert("Wget", "Wget/1.12"); userAgentStrings.insert("Opera", "Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14"); userAgentStrings.insert("Firefox", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0"); userAgentStrings.insert("Chrome", "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36"); loadSettings(); loadShortcuts(); connect(timeoutValueEditor, SIGNAL(valuesChanged()), this, SLOT(loadSettings())); connect(ui->cbUseProxy, SIGNAL(toggled(bool)), this, SLOT(toggleProxy(bool))); connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(editShortcutItem(QListWidgetItem*))); connect(folderShortcuts, SIGNAL(shortcutsChanged()), this, SLOT(loadShortcuts())); connect(dialogFolderShortcut, SIGNAL(shortcutChanged(QString,QString,QString)), folderShortcuts, SLOT(updateShortcut(QString,QString,QString))); connect(dialogFolderShortcut, SIGNAL(editCanceled()), this, SLOT(loadShortcuts())); connect(ui->btnDeleteAllThumbnails, SIGNAL(clicked()), this, SIGNAL(deleteAllThumbnails())); connect(ui->btnDeleteAllThumbnails, SIGNAL(clicked()), this, SLOT(thumbnailDeletionStarted())); }
void KMFolder::setShortcut( const KShortcut &sc ) { if ( mShortcut != sc ) { mShortcut = sc; emit shortcutChanged( this ); } }
ShortcutDialog::ShortcutDialog(QWidget* parent, const char* name, Qt::WFlags) : QWidget(parent), Ui_ShortcutDialogData(), ModularWidget(name), PreferencesEntry() { // apply the dialogs layout setupUi(this); // define the dialogs section name in the INIFile setINIFileSectionName("BALLVIEWSHORTCUTS"); setObjectName(name); // defines the dialogs Entry name setWidgetStackName(String(tr("Shortcuts"))); registerWidgets_(); //The shortcut registry has should be saved along with the other options for shortcuts registerObject_(ShortcutRegistry::getInstance(0)); //The search should not be stored from session to session unregisterObject_(searchEdit); //TODO //registerWidgetForHelpSystem_(widget_stack->widget(0), "shortcuts.html#shortcuts"); hide(); connect(browse_export_button, SIGNAL(clicked()), this, SLOT(browseExportFile_())); connect(browse_import_button, SIGNAL(clicked()), this, SLOT(browseImportFile_())); connect(tableView, SIGNAL(shortcutChanged()), this, SLOT(shortcutChanged_())); }
void QQuickMenuItem::bindToAction(QQuickAction *action) { m_boundAction = action; connect(m_boundAction, SIGNAL(destroyed(QObject*)), this, SLOT(unbindFromAction(QObject*))); connect(m_boundAction, SIGNAL(triggered()), this, SIGNAL(triggered())); connect(m_boundAction, SIGNAL(toggled(bool)), this, SLOT(updateChecked())); connect(m_boundAction, SIGNAL(exclusiveGroupChanged()), this, SIGNAL(exclusiveGroupChanged())); connect(m_boundAction, SIGNAL(enabledChanged()), this, SLOT(updateEnabled())); connect(m_boundAction, SIGNAL(textChanged()), this, SLOT(updateText())); connect(m_boundAction, SIGNAL(shortcutChanged(QVariant)), this, SLOT(updateShortcut())); connect(m_boundAction, SIGNAL(checkableChanged()), this, SIGNAL(checkableChanged())); connect(m_boundAction, SIGNAL(iconNameChanged()), this, SLOT(updateIcon())); connect(m_boundAction, SIGNAL(iconNameChanged()), this, SIGNAL(iconNameChanged())); connect(m_boundAction, SIGNAL(iconSourceChanged()), this, SLOT(updateIcon())); connect(m_boundAction, SIGNAL(iconSourceChanged()), this, SIGNAL(iconSourceChanged())); if (m_boundAction->parent() != this) { updateText(); updateShortcut(); updateEnabled(); updateIcon(); if (checkable()) updateChecked(); } }
void ShortcutViewer::removeShortcut() { if (m_action) { CommandManager::instance()->setShortcut(m_action, ""); emit shortcutChanged(); update(); } }
void ShortcutCatcher::doneRecording() { m_isRecording = false; m_btnChange->releaseKeyboard(); m_btnChange->setDown(false); updateDisplayShortcut(); emit shortcutChanged(m_currentSequence); }
RazorMainMenu::RazorMainMenu(const IRazorPanelPluginStartupInfo &startupInfo): QObject(), IRazorPanelPlugin(startupInfo), mMenu(0), mShortcut(0), mLockCascadeChanges(false) { mButton.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); connect(&mButton, SIGNAL(clicked()), this, SLOT(showMenu())); mPowerManager = new PowerManager(this); mScreenSaver = new ScreenSaver(this); settingsChanged(); connect(mShortcut, SIGNAL(activated()), this, SLOT(showHideMenu())); connect(mShortcut, SIGNAL(shortcutChanged(QString,QString)), this, SLOT(shortcutChanged(QString,QString))); }
QQuickMenuItem::QQuickMenuItem(QObject *parent) : QQuickMenuText(parent, QQuickMenuItemType::Item), m_boundAction(0) { connect(this, SIGNAL(__textChanged()), this, SIGNAL(textChanged())); connect(action(), SIGNAL(shortcutChanged(QVariant)), this, SLOT(updateShortcut())); connect(action(), SIGNAL(triggered()), this, SIGNAL(triggered())); connect(action(), SIGNAL(toggled(bool)), this, SLOT(updateChecked())); if (platformItem()) connect(platformItem(), SIGNAL(activated()), this, SLOT(trigger())); }
void ShortcutTableView::editSuccess_() { if(edited_row_ < 0) { return; } if(model()->setData(model()->index(edited_row_, 1, QModelIndex()), QVariant::fromValue(editor_->getKeySequence()))) { emit shortcutChanged(); } }
ActionImpl::ActionImpl(ClientImpl *client, Action *interface, const QString &path, const QString &description, QObject *parent) : QObject(parent) , mClient(client) , mInterface(interface) , mPath(path) , mDescription(description) { new OrgLxqtActionClientAdaptor(this); connect(this, SIGNAL(emitActivated()), mInterface, SIGNAL(activated())); connect(this, SIGNAL(emitShortcutChanged(QString, QString)), mInterface, SIGNAL(shortcutChanged(QString, QString))); }
void StelShortcut::setGlobal(bool g) { m_global = g; if (g) { m_action->setShortcutContext(Qt::ApplicationShortcut); } else { m_action->setShortcutContext(Qt::WidgetShortcut); } emit shortcutChanged(this); }
void QQuickMenuItem::updateShortcut() { if (platformItem()) { QKeySequence sequence; QVariant var = shortcut(); if (var.type() == QVariant::Int) sequence = QKeySequence(static_cast<QKeySequence::StandardKey>(var.toInt())); else sequence = QKeySequence::fromString(var.toString(), QKeySequence::NativeText); platformItem()->setShortcut(sequence); syncWithPlatformMenu(); } emit shortcutChanged(); }
void StelShortcut::setScript(const QString &scriptText) { QString scriptsDir = StelFileMgr::findFile("scripts/", StelFileMgr::Directory); QString preprocessedScript; if (!StelMainGraphicsView::getInstance().getScriptMgr().preprocessScript( scriptText, preprocessedScript, scriptsDir)) { qWarning() << "Failed to preprocess script " << m_script; return; } m_script = preprocessedScript; connect(m_action, SIGNAL(triggered()), this, SLOT(runScript())); emit shortcutChanged(this); }
ShortcutPopup::ShortcutPopup() : Dialog(TApp::instance()->getMainWindow(), false, false, "Shortcut") { setWindowTitle(tr("Configure Shortcuts")); m_list = new ShortcutTree(this); m_list->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); m_sViewer = new ShortcutViewer(this); m_removeBtn = new QPushButton(tr("Remove"), this); m_topLayout->setMargin(5); m_topLayout->setSpacing(8); { m_topLayout->addWidget(m_list, 1); QHBoxLayout *bottomLayout = new QHBoxLayout(); bottomLayout->setMargin(0); bottomLayout->setSpacing(1); { bottomLayout->addWidget(m_sViewer, 1); bottomLayout->addWidget(m_removeBtn, 0); } m_topLayout->addLayout(bottomLayout, 0); } connect( m_list, SIGNAL(actionSelected(QAction *)), m_sViewer, SLOT(setAction(QAction *))); connect( m_removeBtn, SIGNAL(clicked()), m_sViewer, SLOT(removeShortcut())); connect( m_sViewer, SIGNAL(shortcutChanged()), m_list, SLOT(onShortcutChanged())); }
void QQuickAction::setShortcut(const QVariant &arg) { QKeySequence sequence; if (arg.type() == QVariant::Int) sequence = QKeySequence(static_cast<QKeySequence::StandardKey>(arg.toInt())); else sequence = QKeySequence::fromString(arg.toString()); if (sequence == m_shortcut) return; if (!m_shortcut.isEmpty()) QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(0, this, m_shortcut); m_shortcut = sequence; if (!m_shortcut.isEmpty()) { Qt::ShortcutContext context = Qt::WindowShortcut; QGuiApplicationPrivate::instance()->shortcutMap.addShortcut(this, m_shortcut, context, qShortcutContextMatcher); } emit shortcutChanged(shortcut()); }
RazorMainMenuConfiguration::RazorMainMenuConfiguration(QSettings &settings, QWidget *parent) : QDialog(parent), ui(new Ui::RazorMainMenuConfiguration), mSettings(settings), mOldSettings(settings) { setAttribute(Qt::WA_DeleteOnClose); setObjectName("MainMenuConfigurationWindow"); ui->setupUi(this); connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*))); connect(ui->showTextCB, SIGNAL(toggled(bool)), ui->textL, SLOT(setEnabled(bool))); connect(ui->showTextCB, SIGNAL(toggled(bool)), ui->textLE, SLOT(setEnabled(bool))); loadSettings(); connect(ui->showTextCB, SIGNAL(toggled(bool)), this, SLOT(showTextChanged(bool))); connect(ui->textLE, SIGNAL(textEdited(QString)), this, SLOT(textButtonChanged(QString))); connect(ui->chooseMenuFilePB, SIGNAL(clicked()), this, SLOT(chooseMenuFile())); connect(ui->shortcutEd, SIGNAL(keySequenceChanged(QString)), this, SLOT(shortcutChanged(QString))); }
void ShortcutViewer::keyPressEvent(QKeyEvent *event) { int key = event->key(); if (key == Qt::Key_Control || key == Qt::Key_Shift || key == Qt::Key_Alt) { event->ignore(); return; } Qt::KeyboardModifiers modifiers = event->modifiers(); // Tasti che non possono essere utilizzati come shortcut if ((modifiers | (Qt::CTRL | Qt::SHIFT | Qt::ALT)) != (Qt::CTRL | Qt::SHIFT | Qt::ALT) || key == Qt::Key_Home || key == Qt::Key_End || key == Qt::Key_PageDown || key == Qt::Key_PageUp || key == Qt::Key_Escape || key == Qt::Key_Print || key == Qt::Key_Pause || key == Qt::Key_ScrollLock) { if (key != Qt::Key_Plus && key != Qt::Key_Minus && key != Qt::Key_Asterisk && key != Qt::Key_Slash) { event->ignore(); return; } else modifiers = 0; } if (m_action) { CommandManager *cm = CommandManager::instance(); QKeySequence keySequence(key + modifiers); std::string shortcutString = keySequence.toString().toStdString(); QAction *oldAction = cm->getActionFromShortcut(keySequence.toString().toStdString()); if (oldAction == m_action) return; if (oldAction) { QString msg = tr("%1 is already assigned to '%2'\nAssign to '%3'?").arg(keySequence.toString()).arg(oldAction->iconText()).arg(m_action->iconText()); int ret = DVGui::MsgBox(msg, tr("Yes"), tr("No"), 1); activateWindow(); if (ret == 2 || ret == 0) return; } CommandManager::instance()->setShortcut(m_action, shortcutString); emit shortcutChanged(); } event->accept(); update(); }
LxQtMainMenuConfiguration::LxQtMainMenuConfiguration(QSettings &settings, const QString &defaultShortcut, QWidget *parent) : QDialog(parent), ui(new Ui::LxQtMainMenuConfiguration), mSettings(settings), mOldSettings(settings), mDefaultShortcut(defaultShortcut) { setAttribute(Qt::WA_DeleteOnClose); setObjectName("MainMenuConfigurationWindow"); ui->setupUi(this); connect(ui->buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonsAction(QAbstractButton*))); connect(ui->showTextCB, SIGNAL(toggled(bool)), ui->textL, SLOT(setEnabled(bool))); connect(ui->showTextCB, SIGNAL(toggled(bool)), ui->textLE, SLOT(setEnabled(bool))); loadSettings(); connect(ui->showTextCB, SIGNAL(toggled(bool)), this, SLOT(showTextChanged(bool))); connect(ui->textLE, SIGNAL(textEdited(QString)), this, SLOT(textButtonChanged(QString))); connect(ui->chooseMenuFilePB, SIGNAL(clicked()), this, SLOT(chooseMenuFile())); connect(ui->shortcutEd, SIGNAL(shortcutGrabbed(QString)), this, SLOT(shortcutChanged(QString))); connect(ui->shortcutEd->addMenuAction(tr("Reset")), SIGNAL(triggered()), this, SLOT(shortcutReset())); }
Dialog::Dialog(QWidget *parent) : QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint), ui(new Ui::Dialog), mSettings(new LxQt::Settings("lxqt-runner", this)), mGlobalShortcut(0), mLockCascadeChanges(false), mConfigureDialog(0) { ui->setupUi(this); setWindowTitle("LXDE-Qt Runner"); connect(LxQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(update())); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(mSettings, SIGNAL(settingsChanged()), this, SLOT(applySettings())); ui->commandEd->installEventFilter(this); connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); connect(ui->commandEd, SIGNAL(returnPressed()), this, SLOT(runCommand())); mCommandItemModel = new CommandItemModel(this); ui->commandList->installEventFilter(this); ui->commandList->setModel(mCommandItemModel); ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers); connect(ui->commandList, SIGNAL(clicked(QModelIndex)), this, SLOT(runCommand())); setFilter(""); dataChanged(); ui->commandList->setItemDelegate(new HtmlDelegate(QSize(32, 32), ui->commandList)); // Popup menu ............................... QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure lxqt-runner"), this); connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog())); addAction(a); // a = new QAction(XdgIcon::fromTheme("edit-clear-history"), tr("Clear lxqt-runner History"), this); // connect(a, SIGNAL(triggered()), mCommandItemModel, SLOT(clearHistory())); // addAction(a); mPowerManager = new LxQt::PowerManager(this); addActions(mPowerManager->availableActions()); mScreenSaver = new LxQt::ScreenSaver(this); addActions(mScreenSaver->availableActions()); setContextMenuPolicy(Qt::ActionsContextMenu); QMenu *menu = new QMenu(this); menu->addActions(actions()); ui->actionButton->setMenu(menu); ui->actionButton->setIcon(XdgIcon::fromTheme("configure")); // End of popup menu ........................ applySettings(); connect(mGlobalShortcut, SIGNAL(activated()), this, SLOT(showHide())); connect(mGlobalShortcut, SIGNAL(shortcutChanged(QString, QString)), this, SLOT(shortcutChanged(QString, QString))); resize(mSettings->value("dialog/width", 400).toInt(), size().height()); connect(mCommandItemModel, SIGNAL(layoutChanged()), this, SLOT(dataChanged())); }
void StelShortcut::setCheckable(bool c) { m_checkable = c; m_action->setCheckable(c); emit shortcutChanged(this); }
void StelShortcut::setAutoRepeat(bool ar) { m_autoRepeat = ar; m_action->setAutoRepeat(ar); emit shortcutChanged(this); }
void StelShortcut::setPrimaryKey(const QKeySequence &key) { m_primaryKey = key; updateActionShortcuts(); emit shortcutChanged(this); }
void StelShortcut::setTemporary(bool temp) { m_temporary = temp; emit shortcutChanged(this); }
void StelShortcut::setScriptPath(const QString &scriptPath) { m_scriptFile = scriptPath; emit shortcutChanged(this); }