Example #1
0
void ShortcutButton::addShortcut(const QKeySequence &shortcut)
{
    if ( shortcut.isEmpty() || shortcuts().contains(shortcut) )
        return;

    QPushButton *button = new QPushButton(this);
    m_layout->insertWidget( shortcutCount(), button, 1 );
    connect( button, SIGNAL(clicked()),
             this, SLOT(onShortcutButtonClicked()) );
    button->setText( shortcut.toString(QKeySequence::NativeText) );
    emit shortcutAdded(shortcut);
}
Example #2
0
bool QtGlobalShortcutPrivate::setShortcut(const QKeySequence& shortcut)
{
    Qt::KeyboardModifiers allMods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier;
    key = shortcut.isEmpty() ? Qt::Key(0) : Qt::Key((shortcut[0] ^ allMods) & shortcut[0]);
    mods = shortcut.isEmpty() ? Qt::KeyboardModifiers(0) : Qt::KeyboardModifiers(shortcut[0] & allMods);
    const quint32 nativeKey = nativeKeycode(key);
    const quint32 nativeMods = nativeModifiers(mods);
    const bool res = registerShortcut(nativeKey, nativeMods);
    shortcuts.insert(qMakePair(nativeKey, nativeMods), &qxt_p());
    if (!res)
        qWarning() << "QtGlobalShortcut failed to register:" << QKeySequence(key + mods).toString();
    return res;
}
bool Prefs_KeyboardShortcuts::checkKey(int code)
{
	bool ret = false;
	QKeySequence key = QKeySequence(code);
	for (QMap<QString,Keys>::Iterator it=keyMap.begin(); it!=keyMap.end(); ++it)
	{
		if (key.matches(it.value().keySequence) != QKeySequence::NoMatch)
		{
			ret = true;
			break;
		}
	}
	return ret;
}
QString Prefs_KeyboardShortcuts::getAction(int code)
{
	QString ret;
	QKeySequence key = QKeySequence(code);
	for (QMap<QString,Keys>::Iterator it=keyMap.begin(); it!=keyMap.end(); ++it)
	{
		if (key.matches(it.value().keySequence) != QKeySequence::NoMatch)
		{
			ret = it->cleanMenuText;
			break;
		}
	}
	return ret;
}
void GlobalShortcutsSettingsPage::SetShortcut(const QString& id,
                                              const QKeySequence& key) {
  Shortcut& shortcut = shortcuts_[id];

  shortcut.key = key;
  shortcut.item->setText(1, key.toString(QKeySequence::NativeText));
}
Example #6
0
void ShortcutButton::setButtonShortcut(QPushButton *shortcutButton, const QKeySequence &shortcut)
{
    QString label = shortcut.toString(QKeySequence::NativeText);
    label.replace( QChar('&'), QString("&&") );
    shortcutButton->setText(label);
    shortcutButton->setProperty(propertyShortcut, shortcut);
}
Example #7
0
QString ProxyAction::stringWithAppendedShortcut(const QString &str, const QKeySequence &shortcut)
{
    QString s = str;
    s.replace(QLatin1String("&&"), QLatin1String("&"));
    return QString::fromLatin1("%1 <span style=\"color: gray; font-size: small\">%2</span>").
            arg(s, shortcut.toString(QKeySequence::NativeText));
}
Example #8
0
void TkAction::setDefaultShortcuts(const QKeySequence & shortcut0, const QKeySequence & shortcut1, const QKeySequence & shortcut2, const QKeySequence & shortcut3) {
	QList<QKeySequence> shortcuts;
	if (!shortcut0.isEmpty()) {
		shortcuts += shortcut0;
	}
	if (!shortcut1.isEmpty()) {
		shortcuts += shortcut1;
	}
	if (!shortcut2.isEmpty()) {
		shortcuts += shortcut2;
	}
	if (!shortcut3.isEmpty()) {
		shortcuts += shortcut3;
	}
	setDefaultShortcuts(shortcuts);
}
ShortcutEditWidget::ShortcutEditWidget(QWidget *viewport, const QKeySequence &defaultSeq,
                                       const QKeySequence &activeSeq, bool allowLetterShortcuts)
 : TabConnectedWidget(viewport),
   m_defaultKeySequence(defaultSeq),
   m_isUpdating(false)
{
    QGridLayout *layout = new QGridLayout(this);

    m_defaultRadio = new QRadioButton(i18n("Default:"), this);
    m_defaultLabel = new QLabel(i18nc("No shortcut defined", "None"), this);
    QString defaultText = defaultSeq.toString(QKeySequence::NativeText);
    if (defaultText.isEmpty())
        defaultText = i18nc("No shortcut defined", "None");
    m_defaultLabel->setText(defaultText);

    m_customRadio = new QRadioButton(i18n("Custom:"), this);
    m_customEditor = new KKeySequenceWidget(this);
    m_customEditor->setModifierlessAllowed(allowLetterShortcuts);

    layout->addWidget(m_defaultRadio, 0, 0);
    layout->addWidget(m_defaultLabel, 0, 1);
    layout->addWidget(m_customRadio, 1, 0);
    layout->addWidget(m_customEditor, 1, 1);
    layout->setColumnStretch(2, 1);

    setKeySequence(activeSeq);

    connect(m_defaultRadio, SIGNAL(toggled(bool)),
            this, SLOT(defaultToggled(bool)));
    connect(m_customEditor, SIGNAL(keySequenceChanged(QKeySequence)),
            this, SLOT(setCustom(QKeySequence)));
    connect(m_customEditor, SIGNAL(stealShortcut(QKeySequence,KAction*)),
        this, SIGNAL(stealShortcut(QKeySequence,KAction*)));
}
Example #10
0
void NAction::setGlobalShortcut(const QKeySequence &shortcut)
{
	QList<QKeySequence> list;
	if (!shortcut.isEmpty())
		list << shortcut;
	setGlobalShortcuts(list);
}
Example #11
0
void ShortcutConfig::assignShortcut()
      {
      SCListViewItem* active = (SCListViewItem*) scListView->selectedItems()[0];
      int shortcutindex = active->getIndex();
      ShortcutCaptureDialog* sc = new ShortcutCaptureDialog(this, shortcutindex);
      int key = sc->exec();
      delete(sc);
      if (key != Rejected) {
            shortcuts[shortcutindex].key = key;
            QKeySequence keySequence = QKeySequence(key);
            active->setText(SHRT_SHRTCUT_COL, keySequence.toString());
            _config_changed = true;
            clearButton->setEnabled(true);
            }
      defineButton->setDown(false);
      }
