Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Creating a new widget class over using a stackedWidget?
Forum Updated to NodeBB v4.3 + New Features

Creating a new widget class over using a stackedWidget?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 217 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    he_R0
    wrote on last edited by he_R0
    #1

    I'm a new QT user using QT for a personal project. I haven't found an answer to this question (maybe I'm asking incorrectly).

    My project is broken down into several pages. The pages are related as data will be shared. My question is: should I always be using a StackedWidget, or are there cases where creating a new designer form class is better?

    For now, I have opted for the latter option since each page will likely have a stackedWidget for their page-specific functionalities; I didn't want to make it messy and have too many stackedWidgets embedded into each other. Is this correct? What are the advantages/disadvantages here, given it's not an HMI type application with limited functionality?

    Pl45m4P 1 Reply Last reply
    0
    • H he_R0

      I'm a new QT user using QT for a personal project. I haven't found an answer to this question (maybe I'm asking incorrectly).

      My project is broken down into several pages. The pages are related as data will be shared. My question is: should I always be using a StackedWidget, or are there cases where creating a new designer form class is better?

      For now, I have opted for the latter option since each page will likely have a stackedWidget for their page-specific functionalities; I didn't want to make it messy and have too many stackedWidgets embedded into each other. Is this correct? What are the advantages/disadvantages here, given it's not an HMI type application with limited functionality?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @he_R0

      Hi and welcome :)

      should I always be using a StackedWidget, or are there cases where creating a new designer form class is better?

      As often: it depends...
      Do you want to have your widgets at the same place and showing only one at a time or do you want them to be next to each other (or in a new window) and showing/using multiple at once?
      A QStackedWidget is one of Qt's plenty container widgets... there are also widgets like QTabWidget or different Model/Views.
      QStackedWidget works like a book with pages... you can flip the pages in-place, but you can only see the currentWidget.

      I didn't want to make it messy and have too many stackedWidgets embedded into each other

      Multiple or cascading QStackedWidgets?!
      Mh, that already sounds like bad design. Can't see why you need to do this, since you can simply add a new widget to the only QStackedWidget.
      There is no need to embed a new QStackedWidget and fill it with content widgets... there might be some edge cases, where it could be viable, but I can't see a reason why you need to do this right now ;-)

      Since we know nothing about your app, you should develop a feeling for which design suits your app the best.
      Is it more technical? like some simple inputs/outputs, controls and some processing going on in the background.
      Or do you have some fancy, modern app in mind, with lots of toolbars, side widgets, menus etc.?

      using QT for a personal project.

      Because of this, you are not limited and you can try out few things... if you have a more concrete sketch of your app feel free to ask again :)

      Happy coding :)


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      2
      • H he_R0 has marked this topic as solved on

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved