Important: Please read the Qt Code of Conduct -

How to add QShortcut to QWindow?

  • QShortcut only takes a QWidget as parent. But QQuickView, for example, is a QWindow. I know I can wrap it using createWindowContainer, but that makes automatic window resizing depending on the root item more difficult (and I expect to find more difficulties caused by this intermediate layer).

    Is there any way to use QShortcut with QWindow directly?

  • Lifetime Qt Champion


    Did you consider QQuickWidget ?

  • @SGaist
    Whops, I completely missed that. It's still a wrapper, I see, but at least the ugly details are hidden from my eyes.

    EDIT: It still is unclear to me why a QWindow shouldn't also have shortcuts (I certainly don't see technical reasons), but for my purposes, the answer is quite sufficient.

Log in to reply