mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-26 14:29:02 +08:00
Improved autohidedragndrop example to check, if it also works when dragging with multiple auto hide tabs
This commit is contained in:
parent
f964ce2c68
commit
8dcdc8fad2
@ -23,7 +23,7 @@ SOURCES += \
|
|||||||
droppableitem.cpp
|
droppableitem.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h
|
mainwindow.h \
|
||||||
droppableitem.h
|
droppableitem.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
|
@ -24,6 +24,7 @@ void DroppableItem::dragEnterEvent(QDragEnterEvent* event)
|
|||||||
|
|
||||||
void DroppableItem::dragLeaveEvent(QDragLeaveEvent* event)
|
void DroppableItem::dragLeaveEvent(QDragLeaveEvent* event)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(event);
|
||||||
unsetCursor();
|
unsetCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
||||||
CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig);
|
CDockManager::setAutoHideConfigFlags(CDockManager::DefaultAutoHideConfig);
|
||||||
CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideOpenOnDragHover, true);
|
CDockManager::setAutoHideConfigFlag(CDockManager::AutoHideOpenOnDragHover, true);
|
||||||
|
CDockManager::setConfigParam(CDockManager::AutoHideOpenOnDragHoverDelay_ms, 500);
|
||||||
DockManager = new CDockManager(this);
|
DockManager = new CDockManager(this);
|
||||||
|
|
||||||
// Set central widget
|
// Set central widget
|
||||||
@ -39,8 +40,9 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||||
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
|
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
|
||||||
|
|
||||||
|
{
|
||||||
DroppableItem* droppableItem = new DroppableItem("Drop text here.");
|
DroppableItem* droppableItem = new DroppableItem("Drop text here.");
|
||||||
CDockWidget* dropDockWidget = new CDockWidget("Tab");
|
CDockWidget* dropDockWidget = new CDockWidget("Tab 1");
|
||||||
dropDockWidget->setWidget(droppableItem);
|
dropDockWidget->setWidget(droppableItem);
|
||||||
dropDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
dropDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||||
dropDockWidget->setMinimumSize(200,150);
|
dropDockWidget->setMinimumSize(200,150);
|
||||||
@ -49,6 +51,19 @@ CMainWindow::CMainWindow(QWidget *parent)
|
|||||||
autoHideContainer->setSize(480);
|
autoHideContainer->setSize(480);
|
||||||
autoHideContainer->setAcceptDrops(true);
|
autoHideContainer->setAcceptDrops(true);
|
||||||
ui->menuView->addAction(dropDockWidget->toggleViewAction());
|
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();
|
QTableWidget* propertiesTable = new QTableWidget();
|
||||||
propertiesTable->setColumnCount(3);
|
propertiesTable->setColumnCount(3);
|
||||||
|
@ -2,6 +2,7 @@ TEMPLATE = subdirs
|
|||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
autohide \
|
autohide \
|
||||||
|
autohidedragndrop \
|
||||||
centralwidget \
|
centralwidget \
|
||||||
simple \
|
simple \
|
||||||
hideshow \
|
hideshow \
|
||||||
|
Loading…
Reference in New Issue
Block a user