Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13853573ea | ||
|
|
b6b4c626e8 | ||
|
|
bd41ec1627 | ||
|
|
b54dab7df2 | ||
|
|
e66ef604a7 | ||
|
|
e03674fd4b | ||
|
|
3f69fedd1f | ||
|
|
a614e3cc3d | ||
|
|
ebde50b492 | ||
|
|
2a6bd306cb | ||
|
|
8a27a5596b | ||
|
|
f835ffd978 | ||
|
|
97215705f5 |
104
.appveyor.yml
104
.appveyor.yml
@@ -10,19 +10,52 @@ environment:
|
||||
# Appveyor doesn't have Qt 12 yet
|
||||
LatestQtVersion: 5.13
|
||||
matrix:
|
||||
|
||||
# 32 bit builds
|
||||
# MSVC 2015 builds
|
||||
# Dynamic Library builds
|
||||
# LTS version of Qt, dll, 32bit, MSVC 2015, qmake
|
||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: x86
|
||||
use_mingw: "false"
|
||||
use_static: "false"
|
||||
use_cmake: "false"
|
||||
# LTS version of Qt, dll, 32bit, MSVC 2015, cmake
|
||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: x86
|
||||
use_mingw: "false"
|
||||
use_static: "false"
|
||||
use_cmake: "true"
|
||||
# end Dynamic Library builds
|
||||
# Static Library builds
|
||||
# LTS version of Qt, static, 32bit, MSVC 2015, qmake
|
||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: x86
|
||||
use_mingw: "false"
|
||||
use_static: "true"
|
||||
use_cmake: "false"
|
||||
# LTS version of Qt, static, 32bit, MSVC 2015, cmake
|
||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: x86
|
||||
use_mingw: "false"
|
||||
use_static: "true"
|
||||
use_cmake: "true"
|
||||
# end Static Library builds
|
||||
# end MSVC 2015 builds
|
||||
# MinGW builds
|
||||
# Dynamic Library builds
|
||||
# LTS version of Qt, dll, 32bit, MinGW, qmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\mingw73_32
|
||||
- QT5: C:\Qt\%LatestQtVersion%\mingw73_32
|
||||
COMPILER: C:\Qt\Tools\mingw730_32
|
||||
targetPlatform: x86
|
||||
use_mingw: "true"
|
||||
use_static: "false"
|
||||
use_cmake: "false"
|
||||
# LTS version of Qt, dll, 32bit, MinGW, cmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\mingw73_32
|
||||
- QT5: C:\Qt\%LatestQtVersion%\mingw73_32
|
||||
COMPILER: C:\Qt\Tools\mingw730_32
|
||||
targetPlatform: x86
|
||||
use_mingw: "true"
|
||||
@@ -31,14 +64,14 @@ environment:
|
||||
# end Dynamic Library builds
|
||||
# Static Library builds
|
||||
# LTS version of Qt, static, 32bit, MinGW, qmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\mingw73_32
|
||||
- QT5: C:\Qt\%LatestQtVersion%\mingw73_32
|
||||
COMPILER: C:\Qt\Tools\mingw730_32
|
||||
targetPlatform: x86
|
||||
use_mingw: "true"
|
||||
use_static: "true"
|
||||
use_cmake: "false"
|
||||
# LTS version of Qt, static, 32bit, MinGW, cmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\mingw73_32
|
||||
- QT5: C:\Qt\%LatestQtVersion%\mingw73_32
|
||||
COMPILER: C:\Qt\Tools\mingw730_32
|
||||
targetPlatform: x86
|
||||
use_mingw: "true"
|
||||
@@ -46,54 +79,19 @@ environment:
|
||||
use_cmake: "true"
|
||||
# end Static Library builds
|
||||
# end MinGW builds
|
||||
# MSVC 2017 builds
|
||||
# Dynamic Library builds
|
||||
# LTS version of Qt, dll, 32bit, MSVC 2017, qmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\msvc2017
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: x86
|
||||
use_mingw: "false"
|
||||
use_static: "false"
|
||||
use_cmake: "false"
|
||||
# LTS version of Qt, dll, 32bit, MSVC 2017, cmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\msvc2017
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: x86
|
||||
use_mingw: "false"
|
||||
use_static: "false"
|
||||
use_cmake: "true"
|
||||
# end Dynamic Library builds
|
||||
# Static Library builds
|
||||
# LTS version of Qt, static, 32bit, MSVC 2017, qmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\msvc2017
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: x86
|
||||
use_mingw: "false"
|
||||
use_static: "true"
|
||||
use_cmake: "false"
|
||||
# LTS version of Qt, static, 32bit, MSVC 2017, cmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\msvc2017
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: x86
|
||||
use_mingw: "false"
|
||||
use_static: "true"
|
||||
use_cmake: "true"
|
||||
# end Static Library builds
|
||||
# end MSVC 2017 builds
|
||||
# end 32 bit builds
|
||||
|
||||
# 64 bit builds
|
||||
# MSVC 2017 builds
|
||||
# MSVC 2015 builds
|
||||
# Dynamic Library builds
|
||||
# LTS version of Qt, dll, 64bit, MSVC 2017, qmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\msvc2017_64
|
||||
# LTS version of Qt, dll, 64bit, MSVC 2015, qmake
|
||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: amd64
|
||||
use_mingw: "false"
|
||||
use_static: "false"
|
||||
use_cmake: "false"
|
||||
# LTS version of Qt, dll, 64bit, MSVC 2017, cmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\msvc2017_64
|
||||
# LTS version of Qt, dll, 64bit, MSVC 2015, cmake
|
||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: amd64
|
||||
use_mingw: "false"
|
||||
@@ -101,40 +99,38 @@ environment:
|
||||
use_cmake: "true"
|
||||
# end Dynamic Library builds
|
||||
# Static Library builds
|
||||
# LTS version of Qt, static, 64bit, MSVC 2017, qmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\msvc2017_64
|
||||
# LTS version of Qt, static, 64bit, MSVC 2015, qmake
|
||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: amd64
|
||||
use_mingw: "false"
|
||||
use_static: "true"
|
||||
use_cmake: "false"
|
||||
# LTS version of Qt, static, 64bit, MSVC 2017, cmake
|
||||
- QT: C:\Qt\%LatestQtVersion%\msvc2017_64
|
||||
# LTS version of Qt, static, 64bit, MSVC 2015, cmake
|
||||
- QT5: C:\Qt\%LatestQtVersion%\msvc2017_64
|
||||
COMPILER: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build
|
||||
targetPlatform: amd64
|
||||
use_mingw: "false"
|
||||
use_static: "true"
|
||||
use_cmake: "true"
|
||||
# end Static Library builds
|
||||
# end MSVC 2017 builds
|
||||
# end MSVC 2015 builds
|
||||
# end 64 bit builds
|
||||
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
before_build:
|
||||
- set originalWD=%CD%
|
||||
- call "%QT%\bin\qtenv2.bat"
|
||||
- call "%QT5%\bin\qtenv2.bat"
|
||||
- cd /D %originalWD%
|
||||
- if %use_mingw%==false call "%COMPILER%\vcvarsall.bat" %targetPlatform%
|
||||
- if %use_static%==true (set USESTATIC=ON) else (set USESTATIC=OFF)
|
||||
- if %use_mingw%==true (set CMAKEGENERATOR="MinGW Makefiles") else (set CMAKEGENERATOR="NMake Makefiles")
|
||||
- if %use_mingw%==true (set MAKEENGINE=mingw32-make) else (set MAKEENGINE=nmake)
|
||||
- if %use_mingw%==true set PATH=%PATH%:C:\Program Files\Git\usr\bin;=%
|
||||
- if %use_mingw%==true set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
|
||||
|
||||
build_script:
|
||||
- echo %PATH%
|
||||
- if %use_cmake%==true mkdir build
|
||||
- if %use_cmake%==true cd build
|
||||
- if %use_cmake%==true cmake --version
|
||||
|
||||
11
README.md
11
README.md
@@ -15,10 +15,13 @@ integrated development environments (IDEs) such as Visual Studio.
|
||||
|
||||
## New and Noteworthy
|
||||
|
||||
The [release 3.7.0](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.7.0)
|
||||
adds support for Qt6.
|
||||
The [release 3.7](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.7.0)
|
||||
adds the following features:
|
||||
|
||||
The [release 3.6.0](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.6.0)
|
||||
- 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)
|
||||
adds some nice new features:
|
||||
|
||||
- support for [central widget](doc/user-guide.md#central-widget) concept
|
||||
@@ -32,7 +35,7 @@ adds some nice new features:
|
||||
Both features are contributions from ADS users. Read the [documentation](doc/user-guide.md)
|
||||
to learn more about both new features.
|
||||
|
||||
The [release 3.5.0](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.5.0)
|
||||
The [release 3.5](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/releases/tag/3.5.0)
|
||||
adds the new [focus highlighting](doc/user-guide.md#focushighlighting) feature.
|
||||
This optional feature enables highlighting of the focused dock widget like you
|
||||
know it from Visual Studio.
|
||||
|
||||
@@ -359,6 +359,7 @@ class MainWindow(MainWindowUI, MainWindowBase):
|
||||
floating = sender.property("Floating")
|
||||
dock_widget = self.create_editor_widget()
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetDeleteOnClose, True)
|
||||
dock_widget.setFeature(QtAds.CDockWidget.DockWidgetForceCloseWithArea, True)
|
||||
dock_widget.closeRequested.connect(self.on_editor_close_requested)
|
||||
|
||||
if floating:
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
- [`FloatingContainerForceNativeTitleBar` (Linux only)](#floatingcontainerforcenativetitlebar-linux-only)
|
||||
- [`FloatingContainerForceQWidgetTitleBar` (Linux only)](#floatingcontainerforceqwidgettitlebar-linux-only)
|
||||
- [Central Widget](#central-widget)
|
||||
- [Empty Dock Area](#empty-dock-area)
|
||||
- [Custom Close Handling](#custom-close-handling)
|
||||
- [Styling](#styling)
|
||||
- [Disabling the Internal Style Sheet](#disabling-the-internal-style-sheet)
|
||||
@@ -500,6 +501,33 @@ See the `centralwidget` example to learn how it works.
|
||||
> are already other dock widgets registered. So `setCentralWidget` should be
|
||||
> the first function that you call when adding dock widgets.
|
||||
|
||||
## Empty Dock Area
|
||||
|
||||
Some applications require a fixed DockArea that is always visible, even if it
|
||||
does not contain any DockWidgets. I.e. the DockArea is in this case a kind
|
||||
of central widget that is always visible (see this
|
||||
[issue](https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/issues/199)).
|
||||
|
||||
Since version 3.7.1 the advanced docking system supports this feature. The
|
||||
`emptydockarea` example shows how this can be implemented with the library. You
|
||||
just need to create a dock widget and set the feature flag `CDockWidget::NoTab`.
|
||||
This permanently hides the tab widget of this area and removes it from the tab
|
||||
menu. For this special dock widget you should also disable all other features
|
||||
(movable, closable and floatable) to prevent closing and moving of this widget.
|
||||
If you use the `CDockManager::setCentralWidget` function like in the example
|
||||
code below, then you don't need to disable these features because this is done
|
||||
in the `setCentralWidget` function.
|
||||
|
||||
```c++
|
||||
QLabel* label = new QLabel();
|
||||
label->setText("This is a DockArea which is always visible, even if it does not contain any DockWidgets.");
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget");
|
||||
CentralDockWidget->setWidget(label);
|
||||
CentralDockWidget->setFeature(ads::CDockWidget::NoTab, true);// set the flag before adding the widget to dock manager
|
||||
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||
```
|
||||
|
||||
## Custom Close Handling
|
||||
|
||||
Normally clicking the close button of a dock widget will just hide the widget and the user can show it again using the `toggleView()` action of the dock widget. This is meant for user interfaces with a static amount of widgets. But the advanced docking system also supports dynamic dock widgets that will get deleted on close. If you set the dock widget flag `DockWidgetDeleteOnClose` for a certain dock widget, then it will be deleted as soon as you close this dock widget. This enables the implementation of user interfaces with dynamically created editors, like in word processing applications or source code development tools.
|
||||
|
||||
@@ -3,4 +3,5 @@ project(QtADSExamples LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||
add_subdirectory(simple)
|
||||
add_subdirectory(sidebar)
|
||||
add_subdirectory(deleteonclose)
|
||||
add_subdirectory(centralwidget)
|
||||
add_subdirectory(centralwidget)
|
||||
add_subdirectory(emptydockarea)
|
||||
@@ -106,6 +106,11 @@ class MainWindow(MainWindowUI, MainWindowBase):
|
||||
self.perspective_combobox.clear()
|
||||
self.perspective_combobox.addItems(self.dock_manager.perspectiveNames())
|
||||
self.perspective_combobox.setCurrentText(perspective_name)
|
||||
|
||||
def closeEvent(self, event: QCloseEvent):
|
||||
self.dock_manager.deleteLater()
|
||||
super().closeEvent(event)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
@@ -46,27 +46,26 @@ CMainWindow::CMainWindow(QWidget *parent)
|
||||
CentralDockArea->setAllowedAreas(DockWidgetArea::OuterDockAreas);
|
||||
|
||||
// create other dock widgets
|
||||
QTreeView* fileTree = new QTreeView();
|
||||
fileTree->setFrameShape(QFrame::NoFrame);
|
||||
QFileSystemModel* fileModel = new QFileSystemModel(fileTree);
|
||||
fileModel->setRootPath(QDir::currentPath());
|
||||
fileTree->setModel(fileModel);
|
||||
CDockWidget* DataDockWidget = new CDockWidget("File system");
|
||||
DataDockWidget->setWidget(fileTree);
|
||||
DataDockWidget->resize(150, 250);
|
||||
DataDockWidget->setMinimumSize(100, 250);
|
||||
auto* fileArea = DockManager->addDockWidget(DockWidgetArea::LeftDockWidgetArea, DataDockWidget, CentralDockArea);
|
||||
ui->menuView->addAction(DataDockWidget->toggleViewAction());
|
||||
|
||||
QTableWidget* table = new QTableWidget();
|
||||
table->setColumnCount(3);
|
||||
table->setRowCount(10);
|
||||
CDockWidget* TableDockWidget = new CDockWidget("Table");
|
||||
CDockWidget* TableDockWidget = new CDockWidget("Table 1");
|
||||
TableDockWidget->setWidget(table);
|
||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
TableDockWidget->resize(250, 150);
|
||||
TableDockWidget->setMinimumSize(200,150);
|
||||
DockManager->addDockWidget(DockWidgetArea::BottomDockWidgetArea, TableDockWidget, fileArea);
|
||||
auto TableArea = DockManager->addDockWidget(DockWidgetArea::LeftDockWidgetArea, TableDockWidget);
|
||||
ui->menuView->addAction(TableDockWidget->toggleViewAction());
|
||||
|
||||
table = new QTableWidget();
|
||||
table->setColumnCount(5);
|
||||
table->setRowCount(1020);
|
||||
TableDockWidget = new CDockWidget("Table 2");
|
||||
TableDockWidget->setWidget(table);
|
||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
TableDockWidget->resize(250, 150);
|
||||
TableDockWidget->setMinimumSize(200,150);
|
||||
DockManager->addDockWidget(DockWidgetArea::BottomDockWidgetArea, TableDockWidget, TableArea);
|
||||
ui->menuView->addAction(TableDockWidget->toggleViewAction());
|
||||
|
||||
QTableWidget* propertiesTable = new QTableWidget();
|
||||
|
||||
25
examples/emptydockarea/CMakeLists.txt
Normal file
25
examples/emptydockarea/CMakeLists.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(ads_example_centralwidget VERSION ${VERSION_SHORT})
|
||||
find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
add_executable(EmptyDockAreaExample WIN32
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.ui
|
||||
)
|
||||
target_include_directories(EmptyDockAreaExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||
target_link_libraries(EmptyDockAreaExample PRIVATE qtadvanceddocking)
|
||||
target_link_libraries(EmptyDockAreaExample PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets)
|
||||
set_target_properties(EmptyDockAreaExample 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 Empty Dock Area 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"
|
||||
)
|
||||
34
examples/emptydockarea/emptydockarea.pro
Normal file
34
examples/emptydockarea/emptydockarea.pro
Normal file
@@ -0,0 +1,34 @@
|
||||
ADS_OUT_ROOT = $${OUT_PWD}/../..
|
||||
|
||||
QT += core gui widgets
|
||||
|
||||
TARGET = EmptyDockareaExample
|
||||
DESTDIR = $${ADS_OUT_ROOT}/lib
|
||||
TEMPLATE = app
|
||||
CONFIG += c++14
|
||||
CONFIG += debug_and_release
|
||||
adsBuildStatic {
|
||||
DEFINES += ADS_STATIC
|
||||
}
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
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
|
||||
|
||||
10
examples/emptydockarea/main.cpp
Normal file
10
examples/emptydockarea/main.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <mainwindow.h>
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
CMainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
136
examples/emptydockarea/mainwindow.cpp
Normal file
136
examples/emptydockarea/mainwindow.cpp
Normal file
@@ -0,0 +1,136 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QWidgetAction>
|
||||
#include <QLabel>
|
||||
#include <QCalendarWidget>
|
||||
#include <QTreeView>
|
||||
#include <QFileSystemModel>
|
||||
#include <QTableWidget>
|
||||
#include <QHBoxLayout>
|
||||
#include <QRadioButton>
|
||||
#include <QPushButton>
|
||||
#include <QInputDialog>
|
||||
#include <QFileDialog>
|
||||
#include <QSettings>
|
||||
#include <QMessageBox>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QToolBar>
|
||||
|
||||
#include "DockAreaWidget.h"
|
||||
#include "DockAreaTitleBar.h"
|
||||
#include "DockAreaTabBar.h"
|
||||
#include "FloatingDockContainer.h"
|
||||
#include "DockComponentsFactory.h"
|
||||
|
||||
using namespace ads;
|
||||
|
||||
|
||||
CMainWindow::CMainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::CMainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
CDockManager::setConfigFlag(CDockManager::OpaqueSplitterResize, true);
|
||||
CDockManager::setConfigFlag(CDockManager::XmlCompressionEnabled, false);
|
||||
CDockManager::setConfigFlag(CDockManager::FocusHighlighting, true);
|
||||
DockManager = new CDockManager(this);
|
||||
|
||||
// Set central widget
|
||||
QLabel* label = new QLabel();
|
||||
label->setText("This is a DockArea which is always visible, even if it does not contain any DockWidgets.");
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
CDockWidget* CentralDockWidget = new CDockWidget("CentralWidget");
|
||||
CentralDockWidget->setWidget(label);
|
||||
CentralDockWidget->setFeature(ads::CDockWidget::NoTab, true);
|
||||
auto* CentralDockArea = DockManager->setCentralWidget(CentralDockWidget);
|
||||
|
||||
// create other dock widgets
|
||||
QTableWidget* table = new QTableWidget();
|
||||
table->setColumnCount(3);
|
||||
table->setRowCount(10);
|
||||
CDockWidget* TableDockWidget = new CDockWidget("Table 1");
|
||||
TableDockWidget->setWidget(table);
|
||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
TableDockWidget->resize(250, 150);
|
||||
TableDockWidget->setMinimumSize(200,150);
|
||||
DockManager->addDockWidgetTabToArea(TableDockWidget, CentralDockArea);
|
||||
//auto TableArea = DockManager->addDockWidget(DockWidgetArea::LeftDockWidgetArea, TableDockWidget);
|
||||
ui->menuView->addAction(TableDockWidget->toggleViewAction());
|
||||
|
||||
table = new QTableWidget();
|
||||
table->setColumnCount(5);
|
||||
table->setRowCount(1020);
|
||||
TableDockWidget = new CDockWidget("Table 2");
|
||||
TableDockWidget->setWidget(table);
|
||||
TableDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
TableDockWidget->resize(250, 150);
|
||||
TableDockWidget->setMinimumSize(200,150);
|
||||
auto TableArea = DockManager->addDockWidget(DockWidgetArea::LeftDockWidgetArea, TableDockWidget);
|
||||
//DockManager->addDockWidget(DockWidgetArea::BottomDockWidgetArea, TableDockWidget, TableArea);
|
||||
ui->menuView->addAction(TableDockWidget->toggleViewAction());
|
||||
|
||||
QTableWidget* propertiesTable = new QTableWidget();
|
||||
propertiesTable->setColumnCount(3);
|
||||
propertiesTable->setRowCount(10);
|
||||
CDockWidget* PropertiesDockWidget = new CDockWidget("Properties");
|
||||
PropertiesDockWidget->setWidget(propertiesTable);
|
||||
PropertiesDockWidget->setMinimumSizeHintMode(CDockWidget::MinimumSizeHintFromDockWidget);
|
||||
PropertiesDockWidget->resize(250, 150);
|
||||
PropertiesDockWidget->setMinimumSize(200,150);
|
||||
DockManager->addDockWidget(DockWidgetArea::RightDockWidgetArea, PropertiesDockWidget, CentralDockArea);
|
||||
ui->menuView->addAction(PropertiesDockWidget->toggleViewAction());
|
||||
|
||||
createPerspectiveUi();
|
||||
}
|
||||
|
||||
CMainWindow::~CMainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void CMainWindow::createPerspectiveUi()
|
||||
{
|
||||
SavePerspectiveAction = new QAction("Create Perspective", this);
|
||||
connect(SavePerspectiveAction, SIGNAL(triggered()), SLOT(savePerspective()));
|
||||
PerspectiveListAction = new QWidgetAction(this);
|
||||
PerspectiveComboBox = new QComboBox(this);
|
||||
PerspectiveComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
PerspectiveComboBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
connect(PerspectiveComboBox, SIGNAL(activated(const QString&)),
|
||||
DockManager, SLOT(openPerspective(const QString&)));
|
||||
PerspectiveListAction->setDefaultWidget(PerspectiveComboBox);
|
||||
ui->toolBar->addSeparator();
|
||||
ui->toolBar->addAction(PerspectiveListAction);
|
||||
ui->toolBar->addAction(SavePerspectiveAction);
|
||||
}
|
||||
|
||||
|
||||
void CMainWindow::savePerspective()
|
||||
{
|
||||
QString PerspectiveName = QInputDialog::getText(this, "Save Perspective", "Enter unique name:");
|
||||
if (PerspectiveName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DockManager->addPerspective(PerspectiveName);
|
||||
QSignalBlocker Blocker(PerspectiveComboBox);
|
||||
PerspectiveComboBox->clear();
|
||||
PerspectiveComboBox->addItems(DockManager->perspectiveNames());
|
||||
PerspectiveComboBox->setCurrentText(PerspectiveName);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CMainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
// Delete dock manager here to delete all floating widgets. This ensures
|
||||
// that all top level windows of the dock manager are properly closed
|
||||
DockManager->deleteLater();
|
||||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
43
examples/emptydockarea/mainwindow.h
Normal file
43
examples/emptydockarea/mainwindow.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QComboBox>
|
||||
#include <QWidgetAction>
|
||||
|
||||
#include "DockManager.h"
|
||||
#include "DockAreaWidget.h"
|
||||
#include "DockWidget.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class CMainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class CMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMainWindow(QWidget *parent = nullptr);
|
||||
~CMainWindow();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
private:
|
||||
QAction* SavePerspectiveAction = nullptr;
|
||||
QWidgetAction* PerspectiveListAction = nullptr;
|
||||
QComboBox* PerspectiveComboBox = nullptr;
|
||||
|
||||
Ui::CMainWindow *ui;
|
||||
|
||||
ads::CDockManager* DockManager;
|
||||
ads::CDockAreaWidget* StatusDockArea;
|
||||
ads::CDockWidget* TimelineDockWidget;
|
||||
|
||||
void createPerspectiveUi();
|
||||
|
||||
private slots:
|
||||
void savePerspective();
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
47
examples/emptydockarea/mainwindow.ui
Normal file
47
examples/emptydockarea/mainwindow.ui
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CMainWindow</class>
|
||||
<widget class="QMainWindow" name="CMainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1284</width>
|
||||
<height>757</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>1284</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>View</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menuView"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -4,4 +4,5 @@ SUBDIRS = \
|
||||
centralwidget \
|
||||
simple \
|
||||
sidebar \
|
||||
deleteonclose
|
||||
deleteonclose \
|
||||
emptydockarea
|
||||
|
||||
@@ -135,7 +135,6 @@ protected:
|
||||
ads::CDockOverlay* dockAreaOverlay() const;
|
||||
void notifyWidgetOrAreaRelocation(QWidget* RelocatedWidget);
|
||||
void notifyFloatingWidgetDrop(ads::CFloatingDockContainer* FloatingWidget);
|
||||
ads::CDockWidget* focusedDockWidget() const;
|
||||
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
|
||||
@@ -217,6 +216,9 @@ public:
|
||||
void setViewMenuInsertionOrder(ads::CDockManager::eViewMenuInsertionOrder Order);
|
||||
bool isRestoringState() const;
|
||||
static int startDragDistance();
|
||||
ads::CDockWidget* focusedDockWidget() const;
|
||||
QList<int> splitterSizes(ads::CDockAreaWidget *ContainedArea) const;
|
||||
void setSplitterSizes(ads::CDockAreaWidget *ContainedArea, const QList<int>& sizes);
|
||||
|
||||
public slots:
|
||||
void openPerspective(const QString& PerspectiveName);
|
||||
|
||||
@@ -35,6 +35,8 @@ public:
|
||||
virtual bool event(QEvent *e);
|
||||
void setElideMode(Qt::TextElideMode mode);
|
||||
void updateStyle();
|
||||
QSize iconSize() const;
|
||||
void setIconSize(const QSize& Size);
|
||||
|
||||
public slots:
|
||||
virtual void setVisible(bool visible);
|
||||
|
||||
@@ -180,11 +180,11 @@ void CDockAreaTabBar::setCurrentIndex(int index)
|
||||
return;
|
||||
}
|
||||
|
||||
emit currentChanging(index);
|
||||
Q_EMIT currentChanging(index);
|
||||
d->CurrentIndex = index;
|
||||
d->updateTabs();
|
||||
updateGeometry();
|
||||
emit currentChanged(index);
|
||||
Q_EMIT currentChanged(index);
|
||||
}
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ void CDockAreaTabBar::insertTab(int Index, CDockWidgetTab* Tab)
|
||||
connect(Tab, SIGNAL(moved(const QPoint&)), this, SLOT(onTabWidgetMoved(const QPoint&)));
|
||||
connect(Tab, SIGNAL(elidedChanged(bool)), this, SIGNAL(elidedChanged(bool)));
|
||||
Tab->installEventFilter(this);
|
||||
emit tabInserted(Index);
|
||||
Q_EMIT tabInserted(Index);
|
||||
if (Index <= d->CurrentIndex)
|
||||
{
|
||||
setCurrentIndex(d->CurrentIndex + 1);
|
||||
@@ -266,7 +266,7 @@ void CDockAreaTabBar::removeTab(CDockWidgetTab* Tab)
|
||||
}
|
||||
}
|
||||
|
||||
emit removingTab(RemoveIndex);
|
||||
Q_EMIT removingTab(RemoveIndex);
|
||||
d->TabsLayout->removeWidget(Tab);
|
||||
Tab->disconnect(this);
|
||||
Tab->removeEventFilter(this);
|
||||
@@ -320,7 +320,7 @@ void CDockAreaTabBar::onTabClicked()
|
||||
return;
|
||||
}
|
||||
setCurrentIndex(index);
|
||||
emit tabBarClicked(index);
|
||||
Q_EMIT tabBarClicked(index);
|
||||
}
|
||||
|
||||
|
||||
@@ -409,7 +409,7 @@ void CDockAreaTabBar::onTabWidgetMoved(const QPoint& GlobalPos)
|
||||
d->TabsLayout->removeWidget(MovingTab);
|
||||
d->TabsLayout->insertWidget(toIndex, MovingTab);
|
||||
ADS_PRINT("tabMoved from " << fromIndex << " to " << toIndex);
|
||||
emit tabMoved(fromIndex, toIndex);
|
||||
Q_EMIT tabMoved(fromIndex, toIndex);
|
||||
setCurrentIndex(toIndex);
|
||||
}
|
||||
else
|
||||
@@ -432,7 +432,7 @@ void CDockAreaTabBar::closeTab(int Index)
|
||||
{
|
||||
return;
|
||||
}
|
||||
emit tabCloseRequested(Index);
|
||||
Q_EMIT tabCloseRequested(Index);
|
||||
}
|
||||
|
||||
|
||||
@@ -449,12 +449,12 @@ bool CDockAreaTabBar::eventFilter(QObject *watched, QEvent *event)
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::Hide:
|
||||
emit tabClosed(d->TabsLayout->indexOf(Tab));
|
||||
Q_EMIT tabClosed(d->TabsLayout->indexOf(Tab));
|
||||
updateGeometry();
|
||||
break;
|
||||
|
||||
case QEvent::Show:
|
||||
emit tabOpened(d->TabsLayout->indexOf(Tab));
|
||||
Q_EMIT tabOpened(d->TabsLayout->indexOf(Tab));
|
||||
updateGeometry();
|
||||
break;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
friend struct DockAreaTabBarPrivate;
|
||||
friend class CDockAreaTitleBar;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onTabClicked();
|
||||
void onTabCloseRequested();
|
||||
void onCloseOtherTabsRequested();
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
*/
|
||||
virtual QSize sizeHint() const override;
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* This property sets the index of the tab bar's visible tab
|
||||
*/
|
||||
@@ -152,7 +152,7 @@ public slots:
|
||||
*/
|
||||
void closeTab(int Index);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted when the tab bar's current tab is about to be changed. The new
|
||||
* current has the given index, or -1 if there isn't a new one.
|
||||
|
||||
@@ -382,7 +382,7 @@ void CDockAreaTitleBar::onTabsMenuActionTriggered(QAction* Action)
|
||||
{
|
||||
int Index = Action->data().toInt();
|
||||
d->TabBar->setCurrentIndex(Index);
|
||||
emit tabBarClicked(Index);
|
||||
Q_EMIT tabBarClicked(Index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
DockAreaTitleBarPrivate* d; ///< private data (pimpl)
|
||||
friend struct DockAreaTitleBarPrivate;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onTabsMenuAboutToShow();
|
||||
void onCloseButtonClicked();
|
||||
void onUndockButtonClicked();
|
||||
@@ -88,7 +88,7 @@ protected:
|
||||
*/
|
||||
virtual void contextMenuEvent(QContextMenuEvent *event) override;
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Call this slot to tell the title bar that it should update the tabs menu
|
||||
* the next time it is shown.
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
*/
|
||||
int indexOf(QWidget *widget) const;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted if a tab in the tab bar is clicked by the user
|
||||
* or if the user clicks on a tab item in the title bar tab menu.
|
||||
|
||||
@@ -378,7 +378,7 @@ CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget
|
||||
d->ContentsLayout = new DockAreaLayout(d->Layout);
|
||||
if (d->DockManager)
|
||||
{
|
||||
emit d->DockManager->dockAreaCreated(this);
|
||||
Q_EMIT d->DockManager->dockAreaCreated(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,11 +604,11 @@ void CDockAreaWidget::setCurrentIndex(int index)
|
||||
return;
|
||||
}
|
||||
|
||||
emit currentChanging(index);
|
||||
Q_EMIT currentChanging(index);
|
||||
TabBar->setCurrentIndex(index);
|
||||
d->ContentsLayout->setCurrentIndex(index);
|
||||
d->ContentsLayout->currentWidget()->show();
|
||||
emit currentChanged(index);
|
||||
Q_EMIT currentChanged(index);
|
||||
}
|
||||
|
||||
|
||||
@@ -808,18 +808,49 @@ CDockWidget* CDockAreaWidget::nextOpenDockWidget(CDockWidget* DockWidget) const
|
||||
auto OpenDockWidgets = openedDockWidgets();
|
||||
if (OpenDockWidgets.count() > 1 || (OpenDockWidgets.count() == 1 && OpenDockWidgets[0] != DockWidget))
|
||||
{
|
||||
CDockWidget* NextDockWidget;
|
||||
if (OpenDockWidgets.last() == DockWidget)
|
||||
{
|
||||
NextDockWidget = OpenDockWidgets[OpenDockWidgets.count() - 2];
|
||||
CDockWidget* NextDockWidget = OpenDockWidgets[OpenDockWidgets.count() - 2];
|
||||
// search backwards for widget with tab
|
||||
for (int i = OpenDockWidgets.count() - 2; i >= 0; --i)
|
||||
{
|
||||
auto dw = OpenDockWidgets[i];
|
||||
if (!dw->features().testFlag(CDockWidget::NoTab))
|
||||
{
|
||||
return dw;
|
||||
}
|
||||
}
|
||||
|
||||
// return widget without tab
|
||||
return NextDockWidget;
|
||||
}
|
||||
else
|
||||
{
|
||||
int NextIndex = OpenDockWidgets.indexOf(DockWidget) + 1;
|
||||
NextDockWidget = OpenDockWidgets[NextIndex];
|
||||
}
|
||||
int IndexOfDockWidget = OpenDockWidgets.indexOf(DockWidget);
|
||||
CDockWidget* NextDockWidget = OpenDockWidgets[IndexOfDockWidget + 1];
|
||||
// search forwards for widget with tab
|
||||
for (int i = IndexOfDockWidget + 1; i < OpenDockWidgets.count(); ++i)
|
||||
{
|
||||
auto dw = OpenDockWidgets[i];
|
||||
if (!dw->features().testFlag(CDockWidget::NoTab))
|
||||
{
|
||||
return dw;
|
||||
}
|
||||
}
|
||||
|
||||
return NextDockWidget;
|
||||
// search backwards for widget with tab
|
||||
for (int i = IndexOfDockWidget - 1; i >= 0; --i)
|
||||
{
|
||||
auto dw = OpenDockWidgets[i];
|
||||
if (!dw->features().testFlag(CDockWidget::NoTab))
|
||||
{
|
||||
return dw;
|
||||
}
|
||||
}
|
||||
|
||||
// return widget without tab
|
||||
return NextDockWidget;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -857,7 +888,7 @@ void CDockAreaWidget::toggleView(bool Open)
|
||||
{
|
||||
setVisible(Open);
|
||||
|
||||
emit viewToggled(Open);
|
||||
Q_EMIT viewToggled(Open);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
friend class CDockManager;
|
||||
void onDockWidgetFeaturesChanged();
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onTabCloseRequested(int Index);
|
||||
|
||||
/**
|
||||
@@ -138,7 +138,7 @@ protected:
|
||||
*/
|
||||
void markTitleBarMenuOutdated();
|
||||
|
||||
protected slots:
|
||||
protected Q_SLOTS:
|
||||
void toggleView(bool Open);
|
||||
|
||||
public:
|
||||
@@ -312,7 +312,7 @@ public:
|
||||
*/
|
||||
bool isCentralWidgetArea() const;
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* This activates the tab for the given tab index.
|
||||
* If the dock widget for the given tab is not visible, the this function
|
||||
@@ -330,7 +330,7 @@ public slots:
|
||||
*/
|
||||
void closeOtherAreas();
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted when user clicks on a tab at an index.
|
||||
*/
|
||||
|
||||
@@ -284,13 +284,13 @@ public:
|
||||
void emitDockAreasRemoved()
|
||||
{
|
||||
onVisibleDockAreaCountChanged();
|
||||
emit _this->dockAreasRemoved();
|
||||
Q_EMIT _this->dockAreasRemoved();
|
||||
}
|
||||
|
||||
void emitDockAreasAdded()
|
||||
{
|
||||
onVisibleDockAreaCountChanged();
|
||||
emit _this->dockAreasAdded();
|
||||
Q_EMIT _this->dockAreasAdded();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,7 +341,7 @@ public:
|
||||
CDockAreaWidget* DockArea = qobject_cast<CDockAreaWidget*>(_this->sender());
|
||||
VisibleDockAreaCount += Visible ? 1 : -1;
|
||||
onVisibleDockAreaCountChanged();
|
||||
emit _this->dockAreaViewToggled(DockArea, Visible);
|
||||
Q_EMIT _this->dockAreaViewToggled(DockArea, Visible);
|
||||
}
|
||||
}; // struct DockContainerWidgetPrivate
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ public:
|
||||
*/
|
||||
void closeOtherAreas(CDockAreaWidget* KeepOpenArea);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted if one or multiple dock areas has been added to
|
||||
* the internal list of dock areas.
|
||||
|
||||
@@ -174,7 +174,7 @@ void DockFocusControllerPrivate::updateDockWidgetFocus(CDockWidget* DockWidget)
|
||||
ForceFocusChangedSignal = false;
|
||||
if (DockWidget->isVisible())
|
||||
{
|
||||
emit DockManager->focusedDockWidgetChanged(old, DockWidget);
|
||||
Q_EMIT DockManager->focusedDockWidgetChanged(old, DockWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -193,7 +193,7 @@ void CDockFocusController::onDockWidgetVisibilityChanged(bool Visible)
|
||||
disconnect(Sender, SIGNAL(visibilityChanged(bool)), this, SLOT(onDockWidgetVisibilityChanged(bool)));
|
||||
if (DockWidget && Visible)
|
||||
{
|
||||
emit d->DockManager->focusedDockWidgetChanged(d->OldFocusedDockWidget, DockWidget);
|
||||
Q_EMIT d->DockManager->focusedDockWidgetChanged(d->OldFocusedDockWidget, DockWidget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ private:
|
||||
DockFocusControllerPrivate* d; ///< private data (pimpl)
|
||||
friend struct DockFocusControllerPrivate;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onApplicationFocusChanged(QWidget *old, QWidget *now);
|
||||
void onFocusedDockAreaViewToggled(bool Open);
|
||||
void onStateRestored();
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
*/
|
||||
CDockWidget* focusedDockWidget() const;
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Request a focus change to the given dock widget
|
||||
*/
|
||||
|
||||
@@ -343,7 +343,7 @@ void DockManagerPrivate::restoreDockWidgetsOpenState()
|
||||
if (DockWidget->property(internal::DirtyProperty).toBool())
|
||||
{
|
||||
DockWidget->flagAsUnassigned();
|
||||
emit DockWidget->viewToggled(false);
|
||||
Q_EMIT DockWidget->viewToggled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -582,7 +582,7 @@ bool CDockManager::eventFilter(QObject *obj, QEvent *e)
|
||||
void CDockManager::registerFloatingWidget(CFloatingDockContainer* FloatingWidget)
|
||||
{
|
||||
d->FloatingWidgets.append(FloatingWidget);
|
||||
emit floatingWidgetCreated(FloatingWidget);
|
||||
Q_EMIT floatingWidgetCreated(FloatingWidget);
|
||||
ADS_PRINT("d->FloatingWidgets.count() " << d->FloatingWidgets.count());
|
||||
}
|
||||
|
||||
@@ -699,14 +699,14 @@ bool CDockManager::restoreState(const QByteArray &state, int version)
|
||||
hide();
|
||||
}
|
||||
d->RestoringState = true;
|
||||
emit restoringState();
|
||||
Q_EMIT restoringState();
|
||||
bool Result = d->restoreState(state, version);
|
||||
d->RestoringState = false;
|
||||
if (!IsHidden)
|
||||
{
|
||||
show();
|
||||
}
|
||||
emit stateRestored();
|
||||
Q_EMIT stateRestored();
|
||||
return Result;
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ CFloatingDockContainer* CDockManager::addDockWidgetFloating(CDockWidget* Dockwid
|
||||
{
|
||||
d->UninitializedFloatingWidgets.append(FloatingWidget);
|
||||
}
|
||||
emit dockWidgetAdded(Dockwidget);
|
||||
Q_EMIT dockWidgetAdded(Dockwidget);
|
||||
return FloatingWidget;
|
||||
}
|
||||
|
||||
@@ -761,7 +761,7 @@ CDockAreaWidget* CDockManager::addDockWidget(DockWidgetArea area,
|
||||
d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget);
|
||||
auto Container = DockAreaWidget ? DockAreaWidget->dockContainer(): this;
|
||||
auto AreaOfAddedDockWidget = Container->addDockWidget(area, Dockwidget, DockAreaWidget);
|
||||
emit dockWidgetAdded(Dockwidget);
|
||||
Q_EMIT dockWidgetAdded(Dockwidget);
|
||||
return AreaOfAddedDockWidget;
|
||||
}
|
||||
|
||||
@@ -803,11 +803,11 @@ CDockWidget* CDockManager::findDockWidget(const QString& ObjectName) const
|
||||
//============================================================================
|
||||
void CDockManager::removeDockWidget(CDockWidget* Dockwidget)
|
||||
{
|
||||
emit dockWidgetAboutToBeRemoved(Dockwidget);
|
||||
Q_EMIT dockWidgetAboutToBeRemoved(Dockwidget);
|
||||
d->DockWidgetsMap.remove(Dockwidget->objectName());
|
||||
CDockContainerWidget::removeDockWidget(Dockwidget);
|
||||
Dockwidget->setDockManager(nullptr);
|
||||
emit dockWidgetRemoved(Dockwidget);
|
||||
Q_EMIT dockWidgetRemoved(Dockwidget);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@@ -821,7 +821,7 @@ QMap<QString, CDockWidget*> CDockManager::dockWidgetsMap() const
|
||||
void CDockManager::addPerspective(const QString& UniquePrespectiveName)
|
||||
{
|
||||
d->Perspectives.insert(UniquePrespectiveName, saveState());
|
||||
emit perspectiveListChanged();
|
||||
Q_EMIT perspectiveListChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -843,8 +843,8 @@ void CDockManager::removePerspectives(const QStringList& Names)
|
||||
|
||||
if (Count)
|
||||
{
|
||||
emit perspectivesRemoved();
|
||||
emit perspectiveListChanged();
|
||||
Q_EMIT perspectivesRemoved();
|
||||
Q_EMIT perspectiveListChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -865,9 +865,9 @@ void CDockManager::openPerspective(const QString& PerspectiveName)
|
||||
return;
|
||||
}
|
||||
|
||||
emit openingPerspective(PerspectiveName);
|
||||
Q_EMIT openingPerspective(PerspectiveName);
|
||||
restoreState(Iterator.value());
|
||||
emit perspectiveOpened(PerspectiveName);
|
||||
Q_EMIT perspectiveOpened(PerspectiveName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -506,7 +506,7 @@ public:
|
||||
*/
|
||||
void setSplitterSizes(CDockAreaWidget *ContainedArea, const QList<int>& sizes);
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* Opens the perspective with the given name.
|
||||
*/
|
||||
@@ -519,7 +519,7 @@ public slots:
|
||||
*/
|
||||
void setDockWidgetFocused(CDockWidget* DockWidget);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted if the list of perspectives changed
|
||||
*/
|
||||
|
||||
@@ -338,7 +338,7 @@ void CDockWidget::setFeatures(DockWidgetFeatures features)
|
||||
return;
|
||||
}
|
||||
d->Features = features;
|
||||
emit featuresChanged(d->Features);
|
||||
Q_EMIT featuresChanged(d->Features);
|
||||
d->TabWidget->onDockWidgetFeaturesChanged();
|
||||
if(CDockAreaWidget* DockArea = dockAreaWidget())
|
||||
DockArea->onDockWidgetFeaturesChanged();
|
||||
@@ -538,9 +538,9 @@ void CDockWidget::toggleViewInternal(bool Open)
|
||||
|
||||
if (!Open)
|
||||
{
|
||||
emit closed();
|
||||
Q_EMIT closed();
|
||||
}
|
||||
emit viewToggled(Open);
|
||||
Q_EMIT viewToggled(Open);
|
||||
}
|
||||
|
||||
|
||||
@@ -580,11 +580,11 @@ bool CDockWidget::event(QEvent *e)
|
||||
switch (e->type())
|
||||
{
|
||||
case QEvent::Hide:
|
||||
emit visibilityChanged(false);
|
||||
Q_EMIT visibilityChanged(false);
|
||||
break;
|
||||
|
||||
case QEvent::Show:
|
||||
emit visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0);
|
||||
Q_EMIT visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0);
|
||||
break;
|
||||
|
||||
case QEvent::WindowTitleChange :
|
||||
@@ -602,7 +602,7 @@ bool CDockWidget::event(QEvent *e)
|
||||
{
|
||||
d->DockArea->markTitleBarMenuOutdated();//update tabs menu
|
||||
}
|
||||
emit titleChanged(title);
|
||||
Q_EMIT titleChanged(title);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -785,7 +785,7 @@ void CDockWidget::emitTopLevelChanged(bool Floating)
|
||||
if (Floating != d->IsFloatingTopLevel)
|
||||
{
|
||||
d->IsFloatingTopLevel = Floating;
|
||||
emit topLevelChanged(d->IsFloatingTopLevel);
|
||||
Q_EMIT topLevelChanged(d->IsFloatingTopLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -843,7 +843,7 @@ bool CDockWidget::closeDockWidgetInternal(bool ForceClose)
|
||||
{
|
||||
if (!ForceClose)
|
||||
{
|
||||
emit closeRequested();
|
||||
Q_EMIT closeRequested();
|
||||
}
|
||||
|
||||
if (!ForceClose && features().testFlag(CDockWidget::CustomCloseHandling))
|
||||
@@ -869,7 +869,7 @@ bool CDockWidget::closeDockWidgetInternal(bool ForceClose)
|
||||
}
|
||||
}
|
||||
deleteDockWidget();
|
||||
emit closed();
|
||||
Q_EMIT closed();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ private:
|
||||
DockWidgetPrivate* d; ///< private data (pimpl)
|
||||
friend struct DockWidgetPrivate;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
/**
|
||||
* Adjusts the toolbar icon sizes according to the floating state
|
||||
*/
|
||||
@@ -154,6 +154,7 @@ public:
|
||||
CustomCloseHandling = 0x10, ///< clicking the close button will not close the dock widget but emits the closeRequested() signal instead
|
||||
DockWidgetFocusable = 0x20, ///< if this is enabled, a dock widget can get focus highlighting
|
||||
DockWidgetForceCloseWithArea = 0x40, ///< dock widget will be closed when the dock area hosting it is closed
|
||||
NoTab = 0x80, ///< dock widget tab will never be shown if this flag is set
|
||||
DefaultDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable | DockWidgetFocusable,
|
||||
AllDockWidgetFeatures = DefaultDockWidgetFeatures | DockWidgetDeleteOnClose | CustomCloseHandling,
|
||||
DockWidgetAlwaysCloseAndDelete = DockWidgetForceCloseWithArea | DockWidgetDeleteOnClose,
|
||||
@@ -483,7 +484,7 @@ public: // reimplements QFrame -----------------------------------------------
|
||||
*/
|
||||
virtual bool event(QEvent *e) override;
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* This property controls whether the dock widget is open or closed.
|
||||
* The toogleViewAction triggers this slot
|
||||
@@ -544,7 +545,7 @@ public slots:
|
||||
void showNormal();
|
||||
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted if the dock widget is opened or closed
|
||||
*/
|
||||
|
||||
@@ -353,7 +353,7 @@ void CDockWidgetTab::mousePressEvent(QMouseEvent* ev)
|
||||
ev->accept();
|
||||
d->saveDragStartMousePosition(internal::globalPositionOf(ev));
|
||||
d->DragState = DraggingMousePressed;
|
||||
emit clicked();
|
||||
Q_EMIT clicked();
|
||||
return;
|
||||
}
|
||||
Super::mousePressEvent(ev);
|
||||
@@ -377,7 +377,7 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
||||
// End of tab moving, emit signal
|
||||
if (d->DockArea)
|
||||
{
|
||||
emit moved(internal::globalPositionOf(ev));
|
||||
Q_EMIT moved(internal::globalPositionOf(ev));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -538,7 +538,7 @@ void CDockWidgetTab::setActiveTab(bool active)
|
||||
update();
|
||||
updateGeometry();
|
||||
|
||||
emit activeTabChanged();
|
||||
Q_EMIT activeTabChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -629,7 +629,7 @@ void CDockWidgetTab::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
//============================================================================
|
||||
void CDockWidgetTab::setVisible(bool visible)
|
||||
{
|
||||
// Just here for debugging to insert debug output
|
||||
visible &= !d->DockWidget->features().testFlag(CDockWidget::NoTab);
|
||||
Super::setVisible(visible);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
friend class CDockManager;
|
||||
void onDockWidgetFeaturesChanged();
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void detachDockWidget();
|
||||
|
||||
protected:
|
||||
@@ -175,10 +175,10 @@ public:
|
||||
*/
|
||||
void setIconSize(const QSize& Size);
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
virtual void setVisible(bool visible) override;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void activeTabChanged();
|
||||
void clicked();
|
||||
void closeRequested();
|
||||
|
||||
@@ -74,7 +74,7 @@ void ElidingLabelPrivate::elideText(int Width)
|
||||
IsElided = str != Text;
|
||||
if(IsElided != WasElided)
|
||||
{
|
||||
emit _this->elidedChanged(IsElided);
|
||||
Q_EMIT _this->elidedChanged(IsElided);
|
||||
}
|
||||
_this->QLabel::setText(str);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ void CElidingLabel::mouseReleaseEvent(QMouseEvent* event)
|
||||
return;
|
||||
}
|
||||
|
||||
emit clicked();
|
||||
Q_EMIT clicked();
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ void CElidingLabel::mouseReleaseEvent(QMouseEvent* event)
|
||||
void CElidingLabel::mouseDoubleClickEvent( QMouseEvent *ev )
|
||||
{
|
||||
Q_UNUSED(ev)
|
||||
emit doubleClicked();
|
||||
Q_EMIT doubleClicked();
|
||||
Super::mouseDoubleClickEvent(ev);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public: // reimplements QLabel ----------------------------------------------
|
||||
void setText(const QString &text);
|
||||
QString text() const;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted if the user clicks on the label (i.e. pressed
|
||||
* down then released while the mouse cursor is inside the label)
|
||||
|
||||
@@ -609,7 +609,8 @@ CFloatingDockContainer::CFloatingDockContainer(CDockManager *DockManager) :
|
||||
#ifdef Q_OS_LINUX
|
||||
QDockWidget::setWidget(d->DockContainer);
|
||||
QDockWidget::setFloating(true);
|
||||
QDockWidget::setFeatures(QDockWidget::AllDockWidgetFeatures);
|
||||
QDockWidget::setFeatures(QDockWidget::DockWidgetClosable
|
||||
| QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
|
||||
|
||||
bool native_window = true;
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ private:
|
||||
friend class CDockAreaWidget;
|
||||
friend class CFloatingWidgetTitleBar;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
void onDockAreasAddedOrRemoved();
|
||||
void onDockAreaCurrentChanged(int Index);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ struct FloatingDragPreviewPrivate
|
||||
void cancelDragging()
|
||||
{
|
||||
Canceled = true;
|
||||
emit _this->draggingCanceled();
|
||||
Q_EMIT _this->draggingCanceled();
|
||||
DockManager->containerOverlay()->hideOverlay();
|
||||
DockManager->dockAreaOverlay()->hideOverlay();
|
||||
_this->close();
|
||||
|
||||
@@ -32,7 +32,7 @@ private:
|
||||
FloatingDragPreviewPrivate* d;
|
||||
friend struct FloatingDragPreviewPrivate;
|
||||
|
||||
private slots:
|
||||
private Q_SLOTS:
|
||||
/**
|
||||
* Cancel non opaque undocking if application becomes inactive
|
||||
*/
|
||||
@@ -92,7 +92,7 @@ public: // implements IFloatingWidget -----------------------------------------
|
||||
*/
|
||||
virtual void finishDragging() override;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* This signal is emitted, if dragging has been canceled by escape key
|
||||
* or by active application switching via task manager
|
||||
|
||||
Reference in New Issue
Block a user