c++qtuser-interfaceinterfaceqt4.7

I called showMaximized() with QT4.7,A strange question came up


That's what I would like to achieve:

enter image description here

But it turned out that way:

enter image description here


Solution

  • I found the cause of the problem because I called QWidget::setWindowFlags(Qt::FramelessWindowHint);This caused showMaximized() to show the wrong result.So I've reimplemented these two functions。

    void MainWindowDef::showMax()
    {
        oldSize = this->size();
        oldPoint = this->pos();
        resize(QApplication::desktop()->availableGeometry().size());
        move(0, 0);
        isMax = true;
    }
    
    void MainWindowDef::showOld()
    {
        resize(oldSize);
        move(oldPoint);
    }