Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-126826

When I set a QWidget to Qt::FramelessWindowHint, modify the system's primary screen, and then call showMaximized(), the QWidget disappears.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.12
    • Other
    • None
    • Windows

    Description

      screen is two 1920*1080;
      Widget::Widget(QWidget *parent)
      : QWidget(parent)
      {
      setWindowFlags(Qt::FramelessWindowHint );
       
      InitWidget();
       
      QTimer* ptime = new QTimer(this);
      ptime->start(1000);
       
      connect(ptime, &QTimer::timeout, this, [&]()

      { qDebug() << "max:" << m_bMainWndMax << " - " << this->size() << "- pos:" << this->geometry(); }

      );
      }
       
      void Widget::slotMaxWindow()

      { m_bMainWndMax = true; QWidget::showMaximized(); }

       
      void Widget::slotShowNormalWindow()

      { m_bMainWndMax = false; QWidget::showNormal(); }

       
      void Widget::InitWidget()

      { this->setMinimumSize(500, 400);   QVBoxLayout* layout = new QVBoxLayout(this); layout->setSpacing(0); layout->setMargin(0); layout->setContentsMargins(2, 2, 2, 2);   QPushButton* pMaxBtn = new QPushButton(this); pMaxBtn->setText("max"); layout->addWidget(pMaxBtn);   QPushButton* pNormalBtn = new QPushButton(this); pNormalBtn->setText("normal"); layout->addWidget(pNormalBtn);   connect(pMaxBtn, &QPushButton::clicked, this, &Widget::slotMaxWindow); connect(pNormalBtn, &QPushButton::clicked, this, &Widget::slotShowNormalWindow); }

       
      int main(int argc, char *argv[])

      {     QApplication a(argc, argv);      Widget win;     win.show();       return a.exec(); }

       

      Attachments

        1. debug.png
          debug.png
          44 kB
        2. ZtaxZqoFZT.mp4
          1.65 MB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            cc9527 sun xuan
            cc9527 sun xuan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes