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

68 Views Asked by At

That's what I would like to achieve:

enter image description here

But it turned out that way:

enter image description here

1

There are 1 best solutions below

0
KeyboardMan On BEST ANSWER

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);
}