forked from mfreiholz/Qt-Advanced-Docking-System
-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added configflags example to test use of CDockManager config flags
- Loading branch information
1 parent
ac3af4c
commit 3ff6918
Showing
7 changed files
with
213 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(ads_example_centralwidget 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(configFlagsExample WIN32 | ||
main.cpp | ||
mainwindow.cpp | ||
mainwindow.ui | ||
) | ||
target_include_directories(CentralWidgetExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src") | ||
target_link_libraries(CentralWidgetExample PRIVATE qt${QT_VERSION_MAJOR}advanceddocking) | ||
target_link_libraries(CentralWidgetExample PUBLIC Qt${QT_VERSION_MAJOR}::Core | ||
Qt${QT_VERSION_MAJOR}::Gui | ||
Qt${QT_VERSION_MAJOR}::Widgets) | ||
set_target_properties(CentralWidgetExample 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 Central Widget 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" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ADS_OUT_ROOT = $${OUT_PWD}/../.. | ||
|
||
QT += core gui widgets | ||
|
||
TARGET = ConfigFlagsExample | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include "mainwindow.h" | ||
|
||
#include "ui_mainwindow.h" | ||
|
||
#include <QLabel> | ||
#include <QToolBar> | ||
|
||
#include "DockAreaWidget.h" | ||
#include "DockAreaTitleBar.h" | ||
|
||
|
||
using namespace ads; | ||
|
||
|
||
CMainWindow::CMainWindow(QWidget *parent) : | ||
QMainWindow(parent), | ||
ui(new Ui::CMainWindow) | ||
{ | ||
ui->setupUi(this); | ||
|
||
// Add the toolbar | ||
auto toolbar_ = addToolBar("Top Toolbar"); | ||
|
||
// Create the dock manager | ||
ads::CDockManager::setConfigFlags(ads::CDockManager::DefaultOpaqueConfig); | ||
ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaHasCloseButton, | ||
false); | ||
ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaHasUndockButton, | ||
false); | ||
ads::CDockManager::setConfigFlag( | ||
ads::CDockManager::DockAreaHasTabsMenuButton, false); | ||
auto DockManager = new ads::CDockManager(this); | ||
|
||
// Create a dockable widget | ||
QLabel *l1 = new QLabel(); | ||
l1->setWordWrap(true); | ||
l1->setAlignment(Qt::AlignTop | Qt::AlignLeft); | ||
l1->setText("Docking widget 1"); | ||
ads::CDockWidget *dockWidget1 = new ads::CDockWidget("Dock 1"); | ||
dockWidget1->setWidget(l1); | ||
DockManager->addDockWidget(ads::LeftDockWidgetArea, dockWidget1); | ||
|
||
QLabel *l2 = new QLabel(); | ||
l2->setWordWrap(true); | ||
l2->setAlignment(Qt::AlignTop | Qt::AlignLeft); | ||
l2->setText("Docking widget 2"); | ||
ads::CDockWidget *dockWidget2 = new ads::CDockWidget("Dock 2"); | ||
dockWidget2->setWidget(l2); | ||
DockManager->addDockWidget(ads::RightDockWidgetArea, dockWidget2); | ||
|
||
// Add menu actions | ||
ui->menuView->addAction(dockWidget1->toggleViewAction()); | ||
ui->menuView->addAction(dockWidget2->toggleViewAction()); | ||
toolbar_->addAction(dockWidget1->toggleViewAction()); | ||
toolbar_->addAction(dockWidget2->toggleViewAction()); | ||
} | ||
|
||
|
||
CMainWindow::~CMainWindow() | ||
{ | ||
delete ui; | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#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(); | ||
|
||
private: | ||
Ui::CMainWindow *ui; | ||
}; | ||
#endif // MAINWINDOW_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ SUBDIRS = \ | |
sidebar \ | ||
deleteonclose \ | ||
emptydockarea \ | ||
dockindock | ||
dockindock \ | ||
configflags |