Important: Please read the Qt Code of Conduct -

Glitches when resize widget

  • Hi ,

    I am facing a problem when resizing a QMainWindow that contains a toolbar and a QStackedWidget.

    Initially, the QMainWindow is shown with no problem, then when I try to change the current index of the QStackedWidget (which results in resizing the whole window to be adjusted for the new index widget) the QMainWindow have some glitches in painting, a solid color rectangle covers my objects and it only re-appear when I select another window.

    I am using QWidget::show() to pop-up the QMainWindow.

    Please advise.

  • Lifetime Qt Champion

    Any chance to show picture of this glitch ?
    Its nearly impossible to guess what could be wrong with no code
    and no picture :)

  • I can't find a way to attach a picture here, I've uploaded to another website:

  • Lifetime Qt Champion

    Looks like you have an widget which parent as mainwindow
    and not a stacked or other widget
    so its not inside anything.

    Do you use UI files or do u have code to create the gui?

  • I am using code to create gui, I think it is not a widget since when I click or hover on any object it appears.

    As you can see a part of the table view appeared when I just clicked inside it:

    and Also when I just minimize the window and maximize it again, everything is shown correctly.

  • Lifetime Qt Champion

    Ok, it does look strange.
    I have no idea what it is.

    Are all widgets in layouts?

  • Every Widget is in layouts.
    I think the problem related to resizing the main window.

    I've overrided the resizeEvent() function and called from inside it adjustSize(), I tried to call repaint and updateGeometry() after adjustSize() but it did not make any differnece.

    Hint: I'm running the application through VM if this makes any difference.

  • I found the solution, it is related to the loading through VM, I think something relating to the graphic system mode, I've changed the mode and it worked perfectly :)

    Thank you for your help :)

Log in to reply