Important: Please read the Qt Code of Conduct -

How to properly design a settings dialog?

  • Hi,

    I'm writing a web scraper app and am currently designing a settings dialog. This is what it will look like:


    As you can see, there are several buttons at the top and clicking on each one brings the relevant settings page. Now how do I accomplish this? I mean, I've managed to do it by overlapping all the setting pages (having them at the same position), and then calling the .hide() (or .show()) function when the user clicks a button. I was just wondering if there was a better way to go about this.

    Oh by the way, I'm using PySide (Python's Qt bindings).


  • Moderators

    Look at [[doc:QStackedWidget]]

  • Thanks for a fast reply, I just did look into it. Hmm it looks like I'd have to rewrite my dialog quite a bit in order to accomplish this.

  • Moderators

    Usually backing up and spending time to rewrite something correctly more than pays off for itself in the long run with saved time and energy spent having to work around a bad design.

  • It should not be that much of a rewrite, actually. You just replace the way you make sure you show the right page at the right time, but the actual content of the pages can stay the same. I agree with mlong though: getting rid of design mistakes like these is generally well worth the effort.

  • Yep, if you already have the widgets you just add them to the stacked widget and you are good to go, if you followed OOP ethics there will be nothing to rewrite, if not, it will be a valuable lesson :P I mean if you really NEED to rewrite your code that would pretty much mean you have made a mess, going against the concepts of encapsulation and code reusability, which is always a bad idea.

Log in to reply