Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.5.2
-
None
-
4567799c51b4126c693746e7c5c963faddb40225
Description
There is an issue on the Mac (Carbon), that seems to have been introduced in the latest Qt build (4.5.2) 4.5.0 does not show this behavior. If a showNormal() is called on a maximized widget, which has a minimum size, the widget moves off the screen on the Mac. As the title bar is offscreen, it cannot be moved back onto the screen.
To reproduce, launch the demo app on the Mac, maximize the window and hit the big button ("Maximize Window and Press Me!") in the window.
Also if the minimum size is not set, another bug occurs: After the window is brought back to its normal state, it is completely white. To see this, comment out "setMinimum" lines in sample
#include <QtGui> class CMaximizeHandler : public QObject { Q_OBJECT public: CMaximizeHandler (QWidget* wdt) : QObject (wdt) { } public slots: void onButtonPressed() { // Un-maximize window again... QWidget* wdgt = qobject_cast<QWidget*> (parent ()); wdgt->showNormal (); } void onButton2Pressed() { // Maximize window, this will set previous size correctly... QWidget* wdgt = qobject_cast<QWidget*> (parent ()); wdgt->showMaximized(); } }; //This moc include is to get everything in a single file - for quick testing only #include "main.moc" int main(int argc, char **argv) { QApplication app(argc, argv); //QFrame* frm = new QFrame(); QDialog* frm = new QDialog(); QVBoxLayout *layout = new QVBoxLayout; // The "magic ingredient" to produce the bug: Set a minimum size! frm->setMinimumWidth(320); frm->setMinimumHeight(240); // QPushButton* btn = new QPushButton (frm); QPushButton* btn2 = new QPushButton (frm); layout->addWidget(btn); layout->addWidget(btn2); btn->resize (640, 480); btn->setText ("Maximize Window and Press Me!"); btn2->setText ("Press Me to Zoom!"); frm->setLayout(layout); frm->show (); CMaximizeHandler* handler = new CMaximizeHandler (frm); QObject::connect (btn, SIGNAL (clicked()), handler, SLOT (onButtonPressed ())); QObject::connect (btn2, SIGNAL (clicked()), handler, SLOT (onButton2Pressed ())); return app.exec(); }