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

Update QStackedWidget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.6k 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.
  • K Offline
    K Offline
    kegon
    wrote on last edited by
    #1

    I have a QStackedWidget with 4 pages and I'm using a QComboBox to switch page. None of the pages have more than 3 child widgets. I set up this widget in designer and add child widgets in my constructor.

    Sometimes, when I switch page the stacked widget doesn't redraw. Specifically,

    1. I select the page using the combo.
    2. The combo does not change text, the page does not change.
    3. If you move the mouse over the combo/stack, the widgets update to the correct state.

    I set up an intermediate slot with an update(), but it doen't make any difference:

    @
    ...
    connect(pageChooseCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setPage(int)));
    ...

    void ThisClass::setPage(int page)
    {
    stack->setCurrentIndex(page);
    stack->update();
    }
    @

    Does anyone have any suggestions about how to update the widgets ?

    Platform: Qt 5.1.0 on Mac 10.8.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      Hi, seems the problem is

      bq. select the page using the combo. The combo does not change text

      Which means QCombo doesn't work correctly.

      Can you reproduce this problem without QStackedWidget?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kegon
        wrote on last edited by
        #3

        I added a QLabel to my layout and then changed the setPage slot as follows:

        @
        void ThisClass::setPage(int page)
        {
        /*
        stack->setCurrentIndex(page);
        stack->update();
        */

        debugLabel->setText(QString::number(page));
        }
        @

        I observed the same problem.

        The slot is the only signal connection to/from the combo. So I guess QComboBox has a problem.

        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