Updated centralwidget example

This commit is contained in:
Uwe Kindler 2020-09-03 15:23:05 +02:00
parent 6eb497fb64
commit e0f6f3013f

View File

@ -15,6 +15,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QSettings> #include <QSettings>
#include <QMessageBox> #include <QMessageBox>
#include <QPlainTextEdit>
#include "DockAreaWidget.h" #include "DockAreaWidget.h"
#include "DockAreaTitleBar.h" #include "DockAreaTitleBar.h"
@ -31,12 +32,15 @@ CMainWindow::CMainWindow(QWidget *parent)
ui->setupUi(this); ui->setupUi(this);
CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true); CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false); CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false);
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
DockManager = new CDockManager(this); DockManager = new CDockManager(this);
// Set central widget // Set central widget
QCalendarWidget* calendar = new QCalendarWidget(); QPlainTextEdit* w = new QPlainTextEdit();
w->setPlaceholderText("This is the central editor. Enter your text here.");
//w->setStyleSheet("border: none");
CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget"); CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget");
CentralDockWidget->setWidget(calendar); CentralDockWidget->setWidget(w);
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget); auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas); CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);