Merge pull request #3 from githubuser0xFFFF/master

merge
This commit is contained in:
Andreev Alexander 2019-02-01 20:47:51 +05:00 committed by GitHub
commit f7c8384b73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 448 additions and 107 deletions

160
.appveyor.yml Normal file
View File

@ -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%

155
.travis.yml Normal file
View File

@ -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

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.3) cmake_minimum_required(VERSION 3.3)
set(ads_VERSION "2.3.2") 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_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
@ -8,7 +8,7 @@ set(CMAKE_AUTORCC ON)
project(QtAdvancedDockingSystem VERSION ${ads_VERSION}) project(QtAdvancedDockingSystem VERSION ${ads_VERSION})
option(BUILD_STATIC "Build the static library" OFF) option(BUILD_STATIC "Build the static library" OFF)
option(BUILD_EXAMPLES "Build the examples" ON) 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(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)
@ -56,15 +56,15 @@ set(ads_INSTALL_INCLUDE
src/FloatingDockContainer.h src/FloatingDockContainer.h
) )
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(ads_PlatformDir "x64")
else()
set(ads_PlatformDir "x86") set(ads_PlatformDir "x86")
else()
set(ads_PlatformDir "x64")
endif() endif()
if(BUILD_STATIC) if(BUILD_STATIC)
add_library(ads STATIC ${ads_SRCS}) add_library(qtadvanceddocking STATIC ${ads_SRCS})
set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_STATIC) set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_STATIC)
else() else()
add_library(ads SHARED ${ads_SRCS}) add_library(qtadvanceddocking SHARED ${ads_SRCS})
set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_SHARED_EXPORT) set(ads_COMPILE_DEFINE ${ads_COMPILE_DEFINE} ADS_SHARED_EXPORT)
endif() endif()
install(FILES ${ads_INSTALL_INCLUDE} install(FILES ${ads_INSTALL_INCLUDE}
@ -77,19 +77,19 @@ install(FILES
DESTINATION license DESTINATION license
COMPONENT license COMPONENT license
) )
install(TARGETS ads install(TARGETS qtadvanceddocking
EXPORT adsBinary EXPORT adsBinary
RUNTIME DESTINATION bin COMPONENT library RUNTIME DESTINATION bin COMPONENT library
LIBRARY DESTINATION lib COMPONENT library LIBRARY DESTINATION lib COMPONENT library
ARCHIVE DESTINATION lib COMPONENT library ARCHIVE DESTINATION lib COMPONENT library
) )
target_include_directories(ads PUBLIC target_include_directories(qtadvanceddocking PUBLIC
$<BUILD_INTERFACE:${ads_INCLUDE}> $<BUILD_INTERFACE:${ads_INCLUDE}>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
) )
target_link_libraries(ads PUBLIC ${ads_LIBS}) target_link_libraries(qtadvanceddocking PUBLIC ${ads_LIBS})
target_compile_definitions(ads PRIVATE ${ads_COMPILE_DEFINE}) target_compile_definitions(qtadvanceddocking PRIVATE ${ads_COMPILE_DEFINE})
set_target_properties(ads PROPERTIES set_target_properties(qtadvanceddocking PROPERTIES
VERSION ${ads_VERSION} VERSION ${ads_VERSION}
EXPORT_NAME "Qt Advanced Docking System" EXPORT_NAME "Qt Advanced Docking System"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"

View File

@ -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 Qt Advanced Docking System lets you create customizable layouts using a full
featured window docking system similar to what is found in many popular featured window docking system similar to what is found in many popular
@ -56,7 +60,9 @@ main window layout.
![Perspective](doc/perspectives_dark.png) ![Perspective](doc/perspectives_dark.png)
## Tested Compatible Environments ## 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 ## Build
Open the `ads.pro` with QtCreator and start the build, that's it. Open the `ads.pro` with QtCreator and start the build, that's it.

View File

@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.3) 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_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
project(ads_demo VERSION "1.0") 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(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)
@ -26,23 +26,23 @@ set(ads_demo_SRCS
MainWindow.ui MainWindow.ui
main.qrc main.qrc
) )
add_executable(ads_demo WIN32 ${ads_demo_SRCS}) add_executable(AdvancedDockingSystemDemo WIN32 ${ads_demo_SRCS})
if(BUILD_STATIC) if(BUILD_STATIC)
set(ads_demo_DEFINE ${ads_demo_DEFINE} ADS_STATIC) set(ads_demo_DEFINE ${ads_demo_DEFINE} ADS_STATIC)
endif() endif()
add_dependencies(ads_demo ads) add_dependencies(AdvancedDockingSystemDemo qtadvanceddocking)
target_include_directories(ads_demo PUBLIC target_include_directories(AdvancedDockingSystemDemo PUBLIC
$<BUILD_INTERFACE:${ads_demo_INCLUDE}> $<BUILD_INTERFACE:${ads_demo_INCLUDE}>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
) )
target_include_directories(ads_demo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_demo_INCLUDE}) target_include_directories(AdvancedDockingSystemDemo PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_demo_INCLUDE})
target_link_libraries(ads_demo PRIVATE ads ${ads_demo_LIBS}) target_link_libraries(AdvancedDockingSystemDemo PRIVATE qtadvanceddocking ${ads_demo_LIBS})
target_compile_definitions(ads_demo PRIVATE ${ads_demo_DEFINE}) target_compile_definitions(AdvancedDockingSystemDemo PRIVATE ${ads_demo_DEFINE})
set_target_properties(ads_demo PROPERTIES set_target_properties(AdvancedDockingSystemDemo PROPERTIES
VERSION "1.0" VERSION "1.0"
SOVERSION 1 SOVERSION 1
EXPORT_NAME "Qt Advanced Docking System Demo" EXPORT_NAME "Qt Advanced Docking System Demo"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/demo" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/demo" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin/demo" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"
) )

View File

@ -1,17 +1,20 @@
ADS_ROOT = $${PWD}/..
ADS_OUT_ROOT = $${OUT_PWD}/.. ADS_OUT_ROOT = $${OUT_PWD}/..
TARGET = AdvancedDockingSystemDemo TARGET = AdvancedDockingSystemDemo
DESTDIR = $${ADS_OUT_ROOT}/lib DESTDIR = $${ADS_OUT_ROOT}/lib
QT += core gui widgets QT += core gui widgets
CONFIG *= c++14 CONFIG += c++14
CONFIG += debug_and_release
DEFINES += QT_DEPRECATED_WARNINGS
adsBuildStatic {
DEFINES += ADS_STATIC
}
SOURCES += \ SOURCES += \
main.cpp \ main.cpp \
MainWindow.cpp MainWindow.cpp
HEADERS += \ HEADERS += \
MainWindow.h MainWindow.h
@ -23,9 +26,20 @@ RESOURCES += main.qrc
LIBS += -L$${ADS_OUT_ROOT}/lib LIBS += -L$${ADS_OUT_ROOT}/lib
# Dependency: AdvancedDockingSystem (shared) # Dependency: AdvancedDockingSystem (shared)
win32:CONFIG(release, debug|release): LIBS += -lqtadvanceddocking CONFIG(debug, debug|release){
else:win32:CONFIG(debug, debug|release): LIBS += -lqtadvanceddockingd win32 {
else:unix: LIBS += -lqtadvanceddocking LIBS += -lqtadvanceddockingd
}
else:mac {
LIBS += -lqtadvanceddocking_debug
}
else {
LIBS += -lqtadvanceddocking
}
}
else{
LIBS += -lqtadvanceddocking
}
INCLUDEPATH += ../src INCLUDEPATH += ../src
DEPENDPATH += ../src DEPENDPATH += ../src

View File

