============================================================================
| 1143 | |
| 1144 | //============================================================================ |
| 1145 | CDockAreaWidget* CDockManager::setCentralWidget(CDockWidget* widget) |
| 1146 | { |
| 1147 | if (!widget) |
| 1148 | { |
| 1149 | d->CentralWidget = nullptr; |
| 1150 | return nullptr; |
| 1151 | } |
| 1152 | |
| 1153 | // Setting a new central widget is now allowed if there is already a central |
| 1154 | // widget or if there are already other dock widgets |
| 1155 | if (d->CentralWidget) |
| 1156 | { |
| 1157 | qWarning("Setting a central widget not possible because there is already a central widget."); |
| 1158 | return nullptr; |
| 1159 | } |
| 1160 | |
| 1161 | // Setting a central widget is now allowed if there are already other |
| 1162 | // dock widgets. |
| 1163 | if (!d->DockWidgetsMap.isEmpty()) |
| 1164 | { |
| 1165 | qWarning("Setting a central widget not possible - the central widget need to be the first " |
| 1166 | "dock widget that is added to the dock manager."); |
| 1167 | return nullptr; |
| 1168 | } |
| 1169 | |
| 1170 | |
| 1171 | widget->setFeature(CDockWidget::DockWidgetClosable, false); |
| 1172 | widget->setFeature(CDockWidget::DockWidgetMovable, false); |
| 1173 | widget->setFeature(CDockWidget::DockWidgetFloatable, false); |
| 1174 | widget->setFeature(CDockWidget::DockWidgetPinnable, false); |
| 1175 | d->CentralWidget = widget; |
| 1176 | CDockAreaWidget* CentralArea = addDockWidget(CenterDockWidgetArea, widget); |
| 1177 | CentralArea->setDockAreaFlag(CDockAreaWidget::eDockAreaFlag::HideSingleWidgetTitleBar, true); |
| 1178 | return CentralArea; |
| 1179 | } |
| 1180 | |
| 1181 | //============================================================================ |
| 1182 | QAction* CDockManager::addToggleViewActionToMenu(QAction* ToggleViewAction, |
no test coverage detected