-
Notifications
You must be signed in to change notification settings - Fork 1
/
qdockablewindow.cpp
82 lines (58 loc) · 1.65 KB
/
qdockablewindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "qdockablewindow.h"
#include <QDebug>
#include <QGuiApplication>
#include "qdockgroup.h"
QDockableWindow::QDockableWindow(QWindow* parent)
: QQuickWindow(parent)
{
}
void QDockableWindow::setDockGroup(QDockGroup *group)
{
dockGroup = group;
}
void QDockableWindow::moveEvent(QMoveEvent *ev)
{
QQuickWindow::moveEvent(ev);
//qDebug() << "moveEvent";
}
bool QDockableWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
bool rslt = QQuickWindow::nativeEvent(eventType, message, result);
qDebug() << eventType;
return rslt;
}
void QDockableWindow::focusInEvent(QFocusEvent *ev)
{
QQuickWindow::focusInEvent(ev);
//qDebug() << "window" << id << "focused";
emit focusIn();
}
void QDockableWindow::mouseMoveEvent(QMouseEvent *ev)
{
//qDebug() << "window " << id << " mouse move event";
QQuickWindow::mouseMoveEvent(ev);
}
void QDockableWindow::test01()
{
QWindowList list = QGuiApplication::topLevelWindows();
qDebug() << "number of window = " << list.count();
}
void QDockableWindow::startDrag()
{
qDebug() << "QDockableWindow::startDrag";
DraggingWindow* dragWin = QDockGroup::draggingWindow();
dragWin->show();
dragWin->raise();
dragWin->setPosition(position());
}
QDockableWindow* QDockableWindow::topLevelAt(const QPoint &pos)
{
QWindowList list = QGuiApplication::topLevelWindows();
for (int i = list.size()-1; i >= 0; --i) {
QDockableWindow *w = qobject_cast<QDockableWindow*>(list[i]);
qDebug() << w->geometry() << pos;
if (w && w->isVisible() && w->geometry().contains(pos))
return w;
}
return 0;
}