diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..35ef837 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,160 @@ +version: '2.3.2.{build}' +branches: + only: + - master + +image: Visual Studio 2015 +clone_depth: 1 +environment: + global: + # Appveyor doesn't have Qt 12 yet + LatestLTSQtVersion: 5.9 + LatestQtVersion: 5.11 + matrix: + # Latest version of Qt, dll, 64bit, MSVC 2015, qmake + - QT5: C:\Qt\%LatestQtVersion%\msvc2015_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + targetPlatform: amd64 + use_mingw: "false" + use_static: "false" + use_cmake: "false" +# 32 bit builds +# MSVC 2015 builds +# Dynamic Library builds + # LTS version of Qt, dll, 32bit, MSVC 2015, qmake + - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + targetPlatform: x86 + use_mingw: "false" + use_static: "false" + use_cmake: "false" + # LTS version of Qt, dll, 32bit, MSVC 2015, cmake + - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + 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\%LatestLTSQtVersion%\msvc2015 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + targetPlatform: x86 + use_mingw: "false" + use_static: "true" + use_cmake: "false" + # LTS version of Qt, static, 32bit, MSVC 2015, cmake + - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + 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 + - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 + COMPILER: C:\Qt\Tools\mingw530_32 + targetPlatform: x86 + use_mingw: "true" + use_static: "false" + use_cmake: "false" + # LTS version of Qt, dll, 32bit, MinGW, cmake + - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 + COMPILER: C:\Qt\Tools\mingw530_32 + targetPlatform: x86 + use_mingw: "true" + use_static: "false" + use_cmake: "true" +# end Dynamic Library builds +# Static Library builds + # LTS version of Qt, static, 32bit, MinGW, qmake + - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 + COMPILER: C:\Qt\Tools\mingw530_32 + targetPlatform: x86 + use_mingw: "true" + use_static: "true" + use_cmake: "false" + # LTS version of Qt, static, 32bit, MinGW, cmake + - QT5: C:\Qt\%LatestLTSQtVersion%\mingw53_32 + COMPILER: C:\Qt\Tools\mingw530_32 + targetPlatform: x86 + use_mingw: "true" + use_static: "true" + use_cmake: "true" +# end Static Library builds +# end MinGW builds +# end 32 bit builds +# 64 bit builds +# MSVC 2015 builds +# Dynamic Library builds + # LTS version of Qt, dll, 64bit, MSVC 2015, qmake + - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + targetPlatform: amd64 + use_mingw: "false" + use_static: "false" + use_cmake: "false" + # LTS version of Qt, dll, 64bit, MSVC 2015, cmake + - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + targetPlatform: amd64 + use_mingw: "false" + use_static: "false" + use_cmake: "true" +# end Dynamic Library builds +# Static Library builds + # LTS version of Qt, static, 64bit, MSVC 2015, qmake + - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + targetPlatform: amd64 + use_mingw: "false" + use_static: "true" + use_cmake: "false" + # LTS version of Qt, static, 64bit, MSVC 2015, cmake + - QT5: C:\Qt\%LatestLTSQtVersion%\msvc2015_64 + COMPILER: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC + targetPlatform: amd64 + use_mingw: "false" + use_static: "true" + use_cmake: "true" +# end Static Library builds +# end MSVC 2015 builds +# end 64 bit builds + +matrix: + fast_finish: true + +before_build: +- set PATH=%COMPILER%\bin;%QT5%\bin;%PATH% +- set originalWD=%CD% +- call "%QT5%\bin\qtenv2.bat" +- cd %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;=% + +build_script: +- if %use_cmake%==true mkdir .\build +- if %use_cmake%==true cd .\build +- if %use_cmake%==true cmake --version +- if %use_cmake%==true cmake -G %CMAKEGENERATOR% -DCMAKE_BUILD_TYPE=DEBUG -DBUILD_EXAMPLES=ON -DCMAKE_DEBUG_POSTFIX=d -DBUILD_STATIC=%USESTATIC% -DCMAKE_INSTALL_PREFIX="./installed" ../ +- if %use_cmake%==true cmake --build . +- if %use_cmake%==true cmake --build . --target install +- if %use_cmake%==true cmake -G %CMAKEGENERATOR% -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_EXAMPLES=ON -DBUILD_STATIC=%USESTATIC% -DCMAKE_INSTALL_PREFIX="./installed" ../ +- if %use_cmake%==true cmake --build . +- if %use_cmake%==true cmake --build . --target install +- if %use_cmake%==false if %use_static%==true qmake "CONFIG+=adsBuildStatic" +- if %use_cmake%==false if %use_static%==false qmake +- if %use_cmake%==false %MAKEENGINE% debug +- if %use_cmake%==false %MAKEENGINE% install +- if %use_cmake%==false %MAKEENGINE% release +- if %use_cmake%==false %MAKEENGINE% install + +after_build: +- if %use_mingw%==true set PATH=C:\Program Files\Git\usr\bin;%PATH% diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6b4afaa --- /dev/null +++ b/.travis.yml @@ -0,0 +1,155 @@ +language: cpp +# gcc is clang on mac +compiler: gcc + +git: + depth: 1 + +matrix: + fast_finish: true + include: + - name: Ubuntu qmake Qt5.5.1 + os: linux + dist: trusty + group: stable + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:beineri/opt-qt551-trusty' + update: true + packages: + - qt55base + - qt55tools + - gcc-6 + - g++-6 + - libc6-i386 + script: + - PATH="/opt/qt55/bin:$PATH" + - CXX="g++-6" + - CC="gcc-6" + - qt55-env.sh + - qmake + - make + - make install + - name: Ubuntu qmake dll + os: linux + dist: xenial + group: stable + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial' + update: true + packages: + - qt512base + - qt512tools + - gcc-6 + - g++-6 + - libc6-i386 + - libgl-dev + - libgl1-mesa-dev + - mesa-common-dev + script: + - PATH="/opt/qt512/bin:$PATH" + - CXX="g++-6" + - CC="gcc-6" + - qt512-env.sh + - qmake + - make + - make install + - name: Ubuntu qmake static + os: linux + dist: xenial + group: stable + addons: + apt: + sources: + - ubuntu-toolchain-r-test + - sourceline: 'ppa:beineri/opt-qt-5.12.0-xenial' + update: true + packages: + - qt512base + - qt512tools + - gcc-6 + - g++-6 + - libc6-i386 + - libgl-dev + - libgl1-mesa-dev + - mesa-common-dev + script: + - PATH="/opt/qt512/bin:$PATH" + - CXX="g++-6" + - CC="gcc-6" + - qt512-env.sh + - qmake "CONFIG+=adsBuildStatic" + - make + - make install + - name: macOS CMake dll + os: osx + osx_image: xcode10.1 + addons: + homebrew: + packages: + - qt + update: true + script: + - PATH="/usr/local/opt/qt5/bin:$PATH" + - mkdir -p build + - cd build + - cmake --version + - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_DEBUG_POSTFIX=_debug -DBUILD_EXAMPLES=ON -DBUILD_STATIC=OFF -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install + - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_EXAMPLES=ON -DBUILD_STATIC=OFF -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install + - name: macOS CMake static + os: osx + osx_image: xcode10.1 + addons: + homebrew: + packages: + - qt + update: true + script: + - PATH="/usr/local/opt/qt5/bin:$PATH" + - mkdir -p build + - cd build + - cmake --version + - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_DEBUG_POSTFIX=_debug -DBUILD_EXAMPLES=ON -DBUILD_STATIC=ON -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install + - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE -DBUILD_EXAMPLES=ON -DBUILD_STATIC=ON -DCMAKE_INSTALL_PREFIX="./installed" ../ + - cmake --build . + - cmake --build . --target install + - name: macOS qmake dll + os: osx + osx_image: xcode10.1 + addons: + homebrew: + packages: + - qt + update: true + script: + - PATH="/usr/local/opt/qt5/bin:$PATH" + - qmake + - make + - make install + - name: macOS qmake static + os: osx + osx_image: xcode10.1 + addons: + homebrew: + packages: + - qt + update: true + script: + - PATH="/usr/local/opt/qt5/bin:$PATH" + - qmake "CONFIG+=adsBuildStatic" + - make + - make install +notifications: + email: false + diff --git a/CMakeLists.txt b/CMakeLists.txt index 70691b0..1c9a0f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.3) set(ads_VERSION "2.3.2") -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_AUTOMOC ON) @@ -8,7 +8,7 @@ set(CMAKE_AUTORCC ON) project(QtAdvancedDockingSystem VERSION ${ads_VERSION}) option(BUILD_STATIC "Build the static library" OFF) option(BUILD_EXAMPLES "Build the examples" ON) -set(REQUIRED_QT_VERSION 5.0.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) @@ -56,15 +56,15 @@ set(ads_INSTALL_INCLUDE src/FloatingDockContainer.h ) if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") - set(ads_PlatformDir "x64") -else() set(ads_PlatformDir "x86") +else() + set(ads_PlatformDir "x64") endif() if(BUILD_STATIC) - add_library(ads STATIC ${ads_SRCS}) + add_library(qtadvanceddocking STATIC ${ads_SRCS}) set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_STATIC) else() - add_library(ads SHARED ${ads_SRCS}) + add_library(qtadvanceddocking SHARED ${ads_SRCS}) set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_SHARED_EXPORT) endif() install(FILES ${ads_INSTALL_INCLUDE} @@ -77,19 +77,19 @@ install(FILES DESTINATION license COMPONENT license ) -install(TARGETS ads +install(TARGETS qtadvanceddocking EXPORT adsBinary RUNTIME DESTINATION bin COMPONENT library LIBRARY DESTINATION lib COMPONENT library ARCHIVE DESTINATION lib COMPONENT library ) -target_include_directories(ads PUBLIC +target_include_directories(qtadvanceddocking PUBLIC $ $ ) -target_link_libraries(ads PUBLIC ${ads_LIBS}) -target_compile_definitions(ads PRIVATE ${ads_COMPILE_DEFINE}) -set_target_properties(ads PROPERTIES +target_link_libraries(qtadvanceddocking PUBLIC ${ads_LIBS}) +target_compile_definitions(qtadvanceddocking PRIVATE ${ads_COMPILE_DEFINE}) +set_target_properties(qtadvanceddocking PROPERTIES VERSION ${ads_VERSION} EXPORT_NAME "Qt Advanced Docking System" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" diff --git a/README.md b/README.md index a89770a..7e24607 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -# Advanced Docking System for Qt +# Advanced Docking System for Qt +[![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) + + Qt Advanced Docking System lets you create customizable layouts using a full featured window docking system similar to what is found in many popular @@ -56,7 +60,9 @@ main window layout. ![Perspective](doc/perspectives_dark.png) ## Tested Compatible Environments -- Windows 10 +- 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) +- Ubuntu [![Build Status](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System.svg?branch=master)](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System) +- macOS [![Build Status](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System.svg?branch=master)](https://travis-ci.org/githubuser0xFFFF/Qt-Advanced-Docking-System) ## Build Open the `ads.pro` with QtCreator and start the build, that's it. diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt index b2ee246..7580503 100644 --- a/demo/CMakeLists.txt +++ b/demo/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.3) -set (CMAKE_CXX_STANDARD 11) +set (CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) project(ads_demo VERSION "1.0") -set(REQUIRED_QT_VERSION 5.0.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) @@ -26,23 +26,23 @@ set(ads_demo_SRCS MainWindow.ui main.qrc ) -add_executable(ads_demo WIN32 ${ads_demo_SRCS}) +add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS}) if(BUILD_STATIC) set(ads_demo_DEFINE ${ads_demo_DEFINE} ADS_STATIC) endif() -add_dependencies(ads_demo ads) -target_include_directories(ads_demo PUBLIC +add_dependencies(AdvancedDockingSystemDemo qtadvanceddocking) +target_include_directories(AdvancedDockingSystemDemo PUBLIC $ $ ) -target_include_directories(ads_demo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_demo_INCLUDE}) -target_link_libraries(ads_demo PRIVATE ads ${ads_demo_LIBS}) -target_compile_definitions(ads_demo PRIVATE ${ads_demo_DEFINE}) -set_target_properties(ads_demo PROPERTIES +target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_demo_INCLUDE}) +target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking ${ads_demo_LIBS}) +target_compile_definitions(AdvancedDockingSystemDemo PRIVATE ${ads_demo_DEFINE}) +set_target_properties(AdvancedDockingSystemDemo PROPERTIES VERSION "1.0" SOVERSION 1 EXPORT_NAME "Qt Advanced Docking System Demo" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/demo" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/demo" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin/demo" + 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/demo/demo.pro b/demo/demo.pro index 73086c9..2d787e9 100644 --- a/demo/demo.pro +++ b/demo/demo.pro @@ -1,31 +1,45 @@ -ADS_ROOT = $${PWD}/.. ADS_OUT_ROOT = $${OUT_PWD}/.. TARGET = AdvancedDockingSystemDemo DESTDIR = $${ADS_OUT_ROOT}/lib QT += core gui widgets -CONFIG *= c++14 +CONFIG += c++14 +CONFIG += debug_and_release +DEFINES += QT_DEPRECATED_WARNINGS +adsBuildStatic { + DEFINES += ADS_STATIC +} SOURCES += \ main.cpp \ MainWindow.cpp - HEADERS += \ MainWindow.h FORMS += \ mainwindow.ui - + RESOURCES += main.qrc LIBS += -L$${ADS_OUT_ROOT}/lib # Dependency: AdvancedDockingSystem (shared) -win32:CONFIG(release, debug|release): LIBS += -lqtadvanceddocking -else:win32:CONFIG(debug, debug|release): LIBS += -lqtadvanceddockingd -else:unix: LIBS += -lqtadvanceddocking +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/example/CMakeLists.txt index 8d99310..dafffa7 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.3) -set (CMAKE_CXX_STANDARD 11) +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.0.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) @@ -24,23 +24,23 @@ set(ads_example_SRCS MainWindow.cpp MainWindow.ui ) -add_executable(ads_example WIN32 ${ads_example_SRCS}) +add_executable(Example1 WIN32 ${ads_example_SRCS}) if(BUILD_STATIC) set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) endif() -add_dependencies(ads_example ads) -target_include_directories(ads_example PUBLIC +add_dependencies(Example1 qtadvanceddocking) +target_include_directories(Example1 PUBLIC $ $ ) -target_include_directories(ads_example PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_example_INCLUDE}) -target_link_libraries(ads_example PRIVATE ads ${ads_example_LIBS}) -target_compile_definitions(ads_example PRIVATE ${ads_example_DEFINE}) -set_target_properties(ads_example PROPERTIES +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 VERSION "1.0" SOVERSION 1 EXPORT_NAME "Qt Advanced Docking System Example" - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/example" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/example" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin/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/example/example.pro b/example/example.pro index e571329..6b37fd4 100644 --- a/example/example.pro +++ b/example/example.pro @@ -1,32 +1,18 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2018-12-14T22:42:14 -# -#------------------------------------------------- -ADS_ROOT = $${PWD}/.. ADS_OUT_ROOT = $${OUT_PWD}/.. -QT += core gui widgets - -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +QT += core gui widgets TARGET = Example1 DESTDIR = $${ADS_OUT_ROOT}/lib TEMPLATE = app -CONFIG *= c++14 +CONFIG += c++14 +CONFIG += debug_and_release +adsBuildStatic { + DEFINES += ADS_STATIC +} -# The following define makes your compiler emit warnings if you use -# any feature of Qt which has been marked as 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 -# You can also make your code fail to compile if you use deprecated APIs. -# In order to do so, uncomment the following line. -# You can also select to disable deprecated APIs only up to a certain version of Qt. -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - - SOURCES += \ main.cpp \ MainWindow.cpp @@ -42,9 +28,20 @@ FORMS += \ LIBS += -L$${ADS_OUT_ROOT}/lib # Dependency: AdvancedDockingSystem (shared) -win32:CONFIG(release, debug|release): LIBS += -lqtadvanceddocking -else:win32:CONFIG(debug, debug|release): LIBS += -lqtadvanceddockingd -else:unix: LIBS += -lqtadvanceddocking +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/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index 038a168..b681ede 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -98,7 +98,7 @@ public: */ void insertWidget(int index, QWidget* Widget) { - Widget->setParent(0); + Widget->setParent(nullptr); if (index < 0) { index = m_Widgets.count(); @@ -127,7 +127,7 @@ public: auto LayoutItem = m_ParentLayout->takeAt(1); if (LayoutItem) { - LayoutItem->widget()->setParent(0); + LayoutItem->widget()->setParent(nullptr); } m_CurrentWidget = nullptr; m_CurrentIndex = -1; @@ -167,7 +167,7 @@ public: auto LayoutItem = m_ParentLayout->takeAt(1); if (LayoutItem) { - LayoutItem->widget()->setParent(0); + LayoutItem->widget()->setParent(nullptr); } m_ParentLayout->addWidget(next); @@ -315,12 +315,9 @@ void DockAreaWidgetPrivate::createTitleBar() { TitleBar = new CDockAreaTitleBar(_this); Layout->addWidget(TitleBar); - _this->connect(tabBar(), SIGNAL(tabCloseRequested(int)), - SLOT(onTabCloseRequested(int))); - _this->connect(TitleBar, SIGNAL(tabBarClicked(int)), - SLOT(setCurrentIndex(int))); - _this->connect(tabBar(), SIGNAL(tabMoved(int, int)), - SLOT(reorderDockWidget(int, int))); + QObject::connect(tabBar(), &CDockAreaTabBar::tabCloseRequested, _this, &CDockAreaWidget::onTabCloseRequested); + QObject::connect(TitleBar, &CDockAreaTitleBar::tabBarClicked, _this, &CDockAreaWidget::setCurrentIndex); + QObject::connect(tabBar(), &CDockAreaTabBar::tabMoved, _this, &CDockAreaWidget::reorderDockWidget); } diff --git a/src/DockContainerWidget.cpp b/src/DockContainerWidget.cpp index 3c58e87..6cc3a13 100644 --- a/src/DockContainerWidget.cpp +++ b/src/DockContainerWidget.cpp @@ -47,6 +47,7 @@ #include "ads_globals.h" #include "DockSplitter.h" +#include #include #if QT_VERSION < 0x050900 @@ -64,7 +65,7 @@ QByteArray qByteArrayToHex(const QByteArray& src, char separator) const int length = separator ? (src.size() * 3 - 1) : (src.size() * 2); QByteArray hex(length, Qt::Uninitialized); char *hexData = hex.data(); - const uchar *data = (const uchar *)src.data(); + const uchar *data = reinterpret_cast(src.data()); for (int i = 0, o = 0; i < src.size(); ++i) { hexData[o++] = toHexLower(data[i] >> 4); hexData[o++] = toHexLower(data[i] & 0xf); @@ -96,8 +97,6 @@ static int areaIdToIndex(DockWidgetArea area) default: return 4; } - - return 4; } /** @@ -128,7 +127,7 @@ public: QGridLayout* Layout = nullptr; QSplitter* RootSplitter = nullptr; bool isFloating = false; - CDockAreaWidget* LastAddedAreaCache[5]{0, 0, 0, 0, 0}; + CDockAreaWidget* LastAddedAreaCache[5]; int VisibleDockAreaCount = -1; CDockAreaWidget* TopLevelDockArea = nullptr; @@ -267,7 +266,7 @@ public: /** * Helper function for creation of new splitter */ - CDockSplitter* newSplitter(Qt::Orientation orientation, QWidget* parent = 0) + CDockSplitter* newSplitter(Qt::Orientation orientation, QWidget* parent = nullptr) { CDockSplitter* s = new CDockSplitter(orientation, parent); s->setOpaqueResize(DockManager->configFlags().testFlag(CDockManager::OpaqueSplitterResize)); @@ -291,7 +290,7 @@ public: DockContainerWidgetPrivate::DockContainerWidgetPrivate(CDockContainerWidget* _public) : _this(_public) { - + std::fill(std::begin(LastAddedAreaCache),std::end(LastAddedAreaCache), nullptr); } @@ -541,7 +540,10 @@ void DockContainerWidgetPrivate::appendDockAreas(const QList N DockAreas.append(NewDockAreas); for (auto DockArea : NewDockAreas) { - _this->connect(DockArea, SIGNAL(viewToggled(bool)), SLOT(onDockAreaViewToggled(bool))); + QObject::connect(DockArea, + &CDockAreaWidget::viewToggled, + _this, + std::bind(&DockContainerWidgetPrivate::onDockAreaViewToggled, this, std::placeholders::_1)); } } @@ -611,7 +613,7 @@ bool DockContainerWidgetPrivate::restoreSplitter(QXmlStreamReader& s, QSplitter* Splitter = nullptr; if (!Testing) { - Splitter = newSplitter((Qt::Orientation)Orientation); + Splitter = newSplitter(static_cast(Orientation)); } bool Visible = false; QList Sizes; @@ -1052,7 +1054,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area) // Remove are from parent splitter and recursively hide tree of parent // splitters if it has no visible content - area->setParent(0); + area->setParent(nullptr); internal::hideEmptyParentSplitters(Splitter); // If splitter has more than 1 widgets, we are finished and can leave @@ -1083,7 +1085,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area) } // We replace the superfluous RootSplitter with the ChildSplitter - ChildSplitter->setParent(0); + ChildSplitter->setParent(nullptr); QLayoutItem* li = d->Layout->replaceWidget(Splitter, ChildSplitter); d->RootSplitter = ChildSplitter; delete li; @@ -1124,14 +1126,14 @@ CDockAreaWidget* CDockContainerWidget::dockAreaAt(const QPoint& GlobalPos) const } } - return 0; + return nullptr; } //============================================================================ CDockAreaWidget* CDockContainerWidget::dockArea(int Index) const { - return (Index < dockAreaCount()) ? d->DockAreas[Index] : 0; + return (Index < dockAreaCount()) ? d->DockAreas[Index] : nullptr; } @@ -1465,6 +1467,5 @@ void CDockContainerWidget::closeOtherAreas(CDockAreaWidget* KeepOpenArea) } // namespace ads -#include "moc_DockContainerWidget.cpp" //--------------------------------------------------------------------------- // EOF DockContainerWidget.cpp diff --git a/src/DockContainerWidget.h b/src/DockContainerWidget.h index 75bf54d..0483137 100644 --- a/src/DockContainerWidget.h +++ b/src/DockContainerWidget.h @@ -65,8 +65,6 @@ private: friend class CFloatingDockContainer; friend struct FloatingDockContainerPrivate; friend class CDockWidget; - Q_PRIVATE_SLOT(d, void onDockAreaViewToggled(bool Visible)) - protected: /** * Handles activation events to update zOrderIndex diff --git a/src/DockManager.cpp b/src/DockManager.cpp index 35d79c0..44a0a2b 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -72,7 +72,7 @@ struct DockManagerPrivate QMenu* ViewMenu; CDockManager::eViewMenuInsertionOrder MenuInsertionOrder = CDockManager::MenuAlphabeticallySorted; bool RestoringState = false; - CDockManager::ConfigFlags ConfigFlags{CDockManager::DefaultConfig}; + CDockManager::ConfigFlags ConfigFlags = CDockManager::DefaultConfig; /** * Private data constructor diff --git a/src/FloatingDockContainer.cpp b/src/FloatingDockContainer.cpp index df586ad..c3de7ee 100644 --- a/src/FloatingDockContainer.cpp +++ b/src/FloatingDockContainer.cpp @@ -313,7 +313,18 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event) if (isClosable()) { - QWidget::closeEvent(event); + // In Qt version after 5.9.2 there seems to be a bug that causes the + // QWidget::event() function to not receive any NonClientArea mouse + // events anymore after a close/show cycle. The bug is reported here: + // https://bugreports.qt.io/browse/QTBUG-73295 + // The following code is a workaround for Qt versions > 5.9.2 that seems + // to work +#if (QT_VERSION > 0x050902) + event->ignore(); + this->hide(); +#else + Super::closeEvent(event); +#endif } else { diff --git a/src/ads_globals.cpp b/src/ads_globals.cpp index 877e853..2c6f17e 100644 --- a/src/ads_globals.cpp +++ b/src/ads_globals.cpp @@ -44,7 +44,7 @@ namespace internal void replaceSplitterWidget(QSplitter* Splitter, QWidget* From, QWidget* To) { int index = Splitter->indexOf(From); - From->setParent(0); + From->setParent(nullptr); Splitter->insertWidget(index, To); } @@ -90,7 +90,6 @@ void hideEmptyParentSplitters(CDockSplitter* Splitter) } } - } // namespace internal } // namespace ads diff --git a/src/src.pro b/src/src.pro index 2f4ea7d..b97c1cf 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,26 +1,24 @@ -ADS_ROOT = $${PWD}/.. ADS_OUT_ROOT = $${OUT_PWD}/.. - +CONFIG += c++14 +CONFIG += debug_and_release TARGET = $$qtLibraryTarget(qtadvanceddocking) +DEFINES += QT_DEPRECATED_WARNINGS TEMPLATE = lib DESTDIR = $${ADS_OUT_ROOT}/lib QT += core gui widgets -CONFIG += adsBuildShared - - -adsBuildShared { +!adsBuildStatic { CONFIG += shared DEFINES += ADS_SHARED_EXPORT } -!adsBuildShared { +adsBuildStatic { CONFIG += staticlib + DEFINES += ADS_STATIC } windows { # MinGW *-g++* { - QMAKE_CXXFLAGS += -std=c++11 QMAKE_CXXFLAGS += -Wall -Wextra -pedantic } # MSVC @@ -28,10 +26,6 @@ windows { } } -unix { - CONFIG += c++11 -} - RESOURCES += ads.qrc HEADERS += \ @@ -63,3 +57,12 @@ SOURCES += \ DockSplitter.cpp \ DockAreaTitleBar.cpp \ ElidingLabel.cpp + +isEmpty(PREFIX){ + PREFIX=..\installed + warning("Install Prefix not set") +} +headers.path=$$PREFIX/include +headers.files=$$HEADERS +target.path=$$PREFIX/lib +INSTALLS += headers target