1
0

assign numbers 1-9 as shortcuts for the first 9 results of system applications

Dieser Commit ist enthalten in:
Albert S. 2019-06-01 13:38:58 +02:00
Ursprung 45abb2bf27
Commit 1dc7ef935d
3 geänderte Dateien mit 8 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -57,6 +57,7 @@ int EntryPushButton::getRow() const { return config.row; }
int EntryPushButton::getCol() const { return config.col; } int EntryPushButton::getCol() const { return config.col; }
QString EntryPushButton::getName() const { return config.name; } QString EntryPushButton::getName() const { return config.name; }
QString EntryPushButton::getShortcutKey() const { return config.key; } QString EntryPushButton::getShortcutKey() const { return config.key; }
void EntryPushButton::setShortcutKey(QString key) { this->config.key = key; }
void EntryPushButton::setRow(int row) { this->config.row = row; } void EntryPushButton::setRow(int row) { this->config.row = row; }
void EntryPushButton::setCol(int col) { this->config.col = col; } void EntryPushButton::setCol(int col) { this->config.col = col; }
QStringList EntryPushButton::getArguments() const { return this->config.arguments; } QStringList EntryPushButton::getArguments() const { return this->config.arguments; }

Datei anzeigen

@ -43,6 +43,7 @@ public:
QString getCommand() const; QString getCommand() const;
void setRow(int row); void setRow(int row);
void setCol(int col); void setCol(int col);
void setShortcutKey(QString key);
}; };

Datei anzeigen

@ -269,8 +269,8 @@ void Window::keyPressEvent(QKeyEvent *event)
QKeySequence seq(event->key()); QKeySequence seq(event->key());
QString key = seq.toString().toLower(); QString key = seq.toString().toLower();
auto it = std::find_if(userEntryButtons.begin(), userEntryButtons.end(), [&key](const EntryPushButton *y) { return y->getShortcutKey() == key; }); auto it = std::find_if(buttonsInGrid.begin(), buttonsInGrid.end(), [&key](const EntryPushButton *y) { return y->getShortcutKey() == key; });
if(it != userEntryButtons.end()) if(it != buttonsInGrid.end())
{ {
buttonClick(**it); buttonClick(**it);
} }
@ -304,7 +304,10 @@ void Window::filterGridFor(QString filter)
if(button->getName().contains(filter, Qt::CaseInsensitive)) if(button->getName().contains(filter, Qt::CaseInsensitive))
{ {
button->setVisible(true); button->setVisible(true);
button->setShortcut(QString::number(i++)); if(i < 10)
{
button->setShortcutKey(QString::number(i++));
}
grid->addWidget(button, currow, curcol++); grid->addWidget(button, currow, curcol++);
this->buttonsInGrid.append(button); this->buttonsInGrid.append(button);
if(curcol == 3) if(curcol == 3)