Important: Please read the Qt Code of Conduct -

row number is wrong in stackedwidget.

  • I put listwidget on dialog and put on stacked widget.
    But the problem is QLabel show other row on stacked widget.
    I put my project file on my blog.
    I don't know how can solve this issue.
    I put my project file on blog.

    My blog

  • @darongyi Hi, I just downloaded your project and could instantly reproduce your behaviour. Your problem is that you added two empty pages to the stacked widget in the designer – and then – add more widgets in your CreateStackedPage() method.
    This results in:

    • index 0 - empty
    • index 1 - empty
    • index 2 - Homepage
    • ...

    So the homepage with the test label always comes at index 2.

    You may also want to have a look at the QStackedLayout if you just want to switch through the pages from another control like you do with your tab icons.

    Btw: I saw that you archived the whole git repository history. If you like you can create a github repository and I can send you a pull request.

Log in to reply