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. Access to QStackedWidget's widget
Qt 6.11 is out! See what's new in the release blog

Access to QStackedWidget's widget

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 4.2k 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.
  • M Offline
    M Offline
    Mar91
    wrote on last edited by
    #1

    I've created a QStackedWidget and added some widget into ( Qpushbutton, and so on ). How can i access to them?
    I could understand that using : ui->stackedwidget->widget(0) return a QWidget* which is the first page ( index : 0 ), and now? How can i reach the QPushbutton and so on?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      If you create the QStackedWidget with Designer (or the designer component in Creator), you have access to all widgets via the ui member of your class. No need to call widget(0) then.

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        And basically, the same goes even if you did not use designer. In that case, you simply keep track of the objects you need later on by keeping a pointer to them around as a member of your class.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mar91
          wrote on last edited by
          #4

          It was SO EASY, i thought that the widget were located under ui->stackedwidget->bla bla, indeed they are simply under ui->mywidget. So easy!
          Huge thanks!

          1 Reply Last reply
          0

          • Login

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