mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 00:33:09 -07:00
Fix cmd+w not closing the main window on macOS
This commit is contained in:
parent
84c84160fd
commit
ff7e5da6de
3 changed files with 24 additions and 1 deletions
|
@ -843,6 +843,11 @@ void MainWindow::createKeyboardShortcuts()
|
|||
m_ui->actionDelete->setShortcutContext(Qt::WidgetShortcut); // nullify its effect: delete key event is handled by respective widgets, not here
|
||||
m_ui->actionDownloadFromURL->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O);
|
||||
m_ui->actionExit->setShortcut(Qt::CTRL + Qt::Key_Q);
|
||||
#ifdef Q_OS_MAC
|
||||
m_ui->actionCloseWindow->setShortcut(QKeySequence::Close);
|
||||
#else
|
||||
m_ui->actionCloseWindow->setVisible(false);
|
||||
#endif
|
||||
|
||||
QShortcut *switchTransferShortcut = new QShortcut(Qt::ALT + Qt::Key_1, this);
|
||||
connect(switchTransferShortcut, &QShortcut::activated, this, &MainWindow::displayTransferTab);
|
||||
|
@ -978,6 +983,16 @@ void MainWindow::on_actionExit_triggered()
|
|||
close();
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
void MainWindow::on_actionCloseWindow_triggered()
|
||||
{
|
||||
// On macOS window close is basically equivalent to window hide.
|
||||
// If you decide to implement this functionality for other OS,
|
||||
// then you will also need ui lock checks like in actionExit.
|
||||
close();
|
||||
}
|
||||
#endif
|
||||
|
||||
QWidget *MainWindow::currentTabWidget() const
|
||||
{
|
||||
if (isMinimized() || !isVisible())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue