2019-01-26 20:54:35 +08:00
# Advanced Docking System for Qt
2019-01-28 20:37:01 +08:00
[![Build Status ](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System.svg?branch=master )](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
[![Build status ](https://ci.appveyor.com/api/projects/status/qcfb3cy932jw9mpy/branch/master?svg=true )](https://ci.appveyor.com/project/githubuser0xFFFF/qt-advanced-docking-system/branch/master)
2019-05-15 16:14:22 +08:00
[![License: LGPL v2.1 ](https://img.shields.io/badge/License-LGPL%20v2.1-blue.svg )](gnu-lgpl-v2.1.md)
2019-01-28 20:37:01 +08:00
2016-04-05 14:01:14 +08:00
2017-03-29 21:43:18 +08:00
Qt Advanced Docking System lets you create customizable layouts using a full
featured window docking system similar to what is found in many popular
integrated development environements (IDEs) such as Visual Studio.
Everything is implemented with standard Qt functionality without any
platform specific code. Basic usage of QWidgets an QLayouts and using basic
styles as much as possible.
This work is based on and inspired by the
[Advanced Docking System for Qt ](https://github.com/mfreiholz/Qt-Advanced-Docking-System )
from Manuel Freiholz. I did an almost complete rewrite of his code to improve
code quality, readibility and to fix all issues from the issue tracker
of his docking system project.
2019-01-15 20:05:21 +08:00
The following video gives a first impression what is possible with the Advanced Docking System for Qt.
[![Video Advanced Docking ](doc/advanced-docking_video.png )](https://www.youtube.com/watch?v=7pdNfafg3Qc)
2017-03-29 21:43:18 +08:00
## Features
### Docking everywhere - no central widget
There is no central widget like in the Qt docking system. You can dock on every
border of the main window or you can dock into each dock area - so you are
free to dock almost everywhere.
2018-12-12 18:59:29 +08:00
![Dropping widgets ](doc/preview-dragndrop.png )\
\
![Dropping widgets ](doc/preview-dragndrop_dark.png )
2016-02-17 17:57:28 +08:00
2017-03-29 21:43:18 +08:00
### Docking inside floating windows
There is no difference between the main window and a floating window. Docking
into floating windows is supported.
2018-12-12 18:59:29 +08:00
![Docking inside floating windows ](doc/floating-widget-dragndrop.png )\
\
![Docking inside floating windows ](doc/floating-widget-dragndrop_dark.png )
2017-03-29 21:43:18 +08:00
### Grouped dragging
When dragging the titlebar of a dock, all the tabs that are tabbed with it are
going to be dragged. So you can move complete groups of tabbed widgets into
a floating widget or from one dock area to another one.
2018-12-12 18:59:29 +08:00
![Grouped dragging ](doc/grouped-dragging.png )\
\
![Grouped dragging ](doc/grouped-dragging_dark.png )
2017-03-29 21:43:18 +08:00
2018-02-13 19:50:35 +08:00
### Perspectives for fast switching of the complete main window layout
2018-02-13 19:56:33 +08:00
A perspective defines the set and layout of dock windows in the main
2018-02-13 19:50:35 +08:00
window. You can save the current layout of the dockmanager into a named
perspective to make your own custom perspective. Later you can simply
2018-02-13 19:56:33 +08:00
select a perspective from the perspective list to quickly switch the complete
main window layout.
2018-02-13 19:50:35 +08:00
2018-12-12 18:59:29 +08:00
![Perspective ](doc/perspectives.png )\
\
![Perspective ](doc/perspectives_dark.png )
2017-03-29 21:43:18 +08:00
2016-02-19 19:41:15 +08:00
## Tested Compatible Environments
2019-05-14 22:03:47 +08:00
### Windows
Windows 10 [![Build status ](https://ci.appveyor.com/api/projects/status/qcfb3cy932jw9mpy/branch/master?svg=true )](https://ci.appveyor.com/project/githubuser0xFFFF/qt-advanced-docking-system/branch/master)
The library was developed on and for Windows. It is used in a commercial Windows application and is therefore constantly tested.
### macOS
macOS [![Build Status ](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System.svg?branch=master )](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
The application can be compiled for macOS. A user reported, that the library works on macOS. If have not tested it.
### Linux
Ubuntu [![Build Status ](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System.svg?branch=master )](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System)
The application can be compiled for Linux but the master branch doesn't work under Linux because some required features are not supported by Linux. But there is the branch **linux_experimental** which was developed and tested with **Kubuntu 18.04** . and which should also work on other Linux distributions. The branch needs more testing and maybe some imrpovements before it can be merged into master.
![Advanced Docking on Linux ](doc/linux_kubuntu_1804.png )
2016-02-02 21:35:51 +08:00
## Build
2017-03-29 21:43:18 +08:00
Open the `ads.pro` with QtCreator and start the build, that's it.
2016-02-19 19:41:15 +08:00
You can run the demo project and test it yourself.
2016-01-19 19:21:06 +08:00
2018-12-15 06:16:49 +08:00
## Getting started / Example
The following example shows the minimum code required to use the advanced Qt docking system.
*MainWindow.h*
```cpp
#include <QMainWindow>
#include "DockManager.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
// The main container for docking
ads::CDockManager* m_DockManager;
};
```
*MainWindow.cpp*
```cpp
#include "MainWindow.h"
#include "ui_MainWindow.h"
#include <QLabel>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
2018-12-20 16:15:02 +08:00
// Create the dock manager. Because the parent parameter is a QMainWindow
// the dock manager registers itself as the central widget.
2018-12-20 16:20:17 +08:00
m_DockManager = new ads::CDockManager(this);
// 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());
// Add the dock widget to the top dock widget area
m_DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);
2018-12-15 06:16:49 +08:00
}
MainWindow::~MainWindow()
{
delete ui;
}
```
2016-02-19 19:41:15 +08:00
## Developers
2017-02-20 17:08:19 +08:00
- Uwe Kindler, Project Maintainer
- Manuel Freiholz
2016-01-19 19:21:06 +08:00
2016-02-19 19:41:15 +08:00
## License information
2019-05-15 16:14:22 +08:00
[![License: LGPL v2.1 ](https://img.shields.io/badge/License-LGPL%20v2.1-blue.svg )](gnu-lgpl-v2.1.md)
2017-08-17 19:35:03 +08:00
This project uses the [LGPLv2.1 license ](gnu-lgpl-v2.1.md )
2016-02-19 19:41:15 +08:00