1 Star 0 Fork 0

洛克希德/Qt-Advanced-Docking-System

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
FloatingDragPreview.h 2.98 KB
一键复制 编辑 原始数据 按行查看 历史
#ifndef FloatingDragPreviewH
#define FloatingDragPreviewH
//============================================================================
/// \file FloatingDragPreview.h
/// \author Uwe Kindler
/// \date 26.11.2019
/// \brief Declaration of CFloatingDragPreview
//============================================================================
//============================================================================
// INCLUDES
//============================================================================
#include <QWidget>
#include "FloatingDockContainer.h"
namespace ads
{
class CDockWidget;
class CDockAreaWidget;
struct FloatingDragPreviewPrivate;
/**
* A floating overlay is a temporary floating widget that is just used to
* indicate the floating widget movement.
* This widget is used as a placeholder for drag operations for non-opaque
* docking
*/
class CFloatingDragPreview : public QWidget, public IFloatingWidget
{
Q_OBJECT
private:
FloatingDragPreviewPrivate* d;
friend struct FloatingDragPreviewPrivate;
private Q_SLOTS:
/**
* Cancel non opaque undocking if application becomes inactive
*/
void onApplicationStateChanged(Qt::ApplicationState state);
protected:
/**
* Cares about painting the
*/
virtual void paintEvent(QPaintEvent *e) override;
/**
* The content is a DockArea or a DockWidget
*/
CFloatingDragPreview(QWidget* Content, QWidget* parent);
public:
using Super = QWidget;
/**
* Creates an instance for undocking the DockWidget in Content parameter
*/
CFloatingDragPreview(CDockWidget* Content);
/**
* Creates an instance for undocking the DockArea given in Content
* parameters
*/
CFloatingDragPreview(CDockAreaWidget* Content);
/**
* Delete private data
*/
~CFloatingDragPreview();
/**
* We filter the events of the assigned content widget to receive
* escape key presses for canceling the drag operation
*/
virtual bool eventFilter(QObject *watched, QEvent *event) override;
public: // implements IFloatingWidget -----------------------------------------
virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
eDragState DragState, QWidget* MouseEventHandler) override;
/**
* Moves the widget to a new position relative to the position given when
* startFloating() was called
*/
virtual void moveFloating() override;
/**
* Finishes dragging.
* Hides the dock overlays and executes the real undocking and docking
* of the assigned Content widget
*/
virtual void finishDragging() override;
/**
* Cleanup auto hide container if the dragged widget has one
*/
void cleanupAutoHideContainerWidget(DockWidgetArea ContainerDropArea);
Q_SIGNALS:
/**
* This signal is emitted, if dragging has been canceled by escape key
* or by active application switching via task manager
*/
void draggingCanceled();
};
} // namespace ads
//---------------------------------------------------------------------------
#endif // FloatingDragPreviewH
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/anold/Qt-Advanced-Docking-System.git
git@gitee.com:anold/Qt-Advanced-Docking-System.git
anold
Qt-Advanced-Docking-System
Qt-Advanced-Docking-System
master

搜索帮助