Here's the problem:
Qt Code:
  1. #include <QtGui>
  2.  
  3. class MainWindow : public QMainWindow
  4. {
  5. public:
  6. MainWindow(QWidget* parent = 0) : QMainWindow(parent)
  7. {
  8. menuBar()->addMenu("File");
  9. menuBar()->addMenu("Edit");
  10. menuBar()->addMenu("Tools");
  11. menuBar()->addMenu("Help");
  12.  
  13. QWidget* widget = new QWidget(this);
  14. // change the color just to be able to see the widget
  15. widget->setStyleSheet("background: rgba(255,0,0,128)");
  16. // uncomment the following line and see the difference
  17. // setCentralWidget(widget);
  18. }
  19. };
  20.  
  21. int main(int argc, char* argv[])
  22. {
  23. QApplication app(argc, argv);
  24. MainWindow window;
  25. window.show();
  26. return app.exec();
  27. }
To copy to clipboard, switch view to plain text mode