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. bug of QMdiArea showing scrollbar ?
Forum Updated to NodeBB v4.3 + New Features

bug of QMdiArea showing scrollbar ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 461 Views
  • 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.
  • Q Offline
    Q Offline
    QtTester
    wrote on last edited by QtTester
    #1

    Hei, guys.
    I have a MainWindow project from 'new project wizard'.
    VS2019+5.15.2+Win7
    Here is my code:

    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    
        m_mdiArea = new QMdiArea(this);
        m_mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
        m_mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
        setCentralWidget(m_mdiArea);
    
        QMenu *mu = new QMenu("test");
        QAction *a = new QAction("add widget1");
    
        mu->addAction(a);
        connect(a,&QAction::triggered,this,[&](){
            auto *w1 = new QWidget;
            auto *b1 = new QPushButton("btn1-1");
            auto *b2 = new QPushButton("btn1-2");
            auto *vlay = new QVBoxLayout;
            auto *sw = new QMdiSubWindow;
    
            vlay->addWidget(b1);
            vlay->addSpacerItem(new QSpacerItem(20,40,QSizePolicy::Minimum,QSizePolicy::Expanding));
            vlay->addWidget(b2);
            w1->setLayout(vlay);
            w1->resize(500,400);
            w1->setMinimumHeight(400);
            sw->setWidget(w1);
            sw->resize(w1->size());
            m_mdiArea->addSubWindow(sw);
            w1->show();
        });
        a = new QAction("add widget2");
        mu->addAction(a);
        connect(a,&QAction::triggered,this,[&](){
            QWidget *w2 = new QWidget;
            auto *b1 = new QPushButton("btn2-1");
            auto *b2 = new QPushButton("btn2-2");
            auto *vlay = new QVBoxLayout;
            QMdiSubWindow *sw = new QMdiSubWindow;
    
            vlay->addWidget(b1);
            vlay->addSpacerItem(new QSpacerItem(20,40,QSizePolicy::Minimum,QSizePolicy::Expanding));
            vlay->addWidget(b2);
            w2->setLayout(vlay);
            w2->resize(500,400);
            w2->setMinimumHeight(400);
            sw->setWidget(w2);
            sw->resize(w2->size());
            m_mdiArea->addSubWindow(sw);
            w2->show();
        });
        menuBar()->addMenu(mu);
        resize(650,380);
    }
    

    when add a widget, not showing horizon scrollbar from mdiarea(Step1), then click subwindow to show max,the vertical scrollbar shows fine(Step3).
    but, if add a widget, and showing horizon scrllbar from mdiarea(Step1), then click subwindow to show max,the vertical scrollbar Will NOT show anymore(Step3).

    here is the picture, vbar shows fine:

    2022-02-05_001158.jpg

    vbar will not show anymore if we have horizon bar on start:
    2022-02-05_001001.jpg

    why? any tips will be appreciated.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      I can confirm this issue and think it's fixable. For now set the minimum size to sw too.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Created a bug report: https://bugreports.qt.io/browse/QTBUG-100494

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        1
        • Q Offline
          Q Offline
          QtTester
          wrote on last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Merged, will be fixed in Qt6.4.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            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