lxqt / qterminal

A lightweight Qt-based terminal emulator
https://lxqt.github.io
GNU General Public License v2.0
611 stars 153 forks source link

Use Qt-wide keyboard shortcut for "Quit" #862

Open probonopd opened 3 years ago

probonopd commented 3 years ago
Expected Behavior

The ususal Qt-wide keyboard shortcut for quitting application works

Current Behavior

Quit has no shortcut at all

image

Possible Solution

Probably around

https://github.com/lxqt/qterminal/blob/407f13525efe18635ea50e0cb9b6a626d4353924/src/mainwindow.cpp#L389

need to use QKeySequence::Quit.

Steps to Reproduce (for bugs)
  1. Run helloSystem 0.6.0 Live ISO
  2. Open Terminal
Context

All applications should follow the system-wide Qt shortcuts for things like quitting, so that the user can quit any application using the same keyboard shortcut. Especially for system-level utilities like this one.

System Information
tsujan commented 3 years ago

I leave the decision to @yan12125 but

probonopd commented 3 years ago

This is not about my preferences nor what helloSystem does. This is about follwing general Qt best practices. Many people are using Lxqt and its tools because they like Qt, so it only feels natural to me that Lxqt and its tools should use the official Qt way to do things. Don't you think?

tsujan commented 3 years ago

Don't you think?

I'm afraid most users don't care about what a toolkit may call "best practice". I've received emails and reports (some expressing anger!) about why Ctrl+W isn't used for quitting in my apps and my answer was the same: there's a Preferences dialog.

Also, some apps need to have some unchangeable and hard-coded shortcuts for reasons beyond this comment, although QTerminal isn't among them.

probonopd commented 3 years ago

Maybe we can have the best of both worlds. A preferences dialog like you have now, but the default preferences (if they are not touched by the user) being the Qt default ones?

tsujan commented 3 years ago

Maybe we can have the best of both worlds.

Even if we ignore that there's no guarantee for the existence of a "Qt standard shortcut", the same LXQt app, with the same config file, may be used under different environments (e.g., when the user has multiple DEs) and shortcuts should be saved in config files in the portable format (you could guess the consequences) — to say nothing of the fact that LXQt never advertises to be a Qt-only DE (actually, it isn't, from start).

yan12125 commented 3 years ago

I appreciate your suggestions, but for the situation is more complex for terminals than other applications. Ctrl-Q may be used by applications running in the terminal. For example,

So, I don't plan to assign QKeySequence::Quit to quit.

On the other hand, as you mentioned "Command-Q" in the lximage-qt ticket, I assume helloSystem targets users with a Mac keyboard (with Control, Option & Command) instead of a Windows one (with Ctrl, Win & Alt)? If so, maybe we can figure out a solution that uses Command-Q for qterminal and leaves Ctrl-Q to applications like nano. Such a behavior matches terminals running on macOS (Terminal.app, iTerm2, ...). A possible approach may be adding helloSystem-specific definitions to config.h, like what we did for Q_OS_MACOS in that file. Previous macOS-specific tickets may give more inspiration as well.