fork download
  1. #include <QDockWidget>
  2. #include <QBoxLayout>
  3. #include <QMainWindow>
  4. #include <QApplication>
  5.  
  6. class MainWindow
  7. : public QMainWindow
  8. {
  9. Q_OBJECT
  10.  
  11. private slots:
  12. void floatingChanged(bool floating)
  13. {
  14. if( floating )
  15. static_cast<QDockWidget*>(QObject::sender())->showFullScreen();
  16. }
  17.  
  18. public:
  19. MainWindow()
  20. : QMainWindow()
  21. {
  22. QWidget* central = new QWidget();
  23. central->setLayout(new QBoxLayout(QBoxLayout::TopToBottom));
  24. this->setCentralWidget(central);
  25. QDockWidget* dockwidget = new QDockWidget(this);
  26. this->centralWidget()->layout()->addWidget(dockwidget);
  27.  
  28. QObject::connect(dockwidget, SIGNAL(topLevelChanged(bool)), this, SLOT(floatingChanged(bool)));
  29. }
  30. };
  31.  
  32. int main(int argc, char** argv)
  33. {
  34. QApplication app(argc, argv);
  35.  
  36. QMainWindow* window = new MainWindow;
  37. window->show();
  38.  
  39. return app.exec();
  40. }
  41.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:23: fatal error: QDockWidget: No such file or directory
 #include <QDockWidget>
                       ^
compilation terminated.
stdout
Standard output is empty