Quote Originally Posted by wysota View Post
Could you prepare a minimal compilable example reproducing the problem?
Sorry for the delayed response...here comes the 'minimal' example. When run on my system the main window does not become disabled unless i use the centralwidget-object

Qt Code:
  1. #include <iostream>
  2. #include <QApplication>
  3. #include <QMainWindow>
  4. #include <QWidget>
  5. #include <QPushButton>
  6. #include <QString>
  7. //#include <QRect>
  8. //#include <QSize>
  9. //
  10. using namespace std;
  11. //
  12. class Gui : public QMainWindow
  13. {
  14. Q_OBJECT
  15. public:
  16. Gui( QWidget * parent = 0 );
  17. private slots:
  18. void disableMe();
  19. private:
  20. QWidget *centralwidget;
  21. QPushButton *pushButton;
  22. };
  23.  
  24. int main(int argc, char ** argv)
  25. {
  26. QApplication app( argc, argv );
  27. Gui gui;
  28. gui.show();
  29. app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
  30. return app.exec();
  31. }
  32.  
  33. Gui::Gui( QWidget * parent ) : QMainWindow(parent)
  34. {
  35. this->setObjectName(QString::fromUtf8("MainWindow"));
  36. this->setWindowTitle("main window test");
  37. centralwidget = new QWidget(this);
  38. centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
  39. pushButton = new QPushButton(centralwidget);
  40. pushButton->setObjectName(QString::fromUtf8("pushButton"));
  41. pushButton->setGeometry(QRect(110, 50, 101, 41));
  42. pushButton->setText("disable?");
  43. this->setCentralWidget(centralwidget);
  44.  
  45. QSize size(322, 149);
  46. size = size.expandedTo(this->minimumSizeHint());
  47. this->resize(size);
  48.  
  49. connect(pushButton, SIGNAL(clicked()),
  50. this, SLOT(disableMe()));
  51. }
  52.  
  53. void Gui::disableMe()
  54. {
  55. cout << "trying to disable the mainwindow...";
  56. this->setDisabled(true);
  57. cout << "success?" << endl;
  58. }
To copy to clipboard, switch view to plain text mode