15 #include <QApplication> 88 for (
auto ContainerWidget : Containers)
90 if (!ContainerWidget->isVisible())
95 QPoint MappedPos = ContainerWidget->mapFromGlobal(GlobalPos);
96 if (ContainerWidget->rect().contains(MappedPos))
98 if (!TopContainer || ContainerWidget->
isInFrontOf(TopContainer))
100 TopContainer = ContainerWidget;
108 auto DockDropArea = DockAreaOverlay->dropAreaUnderCursor();
109 auto ContainerDropArea = ContainerOverlay->dropAreaUnderCursor();
113 ContainerOverlay->hideOverlay();
114 DockAreaOverlay->hideOverlay();
123 ContainerOverlay->setAllowedAreas(
125 auto DockArea = TopContainer->
dockAreaAt(GlobalPos);
126 if (DockArea && DockArea->isVisible() && VisibleDockAreas >= 0 && DockArea !=
ContentSourceArea)
128 DockAreaOverlay->enableDropPreview(
true);
139 DockAreaOverlay->enableDropPreview(
false);
140 ContainerOverlay->enableDropPreview(
true);
146 ContainerOverlay->showOverlay(TopContainer);
150 DockAreaOverlay->hideOverlay();
154 if (VisibleDockAreas == 1)
156 ContainerOverlay->hideOverlay();
160 ContainerOverlay->showOverlay(TopContainer);
204 FloatingWidget->setGeometry(
_this->geometry());
205 FloatingWidget->show();
208 QApplication::processEvents();
209 int FrameHeight = FloatingWidget->frameGeometry().height() - FloatingWidget->geometry().height();
210 QRect FixedGeometry =
_this->geometry();
211 FixedGeometry.adjust(0, FrameHeight, 0, 0);
212 FloatingWidget->setGeometry(FixedGeometry);
224 setAttribute(Qt::WA_DeleteOnClose);
228 Qt::Window | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
232 setWindowFlags(Qt::Tool | Qt::FramelessWindowHint);
233 setAttribute(Qt::WA_NoSystemBackground);
234 setAttribute(Qt::WA_TranslucentBackground);
238 auto Flags = windowFlags();
239 Flags |= Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint;
240 setWindowFlags(Flags);
243 setWindowOpacity(0.6);
254 connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
259 qApp->installEventFilter(
this);
272 setWindowTitle(Content->windowTitle());
296 int BorderSize = (frameSize().width() - size().width()) / 2;
298 - QPoint(BorderSize, 0);
306 const QSize &Size,
eDragState DragState, QWidget *MouseEventHandler)
308 Q_UNUSED(MouseEventHandler)
321 ADS_PRINT(
"CFloatingDragPreview::finishDragging");
365 QPainter painter(
this);
375 QColor Color = palette().color(QPalette::Active, QPalette::Highlight);
376 QPen Pen = painter.pen();
377 Pen.setColor(Color.darker(120));
378 Pen.setStyle(Qt::SolidLine);
380 Pen.setCosmetic(
true);
382 Color = Color.lighter(130);
384 painter.setBrush(Color);
385 painter.drawRect(rect().adjusted(0, 0, -1, -1));
392 if (state != Qt::ApplicationActive)
394 disconnect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
405 if (!
d->
Canceled && event->type() == QEvent::KeyPress)
407 QKeyEvent* e =
static_cast<QKeyEvent*
>(event);
408 if (e->key() == Qt::Key_Escape)
410 watched->removeEventFilter(
this);
static bool testConfigFlag(eConfigFlag Flag)
void createFloatingWidget()
CDockContainerWidget * DropContainer
QPoint DragStartMousePosition
virtual void paintEvent(QPaintEvent *e) override
void onApplicationStateChanged(Qt::ApplicationState state)
CDockAreaWidget * ContentSourceArea
virtual void finishDragging() override
CDockManager * DockManager
Declaration of CFloatingDragPreview.
FloatingDragPreviewPrivate * d
CFloatingDragPreview * _this
const QList< CDockContainerWidget * > dockContainers() const
CFloatingDragPreview(QWidget *Content, QWidget *parent)
void updateDropOverlays(const QPoint &GlobalPos)
QPixmap ContentPreviewPixmap
void setHidden(bool Value)
If opaque undocking is disabled, then this flag configures if the drag preview is frameless or looks ...
const T & move(const T &v)
CDockOverlay * containerOverlay() const
FloatingDragPreviewPrivate(CFloatingDragPreview *_public)
virtual bool eventFilter(QObject *watched, QEvent *event) override
virtual void startFloating(const QPoint &DragStartMousePos, const QSize &Size, eDragState DragState, QWidget *MouseEventHandler) override
Declaration of CDockManager class.
If opaque undocking is disabled, this flag defines the behavior of the drag preview window...
CDockOverlay * dockAreaOverlay() const
virtual void moveFloating() override
If opaque undocking is disabled, the created drag preview window shows a copy of the content of the d...