diff --git a/.cproject b/.cproject index f651fa3..cdd20b3 100644 --- a/.cproject +++ b/.cproject @@ -14,13 +14,13 @@ - + - - - + + + + + + + + + @@ -83,7 +92,6 @@ make - clean false true @@ -122,6 +130,7 @@ make + clean false true @@ -160,7 +169,6 @@ make - clean false true @@ -177,7 +185,6 @@ qmake -recursive ../../example/example.pro - true false false @@ -200,6 +207,7 @@ make + clean false true @@ -228,6 +236,46 @@ false false + + mingw32-make + -j + all + false + false + false + + + make + + clean + false + true + false + + + mingw32-make + -j6 + debug + false + false + false + + + qmake + -recursive ../../../examples/sidebar/sidebar.pro + + true + false + false + + + mingw32-make + -j4 + release + false + false + false + mingw32-make -j @@ -238,7 +286,6 @@ make - clean false true @@ -277,7 +324,6 @@ make - clean false true @@ -316,7 +362,6 @@ make - clean false true @@ -347,13 +392,4 @@ - - - - - - - - - diff --git a/CMakeLists.txt b/CMakeLists.txt index 578dfc1..73a0b10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,7 +123,8 @@ set_target_properties(qtadvanceddocking PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin" ) if(BUILD_EXAMPLES) - add_subdirectory(example) + add_subdirectory(examples/simple) + add_subdirectory(examples/sidebar) add_subdirectory(demo) endif() diff --git a/ads.pro b/ads.pro index b798785..c532407 100644 --- a/ads.pro +++ b/ads.pro @@ -3,7 +3,7 @@ TEMPLATE = subdirs SUBDIRS = \ src \ demo \ - example + examples demo.depends = src -example.depends = src +examples.depends = src diff --git a/examples/examples.pro b/examples/examples.pro new file mode 100644 index 0000000..418dd9d --- /dev/null +++ b/examples/examples.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs + +SUBDIRS = \ + simple \ + sidebar diff --git a/examples/sidebar/CMakeLists.txt b/examples/sidebar/CMakeLists.txt new file mode 100644 index 0000000..a050e88 --- /dev/null +++ b/examples/sidebar/CMakeLists.txt @@ -0,0 +1,46 @@ +cmake_minimum_required(VERSION 3.3) +set (CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +project(ads_example VERSION "1.0") +set(REQUIRED_QT_VERSION 5.5.0) +find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED) +find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) +find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) +set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Core_LIBRARIES}) +set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Core_INCLUDE_DIRS}) +set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Core_COMPILE_DEFINITIONS} ) +set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Gui_LIBRARIES}) +set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Gui_INCLUDE_DIRS}) +set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Gui_COMPILE_DEFINITIONS}) +set(ads_example_LIBS ${ads_example_LIBS} ${Qt5Widgets_LIBRARIES}) +set(ads_example_INCLUDE ${ads_example_INCLUDE} ${Qt5Widgets_INCLUDE_DIRS}) +set(ads_example_COMPILE_DEFINE ${ads_example_COMPILE_DEFINE} ${Qt5Widgets_COMPILE_DEFINITIONS}) +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(ads_example_SRCS + main.cpp + MainWindow.cpp + MainWindow.ui +) +add_executable(SidebarExample WIN32 ${ads_example_SRCS}) +if(BUILD_STATIC) + set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) +endif() +add_dependencies(SidebarExample qtadvanceddocking) +target_include_directories(SidebarExample PUBLIC + $ + $ + ) +target_include_directories(SidebarExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src" ${ads_example_INCLUDE}) +target_link_libraries(SidebarExample PRIVATE qtadvanceddocking ${ads_example_LIBS}) +target_compile_definitions(SidebarExample PRIVATE ${ads_example_DEFINE}) +set_target_properties(SidebarExample PROPERTIES + VERSION "1.0" + SOVERSION 1 + EXPORT_NAME "Qt Advanced Docking System 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" +) diff --git a/examples/sidebar/MainWindow.cpp b/examples/sidebar/MainWindow.cpp new file mode 100644 index 0000000..880a5d0 --- /dev/null +++ b/examples/sidebar/MainWindow.cpp @@ -0,0 +1,53 @@ +#include "../../examples/simple/MainWindow.h" + +#include "ui_MainWindow.h" + +#include +#include +#include + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); + + // Create the dock manager. Because the parent parameter is a QMainWindow + // the dock manager registers itself as the central widget. + QVBoxLayout* Layout = new QVBoxLayout(ui->dockContainer); + Layout->setContentsMargins(QMargins(0, 0, 0, 0)); + m_DockManager = new ads::CDockManager(ui->dockContainer); + Layout->addWidget(m_DockManager); + + // 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); + + // Create an example editor + QPlainTextEdit* te = new QPlainTextEdit(); + te->setPlaceholderText("Please enter your text here into this QPlainTextEdit..."); + DockWidget = new ads::CDockWidget("Editor 1"); + ui->menuView->addAction(DockWidget->toggleViewAction()); + m_DockManager->addDockWidget(ads::BottomDockWidgetArea, DockWidget); +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/examples/sidebar/MainWindow.h b/examples/sidebar/MainWindow.h new file mode 100644 index 0000000..bb6148f --- /dev/null +++ b/examples/sidebar/MainWindow.h @@ -0,0 +1,29 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include "DockManager.h" + +namespace Ui { +class MainWindow; +} + + +/** + * This example shows, how to place a dock widget container and a static + * sidebar into a QMainWindow + */ +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + Ui::MainWindow *ui; + ads::CDockManager* m_DockManager; +}; + +#endif // MAINWINDOW_H diff --git a/examples/sidebar/MainWindow.ui b/examples/sidebar/MainWindow.ui new file mode 100644 index 0000000..9bcac64 --- /dev/null +++ b/examples/sidebar/MainWindow.ui @@ -0,0 +1,85 @@ + + + MainWindow + + + + 0 + 0 + 650 + 376 + + + + MainWindow + + + + + + + + + + + + PushButton + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + + + + + + + 0 + 0 + + + + + + + + + + 0 + 0 + 650 + 21 + + + + + View + + + + + + + + + + diff --git a/example/main.cpp b/examples/sidebar/main.cpp similarity index 76% rename from example/main.cpp rename to examples/sidebar/main.cpp index af9caac..83e8bb7 100644 --- a/example/main.cpp +++ b/examples/sidebar/main.cpp @@ -1,5 +1,5 @@ -#include "MainWindow.h" #include +#include "../../examples/simple/MainWindow.h" int main(int argc, char *argv[]) { diff --git a/examples/sidebar/sidebar.pro b/examples/sidebar/sidebar.pro new file mode 100644 index 0000000..4d69920 --- /dev/null +++ b/examples/sidebar/sidebar.pro @@ -0,0 +1,47 @@ +ADS_OUT_ROOT = $${OUT_PWD}/../.. + +QT += core gui widgets + +TARGET = SidebarExample +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 + +# Dependency: AdvancedDockingSystem (shared) +CONFIG(debug, debug|release){ + win32 { + LIBS += -lqtadvanceddockingd + } + else:mac { + LIBS += -lqtadvanceddocking_debug + } + else { + LIBS += -lqtadvanceddocking + } +} +else{ + LIBS += -lqtadvanceddocking +} + +INCLUDEPATH += ../../src +DEPENDPATH += ../../src + diff --git a/example/CMakeLists.txt b/examples/simple/CMakeLists.txt similarity index 78% rename from example/CMakeLists.txt rename to examples/simple/CMakeLists.txt index dafffa7..35e9866 100644 --- a/example/CMakeLists.txt +++ b/examples/simple/CMakeLists.txt @@ -24,19 +24,19 @@ set(ads_example_SRCS MainWindow.cpp MainWindow.ui ) -add_executable(Example1 WIN32 ${ads_example_SRCS}) +add_executable(SimpleExample WIN32 ${ads_example_SRCS}) if(BUILD_STATIC) set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) endif() -add_dependencies(Example1 qtadvanceddocking) -target_include_directories(Example1 PUBLIC +add_dependencies(SimpleExample qtadvanceddocking) +target_include_directories(SimpleExample PUBLIC $ $ ) -target_include_directories(Example1 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_example_INCLUDE}) -target_link_libraries(Example1 PRIVATE qtadvanceddocking ${ads_example_LIBS}) -target_compile_definitions(Example1 PRIVATE ${ads_example_DEFINE}) -set_target_properties(Example1 PROPERTIES +target_include_directories(SimpleExample PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src" ${ads_example_INCLUDE}) +target_link_libraries(SimpleExample PRIVATE qtadvanceddocking ${ads_example_LIBS}) +target_compile_definitions(SimpleExample PRIVATE ${ads_example_DEFINE}) +set_target_properties(SimpleExample PROPERTIES VERSION "1.0" SOVERSION 1 EXPORT_NAME "Qt Advanced Docking System Example" diff --git a/example/MainWindow.cpp b/examples/simple/MainWindow.cpp similarity index 96% rename from example/MainWindow.cpp rename to examples/simple/MainWindow.cpp index f9edab0..aeaea2b 100644 --- a/example/MainWindow.cpp +++ b/examples/simple/MainWindow.cpp @@ -1,4 +1,5 @@ -#include "MainWindow.h" +#include "../../examples/simple/MainWindow.h" + #include "ui_MainWindow.h" #include diff --git a/example/MainWindow.h b/examples/simple/MainWindow.h similarity index 100% rename from example/MainWindow.h rename to examples/simple/MainWindow.h diff --git a/example/MainWindow.ui b/examples/simple/MainWindow.ui similarity index 100% rename from example/MainWindow.ui rename to examples/simple/MainWindow.ui diff --git a/examples/simple/main.cpp b/examples/simple/main.cpp new file mode 100644 index 0000000..83e8bb7 --- /dev/null +++ b/examples/simple/main.cpp @@ -0,0 +1,11 @@ +#include +#include "../../examples/simple/MainWindow.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/example/example.pro b/examples/simple/simple.pro similarity index 85% rename from example/example.pro rename to examples/simple/simple.pro index 33b73f9..f79c718 100644 --- a/example/example.pro +++ b/examples/simple/simple.pro @@ -1,8 +1,8 @@ -ADS_OUT_ROOT = $${OUT_PWD}/.. +ADS_OUT_ROOT = $${OUT_PWD}/../.. QT += core gui widgets -TARGET = Example1 +TARGET = SimpleExample DESTDIR = $${ADS_OUT_ROOT}/lib TEMPLATE = app CONFIG += c++14 @@ -42,6 +42,6 @@ else{ LIBS += -lqtadvanceddocking } -INCLUDEPATH += ../src -DEPENDPATH += ../src +INCLUDEPATH += ../../src +DEPENDPATH += ../../src diff --git a/example/example.py b/examples/simple/simple.py similarity index 100% rename from example/example.py rename to examples/simple/simple.py