Is QStackedWidget the ideal solution to a log in system?



  • Since I started to learn programming and there seems not to be a right solution for a particular problem. As long as the solution results in the expected outcome no one seems to care about the method used to accomplish the task.

    What I want to create is a log in system. The first screen asks for username/password. If entered correctly, the user is allowed access to the second screen, which is the actual program.

    This can be accomplished using QStackedWidget but is QStackedWidget the best solution? Is this how commercial applications implement their log in system? Is it secure?

    Thanks in advance :)


  • Lifetime Qt Champion

    Hi,

    Short answer: it depends.

    Some applications use a dialog to get the information and keeps looping in it until the user enters the right data and if so show their main window. Other have a "lock screen" that is part of their main window and then hide that lock screen to show the main interface. QStackedWidget can be used in the case of the second implementation. What's best is a bit up to you to follow your application design.

    Hope it helps



  • @SGaist

    For the "lock screen" solution, is QStackedWidget the only way to implement it?



  • @WhatIf

    For the "lock screen" solution, is QStackedWidget the only way to implement it?

    No , the life cycle of logging in normally is short.

    So it is a common sense to create login widget when it is needed and then delete it
    after successful login.

    Stacked widget is designed to keep it child widgets in the memory.
    Keeping once constructed login widget (and thus consider placing it on the stacked widget page ) is only reasonable when logging in is expected to be done multiple times during a single session.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.