コード例 #1
0
ファイル: configwidget.cpp プロジェクト: powder96/Pastexen
void ConfigWidget::changeHotkey()
{
    ScanHotkeyDialog dial(this);
    dial.setModal(true);
    if (dial.exec()) {
        QPushButton* b = qobject_cast<QPushButton*>(sender());
        if (b) {
            QString settingsKey("general/");
            settingsKey += b->objectName();

            _settings->setValue(settingsKey, dial.key());

            b->setText(dial.key());

            registerActualHotkeys();
        }
    }
}
コード例 #2
0
ファイル: configwidget.cpp プロジェクト: riartem/Pastexen
ConfigWidget::ConfigWidget(QMap<QString, QString> &languages, QWidget *parent)
    : QWidget(parent),
      _languages(languages),
      _hotKeys(new UGlobalHotkeys(parent))
{
    _ui.setupUi(this);

    this->setGeometry(QDesktopWidget().availableGeometry().center().x() - (this->width() / 2),
                      QDesktopWidget().availableGeometry().center().y() - (this->height() / 2),
                       this->width(), this->height());
    this->setFixedSize(this->size());

    connect(_ui.cancelButton, SIGNAL(clicked()), this, SLOT(hide()));
    connect(_ui.applyButton, SIGNAL(clicked()), this, SLOT(applyChanges()));    // Config window

    connect(_ui.fullhotkey, SIGNAL(clicked()), this, SLOT(changeHotkey()));
    connect(_ui.parthotkey, SIGNAL(clicked()), this, SLOT(changeHotkey()));
    connect(_ui.texthotkey, SIGNAL(clicked()), this, SLOT(changeHotkey()));
    connect(_hotKeys, SIGNAL(Activated(size_t)), this, SIGNAL(hotkeyActivated(size_t)));
    registerActualHotkeys();
}