void GlobalShortcutsSettingsPage::ChangeClicked() {
  GlobalShortcuts* manager = dialog()->global_shortcuts_manager();
  manager->Unregister();
  QKeySequence key = grabber_->GetKey(shortcuts_[current_id_].s.action->text());
  manager->Register();

  if (key.isEmpty()) return;

  // Check if this key sequence is used by any other actions
  for (const QString& id : shortcuts_.keys()) {
    if (shortcuts_[id].key == key) SetShortcut(id, QKeySequence());
  }

  ui_->radio_custom->setChecked(true);
  SetShortcut(current_id_, key);
}
Example #13
0
void configwidget::acceptShortcut(const QKeySequence& seq)
{
    if (checkUsedShortcuts() == false)
    {
	// iterate for
	if (avalibelGlobalShortcuts(seq) == true)
	{
	    changeShortcut(seq);
	}
	else
	{
	    QMessageBox msg;
	    msg.setWindowTitle(tr("Error"));
	    msg.setText(tr("This key is exist in global shortcuts on yoy system! Please select other keys"));
	    msg.setIcon(QMessageBox::Information);
	    msg.setStandardButtons(QMessageBox::Ok);
	    msg.exec();
	    m_ui->keyWidget->clearKeySequence();
	}
    }
    else if (checkUsedShortcuts() == true && seq.toString() != "")
    {
	QMessageBox msg;
	msg.setWindowTitle(tr("Error"));
	msg.setText(tr("This key is exist! Please select other keys"));
	msg.setIcon(QMessageBox::Information);
	msg.setStandardButtons(QMessageBox::Ok);
	msg.exec();
	m_ui->keyWidget->clearKeySequence();
    }
}
Example #14
0
bool QxtGlobalShortcutPrivate::setShortcut(const QKeySequence &shortcut)
{
    Q_Q(QxtGlobalShortcut);
    Qt::KeyboardModifiers allMods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier;
    key = shortcut.isEmpty() ? Qt::Key(0) : Qt::Key((shortcut[0] ^ allMods) & shortcut[0]);
    mods = shortcut.isEmpty() ? Qt::KeyboardModifiers(Qt::NoModifier) : Qt::KeyboardModifiers(shortcut[0] & allMods);
    const quint32 nativeKey = nativeKeycode(key);
    const quint32 nativeMods = nativeModifiers(mods);
    const bool res = registerShortcut(nativeKey, nativeMods);
    if (res)
        shortcuts.insert({nativeKey, nativeMods}, q);
    else
        qWarning("QxtGlobalShortcut failed to register: %s", qPrintable(QKeySequence(key + mods).toString()));

    return res;
}
Example #15
0
QBoxLayout* CreateSliderValuePairLayout(QDialog* window, QString name, QSpinBox*& value, u16 max,
                                        Qt::Key shortcut_key, QWidget* shortcut_widget, bool invert)
{
  const QKeySequence shortcut_key_sequence = QKeySequence(Qt::ALT + shortcut_key);

  auto* label = new QLabel(QStringLiteral("%1 (%2)").arg(
      name, shortcut_key_sequence.toString(QKeySequence::NativeText)));

  QBoxLayout* layout = new QHBoxLayout;
  layout->addWidget(label);

  value = CreateSliderValuePair(window, layout, max, shortcut_key_sequence, Qt::Horizontal,
                                shortcut_widget, invert);

  return layout;
}
bool UIActionPool::processHotKey(const QKeySequence &key)
{
    /* Get the list of keys: */
    QList<int> keys = m_pool.keys();
    /* Iterate through the whole list of keys: */
    for (int i = 0; i < keys.size(); ++i)
    {
        /* Get current action: */
        UIAction *pAction = m_pool[keys[i]];
        /* Skip menus/separators: */
        if (pAction->type() == UIActionType_Menu)
            continue;
        /* Get the hot key of the current action: */
        QString strHotKey = VBoxGlobal::extractKeyFromActionText(pAction->text());
        if (pAction->isEnabled() && pAction->isVisible() && !strHotKey.isEmpty())
        {
            if (key.matches(QKeySequence(strHotKey)) == QKeySequence::ExactMatch)
            {
                /* We asynchronously post a special event instead of calling
                 * pAction->trigger() directly, to let key presses and
                 * releases be processed correctly by Qt first.
                 * Note: we assume that nobody will delete the menu item
                 * corresponding to the key sequence, so that the pointer to
                 * menu data posted along with the event will remain valid in
                 * the event handler, at least until the main window is closed. */
                QApplication::postEvent(this, new ActivateActionEvent(pAction));
                return true;
            }
        }
    }
    return false;
}
Example #17
0
bool KShortcut::contains(const QKeySequence &needle) const
{
    if (needle.isEmpty()) {
        return false;
    }
    return d->primary == needle || d->alternate == needle;
}
Example #18
0
void ShortcutController::loadShortcuts(ShortcutItem* item) {
	QVariant shortcut = m_config->getQtOption(item->name(), KEY_SECTION);
	if (!shortcut.isNull()) {
		QKeySequence keySequence(shortcut.toString());
		if (item->functions().first) {
			QKeySequence oldShortcut = item->shortcut();
			if (!oldShortcut.isEmpty()) {
				m_heldKeys.take(oldShortcut);
			}
			m_heldKeys[keySequence] = item;
		}
		item->setShortcut(keySequence);
	}
	QVariant button = m_config->getQtOption(item->name(), BUTTON_SECTION);
	if (!button.isNull()) {
		int oldButton = item->button();
		item->setButton(button.toInt());
		if (oldButton >= 0) {
			m_buttons.take(oldButton);
		}
		m_buttons[button.toInt()] = item;
	}
	QVariant axis = m_config->getQtOption(item->name(), AXIS_SECTION);
	if (!axis.isNull()) {
		int oldAxis = item->axis();
		GamepadAxisEvent::Direction oldDirection = item->direction();
		QString axisDesc = axis.toString();
		if (axisDesc.size() >= 2) {
			GamepadAxisEvent::Direction direction = GamepadAxisEvent::NEUTRAL;
			if (axisDesc[0] == '-') {
				direction = GamepadAxisEvent::NEGATIVE;
			}
			if (axisDesc[0] == '+') {
				direction = GamepadAxisEvent::POSITIVE;
			}
			bool ok;
			int axis = axisDesc.mid(1).toInt(&ok);
			if (ok) {
				item->setAxis(axis, direction);
				if (oldAxis >= 0) {
					m_axes.take(qMakePair(oldAxis, oldDirection));
				}
				m_axes[qMakePair(axis, direction)] = item;
			}
		}
	}
}
Example #19
0
void ShortcutLineEdit::setContents(QKeySequence ks)
{
	// Avoiding infinite loop of same signal-slot emitting/calling
	if (ks.toString(QKeySequence::NativeText) == text())
		return;
	
	// Set the keys from the given key sequence
	clear();
	for (uint i = 0; i < ks.count(); ++i)
	{
		keys.append(ks[i]);
	}
	
	// Show Ctrl button as Cmd on Mac
	setText(ks.toString(QKeySequence::NativeText));
	emit contentsChanged();
}
Example #20
0
QSize KxMenuItemWidget::sizeHint() const
{
    // Do not give invisible menu items any space
    if(!fMenuItem->isVisible()) return QSize(0,0);

    QSize sz;

    QWidget *q = parentWidget();
    QStyleOptionMenuItem opt = getStyleOption();
    KxMenuItem *action = fMenuItem;

    const int hmargin = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q),
        iconWidth = q->style()->pixelMetric(QStyle::PM_SmallIconSize, 0, q);

    QFontMetrics fm(action->font().resolve(q->font()));
    if (action->isSeparator()) {
        sz = QSize(2, 2);
    } else {
        // Text
        QString s = action->text();
        int w = fm.width(s);
        QKeySequence shortcutSeq = fMenuItem->shortcut();
        sz.setWidth(w);
        sz.setHeight(fm.height());
        // Keyboard shortcut
        if(!shortcutSeq.isEmpty()) {
            QString shortcut = shortcutSeq.toString(QKeySequence::NativeText);
            w = fm.width(shortcut);
            sz.rwidth() += w + kShortcutRightMargin;
        }
        // Checkbox
        if(action->isCheckable()) {
            sz.rwidth() += iconWidth;
        }
        // option boxes
        sz.rwidth() += iconWidth;
        // Margins
        sz.rwidth() += 2 * hmargin;
    }

    opt.rect = q->rect();
    sz = q->style()->sizeFromContents(QStyle::CT_MenuItem, &opt, sz, q);

    return sz;
}
Example #21
0
void ShortcutsPage::keyCapLineEditTextChanged()
{
    QKeySequence keySeqence = ui->keySequenceEdit->keySequence();
    if (!m_currentItemIndex.isValid())
    {
        return;
    }

    int row = m_currentItemIndex.row();
    QStandardItem* actionItem = m_treeModel->item(row, ACT_NAME_COLUMN);
    QStandardItem* keyseqItem = m_treeModel->item(row, KEY_SEQ_COLUMN);

    QString strCmdName = QString("Cmd%1").arg( actionItem->text() );
    QString strKeySeq  = keySeqence.toString( QKeySequence::PortableText );

    QSettings setting( PENCIL2D, PENCIL2D );
    setting.beginGroup("shortcuts");

    if (isKeySequenceExist(setting, strCmdName, keySeqence))
    {
        QMessageBox msgBox;
        msgBox.setText( tr("Shortcut Conflict!"));
        msgBox.setInformativeText( tr("%1 is already used, overwrite?").arg(keySeqence.toString(QKeySequence::NativeText)) );
        msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
        msgBox.setDefaultButton(QMessageBox::No);
        msgBox.setIcon( QMessageBox::Warning );

        int result = msgBox.exec();

        if ( result != QMessageBox::Yes )
        {
            ui->keySequenceEdit->setKeySequence( keyseqItem->text() );
            return;
        }
        removeDuplicateKeySequence(&setting, keySeqence);
    }

    setting.setValue(strCmdName, strKeySeq);
    setting.endGroup();
    setting.sync();

    treeModelLoadShortcutsSetting();

    qDebug() << "Shortcut " << strCmdName << " = " << strKeySeq;
}
void PreferencesDialog::validateHotkey(QTableWidgetItem* item)
{
    INFO("Validating hotkey");
    if(item->flags() & Qt::ItemIsSelectable) //Only validate cells with hotkeys in them
    {
        QKeySequence keySeq = QKeySequence(item->text());
        QString keySeqString = keySeq.toString();
        if (keySeqString.isEmpty() || (keySeqString.count(QRegExp("[!@#$%^&*()_\"]")) > 0)) {
            WARNING("Failed to validate hotkey(" + keySeqString +"). Resetting to " + oldHotkeyText);
            item->setText(oldHotkeyText);
            this->setFocus(Qt::OtherFocusReason);
            editingHotkeyField = false;
        } else {
            item->setText(keySeqString);
        }
        keysRecorded = 0;
    }
}
Example #23
0
void ShortcutDialog::accept()
{
    QKeySequence seq = shortcut();
    if (!seq.isEmpty()) {
        if (seq[0] == Qt::Key_Escape) {
            reject();
            return;
        }
        if (seq[0] == Qt::Key_Space
        || (seq[0] & Qt::KeyboardModifierMask) == 0) {
            // clear
            widget->clearKeySequence();
            KDialog::accept();
            return;
        }
    }
    KDialog::accept();
}
Example #24
0
bool QxtGlobalShortcut::setShortcut(const QKeySequence &shortcut)
{
    Q_D(QxtGlobalShortcut);
    if (d->key != 0 && !d->unsetShortcut())
        return false;
    if (shortcut.isEmpty())
        return true;
    return d->setShortcut(shortcut);
}
void SweetDisplayStandby::updateRestoreSequence(QKeySequence keySequence)
{
    settings->setValue("restoreSequence", keySequence.toString());
    QList<int> keys = getVirtualKey(keySequence);


    UnregisterHotKey((HWND)SweetDisplayStandby::winId(), restoreHotKeyId);
    RegisterHotKey((HWND)SweetDisplayStandby::winId(), restoreHotKeyId, keys[0], keys[1]);
}
Example #26
0
bool GlobalHotImpl::unregister_hot(const QKeySequence &keys) {
  if (keys.isEmpty()) return false;
  Qt::KeyboardModifiers allMods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier;
  quint32 code = native_keycode(Qt::Key((keys[0] ^ allMods) & keys[0]));
  quint32 mods = native_modifiers(Qt::KeyboardModifiers(keys[0] & allMods));
  unregister_hot(code, mods);
  m_shortcuts.remove(qMakePair(code, mods));
  return true;
}
Example #27
0
QGroupBox* CreateStickInputs(QDialog* window, QString name, QSpinBox*& x_value, QSpinBox*& y_value,
                             u16 max_x, u16 max_y, Qt::Key x_shortcut_key, Qt::Key y_shortcut_key)
{
  const QKeySequence x_shortcut_key_sequence = QKeySequence(Qt::ALT + x_shortcut_key);
  const QKeySequence y_shortcut_key_sequence = QKeySequence(Qt::ALT + y_shortcut_key);

  auto* box =
      new QGroupBox(QStringLiteral("%1 (%2/%3)")
                        .arg(name, x_shortcut_key_sequence.toString(QKeySequence::NativeText),
                             y_shortcut_key_sequence.toString(QKeySequence::NativeText)));

  auto* x_layout = new QHBoxLayout;
  x_value =
      CreateSliderValuePair(window, x_layout, max_x, x_shortcut_key_sequence, Qt::Horizontal, box);

  auto* y_layout = new QVBoxLayout;
  y_value =
      CreateSliderValuePair(window, y_layout, max_y, y_shortcut_key_sequence, Qt::Vertical, box);
  y_value->setMaximumWidth(60);

  auto* visual = new StickWidget(window, max_x, max_y);
  window->connect(x_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
                  &StickWidget::SetX);
  window->connect(y_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
                  &StickWidget::SetY);
  window->connect(visual, &StickWidget::ChangedX, x_value, &QSpinBox::setValue);
  window->connect(visual, &StickWidget::ChangedY, y_value, &QSpinBox::setValue);

  x_value->setValue(max_x / 2);
  y_value->setValue(max_y / 2);

  auto* visual_ar = new AspectRatioWidget(visual, max_x, max_y);

  auto* visual_layout = new QHBoxLayout;
  visual_layout->addWidget(visual_ar);
  visual_layout->addLayout(y_layout);

  auto* layout = new QVBoxLayout;
  layout->addLayout(x_layout);
  layout->addLayout(visual_layout);
  box->setLayout(layout);

  return box;
}
Example #28
0
bool MixxxKeyboard::eventFilter(QObject*, QEvent* e) {
    if (e->type() == QEvent::KeyPress) {
        QKeyEvent* ke = (QKeyEvent *)e;

#ifdef __APPLE__
        // On Mac OSX the nativeScanCode is empty (const 1) http://doc.qt.nokia.com/4.7/qkeyevent.html#nativeScanCode
        // We may loose the release event if a the shift key is pressed later
        // and there is character shift like "1" -> "!"
        int keyId = ke->key();
#else
        int keyId = ke->nativeScanCode();
#endif
        //qDebug() << "KeyPress event =" << ke->key() << "KeyId =" << keyId;

        // Run through list of active keys to see if the pressed key is already active
        // Just for returning true if we are consuming this key event

        foreach (const KeyDownInformation& keyDownInfo, m_qActiveKeyList) {
            if (keyDownInfo.keyId == keyId) {
                return true;
            }
        }

        QKeySequence ks = getKeySeq(ke);
        if (!ks.isEmpty()) {
            // Check if a shortcut is defined
            ConfigKey* pConfigKey = m_pKbdConfigObject->get(ConfigValueKbd(ks));
            if (pConfigKey && pConfigKey->group != "[KeyboardShortcuts]") {
                ControlObject* control = ControlObject::getControl(*pConfigKey);
                if (control) {
                    //qDebug() << pConfigKey->group << pConfigKey->item << "MIDI_NOTE_ON" << 1;
                    control->setValueFromMidi(MIDI_NOTE_ON, 1);
                    // Add key to active key list
                    m_qActiveKeyList.append(KeyDownInformation(
                        keyId, ke->modifiers(), pConfigKey));
                    return true;
                } else {
                    qDebug() << "Warning: Keyboard key is configured for nonexistent control: "
                             << pConfigKey->group << " " << pConfigKey->item;
                    return false;
                }
            }
        }
    } else if (e->type()==QEvent::KeyRelease) {
Example #29
0
// Edit a timer of the list
void MainWindow::editTimerTriggerred()
{
    Timer* timer = getCurrentTimer();

    // Prevent the user to edit the timer if its media is broken
    if (timer->isBroken()) {
        QMessageBox::warning(this, tr("Error"), tr("This timer can't be modified because it's broken"), QMessageBox::Ok);
    }
    else {
        QString filename         = timer->getFilename();
        int period               = timer->getPeriod();
        QKeySequence keySequence = timer->getKeySequence();
        UINT virtualKey          = timer->getVirtualKey();
        UINT modifiers           = timer->getModifiers();

        QPointer<DlgEditTimer> dlg = new DlgEditTimer(filename, period, keySequence, modifiers, virtualKey, this);
        if (dlg->exec() == QDialog::Accepted) {
            try {
                timer->setNewData(dlg->getPeriod(), dlg->getKeySquence(), dlg->getNativeModifiers(), dlg->getNativeVirtualKey(), this->hotkeyID);
                this->hotkeyID++;
            }
            catch (const SMException& exception) {
                QString message = tr("Couldn't modify the timer: %1").arg(exception.getMessage());
                QMessageBox::critical(this, tr("Error"), message, QMessageBox::Ok);
                return;
            }

            int period              = timer->getPeriod();
            QString displayedPeriod = QString("%1:%2").arg(period / 60, 2, 10, QChar('0')).arg(period % 60, 2, 10, QChar('0'));
            TableItem* itemPeriod   = new TableItem(displayedPeriod);

            QKeySequence keySequence = timer->getKeySequence();
            QString displayedHotkey  = keySequence.toString();
            TableItem* itemHotkey    = new TableItem(displayedHotkey);

            int row = getCurrentRow();
            this->timerTable->setItem(row, COLUMN_PERIOD, itemPeriod);
            this->timerTable->setItem(row, COLUMN_HOTKEY, itemHotkey);

            this->modified.setModified(true);
        }
        delete dlg;
    }
}
Example #30
0
void ShortcutConfig::updateSCListView(int category)
      {
      scListView->clear();
      SCListViewItem* newItem;
      //QString catpre;
      for (int i=0; i < SHRT_NUM_OF_ELEMENTS; i++) {
            if (shortcuts[i].type & category) {
                  newItem = new SCListViewItem(scListView, i);
                  newItem->setText(SHRT_DESCR_COL, qApp->translate("shortcuts", shortcuts[i].descr));
                  //if(category == ALL_SHRT)
                  //  catpre = QString(shortcut_category[shortcuts[i].type].name) + QString(": ");
                  //else 
                  //  catpre.clear();  
                  //newItem->setText(SHRT_DESCR_COL, catpre + tr(qApp->translate("shortcuts", shortcuts[i].descr));  // Tim
                  QKeySequence key = QKeySequence(shortcuts[i].key);
                  newItem->setText(SHRT_SHRTCUT_COL, key.toString());
                  }
            }
      }