Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5fefaa35f | ||
|
|
3c4af9c6af | ||
|
|
12ec819aeb | ||
|
|
e6fc1c14bd | ||
|
|
6fb45c055c | ||
|
|
535b926095 | ||
|
|
b15bc26a63 | ||
|
|
1d90e8e823 | ||
|
|
6b3027401d | ||
|
|
e35bd65a91 | ||
|
|
8888f6800b | ||
|
|
2afe62ec77 | ||
|
|
4b27af959b | ||
|
|
0df1a41a1d | ||
|
|
21badd592e | ||
|
|
a110d53a53 | ||
|
|
0270993782 | ||
|
|
2c0d899b2a | ||
|
|
1abe101ef7 | ||
|
|
0ebc170cfa | ||
|
|
ee6ddfadc3 | ||
|
|
720b5f0c72 | ||
|
|
aceabd8455 | ||
|
|
d0c100995e | ||
|
|
f54e4c8ac2 | ||
|
|
2c7b5982b5 | ||
|
|
bac0698581 | ||
|
|
be3180df6f |
@@ -1,20 +1,41 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
||||
include(GetGitRevisionDescription)
|
||||
git_describe(GitTagVersion --tags)
|
||||
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GitTagVersion}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GitTagVersion}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GitTagVersion}")
|
||||
set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
|
||||
# By default, the version information is extracted from the git index. However,
|
||||
# we can override this behavior by explicitly setting ADS_VERSION and
|
||||
# skipping the git checks. This is useful for cases where this project is being
|
||||
# used independently of its original git repo (e.g. vendored in another project)
|
||||
if(NOT ADS_VERSION)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
||||
include(GetGitRevisionDescription)
|
||||
git_describe(GitTagVersion --tags)
|
||||
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GitTagVersion}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GitTagVersion}")
|
||||
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GitTagVersion}")
|
||||
set(VERSION_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
else()
|
||||
string(REGEX MATCHALL "[\.]" VERSION_DOT_MATCHES ${ADS_VERSION})
|
||||
list(LENGTH VERSION_DOT_MATCHES VERSION_DOT_COUNT)
|
||||
if(VERSION_DOT_COUNT EQUAL 2)
|
||||
set(VERSION_SHORT ${ADS_VERSION})
|
||||
else()
|
||||
message(FATAL_ERROR "ADS_VERSION must be in major.minor.patch format, e.g. 3.8.1. Got ${ADS_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
project(QtADS LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||
|
||||
option(BUILD_STATIC "Build the static library" OFF)
|
||||
option(BUILD_EXAMPLES "Build the examples" ON)
|
||||
|
||||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
|
||||
set(ads_PlatformDir "x86")
|
||||
else()
|
||||
set(ads_PlatformDir "x64")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
if(BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
add_subdirectory(demo)
|
||||
|
||||
50
README.md
50
README.md
@@ -15,13 +15,20 @@ integrated development environments (IDEs) such as Visual Studio.
|
||||
|
||||
## New and Noteworthy
|
||||
|
||||
The [release 3.7](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.7.0)
|
||||
The [release 3.8](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.8.1)
|
||||
adds the following features:
|
||||
|
||||
- option to close tabs with the middle mouse button
|
||||
- `DeleteContentOnClose` flag for dynamic deletion and creation of dock widget
|
||||
content
|
||||
|
||||
The [release 3.7](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.7.2)
|
||||
adds the following features:
|
||||
|
||||
- support for **Qt6.**
|
||||
- support for [empty dock area](doc/user-guide.md#empty-dock-area)
|
||||
|
||||
The [release 3.6](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.6.0)
|
||||
The [release 3.6](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.6.3)
|
||||
adds some nice new features:
|
||||
|
||||
- support for [central widget](doc/user-guide.md#central-widget) concept
|
||||
@@ -82,6 +89,8 @@ know it from Visual Studio.
|
||||
- [D-Tect X](#d-tect-x)
|
||||
- [HiveWE](#hivewe)
|
||||
- [Ramses Composer](#ramses-composer)
|
||||
- [Plot Juggler](#plot-juggler)
|
||||
- [Notepad Next](#notepad-next)
|
||||
|
||||
### Docking everywhere - no central widget
|
||||
|
||||
@@ -363,13 +372,13 @@ Taken from the [Qt Blog](https://www.qt.io/blog/qt-design-studio-1.5-beta-releas
|
||||
|
||||
[](https://youtu.be/za9KBWcFXEw?t=84)
|
||||
|
||||
### [QmixElements](https://www.cetoni.com/products/qmixelements/)
|
||||
### [CETONI Elements](https://www.cetoni.com/products/qmixelements/)
|
||||
|
||||
The QmixElements software from [CETONI](https://www.cetoni.com) is a comprehensive,
|
||||
The CETONI Elements software from [CETONI](https://www.cetoni.com) is a comprehensive,
|
||||
plugin-based and modular laboratory automation software for controlling CETONI devices using a joint graphical user interface. The software features a powerful script system to automate processes. This [blog post](https://www.cetoni.com/blog/qmixelements-advanced-docking-system/) gives a nice overview about the use of the Qt
|
||||
Advanced Docking System in the QmixElements sofware.
|
||||
Advanced Docking System in the CETONI Elements sofware.
|
||||
|
||||

|
||||

|
||||
|
||||
### [ezEditor](https://github.com/ezEngine/ezEngine)
|
||||
|
||||
@@ -413,3 +422,32 @@ and digital portfolio.
|
||||
[learn more...](https://github.com/GENIVI/ramses-composer)
|
||||
|
||||

|
||||
|
||||
### [Plot Juggler](https://github.com/facontidavide/PlotJuggler)
|
||||
|
||||
PlotJuggler is a fast, powerful and intuitive tool to visualize time series.
|
||||
It makes it easy to visualize data but also to analyze it. You can manipulate
|
||||
your time series using a simple and extendable Transform Editor. Some of the
|
||||
highlights are:
|
||||
|
||||
- Simple Drag & Drop user interface.
|
||||
- Load data from file.
|
||||
- Connect to live streaming of data.
|
||||
- Save the visualization layout and configurations to re-use them later.
|
||||
- Fast OpenGL visualization.
|
||||
- Can handle thousands of timeseries and millions of data points.
|
||||
- Transform your data using a simple editor: derivative, moving average, integral, etc…
|
||||
- PlotJuggler can be easily extended using plugins.
|
||||
|
||||
[read more...](https://github.com/facontidavide/PlotJuggler)
|
||||
|
||||
[](https://vimeo.com/480588113#t=46s)
|
||||
|
||||
### [Notepad Next](https://github.com/dail8859/NotepadNext)
|
||||
|
||||
Notepad Next is a cross-platform reimplementation of Notepad++ that uses the
|
||||
Advanced Docking System to arrange the open source files on the screen.
|
||||
|
||||
[learn more...](https://github.com/dail8859/NotepadNext)
|
||||
|
||||

|
||||
|
||||
@@ -466,6 +466,15 @@ void MainWindowPrivate::createContent()
|
||||
Action = ui.menuTests->addAction(QString("Raise %1").arg(DockWidget->windowTitle()));
|
||||
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(raise()));
|
||||
|
||||
// Test hidden floating dock widget
|
||||
DockWidget = createLongTextLabelDockWidget();
|
||||
DockManager->addDockWidgetFloating(DockWidget);
|
||||
DockWidget->toggleView(false);
|
||||
|
||||
// Test visible floating dock widget
|
||||
DockWidget = createCalendarDockWidget();
|
||||
DockManager->addDockWidgetFloating(DockWidget);
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
BIN
doc/cfg_flag_MiddleMouseButtonClosesTab.gif
Normal file
BIN
doc/cfg_flag_MiddleMouseButtonClosesTab.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 257 KiB |
BIN
doc/showcase_notepad_next.png
Normal file
BIN
doc/showcase_notepad_next.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 92 KiB |
BIN
doc/showcase_plot_juggler.png
Normal file
BIN
doc/showcase_plot_juggler.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 264 KiB |
@@ -27,6 +27,17 @@
|
||||
- [`EqualSplitOnInsertion`](#equalsplitoninsertion)
|
||||
- [`FloatingContainerForceNativeTitleBar` (Linux only)](#floatingcontainerforcenativetitlebar-linux-only)
|
||||
- [`FloatingContainerForceQWidgetTitleBar` (Linux only)](#floatingcontainerforceqwidgettitlebar-linux-only)
|
||||
- [`MiddleMouseButtonClosesTab`](#middlemousebuttonclosestab)
|
||||
- [DockWidget Feature Flags](#dockwidget-feature-flags)
|
||||
- [`DockWidgetClosable`](#dockwidgetclosable)
|
||||
- [`DockWidgetMovable`](#dockwidgetmovable)
|
||||
- [`DockWidgetFloatable`](#dockwidgetfloatable)
|
||||
- [`DockWidgetDeleteOnClose`](#dockwidgetdeleteonclose)
|
||||
- [`CustomCloseHandling`](#customclosehandling)
|
||||
- [`DockWidgetFocusable`](#dockwidgetfocusable)
|
||||
- [`DockWidgetForceCloseWithArea`](#dockwidgetforceclosewitharea)
|
||||
- [`NoTab`](#notab)
|
||||
- [`DeleteContentOnClose`](#deletecontentonclose)
|
||||
- [Central Widget](#central-widget)
|
||||
- [Empty Dock Area](#empty-dock-area)
|
||||
- [Custom Close Handling](#custom-close-handling)
|
||||
@@ -464,6 +475,69 @@ If you would like to overwrite autodetection, then you can activate this flag
|
||||
to force QWidget based title bars. You can overwrite autodetection and this
|
||||
flag, if you set the environment variable `ADS_UseNativeTitle` to 0 or 1.
|
||||
|
||||
### `MiddleMouseButtonClosesTab`
|
||||
|
||||
If the flag is set, the user can use the mouse middle button to close the tab
|
||||
under the mouse. So you do not need to exactly hit the tab close button to
|
||||
close tab. Just click with the middle mouse button on a tab like this is
|
||||
possible in various web browsers.
|
||||
|
||||

|
||||
|
||||
## DockWidget Feature Flags
|
||||
|
||||
### `DockWidgetClosable`
|
||||
|
||||
If set, the dock widget will have a close button.
|
||||
|
||||
### `DockWidgetMovable`
|
||||
|
||||
If a dock widget is movable, then it and can be moved to a new position in the
|
||||
current dock container. Disable this flag to prevent moving of a dock widget
|
||||
via mouse. If the `OpaqueUndocking` configuration flag is set, then dock widgets
|
||||
are immediately undocked into floating widgets. That means, moving is only
|
||||
possible in this case, if the dock widget is also floatable (feature flag
|
||||
`DockWidgetFloatable` is set).
|
||||
|
||||
### `DockWidgetFloatable`
|
||||
|
||||
If set, a dock widget can be dragged into a floating window.
|
||||
|
||||
### `DockWidgetDeleteOnClose`
|
||||
|
||||
Deletes the dock widget and its content when it is closed.
|
||||
|
||||
### `CustomCloseHandling`
|
||||
|
||||
Clicking the close button will not close the dock widget but emits the
|
||||
`closeRequested()` signal instead. This allows the application to implement
|
||||
a custom close handling.
|
||||
|
||||
### `DockWidgetFocusable`
|
||||
|
||||
If this is enabled, a dock widget can get focus highlighting.
|
||||
|
||||
### `DockWidgetForceCloseWithArea`
|
||||
|
||||
A dock widget will be closed when the dock area hosting it is closed. If the
|
||||
`DockWidgetDeleteOnClose` feature is enabled for a dock widget, then it will
|
||||
be deleted, if the user clicks the close button of this dock widget. If the
|
||||
user clicks the close button of the dock area that contains this widget,
|
||||
then only the visibility of the dock widget is toggled. If this feature flag
|
||||
is set, the closing the dock area also closes the dock widget. That means, if
|
||||
the dock widget feature `DockWidgetDeleteOnClose` is set for the dock widgets
|
||||
in a dock area, then all dock widgets will be deleted if the dock area is closed.
|
||||
|
||||
### `NoTab`
|
||||
|
||||
A dock widget tab will never be shown if this flag is set.
|
||||
|
||||
### `DeleteContentOnClose`
|
||||
|
||||
Deletes only the contained widget on close, keeping the dock widget intact and
|
||||
in place. Attempts to rebuild the contents widget on show if there is a widget
|
||||
factory set. See [issue #365](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/pull/365) for more details.
|
||||
|
||||
## Central Widget
|
||||
|
||||
The Advanced Docking System has been developed to overcome the limitations of
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(QtADSExamples LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||
add_subdirectory(simple)
|
||||
add_subdirectory(hideshow)
|
||||
add_subdirectory(sidebar)
|
||||
add_subdirectory(deleteonclose)
|
||||
add_subdirectory(centralwidget)
|
||||
|
||||
@@ -3,6 +3,7 @@ TEMPLATE = subdirs
|
||||
SUBDIRS = \
|
||||
centralwidget \
|
||||
simple \
|
||||
hideshow \
|
||||
sidebar \
|
||||
deleteonclose \
|
||||
emptydockarea \
|
||||
|
||||
28
examples/hideshow/CMakeLists.txt
Normal file
28
examples/hideshow/CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ads_example_hideshow VERSION ${VERSION_SHORT})
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
add_executable(HideShowExample WIN32
|
||||
main.cpp
|
||||
MainWindow.cpp
|
||||
MainWindow.ui
|
||||
)
|
||||
target_include_directories(HideShowExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||
target_link_libraries(HideShowExample PRIVATE qtadvanceddocking)
|
||||
target_link_libraries(HideShowExample PUBLIC Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Gui
|
||||
Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
set_target_properties(HideShowExample PROPERTIES
|
||||
AUTOMOC ON
|
||||
AUTORCC ON
|
||||
AUTOUIC ON
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
VERSION ${VERSION_SHORT}
|
||||
EXPORT_NAME "Qt Advanced Docking System Hide,Show Example"
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"
|
||||
)
|
||||
78
examples/hideshow/MainWindow.cpp
Normal file
78
examples/hideshow/MainWindow.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#include "../../examples/hideshow/MainWindow.h"
|
||||
|
||||
#include "ui_MainWindow.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->centralWidget->setLayout( m_layout = new QStackedLayout() );
|
||||
|
||||
m_welcomeWidget = new QWidget(this);
|
||||
auto welcomeLayout = new QVBoxLayout(m_welcomeWidget);
|
||||
welcomeLayout->addStretch();
|
||||
QPushButton* openButton = new QPushButton("Open project");
|
||||
welcomeLayout->addWidget( openButton );
|
||||
welcomeLayout->addStretch();
|
||||
|
||||
connect( openButton, SIGNAL(clicked()), this, SLOT(openProject()) );
|
||||
|
||||
m_DockManager = new ads::CDockManager(ui->centralWidget);
|
||||
|
||||
// Create example content label - this can be any application specific
|
||||
// widget
|
||||
QLabel* l = new QLabel();
|
||||
l->setWordWrap(true);
|
||||
l->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
l->setText("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ");
|
||||
|
||||
// Create a dock widget with the title Label 1 and set the created label
|
||||
// as the dock widget content
|
||||
ads::CDockWidget* DockWidget = new ads::CDockWidget("Label 1");
|
||||
DockWidget->setWidget(l);
|
||||
|
||||
// Add the toggleViewAction of the dock widget to the menu to give
|
||||
// the user the possibility to show the dock widget if it has been closed
|
||||
ui->menuView->addAction(DockWidget->toggleViewAction());
|
||||
|
||||
connect( ui->actionOpen, SIGNAL(triggered()), this, SLOT(openProject()) );
|
||||
connect( ui->actionClose, SIGNAL(triggered()), this, SLOT(closeProject()) );
|
||||
|
||||
// Add the dock widget to the top dock widget area
|
||||
m_DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);
|
||||
|
||||
ui->centralWidget->layout()->addWidget( m_welcomeWidget );
|
||||
ui->centralWidget->layout()->addWidget( m_DockManager );
|
||||
|
||||
closeProject();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::openProject()
|
||||
{
|
||||
ui->actionOpen->setEnabled(false);
|
||||
ui->actionClose->setEnabled(true);
|
||||
ui->menuView->setEnabled(true);
|
||||
|
||||
m_layout->setCurrentWidget( m_DockManager );
|
||||
}
|
||||
|
||||
void MainWindow::closeProject()
|
||||
{
|
||||
ui->actionOpen->setEnabled(true);
|
||||
ui->actionClose->setEnabled(false);
|
||||
ui->menuView->setEnabled(false);
|
||||
|
||||
m_DockManager->hideManagerAndFloatingWidgets();
|
||||
m_layout->setCurrentWidget( m_welcomeWidget );
|
||||
}
|
||||
|
||||
33
examples/hideshow/MainWindow.h
Normal file
33
examples/hideshow/MainWindow.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QStackedLayout>
|
||||
#include "DockManager.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void openProject();
|
||||
void closeProject();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QWidget* m_welcomeWidget;
|
||||
ads::CDockManager* m_DockManager;
|
||||
QStackedLayout* m_layout;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
56
examples/hideshow/MainWindow.ui
Normal file
56
examples/hideshow/MainWindow.ui
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget"/>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>View</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionClose"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuView"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionOpen">
|
||||
<property name="text">
|
||||
<string>Open project</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClose">
|
||||
<property name="text">
|
||||
<string>Close project</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
31
examples/hideshow/hideshow.pro
Normal file
31
examples/hideshow/hideshow.pro
Normal file
@@ -0,0 +1,31 @@
|
||||
ADS_OUT_ROOT = $${OUT_PWD}/../..
|
||||
|
||||
QT += core gui widgets
|
||||
|
||||
TARGET = HideShowExample
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
TEMPLATE = app
|
||||
CONFIG += c++14
|
||||
CONFIG += debug_and_release
|
||||
adsBuildStatic {
|
||||
DEFINES += ADS_STATIC
|
||||
}
|
||||
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
MainWindow.cpp
|
||||
|
||||
HEADERS += \
|
||||
MainWindow.h
|
||||
|
||||
FORMS += \
|
||||
MainWindow.ui
|
||||
|
||||
|
||||
LIBS += -L$${ADS_OUT_ROOT}/lib
|
||||
include(../../ads.pri)
|
||||
INCLUDEPATH += ../../src
|
||||
DEPENDPATH += ../../src
|
||||
|
||||
11
examples/hideshow/main.cpp
Normal file
11
examples/hideshow/main.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <QApplication>
|
||||
#include "../../examples/hideshow/MainWindow.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
@@ -367,7 +367,8 @@ Q_SIGNALS:
|
||||
*/
|
||||
void viewToggled(bool Open);
|
||||
}; // class DockAreaWidget
|
||||
}
|
||||
// namespace ads
|
||||
} // namespace ads
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(ads::CDockAreaWidget::DockAreaFlags)
|
||||
//-----------------------------------------------------------------------------
|
||||
#endif // DockAreaWidgetH
|
||||
|
||||
@@ -1286,7 +1286,7 @@ CDockContainerWidget::CDockContainerWidget(CDockManager* DockManager, QWidget *p
|
||||
d->isFloating = floatingWidget() != nullptr;
|
||||
|
||||
d->Layout = new QGridLayout();
|
||||
d->Layout->setContentsMargins(0, 1, 0, 1);
|
||||
d->Layout->setContentsMargins(0, 0, 0, 0);
|
||||
d->Layout->setSpacing(0);
|
||||
setLayout(d->Layout);
|
||||
|
||||
@@ -1625,6 +1625,21 @@ QList<CDockAreaWidget*> CDockContainerWidget::openedDockAreas() const
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool CDockContainerWidget::hasOpenDockAreas() const
|
||||
{
|
||||
for (auto DockArea : d->DockAreas)
|
||||
{
|
||||
if (!DockArea->isHidden())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockContainerWidget::saveState(QXmlStreamWriter& s) const
|
||||
{
|
||||
@@ -1680,7 +1695,10 @@ bool CDockContainerWidget::restoreState(CDockingStateReader& s, bool Testing)
|
||||
if (!Testing)
|
||||
{
|
||||
CFloatingDockContainer* FloatingWidget = floatingWidget();
|
||||
FloatingWidget->restoreGeometry(Geometry);
|
||||
if (FloatingWidget)
|
||||
{
|
||||
FloatingWidget->restoreGeometry(Geometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,13 @@ public:
|
||||
*/
|
||||
QList<CDockAreaWidget*> openedDockAreas() const;
|
||||
|
||||
/**
|
||||
* This function returns true, if the container has open dock areas.
|
||||
* This functions is a little bit faster than calling openedDockAreas().isEmpty()
|
||||
* because it returns as soon as it finds an open dock area
|
||||
*/
|
||||
bool hasOpenDockAreas() const;
|
||||
|
||||
/**
|
||||
* This function returns true if this dock area has only one single
|
||||
* visible dock widget.
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
namespace ads
|
||||
{
|
||||
static const char* const FocusedDockWidgetProperty = "FocusedDockWidget";
|
||||
|
||||
/**
|
||||
* Private data class of CDockFocusController class (pimpl)
|
||||
*/
|
||||
@@ -57,8 +59,8 @@ struct DockFocusControllerPrivate
|
||||
* the dock area that it belongs to
|
||||
*/
|
||||
void updateDockWidgetFocus(CDockWidget* DockWidget);
|
||||
};
|
||||
// struct DockFocusControllerPrivate
|
||||
}; // struct DockFocusControllerPrivate
|
||||
|
||||
|
||||
|
||||
//===========================================================================
|
||||
@@ -125,7 +127,7 @@ void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
|
||||
|
||||
if (Window)
|
||||
{
|
||||
Window->setProperty("FocusedDockWidget", QVariant::fromValue<CDockWidget*>(DockWidget));
|
||||
Window->setProperty(FocusedDockWidgetProperty, QVariant::fromValue(QPointer<CDockWidget>(DockWidget)));
|
||||
}
|
||||
CDockAreaWidget* NewFocusedDockArea = nullptr;
|
||||
if (FocusedDockWidget)
|
||||
@@ -161,7 +163,7 @@ void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
|
||||
|
||||
if (NewFloatingWidget)
|
||||
{
|
||||
NewFloatingWidget->setProperty("FocusedDockWidget", QVariant::fromValue(DockWidget));
|
||||
NewFloatingWidget->setProperty(FocusedDockWidgetProperty, QVariant::fromValue(QPointer<CDockWidget>(DockWidget)));
|
||||
}
|
||||
|
||||
|
||||
@@ -243,13 +245,13 @@ void CDockFocusController::onFocusWindowChanged(QWindow *focusWindow)
|
||||
return;
|
||||
}
|
||||
|
||||
auto vDockWidget = focusWindow->property("FocusedDockWidget");
|
||||
auto vDockWidget = focusWindow->property(FocusedDockWidgetProperty);
|
||||
if (!vDockWidget.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto DockWidget = vDockWidget.value<CDockWidget*>();
|
||||
auto DockWidget = vDockWidget.value<QPointer<CDockWidget>>();
|
||||
if (!DockWidget)
|
||||
{
|
||||
return;
|
||||
@@ -376,13 +378,13 @@ void CDockFocusController::notifyFloatingWidgetDrop(CFloatingDockContainer* Floa
|
||||
return;
|
||||
}
|
||||
|
||||
auto vDockWidget = FloatingWidget->property("FocusedDockWidget");
|
||||
auto vDockWidget = FloatingWidget->property(FocusedDockWidgetProperty);
|
||||
if (!vDockWidget.isValid())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto DockWidget = vDockWidget.value<CDockWidget*>();
|
||||
auto DockWidget = vDockWidget.value<QPointer<CDockWidget>>();
|
||||
if (DockWidget)
|
||||
{
|
||||
DockWidget->dockAreaWidget()->setCurrentDockWidget(DockWidget);
|
||||
|
||||
@@ -98,6 +98,7 @@ struct DockManagerPrivate
|
||||
{
|
||||
CDockManager* _this;
|
||||
QList<CFloatingDockContainer*> FloatingWidgets;
|
||||
QList<CFloatingDockContainer*> HiddenFloatingWidgets;
|
||||
QList<CDockContainerWidget*> Containers;
|
||||
CDockOverlay* ContainerOverlay;
|
||||
CDockOverlay* DockAreaOverlay;
|
||||
@@ -755,6 +756,9 @@ CFloatingDockContainer* CDockManager::addDockWidgetFloating(CDockWidget* Dockwid
|
||||
void CDockManager::showEvent(QShowEvent *event)
|
||||
{
|
||||
Super::showEvent(event);
|
||||
|
||||
// Fix Issue #380
|
||||
restoreHiddenFloatingWidgets();
|
||||
if (d->UninitializedFloatingWidgets.empty())
|
||||
{
|
||||
return;
|
||||
@@ -762,12 +766,52 @@ void CDockManager::showEvent(QShowEvent *event)
|
||||
|
||||
for (auto FloatingWidget : d->UninitializedFloatingWidgets)
|
||||
{
|
||||
FloatingWidget->show();
|
||||
// Check, if someone closed a floating dock widget before the dock
|
||||
// manager is shown
|
||||
if (FloatingWidget->dockContainer()->hasOpenDockAreas())
|
||||
{
|
||||
FloatingWidget->show();
|
||||
}
|
||||
}
|
||||
d->UninitializedFloatingWidgets.clear();
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockManager::restoreHiddenFloatingWidgets()
|
||||
{
|
||||
if (d->HiddenFloatingWidgets.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Restore floating widgets that were hidden upon hideManagerAndFloatingWidgets
|
||||
for (auto FloatingWidget : d->HiddenFloatingWidgets)
|
||||
{
|
||||
bool hasDockWidgetVisible = false;
|
||||
|
||||
// Needed to prevent CFloatingDockContainer being shown empty
|
||||
// Could make sense to move this to CFloatingDockContainer::showEvent(QShowEvent *event)
|
||||
// if experiencing CFloatingDockContainer being shown empty in other situations, but let's keep
|
||||
// it here for now to make sure changes to fix Issue #380 does not impact existing behaviours
|
||||
for (auto dockWidget : FloatingWidget->dockWidgets())
|
||||
{
|
||||
if (dockWidget->toggleViewAction()->isChecked())
|
||||
{
|
||||
dockWidget->toggleView(true);
|
||||
hasDockWidgetVisible = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasDockWidgetVisible)
|
||||
{
|
||||
FloatingWidget->show();
|
||||
}
|
||||
}
|
||||
|
||||
d->HiddenFloatingWidgets.clear();
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
CDockAreaWidget* CDockManager::addDockWidget(DockWidgetArea area,
|
||||
CDockWidget* Dockwidget, CDockAreaWidget* DockAreaWidget)
|
||||
@@ -779,6 +823,16 @@ CDockAreaWidget* CDockManager::addDockWidget(DockWidgetArea area,
|
||||
return AreaOfAddedDockWidget;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
CDockAreaWidget* CDockManager::addDockWidgetToContainer(DockWidgetArea area,
|
||||
CDockWidget* Dockwidget, CDockContainerWidget* DockContainerWidget)
|
||||
{
|
||||
d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget);
|
||||
auto AreaOfAddedDockWidget = DockContainerWidget->addDockWidget(area, Dockwidget);
|
||||
Q_EMIT dockWidgetAdded(Dockwidget);
|
||||
return AreaOfAddedDockWidget;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
CDockAreaWidget* CDockManager::addDockWidgetTab(DockWidgetArea area,
|
||||
@@ -1097,6 +1151,38 @@ void CDockManager::setDockWidgetFocused(CDockWidget* DockWidget)
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
void CDockManager::hideManagerAndFloatingWidgets()
|
||||
{
|
||||
hide();
|
||||
|
||||
d->HiddenFloatingWidgets.clear();
|
||||
// Hide updates of floating widgets from user
|
||||
for (auto FloatingWidget : d->FloatingWidgets)
|
||||
{
|
||||
if ( FloatingWidget->isVisible() )
|
||||
{
|
||||
QList<CDockWidget*> VisibleWidgets;
|
||||
for ( auto dockWidget : FloatingWidget->dockWidgets() )
|
||||
{
|
||||
if ( dockWidget->toggleViewAction()->isChecked() )
|
||||
VisibleWidgets.push_back( dockWidget );
|
||||
}
|
||||
|
||||
// save as floating widget to be shown when CDockManager will be shown back
|
||||
d->HiddenFloatingWidgets.push_back( FloatingWidget );
|
||||
FloatingWidget->hide();
|
||||
|
||||
// hidding floating widget automatically marked contained CDockWidgets as hidden
|
||||
// but they must remain marked as visible as we want them to be restored visible
|
||||
// when CDockManager will be shown back
|
||||
for ( auto dockWidget : VisibleWidgets )
|
||||
{
|
||||
dockWidget->toggleViewAction()->setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
CDockWidget* CDockManager::focusedDockWidget() const
|
||||
|
||||
@@ -147,6 +147,11 @@ protected:
|
||||
*/
|
||||
CDockFocusController* dockFocusController() const;
|
||||
|
||||
/**
|
||||
* Restore floating widgets hidden by an earlier call to hideManagerAndFloatingWidgets.
|
||||
*/
|
||||
void restoreHiddenFloatingWidgets();
|
||||
|
||||
public:
|
||||
using Super = CDockContainerWidget;
|
||||
|
||||
@@ -278,6 +283,15 @@ public:
|
||||
CDockAreaWidget* addDockWidget(DockWidgetArea area, CDockWidget* Dockwidget,
|
||||
CDockAreaWidget* DockAreaWidget = nullptr);
|
||||
|
||||
/**
|
||||
* Adds dockwidget into the given container.
|
||||
* This allows you to place the dock widget into a container, even if that
|
||||
* container does not yet contain a DockAreaWidget.
|
||||
* \return Returns the dock area widget that contains the new DockWidget
|
||||
*/
|
||||
CDockAreaWidget* addDockWidgetToContainer(DockWidgetArea area, CDockWidget* Dockwidget,
|
||||
CDockContainerWidget* DockContainerWidget);
|
||||
|
||||
/**
|
||||
* This function will add the given Dockwidget to the given dock area as
|
||||
* a new tab.
|
||||
@@ -527,6 +541,12 @@ public Q_SLOTS:
|
||||
*/
|
||||
void setDockWidgetFocused(CDockWidget* DockWidget);
|
||||
|
||||
/**
|
||||
* hide CDockManager and all floating widgets (See Issue #380). Calling regular QWidget::hide()
|
||||
* hides the CDockManager but not the floating widgets;
|
||||
*/
|
||||
void hideManagerAndFloatingWidgets();
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted if the list of perspectives changed.
|
||||
@@ -617,5 +637,7 @@ Q_SIGNALS:
|
||||
void focusedDockWidgetChanged(ads::CDockWidget* old, ads::CDockWidget* now);
|
||||
}; // class DockManager
|
||||
} // namespace ads
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(ads::CDockManager::ConfigFlags)
|
||||
//-----------------------------------------------------------------------------
|
||||
#endif // DockManagerH
|
||||
|
||||
@@ -893,7 +893,10 @@ void CDockWidget::setFloating()
|
||||
//============================================================================
|
||||
void CDockWidget::deleteDockWidget()
|
||||
{
|
||||
dockManager()->removeDockWidget(this);
|
||||
auto manager=dockManager();
|
||||
if(manager){
|
||||
manager->removeDockWidget(this);
|
||||
}
|
||||
deleteLater();
|
||||
d->Closed = true;
|
||||
}
|
||||
|
||||
@@ -600,7 +600,8 @@ Q_SIGNALS:
|
||||
*/
|
||||
void featuresChanged(ads::CDockWidget::DockWidgetFeatures features);
|
||||
}; // class DockWidget
|
||||
}
|
||||
// namespace ads
|
||||
} // namespace ads
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(ads::CDockWidget::DockWidgetFeatures)
|
||||
//-----------------------------------------------------------------------------
|
||||
#endif // DockWidgetH
|
||||
|
||||
@@ -407,7 +407,7 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
||||
}
|
||||
else if (ev->button() == Qt::MiddleButton)
|
||||
{
|
||||
if (CDockManager::testConfigFlag(CDockManager::MiddleMouseButtonClosesTab))
|
||||
if (CDockManager::testConfigFlag(CDockManager::MiddleMouseButtonClosesTab) && d->DockWidget->features().testFlag(CDockWidget::DockWidgetClosable))
|
||||
{
|
||||
// Only attempt to close if the mouse is still
|
||||
// on top of the widget, to allow the user to cancel.
|
||||
|
||||
@@ -163,8 +163,8 @@ void CElidingLabel::resizeEvent(QResizeEvent *event)
|
||||
//============================================================================
|
||||
QSize CElidingLabel::minimumSizeHint() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
bool HasPixmap = !pixmap().isNull();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||
bool HasPixmap = !pixmap(Qt::ReturnByValue).isNull();
|
||||
#else
|
||||
bool HasPixmap = (pixmap() != nullptr);
|
||||
#endif
|
||||
@@ -185,8 +185,8 @@ QSize CElidingLabel::minimumSizeHint() const
|
||||
//============================================================================
|
||||
QSize CElidingLabel::sizeHint() const
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
bool HasPixmap = !pixmap().isNull();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
|
||||
bool HasPixmap = !pixmap(Qt::ReturnByValue).isNull();
|
||||
#else
|
||||
bool HasPixmap = (pixmap() != nullptr);
|
||||
#endif
|
||||
|
||||
@@ -308,5 +308,6 @@ void repolishStyle(QWidget* w, eRepolishChildOptions Options = RepolishIgnoreChi
|
||||
} // namespace internal
|
||||
} // namespace ads
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(ads::DockWidgetAreas)
|
||||
//---------------------------------------------------------------------------
|
||||
#endif // ads_globalsH
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
ads--CDockContainerWidget {
|
||||
background: palette(dark);
|
||||
}
|
||||
ads--CDockContainerWidget > QSplitter{
|
||||
padding: 1 0 1 0;
|
||||
}
|
||||
|
||||
ads--CDockContainerWidget ads--CDockSplitter::handle {
|
||||
background: palette(dark);
|
||||
@@ -90,4 +93,4 @@ QScrollArea#dockWidgetScrollArea {
|
||||
qproperty-icon: url(:/ads/images/detach-button.svg),
|
||||
url(:/ads/images/detach-button-disabled.svg) disabled;
|
||||
qproperty-iconSize: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
ads--CDockContainerWidget {
|
||||
background: palette(dark);
|
||||
}
|
||||
ads--CDockContainerWidget > QSplitter{
|
||||
padding: 1 0 1 0;
|
||||
}
|
||||
|
||||
ads--CDockContainerWidget ads--CDockSplitter::handle {
|
||||
background: palette(dark);
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
ads--CDockContainerWidget {
|
||||
background: palette(dark);
|
||||
}
|
||||
ads--CDockContainerWidget > QSplitter{
|
||||
padding: 1 0 1 0;
|
||||
}
|
||||
|
||||
ads--CDockAreaWidget {
|
||||
background: palette(window);
|
||||
@@ -123,4 +126,4 @@ ads--CDockAreaWidget[focused="true"] ads--CDockAreaTitleBar {
|
||||
background: transparent;
|
||||
border-bottom: 2px solid palette(highlight);
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
ads--CDockContainerWidget {
|
||||
background: palette(dark);
|
||||
}
|
||||
ads--CDockContainerWidget > QSplitter{
|
||||
padding: 1 0 1 0;
|
||||
}
|
||||
|
||||
|
||||
ads--CDockContainerWidget ads--CDockSplitter::handle {
|
||||
background: palette(dark);
|
||||
|
||||
Reference in New Issue
Block a user