From 3aee5192b6ffc1b0313ff5aa2db6bdbfcaa365d0 Mon Sep 17 00:00:00 2001 From: mrbesen Date: Wed, 15 Dec 2021 00:04:35 +0100 Subject: [PATCH] shortcut "fixed" --- QxtGlobalShortcut | 2 +- src/mainwindow.cpp | 10 ++++++---- src/soundbutton.cpp | 12 +++++++++++- ui/mainwindow.ui | 6 ++++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/QxtGlobalShortcut b/QxtGlobalShortcut index cf34488..336b6f5 160000 --- a/QxtGlobalShortcut +++ b/QxtGlobalShortcut @@ -1 +1 @@ -Subproject commit cf3448884274f2e9cd360ff33982128401c4737b +Subproject commit 336b6f5780109501dd8c3d98ca336265af021808 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 20c81c9..2a4342b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -11,12 +11,12 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::Soundb reloadConfig(); - QKeySequence seq("Num+,"); - stopGlobal = new QxtGlobalShortcut(seq); + // QKeySequence seq(QString::fromStdString("Shift+Num+0")); + // stopGlobal = new QxtGlobalShortcut(seq); QObject::connect(ui->reloadButton, SIGNAL(clicked()), this, SLOT(reloadConfig())); QObject::connect(ui->stopButton, SIGNAL( clicked() ), this, SLOT( stop() )); - QObject::connect(stopGlobal, SIGNAL( activated() ), this, SLOT( stop() )); + // QObject::connect(stopGlobal, SIGNAL( activated() ), this, SLOT( stop() )); QObject::connect(this, SIGNAL(newStatusMessage(const QString&)), ui->statusbar, SLOT(showMessage(const QString&))); } @@ -103,8 +103,10 @@ void MainWindow::loadButtonsFromConfig() { x += bc.width; } - ui->gridLayout->setRowMinimumHeight(y, 40); + ui->gridLayout->setRowMinimumHeight(y, 60); x = 0; y++; } + + // ui->gridLayoutWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); } diff --git a/src/soundbutton.cpp b/src/soundbutton.cpp index 206a844..060dd8a 100644 --- a/src/soundbutton.cpp +++ b/src/soundbutton.cpp @@ -9,8 +9,18 @@ uint64_t SoundButton::nextid = 0; SoundButton::SoundButton(const std::string& filename, const std::string& name_, const std::string& keycombo) : id(nextid++), file(filename), keycombo(keycombo) { name = (name_.empty() ? filename : name_); - button = new QPushButton(QString::fromStdString(name)); + std::string keycomb; + if(!keycombo.empty()) { + keycomb = "\n" + keycombo; + } + + QString info = QString::fromStdString(name + keycomb); + button = new QPushButton(info); button->setObjectName(QString::fromStdString("soundButton" + std::to_string(id))); + button->setMinimumHeight(50); + button->setToolTip(info); + +// button->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum)); QKeySequence seq(QString::fromStdString(keycombo)); globalShortcut = new QxtGlobalShortcut(seq); diff --git a/ui/mainwindow.ui b/ui/mainwindow.ui index 5c686e9..d941444 100644 --- a/ui/mainwindow.ui +++ b/ui/mainwindow.ui @@ -14,6 +14,12 @@ Soundboard + + + 0 + 0 + +