Problems with Open-Source Downloads read and

Subwindows in QTabWidget get disoriented after switching between tabs

  • Hello,

    I have a QTabWidget with many subwindows. Each subwindow has a custom widget inside of it. For some reason when I set all the widgets at startup, every subwindow is where it should be on the screen. If i randomly switch between the tabs of the QTabWidget the subwindows randomly move around and destroy the layout of my tab screen. Sometimes, some subwindows dont even appear. Does anyone know why this may be?


  • Can you give us a simple but compilable example that can be used to reproduce the problem?

  • [quote author="1+1=2" date="1373987347"]Can you give us a simple but compilable example that can be used to reproduce the problem?[/quote]

    I basically just call the following code for each subwindow after a change in the tab has been made.

    @ /Calculate the size of the subwindow which will also equal the size of the widget in the subwindow/
    width = round_num(mdiarea->size().width() * widthratio);
    height = round_num(mdiarea->size().height() * heightratio);

    widget->setFixedSize(width, height);    /*Set size of widget to designated size of subwindow*/
    mdisubwindow->setWindowFlags(Qt::FramelessWindowHint);  /*Make the subwindow frameless*/
    mdisubwindow->setFixedSize(width, height);  /*Adjust size of subwindow to fit to its portion of the mdi area*/
    if(mdisubwindow->widget() != widget) {mdisubwindow->setWidget(widget);}    /*Add the widget ot the subwindow*/
    if(!mdiarea->subWindowList().contains(mdisubwindow)) {mdiarea->addSubWindow(mdisubwindow);}    /*Add subwindow to the mdiarea*/

Log in to reply