Important: Please read the Qt Code of Conduct -

revealing advanced user options

  • Hi all -

    I'd like to add some functionality to an app that is best left to the "super-user." It's not security-sensitive; just some advanced functions that are probably best when not easily accessed by everyone.

    Something like revealing a push button when a combination of keys is held down would work nicely. I've been experimenting with the QKeyEvent class, but I can't get it to work the way I want.

    Does this seem like a reasonable approach in theory? If so, I'll post some specific questions in General.


  • Moderators

    @mzimmers said in revealing advanced user options:

    Does this seem like a reasonable approach in theory?

    to me yes,
    You may or may not be able to play snake in most of my applications, if you press the correct key sequence.


  • Moderators

    Yes it's a sane approach, and quite common. You'll need to make sure your super users will know about this secret combination of keys. And, if you are developing an app for somebody else, make sure they know about it. Some companies have strict policies against hidden features.

    Is this a QWidget app or QML?

    Some ideas how to "hide" a feature:

    • reveal it after triple-clicking on some label or button (there is a precedent: enabling developer mode on Android)
    • secret combination (in QML it's easy to achieve with Shortcut component, in widgets you can use QShortcut)
    • use a configuration file (QSettings) - you likely already have a config file, so just add another boolean flag in there. Disabled by default, advanced users are probably poking around your config files anyway, so they are likely to find it :-)
    • if it's really only for system-level admins, then you can detect if app is running with admin permissions (no API for this in Qt, unfortunately, you need to implement your own, per-platform solution) and show the feature then

  • @mzimmers
    This requires that your users read the help/manual. The other responders here seem quite happy with this approach, clearly you all have customers different from mine because it's rare for my customers to be prepared to read any instructions....!

    Do you not have a menu system where these operations can be added? Or, an "Options" page where admins can enable an "Advanced Admin Mode" preference which causes these buttons to be displayed?

    It appears I seem to be on my own on this one, other than games I am not aware I have used any applications which have "hidden keypresses", but there you are....

  • Thanks for the input, guys. Jon makes a good point about the need to convey this "hidden" feature to the user. That said, I might go ahead and try implementing this, simply because I can foresee a lot of good uses for the QKeyEvents. I can always go back and implement something that Jon could live with.

    Thanks again...

    EDIT: QKeyEvents aren't a great solution. It turns out that, on Windows and Linux (but not Mac), holding down keys prevents a button push from signalling. You have to press and release the keys, then push the button. Much clunkier than I'd hoped for.

Log in to reply