Advertisement
Guest User

Untitled

a guest
Jul 16th, 2011
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. DockWidget.h
  2.  
  3. #ifndef DOCKWIDGET_H
  4. #define DOCKWIDGET_H
  5.  
  6. #include <QMainWindow>
  7. #include <QDockWidget>
  8. #include <QCheckBox>
  9.  
  10. class DockWidget : public QMainWindow
  11. {
  12.     Q_OBJECT
  13.  
  14. public:
  15.     DockWidget();
  16.  
  17. private:
  18.  
  19.     QDockWidget *dckWidget;
  20.     QCheckBox *showdckWidgetChkBox;
  21.  
  22. };
  23.  
  24. #endif
  25.  
  26. // end .h file
  27.  
  28.  
  29. //  Begin DockWidget.cpp File.
  30.  
  31. #include "DockWidget.h"
  32. #include <QtGui>
  33.  
  34. DockWidget::DockWidget()
  35. {
  36.     dckWidget = new QDockWidget(this);
  37.     dckWidget->setFixedSize(250, 100);
  38.  
  39.     showdckWidgetChkBox = new QCheckBox(tr("Show or hide the Dock Widget"), this);
  40.     showdckWidgetChkBox->setChecked(true);
  41.  
  42.     if (showdckWidgetChkBox->isChecked()) {
  43.         showdckWidgetChkBox->show();
  44.     } else {
  45.         showdckWidgetChkBox->hide();
  46.     }
  47.  
  48.     setGeometry(250, 250, 1024, 700);
  49. }
  50.  
  51.  
  52. // End DockWidget.cpp File
  53.  
  54. //start main.cpp file
  55.  
  56. #include "DockWidget.h"
  57. #include <QtGui>
  58.  
  59. int main(int argc, char * argv[])
  60. {
  61.     QApplication Dock(argc, argv);
  62.  
  63.     DockWidget *dockWidget = new DockWidget;
  64.                 dockWidget->show();
  65.  
  66.     return Dock.exec();
  67. }
  68.  
  69. // End DockWidget.cpp File
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement