Merge branch 'master' into focused_dockwidget
This commit is contained in:
106
src/CMakeLists.txt
Normal file
106
src/CMakeLists.txt
Normal file
@@ -0,0 +1,106 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
|
||||
find_package(Qt5 5.5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
if(BUILD_STATIC)
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX "_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||
endif()
|
||||
set(ads_SRCS
|
||||
ads_globals.cpp
|
||||
DockAreaTabBar.cpp
|
||||
DockAreaTitleBar.cpp
|
||||
DockAreaWidget.cpp
|
||||
DockContainerWidget.cpp
|
||||
DockManager.cpp
|
||||
DockOverlay.cpp
|
||||
DockSplitter.cpp
|
||||
DockWidget.cpp
|
||||
DockWidgetTab.cpp
|
||||
DockingStateReader.cpp
|
||||
ElidingLabel.cpp
|
||||
FloatingDockContainer.cpp
|
||||
FloatingDragPreview.cpp
|
||||
IconProvider.cpp
|
||||
DockComponentsFactory.cpp
|
||||
ads.qrc
|
||||
)
|
||||
set(ads_INSTALL_INCLUDE
|
||||
ads_globals.h
|
||||
DockAreaTabBar.h
|
||||
DockAreaTitleBar.h
|
||||
DockAreaTitleBar_p.h
|
||||
DockAreaWidget.h
|
||||
DockContainerWidget.h
|
||||
DockManager.h
|
||||
DockOverlay.h
|
||||
DockSplitter.h
|
||||
DockWidget.h
|
||||
DockWidgetTab.h
|
||||
DockingStateReader.h
|
||||
ElidingLabel.h
|
||||
FloatingDockContainer.h
|
||||
FloatingDragPreview.h
|
||||
IconProvider.h
|
||||
DockComponentsFactory.h
|
||||
)
|
||||
if (UNIX)
|
||||
set(ads_SRCS linux/FloatingWidgetTitleBar.cpp ${ads_SRCS})
|
||||
set(ads_INSTALL_INCLUDE linux/FloatingWidgetTitleBar.h ${ads_INSTALL_INCLUDE})
|
||||
endif()
|
||||
if(BUILD_STATIC)
|
||||
add_library(qtadvanceddocking STATIC ${ads_SRCS})
|
||||
target_compile_definitions(qtadvanceddocking PUBLIC ADS_STATIC)
|
||||
else()
|
||||
add_library(qtadvanceddocking SHARED ${ads_SRCS})
|
||||
target_compile_definitions(qtadvanceddocking PRIVATE ADS_SHARED_EXPORT)
|
||||
endif()
|
||||
target_link_libraries(qtadvanceddocking PUBLIC Qt5::Core Qt5::Gui Qt5::Widgets)
|
||||
set_target_properties(qtadvanceddocking PROPERTIES
|
||||
AUTOMOC ON
|
||||
AUTORCC ON
|
||||
CXX_STANDARD 14
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
CXX_EXTENSIONS OFF
|
||||
VERSION ${VERSION_SHORT}
|
||||
EXPORT_NAME "qtadvanceddocking"
|
||||
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"
|
||||
)
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
"qtadvanceddockingConfigVersion.cmake"
|
||||
VERSION ${VERSION_SHORT}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
install(FILES ${ads_INSTALL_INCLUDE}
|
||||
DESTINATION include
|
||||
COMPONENT headers
|
||||
)
|
||||
install(FILES
|
||||
"${CMAKE_SOURCE_DIR}/LICENSE"
|
||||
"${CMAKE_SOURCE_DIR}/gnu-lgpl-v2.1.md"
|
||||
DESTINATION license
|
||||
COMPONENT license
|
||||
)
|
||||
install(TARGETS qtadvanceddocking
|
||||
EXPORT adsTargets
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
INCLUDES DESTINATION include
|
||||
)
|
||||
|
||||
install(EXPORT adsTargets
|
||||
FILE adsTargets.cmake
|
||||
NAMESPACE ads::
|
||||
DESTINATION lib/cmake/qtadvanceddocking
|
||||
)
|
||||
install(FILES qtadvanceddockingConfig.cmake "${CMAKE_CURRENT_BINARY_DIR}/qtadvanceddockingConfigVersion.cmake"
|
||||
DESTINATION lib/cmake/qtadvanceddocking
|
||||
)
|
||||
|
||||
target_include_directories(qtadvanceddocking PUBLIC
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <FloatingDragPreview.h>
|
||||
#include "FloatingDragPreview.h"
|
||||
#include "DockAreaTabBar.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <DockComponentsFactory.h>
|
||||
#include "DockComponentsFactory.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
@@ -293,6 +293,7 @@ QWidget* CDockWidget::takeWidget()
|
||||
w = d->ScrollArea->takeWidget();
|
||||
delete d->ScrollArea;
|
||||
d->ScrollArea = nullptr;
|
||||
d->Widget = nullptr;
|
||||
}
|
||||
else if (d->Widget)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <FloatingDragPreview.h>
|
||||
#include "FloatingDragPreview.h"
|
||||
#include "ElidingLabel.h"
|
||||
#include "DockWidgetTab.h"
|
||||
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <windows.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "User32.lib")
|
||||
#endif
|
||||
#endif
|
||||
#ifdef Q_OS_LINUX
|
||||
#include "linux/FloatingWidgetTitleBar.h"
|
||||
@@ -57,7 +60,7 @@
|
||||
namespace ads
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
#if 0
|
||||
#if 0 // set to 1 if you need this function for debugging
|
||||
/**
|
||||
* Just for debuging to convert windows message identifiers to strings
|
||||
*/
|
||||
@@ -715,7 +718,6 @@ bool CFloatingDockContainer::nativeEvent(const QByteArray &eventType, void *mess
|
||||
if (d->isState(DraggingMousePressed))
|
||||
{
|
||||
ADS_PRINT("CFloatingDockContainer::nativeEvent WM_ENTERSIZEMOVE" << e->type());
|
||||
qApp->installEventFilter(this);
|
||||
d->setState(DraggingFloatingWidget);
|
||||
d->updateDropOverlays(QCursor::pos());
|
||||
}
|
||||
@@ -724,8 +726,15 @@ bool CFloatingDockContainer::nativeEvent(const QByteArray &eventType, void *mess
|
||||
case WM_EXITSIZEMOVE:
|
||||
if (d->isState(DraggingFloatingWidget))
|
||||
{
|
||||
ADS_PRINT("CFloatingDockContainer::nativeEvent WM_EXITSIZEMOVE" << e->type());;
|
||||
d->titleMouseReleaseEvent();
|
||||
ADS_PRINT("CFloatingDockContainer::nativeEvent WM_EXITSIZEMOVE" << e->type());
|
||||
if (GetAsyncKeyState(VK_ESCAPE) & 0x8000)
|
||||
{
|
||||
d->handleEscapeKey();
|
||||
}
|
||||
else
|
||||
{
|
||||
d->titleMouseReleaseEvent();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -798,43 +807,6 @@ void CFloatingDockContainer::showEvent(QShowEvent *event)
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
bool CFloatingDockContainer::eventFilter(QObject *watched, QEvent *e)
|
||||
{
|
||||
Q_UNUSED(watched);
|
||||
// I have not found a way to detect non client area key press events to
|
||||
// handle escape key presses. On Windows, if the escape key is pressed while
|
||||
// dragging around a widget, the widget position is reset to its start position
|
||||
// which in turn generates a QEvent::NonClientAreaMouseButtonRelease event
|
||||
// if the mouse is outside of the widget after the move to its initial position
|
||||
// or a QEvent::MouseButtonRelease event, if the mouse is inside of teh widget
|
||||
// after the position has been reset.
|
||||
// So we can install an event filter on the application to get these events
|
||||
// here to properly cancel dragging and hide the overlays.
|
||||
// If we are in DraggingFloatingWidget state, it means the widget
|
||||
// has been dragged already but if the position is the same like
|
||||
// the start position, then this is an indication that the escape
|
||||
// key has been pressed.
|
||||
if (e->type() == QEvent::MouseButtonRelease || e->type() == QEvent::NonClientAreaMouseButtonRelease)
|
||||
{
|
||||
ADS_PRINT("CFloatingDockContainer::eventFilter QEvent::MouseButtonRelease or"
|
||||
"QEvent::NonClientAreaMouseButtonRelease" << "d->DragggingState " << d->DraggingState);
|
||||
qApp->removeEventFilter(this);
|
||||
if (d->DragStartPos == pos())
|
||||
{
|
||||
d->handleEscapeKey();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#if (ADS_DEBUG_LEVEL > 0)
|
||||
qDebug() << QTime::currentTime() << "CFloatingDockContainer::eventFilter " << e->type();
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CFloatingDockContainer::startFloating(const QPoint &DragStartMousePos,
|
||||
const QSize &Size, eDragState DragState, QWidget *MouseEventHandler)
|
||||
|
||||
@@ -179,7 +179,6 @@ protected: // reimplements QWidget
|
||||
virtual void closeEvent(QCloseEvent *event) override;
|
||||
virtual void hideEvent(QHideEvent *event) override;
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
virtual bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
/**
|
||||
|
||||
2
src/qtadvanceddockingConfig.cmake
Normal file
2
src/qtadvanceddockingConfig.cmake
Normal file
@@ -0,0 +1,2 @@
|
||||
include(CMakeFindDependencyMacro)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/adsTargets.cmake")
|
||||
@@ -73,7 +73,7 @@ SOURCES += linux/FloatingWidgetTitleBar.cpp
|
||||
}
|
||||
|
||||
isEmpty(PREFIX){
|
||||
PREFIX=..\installed
|
||||
PREFIX=../installed
|
||||
warning("Install Prefix not set")
|
||||
}
|
||||
headers.path=$$PREFIX/include
|
||||
|
||||
Reference in New Issue
Block a user