Added new CDockWidget flag CDockWidget::NoTab to hide the tab from the dock area title bar

This commit is contained in:
Uwe Kindler 2021-01-09 19:02:25 +01:00
parent c8fe4c46dd
commit 8a27a5596b
3 changed files with 7 additions and 5 deletions

View File

@ -49,12 +49,13 @@ CMainWindow::CMainWindow(QWidget *parent)
DockManager = new CDockManager(this);
// Set central widget
QPlainTextEdit* w = new QPlainTextEdit();
w->setPlaceholderText("This is the central editor. Enter your text here.");
//QPlainTextEdit* w = new QPlainTextEdit();
//w->setPlaceholderText("This is the central editor. Enter your text here.");
CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget");
CentralDockWidget->setWidget(w);
//CentralDockWidget->setWidget(w);
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
CentralDockWidget->setFeature(ads::CDockWidget::NoTab, true);
//CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
// create other dock widgets
QTreeView* fileTree = new QTreeView();

View File

@ -154,6 +154,7 @@ public:
CustomCloseHandling = 0x10, ///< clicking the close button will not close the dock widget but emits the closeRequested() signal instead
DockWidgetFocusable = 0x20, ///< if this is enabled, a dock widget can get focus highlighting
DockWidgetForceCloseWithArea = 0x40, ///< dock widget will be closed when the dock area hosting it is closed
NoTab = 0x80, ///< dock widget tab will never be shown if this flag is set
DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable,
AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling,
DockWidgetAlwaysCloseAndDelete = DockWidgetForceCloseWithArea | DockWidgetDeleteOnClose,

View File

@ -629,7 +629,7 @@ void CDockWidgetTab::mouseDoubleClickEvent(QMouseEvent *event)
//============================================================================
void CDockWidgetTab::setVisible(bool visible)
{
// Just here for debugging to insert debug output
visible &= !d->DockWidget->features().testFlag(CDockWidget::NoTab);
Super::setVisible(visible);
}