@@ -9,7 +9,7 @@ MainWindow::MainWindow(QWidget *parent) :
9
9
QMainWindow(parent),
10
10
ui(new Ui::MainWindow)
11
11
{
12
- /* ui->setupUi(this);
12
+ ui->setupUi (this );
13
13
14
14
// Create the dock manager. Because the parent parameter is a QMainWindow
15
15
// the dock manager registers itself as the central widget.
@@ -32,85 +32,11 @@ MainWindow::MainWindow(QWidget *parent) :
32
32
ui->menuView ->addAction (DockWidget->toggleViewAction ());
33
33
34
34
// Add the dock widget to the top dock widget area
35
- m_DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);*/
36
-
37
- ui->setupUi (this );
38
-
39
- // Create the dock manager. Because the parent parameter is a QMainWindow
40
- // the dock manager registers itself as the central widget.
41
- m_DockManager1 = new ads::CDockManager (this );
42
-
43
- // Create example content label - this can be any application specific
44
- // widget
45
- ads::CDockWidget* DockWidget;
46
- {
47
- QLabel* l = new QLabel ();
48
- l->setWordWrap (true );
49
- l->setAlignment (Qt::AlignTop | Qt::AlignLeft);
50
- l->setText (" Lorem ipsum dolor sit amet, consectetuer adipiscing elit. " );
51
-
52
- // Create a dock widget with the title Label 1 and set the created label
53
- // as the dock widget content
54
- DockWidget = new ads::CDockWidget (" Label 1" );
55
- DockWidget->setWidget (l);
56
- }
57
-
58
- ads::CDockWidget* DockWidget2;
59
- {
60
- QLabel* l = new QLabel ();
61
- l->setWordWrap (true );
62
- l->setAlignment (Qt::AlignTop | Qt::AlignLeft);
63
- l->setText (" Lorem ipsum dolor sit amet, consectetuer adipiscing elit. " );
64
-
65
- // Create a dock widget with the title Label 1 and set the created label
66
- // as the dock widget content
67
- DockWidget2 = new ads::CDockWidget (" Label 2" );
68
- DockWidget2->setWidget (l);
69
- }
70
-
71
-
72
- // Add the toggleViewAction of the dock widget to the menu to give
73
- // the user the possibility to show the dock widget if it has been closed
74
- ui->menuView ->addAction (DockWidget->toggleViewAction ());
75
-
76
- // Add the dock widget to the top dock widget area
77
- m_DockManager1->addDockWidget (ads::TopDockWidgetArea, DockWidget);
78
-
79
-
80
- auto funcRemoveFirstManager = [=]()
81
- {
82
- m_DockManager1->removeDockWidget (DockWidget);
83
-
84
- delete m_DockManager1;
85
- m_DockManager1 = nullptr ;
86
- };
87
- QTimer::singleShot (3000 , funcRemoveFirstManager);
88
-
89
- auto funcAddSecondManager = [=]()
90
- {
91
- m_DockManager2 = new ads::CDockManager (this );
92
-
93
- m_DockManager2->addDockWidget (ads::TopDockWidgetArea, DockWidget);
94
- };
95
- QTimer::singleShot (5000 , funcAddSecondManager);
35
+ m_DockManager->addDockWidget (ads::TopDockWidgetArea, DockWidget);
96
36
}
97
37
98
38
MainWindow::~MainWindow ()
99
39
{
100
40
delete ui;
101
41
}
102
42
103
-
104
- void MainWindow::closeEvent (QCloseEvent *event)
105
- {
106
- QMainWindow::closeEvent (event);
107
- if (m_DockManager1)
108
- {
109
- m_DockManager1->deleteLater ();
110
- }
111
-
112
- if (m_DockManager2)
113
- {
114
- m_DockManager2->deleteLater ();
115
- }
116
- }
0 commit comments