Improved autohidedragndrop example to check, if it also works when dragging with multiple auto hide tabs

This commit is contained in:
Uwe Kindler 2024-10-28 15:40:32 +01:00
parent f964ce2c68
commit 8dcdc8fad2
4 changed files with 28 additions and 11 deletions

View File

@ -23,7 +23,7 @@ SOURCES += \
droppableitem.cpp
HEADERS += \
mainwindow.h
mainwindow.h \
droppableitem.h
FORMS += \

View File

@ -24,6 +24,7 @@ void DroppableItem::dragEnterEvent(QDragEnterEvent* event)
void DroppableItem::dragLeaveEvent(QDragLeaveEvent* event)
{
Q_UNUSED(event);
unsetCursor();
}

View File

@ -29,6 +29,7 @@ CMainWindow::CMainWindow(QWidget *parent)
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig);
CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideOpenOnDragHover, true);
CDockManager::setConfigParam(CDockManager::AutoHideOpenOnDragHoverDelay_ms, 500);
DockManager = new CDockManager(this);
// Set central widget
@ -39,8 +40,9 @@ CMainWindow::CMainWindow(QWidget *parent)
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
{
DroppableItem* droppableItem = new DroppableItem("Drop text here.");
CDockWidget* dropDockWidget = new CDockWidget("Tab");
CDockWidget* dropDockWidget = new CDockWidget("Tab 1");
dropDockWidget->setWidget(droppableItem);
dropDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
dropDockWidget->setMinimumSize(200,150);
@ -49,6 +51,19 @@ CMainWindow::CMainWindow(QWidget *parent)
autoHideContainer->setSize(480);
autoHideContainer->setAcceptDrops(true);
ui->menuView->addAction(dropDockWidget->toggleViewAction());
}
{
DroppableItem* droppableItem = new DroppableItem("Drop text here.");
CDockWidget* dropDockWidget = new CDockWidget("Tab 2");
dropDockWidget->setWidget(droppableItem);
dropDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
dropDockWidget->setMinimumSize(200,150);
dropDockWidget->setAcceptDrops(true);
const auto autoHideContainer = DockManager->addAutoHideDockWidget(SideBarLocation::SideBarRight, dropDockWidget);
autoHideContainer->setSize(480);
autoHideContainer->setAcceptDrops(true);
ui->menuView->addAction(dropDockWidget->toggleViewAction());
}
QTableWidget* propertiesTable = new QTableWidget();
propertiesTable->setColumnCount(3);

View File

@ -2,6 +2,7 @@ TEMPLATE = subdirs
SUBDIRS = \
autohide \
autohidedragndrop \
centralwidget \
simple \
hideshow \