Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.5.1
-
None
Description
The steps to reproduce this are:
QMainWindow::hide();
use mouse to resize the window
QMainWindow::show();
this will cause the window to shirnk, because adjustSize() is called in QWidget::setVisible() if Qt::WA_Resized is false.
The following code reproduces this behaviour:
Use QWidget instead of QMainWindow or uncomment the setAttribute() to stop the shrining.
#include <QtGui>
#include <QDebug>
class MainWidget : public QWidget
{
Q_OBJECT
public slots:
void showHide()
{
if (showHideWidget->isVisible())
showHideWidget->hide();
else
}
public:
MainWidget(QWidget *parent = 0) : QWidget(parent)
private:
QPushButton *showHideButton;
QWidget *showHideWidget;
};
#include "main.moc"
int main(int argc, char **argv)
{
QApplication app(argc, argv);
MainWidget *main = new MainWidget;
main->show();
return app.exec();
}