@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.3) 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_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
project(ads_example VERSION "1.0") 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(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED) find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)
@ -24,23 +24,23 @@ set(ads_example_SRCS
MainWindow.cpp MainWindow.cpp
MainWindow.ui MainWindow.ui
) )
add_executable(ads_example WIN32 ${ads_example_SRCS}) add_executable(Example1 WIN32 ${ads_example_SRCS})
if(BUILD_STATIC) if(BUILD_STATIC)
set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC) set(ads_example_DEFINE ${ads_example_DEFINE} ADS_STATIC)
endif() endif()
add_dependencies(ads_example ads) add_dependencies(Example1 qtadvanceddocking)
target_include_directories(ads_example PUBLIC target_include_directories(Example1 PUBLIC
$<BUILD_INTERFACE:${ads_example_INCLUDE}> $<BUILD_INTERFACE:${ads_example_INCLUDE}>
$<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include>
) )
target_include_directories(ads_example PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_example_INCLUDE}) target_include_directories(Example1 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../src" ${ads_example_INCLUDE})
target_link_libraries(ads_example PRIVATE ads ${ads_example_LIBS}) target_link_libraries(Example1 PRIVATE qtadvanceddocking ${ads_example_LIBS})
target_compile_definitions(ads_example PRIVATE ${ads_example_DEFINE}) target_compile_definitions(Example1 PRIVATE ${ads_example_DEFINE})
set_target_properties(ads_example PROPERTIES set_target_properties(Example1 PROPERTIES
VERSION "1.0" VERSION "1.0"
SOVERSION 1 SOVERSION 1
EXPORT_NAME "Qt Advanced Docking System Example" EXPORT_NAME "Qt Advanced Docking System Example"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/example" ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib/example" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin/example" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ads_PlatformDir}/bin"
) )

View File

@ -1,32 +1,18 @@
#-------------------------------------------------
#
# Project created by QtCreator 2018-12-14T22:42:14
#
#-------------------------------------------------
ADS_ROOT = $${PWD}/..
ADS_OUT_ROOT = $${OUT_PWD}/.. ADS_OUT_ROOT = $${OUT_PWD}/..
QT += core gui widgets QT += core gui widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Example1 TARGET = Example1
DESTDIR = $${ADS_OUT_ROOT}/lib DESTDIR = $${ADS_OUT_ROOT}/lib
TEMPLATE = app 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 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 += \ SOURCES += \
main.cpp \ main.cpp \
MainWindow.cpp MainWindow.cpp
@ -42,9 +28,20 @@ FORMS += \
LIBS += -L$${ADS_OUT_ROOT}/lib LIBS += -L$${ADS_OUT_ROOT}/lib
# Dependency: AdvancedDockingSystem (shared) # Dependency: AdvancedDockingSystem (shared)
win32:CONFIG(release, debug|release): LIBS += -lqtadvanceddocking CONFIG(debug, debug|release){
else:win32:CONFIG(debug, debug|release): LIBS += -lqtadvanceddockingd win32 {
else:unix: LIBS += -lqtadvanceddocking LIBS += -lqtadvanceddockingd
}
else:mac {
LIBS += -lqtadvanceddocking_debug
}
else {
LIBS += -lqtadvanceddocking
}
}
else{
LIBS += -lqtadvanceddocking
}
INCLUDEPATH += ../src INCLUDEPATH += ../src
DEPENDPATH += ../src DEPENDPATH += ../src

View File

@ -98,7 +98,7 @@ public:
*/ */
void insertWidget(int index, QWidget* Widget) void insertWidget(int index, QWidget* Widget)
{ {
Widget->setParent(0); Widget->setParent(nullptr);
if (index < 0) if (index < 0)
{ {
index = m_Widgets.count(); index = m_Widgets.count();
@ -127,7 +127,7 @@ public:
auto LayoutItem = m_ParentLayout->takeAt(1); auto LayoutItem = m_ParentLayout->takeAt(1);
if (LayoutItem) if (LayoutItem)
{ {
LayoutItem->widget()->setParent(0); LayoutItem->widget()->setParent(nullptr);
} }
m_CurrentWidget = nullptr; m_CurrentWidget = nullptr;
m_CurrentIndex = -1; m_CurrentIndex = -1;
@ -167,7 +167,7 @@ public:
auto LayoutItem = m_ParentLayout->takeAt(1); auto LayoutItem = m_ParentLayout->takeAt(1);
if (LayoutItem) if (LayoutItem)
{ {
LayoutItem->widget()->setParent(0); LayoutItem->widget()->setParent(nullptr);
} }
m_ParentLayout->addWidget(next); m_ParentLayout->addWidget(next);
@ -315,12 +315,9 @@ void DockAreaWidgetPrivate::createTitleBar()
{ {
TitleBar = new CDockAreaTitleBar(_this); TitleBar = new CDockAreaTitleBar(_this);
Layout->addWidget(TitleBar); Layout->addWidget(TitleBar);
_this->connect(tabBar(), SIGNAL(tabCloseRequested(int)), QObject::connect(tabBar(), &CDockAreaTabBar::tabCloseRequested, _this, &CDockAreaWidget::onTabCloseRequested);
SLOT(onTabCloseRequested(int))); QObject::connect(TitleBar, &CDockAreaTitleBar::tabBarClicked, _this, &CDockAreaWidget::setCurrentIndex);
_this->connect(TitleBar, SIGNAL(tabBarClicked(int)), QObject::connect(tabBar(), &CDockAreaTabBar::tabMoved, _this, &CDockAreaWidget::reorderDockWidget);
SLOT(setCurrentIndex(int)));
_this->connect(tabBar(), SIGNAL(tabMoved(int, int)),
SLOT(reorderDockWidget(int, int)));
} }

View File

@ -47,6 +47,7 @@
#include "ads_globals.h" #include "ads_globals.h"
#include "DockSplitter.h" #include "DockSplitter.h"
#include <functional>
#include <iostream> #include <iostream>
#if QT_VERSION < 0x050900 #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); const int length = separator ? (src.size() * 3 - 1) : (src.size() * 2);
QByteArray hex(length, Qt::Uninitialized); QByteArray hex(length, Qt::Uninitialized);
char *hexData = hex.data(); char *hexData = hex.data();
const uchar *data = (const uchar *)src.data(); const uchar *data = reinterpret_cast<const uchar *>(src.data());
for (int i = 0, o = 0; i < src.size(); ++i) { for (int i = 0, o = 0; i < src.size(); ++i) {
hexData[o++] = toHexLower(data[i] >> 4); hexData[o++] = toHexLower(data[i] >> 4);
hexData[o++] = toHexLower(data[i] & 0xf); hexData[o++] = toHexLower(data[i] & 0xf);
@ -96,8 +97,6 @@ static int areaIdToIndex(DockWidgetArea area)
default: default:
return 4; return 4;
} }
return 4;
} }
/** /**
@ -128,7 +127,7 @@ public:
QGridLayout* Layout = nullptr; QGridLayout* Layout = nullptr;
QSplitter* RootSplitter = nullptr; QSplitter* RootSplitter = nullptr;
bool isFloating = false; bool isFloating = false;
CDockAreaWidget* LastAddedAreaCache[5]{0, 0, 0, 0, 0}; CDockAreaWidget* LastAddedAreaCache[5];
int VisibleDockAreaCount = -1; int VisibleDockAreaCount = -1;
CDockAreaWidget* TopLevelDockArea = nullptr; CDockAreaWidget* TopLevelDockArea = nullptr;
@ -267,7 +266,7 @@ public:
/** /**
* Helper function for creation of new splitter * 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); CDockSplitter* s = new CDockSplitter(orientation, parent);
s->setOpaqueResize(DockManager->configFlags().testFlag(CDockManager::OpaqueSplitterResize)); s->setOpaqueResize(DockManager->configFlags().testFlag(CDockManager::OpaqueSplitterResize));
@ -291,7 +290,7 @@ public:
DockContainerWidgetPrivate::DockContainerWidgetPrivate(CDockContainerWidget* _public) : DockContainerWidgetPrivate::DockContainerWidgetPrivate(CDockContainerWidget* _public) :
_this(_public) _this(_public)
{ {
std::fill(std::begin(LastAddedAreaCache),std::end(LastAddedAreaCache), nullptr);
} }
@ -541,7 +540,10 @@ void DockContainerWidgetPrivate::appendDockAreas(const QList<CDockAreaWidget*> N
DockAreas.append(NewDockAreas); DockAreas.append(NewDockAreas);
for (auto DockArea : 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; QSplitter* Splitter = nullptr;
if (!Testing) if (!Testing)
{ {
Splitter = newSplitter((Qt::Orientation)Orientation); Splitter = newSplitter(static_cast<Qt::Orientation>(Orientation));
} }
bool Visible = false; bool Visible = false;
QList<int> Sizes; QList<int> Sizes;
@ -1052,7 +1054,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
// Remove are from parent splitter and recursively hide tree of parent // Remove are from parent splitter and recursively hide tree of parent
// splitters if it has no visible content // splitters if it has no visible content
area->setParent(0); area->setParent(nullptr);
internal::hideEmptyParentSplitters(Splitter); internal::hideEmptyParentSplitters(Splitter);
// If splitter has more than 1 widgets, we are finished and can leave // 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 // We replace the superfluous RootSplitter with the ChildSplitter
ChildSplitter->setParent(0); ChildSplitter->setParent(nullptr);
QLayoutItem* li = d->Layout->replaceWidget(Splitter, ChildSplitter); QLayoutItem* li = d->Layout->replaceWidget(Splitter, ChildSplitter);
d->RootSplitter = ChildSplitter; d->RootSplitter = ChildSplitter;
delete li; delete li;
@ -1124,14 +1126,14 @@ CDockAreaWidget* CDockContainerWidget::dockAreaAt(const QPoint& GlobalPos) const
} }
} }
return 0; return nullptr;
} }
//============================================================================ //============================================================================
CDockAreaWidget* CDockContainerWidget::dockArea(int Index) const 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 } // namespace ads
#include "moc_DockContainerWidget.cpp"
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// EOF DockContainerWidget.cpp // EOF DockContainerWidget.cpp

View File

@ -65,8 +65,6 @@ private:
friend class CFloatingDockContainer; friend class CFloatingDockContainer;
friend struct FloatingDockContainerPrivate; friend struct FloatingDockContainerPrivate;
friend class CDockWidget; friend class CDockWidget;
Q_PRIVATE_SLOT(d, void onDockAreaViewToggled(bool Visible))
protected: protected:
/** /**
* Handles activation events to update zOrderIndex * Handles activation events to update zOrderIndex

View File

@ -72,7 +72,7 @@ struct DockManagerPrivate
QMenu* ViewMenu; QMenu* ViewMenu;
CDockManager::eViewMenuInsertionOrder MenuInsertionOrder = CDockManager::MenuAlphabeticallySorted; CDockManager::eViewMenuInsertionOrder MenuInsertionOrder = CDockManager::MenuAlphabeticallySorted;
bool RestoringState = false; bool RestoringState = false;
CDockManager::ConfigFlags ConfigFlags{CDockManager::DefaultConfig}; CDockManager::ConfigFlags ConfigFlags = CDockManager::DefaultConfig;
/** /**
* Private data constructor * Private data constructor

View File

@ -313,7 +313,18 @@ void CFloatingDockContainer::closeEvent(QCloseEvent *event)
if (isClosable()) 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 else
{ {

View File

@ -44,7 +44,7 @@ namespace internal
void replaceSplitterWidget(QSplitter* Splitter, QWidget* From, QWidget* To) void replaceSplitterWidget(QSplitter* Splitter, QWidget* From, QWidget* To)
{ {
int index = Splitter->indexOf(From); int index = Splitter->indexOf(From);
From->setParent(0); From->setParent(nullptr);
Splitter->insertWidget(index, To); Splitter->insertWidget(index, To);
} }
@ -90,7 +90,6 @@ void hideEmptyParentSplitters(CDockSplitter* Splitter)
} }
} }
} // namespace internal } // namespace internal
} // namespace ads } // namespace ads

View File

@ -1,26 +1,24 @@
ADS_ROOT = $${PWD}/..
ADS_OUT_ROOT = $${OUT_PWD}/.. ADS_OUT_ROOT = $${OUT_PWD}/..
CONFIG += c++14
CONFIG += debug_and_release
TARGET = $$qtLibraryTarget(qtadvanceddocking) TARGET = $$qtLibraryTarget(qtadvanceddocking)
DEFINES += QT_DEPRECATED_WARNINGS
TEMPLATE = lib TEMPLATE = lib
DESTDIR = $${ADS_OUT_ROOT}/lib DESTDIR = $${ADS_OUT_ROOT}/lib
QT += core gui widgets QT += core gui widgets
CONFIG += adsBuildShared !adsBuildStatic {
adsBuildShared {
CONFIG += shared CONFIG += shared
DEFINES += ADS_SHARED_EXPORT DEFINES += ADS_SHARED_EXPORT
} }
!adsBuildShared { adsBuildStatic {
CONFIG += staticlib CONFIG += staticlib
DEFINES += ADS_STATIC
} }
windows { windows {
# MinGW # MinGW
*-g++* { *-g++* {
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -Wall -Wextra -pedantic QMAKE_CXXFLAGS += -Wall -Wextra -pedantic
} }
# MSVC # MSVC
@ -28,10 +26,6 @@ windows {
} }
} }
unix {
CONFIG += c++11
}
RESOURCES += ads.qrc RESOURCES += ads.qrc
HEADERS += \ HEADERS += \
@ -63,3 +57,12 @@ SOURCES += \
DockSplitter.cpp \ DockSplitter.cpp \
DockAreaTitleBar.cpp \ DockAreaTitleBar.cpp \
ElidingLabel.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