Important: Please read the Qt Code of Conduct -

User authentication / User restrictions for Qt-Gui

  • Hallo,
    I’m new on qt and in the forum.
    At the moment I’m developing a HMI for a machine. For the HMI it’s necessary to have different users and user-levels. Another requirement is to have configurable restrictions for each widget(buttons, tables, … ). For each user-level I like to configure which widget is enabled or disabled.
    My first idea was to use the object name (Qobject::objectName) of the widgets. In my approach there should be a list where the options (enable/disable) for each widget and each user-level is stored. On startup and when the user changed I look into the list and search the objectName of each gui-widget. Than I set the enable-property of each gui-widget.
    At the moment I collect some ideas and make some drafts.
    My Question:
    What is the usual approach to handle users, user-level and user-accounts?
    What would you recommend how I should handle the enable/disable property for the widgets?
    Is there is a built-in mechanism in qt?
    Do you know some good examples?

    Thanks for helping.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    No there's no builtin mechanism for that.

    As for users, user-level and accounts, that's usually done using a database where you have all that information.

    As for handling of the widgets state you can e.g. use a custom event that you generate when the user changes and it's the responsibility of each widget to know what to enable disable based on the level of the new user.

  • @SGaist
    Thanks for you tips.
    I will do some work on my user-authentication. If I find some time i will post a short overview of my approch, if anyone is interested.

    Best regards

  • I'm definitely interested in what you come up with!

  • Moderators

    Me as well, especially the implications of disabling/hiding some widgets for some users and how you work around it.

Log in to reply