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. Subwindows in QTabWidget get disoriented after switching between tabs

Subwindows in QTabWidget get disoriented after switching between tabs

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

    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?

    Thanks!

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

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

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rizoritis
        wrote on last edited by
        #3

        [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*/
        mdisubwindow->show();@
        
        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