Skip to content

Commit 0b3c3f0

Browse files
Merge branch 'master' into autohide_drag
2 parents e2929ad + 957afe3 commit 0b3c3f0

File tree

6 files changed

+33
-12
lines changed

6 files changed

+33
-12
lines changed

.github/workflows/linux-builds.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
run: |
1717
sudo apt-get update --fix-missing
1818
sudo apt-get install qt5-default
19-
sudo apt-get install qtbase5-private-dev
19+
sudo apt-get install qtbase5-private-dev qtdeclarative5-dev
2020
- name: qmake
2121
run: qmake
2222
- name: make

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ Screenshot Ubuntu:
320320
## Build
321321

322322
The Linux build requires private header files. Make sure that they are installed.
323-
The library uses SVG icons, so ensure that Qt SVG support is installed.
323+
The library uses SVG icons, so ensure that Qt SVG support is installed. The demo
324+
application creates a `QQuickWidget` for testing, so ensure that the required
325+
libraries are installed.
324326

325327
### Qt5 on Ubuntu 18.04 or 20.04
326328

@@ -331,13 +333,13 @@ sudo apt install qt5-default qtbase5-private-dev
331333
### Qt5 on Ubuntu 22.04
332334

333335
```bash
334-
sudo apt install qtbase5-dev qtbase5-private-dev qtbase5-dev-tools libqt5svg5
336+
sudo apt install qtbase5-dev qtbase5-private-dev qtbase5-dev-tools libqt5svg5 libqt5qml5 qtdeclarative5-dev
335337
```
336338

337339
### Qt6 on Ubuntu 22.04
338340

339341
```bash
340-
sudo apt install qt6-base-dev qt6-base-private-dev qt6-tools-dev libqt6svg6
342+
sudo apt install qt6-default qt6-base-dev qt6-base-private-dev qt6-tools-dev libqt6svg6 qt6-qtdeclarative
341343
```
342344

343345
Open the `ads.pro` file with QtCreator and start the build, that's it.

demo/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5)
22
project(ads_demo VERSION ${VERSION_SHORT})
33

44
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
5-
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED)
5+
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets Quick QuickWidgets REQUIRED)
66
if(WIN32 AND QT_VERSION_MAJOR LESS 6)
77
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS AxContainer REQUIRED)
88
endif()
@@ -21,7 +21,9 @@ add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS})
2121
target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src")
2222
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::Core
2323
Qt${QT_VERSION_MAJOR}::Gui
24-
Qt${QT_VERSION_MAJOR}::Widgets)
24+
Qt${QT_VERSION_MAJOR}::Widgets
25+
Qt${QT_VERSION_MAJOR}::Quick
26+
Qt${QT_VERSION_MAJOR}::QuickWidgets)
2527
if(WIN32 AND QT_VERSION_MAJOR LESS 6)
2628
target_link_libraries(AdvancedDockingSystemDemo PUBLIC Qt${QT_VERSION_MAJOR}::AxContainer)
2729
endif()

demo/MainWindow.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include <QPointer>
6363
#include <QMap>
6464
#include <QElapsedTimer>
65+
#include <QQuickWidget>
6566

6667

6768
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
@@ -407,6 +408,17 @@ struct MainWindowPrivate
407408
return DockWidget;
408409
}
409410

411+
/**
412+
* Create QQuickWidget for test for OpenGL and QQuick
413+
*/
414+
ads::CDockWidget *createQQuickWidget()
415+
{
416+
QQuickWidget *widget = new QQuickWidget();
417+
ads::CDockWidget *dockWidget = new ads::CDockWidget("Quick");
418+
dockWidget->setWidget(widget);
419+
return dockWidget;
420+
}
421+
410422

411423
#ifdef Q_OS_WIN
412424
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
@@ -424,7 +436,6 @@ struct MainWindowPrivate
424436
}
425437
#endif
426438
#endif
427-
428439
};
429440

430441
//============================================================================
@@ -559,6 +570,11 @@ void MainWindowPrivate::createContent()
559570
// Create image viewer
560571
DockWidget = createImageViewer();
561572
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
573+
574+
// Create quick widget
575+
DockWidget = createQQuickWidget();
576+
DockWidget->setFeature(ads::CDockWidget::DockWidgetClosable, true);
577+
DockManager->addDockWidget(ads::LeftDockWidgetArea, DockWidget);
562578
}
563579

564580

demo/demo.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ADS_OUT_ROOT = $${OUT_PWD}/..
22

33
TARGET = AdvancedDockingSystemDemo
44
DESTDIR = $${ADS_OUT_ROOT}/lib
5-
QT += core gui widgets
5+
QT += core gui widgets quick quickwidgets
66

77
include(../ads.pri)
88

src/FloatingDockContainer.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ struct FloatingDockContainerPrivate
378378
QWidget* MouseEventHandler = nullptr;
379379
CFloatingWidgetTitleBar* TitleBar = nullptr;
380380
bool IsResizing = false;
381+
bool MousePressed = false;
381382
#endif
382383

383384
/**
@@ -1336,12 +1337,12 @@ void CFloatingDockContainer::resizeEvent(QResizeEvent *event)
13361337
Super::resizeEvent(event);
13371338
}
13381339

1339-
static bool s_mousePressed = false;
1340+
13401341
//============================================================================
13411342
void CFloatingDockContainer::moveEvent(QMoveEvent *event)
13421343
{
13431344
Super::moveEvent(event);
1344-
if (!d->IsResizing && event->spontaneous() && s_mousePressed)
1345+
if (!d->IsResizing && event->spontaneous() && d->MousePressed)
13451346
{
13461347
d->setState(DraggingFloatingWidget);
13471348
d->updateDropOverlays(QCursor::pos());
@@ -1357,10 +1358,10 @@ bool CFloatingDockContainer::event(QEvent *e)
13571358
switch (e->type())
13581359
{
13591360
case QEvent::WindowActivate:
1360-
s_mousePressed = false;
1361+
d->MousePressed = false;
13611362
break;
13621363
case QEvent::WindowDeactivate:
1363-
s_mousePressed = true;
1364+
d->MousePressed = true;
13641365
break;
13651366
default:
13661367
break;

0 commit comments

Comments
 (0)