Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qmdisubwindow.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||
10 | using namespace QMdi; | - | ||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||
12 | static const QStyle::SubControl SubControls[] = | - | ||||||||||||||||||||||||
13 | { | - | ||||||||||||||||||||||||
14 | QStyle::SC_TitleBarLabel, | - | ||||||||||||||||||||||||
15 | QStyle::SC_TitleBarSysMenu, | - | ||||||||||||||||||||||||
16 | QStyle::SC_TitleBarMinButton, | - | ||||||||||||||||||||||||
17 | QStyle::SC_TitleBarMaxButton, | - | ||||||||||||||||||||||||
18 | QStyle::SC_TitleBarShadeButton, | - | ||||||||||||||||||||||||
19 | QStyle::SC_TitleBarCloseButton, | - | ||||||||||||||||||||||||
20 | QStyle::SC_TitleBarNormalButton, | - | ||||||||||||||||||||||||
21 | QStyle::SC_TitleBarUnshadeButton, | - | ||||||||||||||||||||||||
22 | QStyle::SC_TitleBarContextHelpButton | - | ||||||||||||||||||||||||
23 | }; | - | ||||||||||||||||||||||||
24 | static const int NumSubControls = sizeof(SubControls) / sizeof(SubControls[0]); | - | ||||||||||||||||||||||||
25 | - | |||||||||||||||||||||||||
26 | static const Qt::WindowFlags CustomizeWindowFlags = | - | ||||||||||||||||||||||||
27 | Qt::FramelessWindowHint | - | ||||||||||||||||||||||||
28 | | Qt::CustomizeWindowHint | - | ||||||||||||||||||||||||
29 | | Qt::WindowTitleHint | - | ||||||||||||||||||||||||
30 | | Qt::WindowSystemMenuHint | - | ||||||||||||||||||||||||
31 | | Qt::WindowMinimizeButtonHint | - | ||||||||||||||||||||||||
32 | | Qt::WindowMaximizeButtonHint | - | ||||||||||||||||||||||||
33 | | Qt::WindowMinMaxButtonsHint; | - | ||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||
35 | - | |||||||||||||||||||||||||
36 | static const int BoundaryMargin = 5; | - | ||||||||||||||||||||||||
37 | - | |||||||||||||||||||||||||
38 | static inline int getMoveDeltaComponent(uint cflags, uint moveFlag, uint resizeFlag, | - | ||||||||||||||||||||||||
39 | int delta, int maxDelta, int minDelta) | - | ||||||||||||||||||||||||
40 | { | - | ||||||||||||||||||||||||
41 | if (cflags & moveFlag
| 0 | ||||||||||||||||||||||||
42 | if (delta > 0
| 0 | ||||||||||||||||||||||||
43 | return never executed: (cflags & resizeFlag) ? qMin(delta, maxDelta) : delta;return (cflags & resizeFlag) ? qMin(delta, maxDelta) : delta; never executed: return (cflags & resizeFlag) ? qMin(delta, maxDelta) : delta; | 0 | ||||||||||||||||||||||||
44 | return never executed: (cflags & resizeFlag) ? qMax(delta, minDelta) : delta;return (cflags & resizeFlag) ? qMax(delta, minDelta) : delta; never executed: return (cflags & resizeFlag) ? qMax(delta, minDelta) : delta; | 0 | ||||||||||||||||||||||||
45 | } | - | ||||||||||||||||||||||||
46 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
47 | } | - | ||||||||||||||||||||||||
48 | - | |||||||||||||||||||||||||
49 | static inline int getResizeDeltaComponent(uint cflags, uint resizeFlag, | - | ||||||||||||||||||||||||
50 | uint resizeReverseFlag, int delta) | - | ||||||||||||||||||||||||
51 | { | - | ||||||||||||||||||||||||
52 | if (cflags & resizeFlag
| 0 | ||||||||||||||||||||||||
53 | if (cflags & resizeReverseFlag
| 0 | ||||||||||||||||||||||||
54 | return never executed: -delta;return -delta; never executed: return -delta; | 0 | ||||||||||||||||||||||||
55 | return never executed: delta;return delta; never executed: return delta; | 0 | ||||||||||||||||||||||||
56 | } | - | ||||||||||||||||||||||||
57 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
58 | } | - | ||||||||||||||||||||||||
59 | - | |||||||||||||||||||||||||
60 | static inline bool isChildOfQMdiSubWindow(const QWidget *child) | - | ||||||||||||||||||||||||
61 | { | - | ||||||||||||||||||||||||
62 | ((!(child)) ? qt_assert("child",__FILE__,221) : qt_noop()); | - | ||||||||||||||||||||||||
63 | QWidget *parent = child->parentWidget(); | - | ||||||||||||||||||||||||
64 | while (parent
| 0 | ||||||||||||||||||||||||
65 | if (qobject_cast<QMdiSubWindow *>(parent)
| 0 | ||||||||||||||||||||||||
66 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
67 | parent = parent->parentWidget(); | - | ||||||||||||||||||||||||
68 | } never executed: end of block | 0 | ||||||||||||||||||||||||
69 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
70 | } | - | ||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||
72 | static inline bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child) | - | ||||||||||||||||||||||||
73 | { | - | ||||||||||||||||||||||||
74 | ((!(child)) ? qt_assert("child",__FILE__,233) : qt_noop()); | - | ||||||||||||||||||||||||
75 | if (QMdiArea *mdiArea = child->mdiArea()
| 0 | ||||||||||||||||||||||||
76 | if (mdiArea->viewMode() == QMdiArea::TabbedView
| 0 | ||||||||||||||||||||||||
77 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
78 | } never executed: end of block | 0 | ||||||||||||||||||||||||
79 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
80 | } | - | ||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||
82 | template<typename T> | - | ||||||||||||||||||||||||
83 | static inline ControlElement<T> *ptr(QWidget *widget) | - | ||||||||||||||||||||||||
84 | { | - | ||||||||||||||||||||||||
85 | if (widget
| 0 | ||||||||||||||||||||||||
86 | && strcmp(widget->metaObject()->className(), T::staticMetaObject.className()) == 0
| 0 | ||||||||||||||||||||||||
87 | return never executed: static_cast<ControlElement<T> *>(widget);return static_cast<ControlElement<T> *>(widget); never executed: return static_cast<ControlElement<T> *>(widget); | 0 | ||||||||||||||||||||||||
88 | } | - | ||||||||||||||||||||||||
89 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
90 | } | - | ||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||
92 | QString QMdiSubWindowPrivate::originalWindowTitle() | - | ||||||||||||||||||||||||
93 | { | - | ||||||||||||||||||||||||
94 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
95 | if (originalTitle.isNull()
| 0 | ||||||||||||||||||||||||
96 | originalTitle = q->window()->windowTitle(); | - | ||||||||||||||||||||||||
97 | if (originalTitle.isNull()
| 0 | ||||||||||||||||||||||||
98 | originalTitle = QLatin1String(""); never executed: originalTitle = QLatin1String(""); | 0 | ||||||||||||||||||||||||
99 | } never executed: end of block | 0 | ||||||||||||||||||||||||
100 | return never executed: originalTitle;return originalTitle; never executed: return originalTitle; | 0 | ||||||||||||||||||||||||
101 | } | - | ||||||||||||||||||||||||
102 | - | |||||||||||||||||||||||||
103 | void QMdiSubWindowPrivate::setNewWindowTitle() | - | ||||||||||||||||||||||||
104 | { | - | ||||||||||||||||||||||||
105 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
106 | QString childTitle = q->windowTitle(); | - | ||||||||||||||||||||||||
107 | if (childTitle.isEmpty()
| 0 | ||||||||||||||||||||||||
108 | return; never executed: return; | 0 | ||||||||||||||||||||||||
109 | QString original = originalWindowTitle(); | - | ||||||||||||||||||||||||
110 | if (!original.isEmpty()
| 0 | ||||||||||||||||||||||||
111 | if (!original.contains(QMdiSubWindow::tr("- [%1]").arg(childTitle))
| 0 | ||||||||||||||||||||||||
112 | q->window()->setWindowTitle(QMdiSubWindow::tr("%1 - [%2]").arg(original, childTitle)); never executed: q->window()->setWindowTitle(QMdiSubWindow::tr("%1 - [%2]").arg(original, childTitle)); | 0 | ||||||||||||||||||||||||
113 | - | |||||||||||||||||||||||||
114 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
115 | q->window()->setWindowTitle(childTitle); | - | ||||||||||||||||||||||||
116 | } never executed: end of block | 0 | ||||||||||||||||||||||||
117 | } | - | ||||||||||||||||||||||||
118 | - | |||||||||||||||||||||||||
119 | static inline bool isHoverControl(QStyle::SubControl control) | - | ||||||||||||||||||||||||
120 | { | - | ||||||||||||||||||||||||
121 | return never executed: control != QStyle::SC_None && control != QStyle::SC_TitleBarLabel;return control != QStyle::SC_None && control != QStyle::SC_TitleBarLabel; never executed: return control != QStyle::SC_None && control != QStyle::SC_TitleBarLabel; | 0 | ||||||||||||||||||||||||
122 | } | - | ||||||||||||||||||||||||
123 | static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOptionComplex &opt, | - | ||||||||||||||||||||||||
124 | QStyle::ComplexControl complexControl, QStyle::SubControl subControl) | - | ||||||||||||||||||||||||
125 | { | - | ||||||||||||||||||||||||
126 | ((!(helpEvent)) ? qt_assert("helpEvent",__FILE__,294) : qt_noop()); | - | ||||||||||||||||||||||||
127 | ((!(helpEvent->type() == QEvent::ToolTip)) ? qt_assert("helpEvent->type() == QEvent::ToolTip",__FILE__,295) : qt_noop()); | - | ||||||||||||||||||||||||
128 | ((!(widget)) ? qt_assert("widget",__FILE__,296) : qt_noop()); | - | ||||||||||||||||||||||||
129 | if (complexControl == QStyle::CC_MdiControls
| 0 | ||||||||||||||||||||||||
130 | if (subControl == QStyle::SC_MdiMinButton
| 0 | ||||||||||||||||||||||||
131 | subControl = QStyle::SC_TitleBarMinButton; never executed: subControl = QStyle::SC_TitleBarMinButton; | 0 | ||||||||||||||||||||||||
132 | else if (subControl == QStyle::SC_MdiCloseButton
| 0 | ||||||||||||||||||||||||
133 | subControl = QStyle::SC_TitleBarCloseButton; never executed: subControl = QStyle::SC_TitleBarCloseButton; | 0 | ||||||||||||||||||||||||
134 | else if (subControl == QStyle::SC_MdiNormalButton
| 0 | ||||||||||||||||||||||||
135 | subControl = QStyle::SC_TitleBarNormalButton; never executed: subControl = QStyle::SC_TitleBarNormalButton; | 0 | ||||||||||||||||||||||||
136 | else | - | ||||||||||||||||||||||||
137 | subControl = QStyle::SC_None; never executed: subControl = QStyle::SC_None; | 0 | ||||||||||||||||||||||||
138 | } | - | ||||||||||||||||||||||||
139 | - | |||||||||||||||||||||||||
140 | - | |||||||||||||||||||||||||
141 | if (subControl == QStyle::SC_None
| 0 | ||||||||||||||||||||||||
142 | return; never executed: return; | 0 | ||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||
144 | QString toolTip; | - | ||||||||||||||||||||||||
145 | - | |||||||||||||||||||||||||
146 | switch (subControl) { | - | ||||||||||||||||||||||||
147 | case never executed: QStyle::SC_TitleBarMinButton:case QStyle::SC_TitleBarMinButton: never executed: case QStyle::SC_TitleBarMinButton: | 0 | ||||||||||||||||||||||||
148 | toolTip = QMdiSubWindow::tr("Minimize"); | - | ||||||||||||||||||||||||
149 | break; never executed: break; | 0 | ||||||||||||||||||||||||
150 | case never executed: QStyle::SC_TitleBarMaxButton:case QStyle::SC_TitleBarMaxButton: never executed: case QStyle::SC_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||
151 | toolTip = QMdiSubWindow::tr("Maximize"); | - | ||||||||||||||||||||||||
152 | break; never executed: break; | 0 | ||||||||||||||||||||||||
153 | case never executed: QStyle::SC_TitleBarUnshadeButton:case QStyle::SC_TitleBarUnshadeButton: never executed: case QStyle::SC_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||
154 | toolTip = QMdiSubWindow::tr("Unshade"); | - | ||||||||||||||||||||||||
155 | break; never executed: break; | 0 | ||||||||||||||||||||||||
156 | case never executed: QStyle::SC_TitleBarShadeButton:case QStyle::SC_TitleBarShadeButton: never executed: case QStyle::SC_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||
157 | toolTip = QMdiSubWindow::tr("Shade"); | - | ||||||||||||||||||||||||
158 | break; never executed: break; | 0 | ||||||||||||||||||||||||
159 | case never executed: QStyle::SC_TitleBarNormalButton:case QStyle::SC_TitleBarNormalButton: never executed: case QStyle::SC_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||
160 | if (widget->isMaximized()
| 0 | ||||||||||||||||||||||||
161 | toolTip = QMdiSubWindow::tr("Restore Down"); never executed: toolTip = QMdiSubWindow::tr("Restore Down"); | 0 | ||||||||||||||||||||||||
162 | else | - | ||||||||||||||||||||||||
163 | toolTip = QMdiSubWindow::tr("Restore"); never executed: toolTip = QMdiSubWindow::tr("Restore"); | 0 | ||||||||||||||||||||||||
164 | break; never executed: break; | 0 | ||||||||||||||||||||||||
165 | case never executed: QStyle::SC_TitleBarCloseButton:case QStyle::SC_TitleBarCloseButton: never executed: case QStyle::SC_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||
166 | toolTip = QMdiSubWindow::tr("Close"); | - | ||||||||||||||||||||||||
167 | break; never executed: break; | 0 | ||||||||||||||||||||||||
168 | case never executed: QStyle::SC_TitleBarContextHelpButton:case QStyle::SC_TitleBarContextHelpButton: never executed: case QStyle::SC_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||
169 | toolTip = QMdiSubWindow::tr("Help"); | - | ||||||||||||||||||||||||
170 | break; never executed: break; | 0 | ||||||||||||||||||||||||
171 | case never executed: QStyle::SC_TitleBarSysMenu:case QStyle::SC_TitleBarSysMenu: never executed: case QStyle::SC_TitleBarSysMenu: | 0 | ||||||||||||||||||||||||
172 | toolTip = QMdiSubWindow::tr("Menu"); | - | ||||||||||||||||||||||||
173 | break; never executed: break; | 0 | ||||||||||||||||||||||||
174 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
175 | break; never executed: break; | 0 | ||||||||||||||||||||||||
176 | } | - | ||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||
178 | const QRect rect = widget->style()->subControlRect(complexControl, &opt, subControl, widget); | - | ||||||||||||||||||||||||
179 | QToolTip::showText(helpEvent->globalPos(), toolTip, widget, rect); | - | ||||||||||||||||||||||||
180 | } never executed: end of block | 0 | ||||||||||||||||||||||||
181 | - | |||||||||||||||||||||||||
182 | - | |||||||||||||||||||||||||
183 | namespace QMdi { | - | ||||||||||||||||||||||||
184 | - | |||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||
186 | - | |||||||||||||||||||||||||
187 | - | |||||||||||||||||||||||||
188 | class ControlLabel : public QWidget | - | ||||||||||||||||||||||||
189 | { | - | ||||||||||||||||||||||||
190 | public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } | - | ||||||||||||||||||||||||
191 | #pragma GCC diagnostic push | - | ||||||||||||||||||||||||
192 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||||||||||||||
193 | #pragma GCC diagnostic pop | - | ||||||||||||||||||||||||
194 | struct QPrivateSignal {}; | - | ||||||||||||||||||||||||
195 | public: | - | ||||||||||||||||||||||||
196 | ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = 0); | - | ||||||||||||||||||||||||
197 | - | |||||||||||||||||||||||||
198 | QSize sizeHint() const override; | - | ||||||||||||||||||||||||
199 | - | |||||||||||||||||||||||||
200 | public : | - | ||||||||||||||||||||||||
201 | void _q_clicked(); | - | ||||||||||||||||||||||||
202 | void _q_doubleClicked(); | - | ||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||
204 | protected: | - | ||||||||||||||||||||||||
205 | bool event(QEvent *event) override; | - | ||||||||||||||||||||||||
206 | void paintEvent(QPaintEvent *paintEvent) override; | - | ||||||||||||||||||||||||
207 | void mousePressEvent(QMouseEvent *mouseEvent) override; | - | ||||||||||||||||||||||||
208 | void mouseDoubleClickEvent(QMouseEvent *mouseEvent) override; | - | ||||||||||||||||||||||||
209 | void mouseReleaseEvent(QMouseEvent *mouseEvent) override; | - | ||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||
211 | private: | - | ||||||||||||||||||||||||
212 | QPixmap label; | - | ||||||||||||||||||||||||
213 | bool isPressed; | - | ||||||||||||||||||||||||
214 | void updateWindowIcon(); | - | ||||||||||||||||||||||||
215 | }; | - | ||||||||||||||||||||||||
216 | } | - | ||||||||||||||||||||||||
217 | - | |||||||||||||||||||||||||
218 | ControlLabel::ControlLabel(QMdiSubWindow *subWindow, QWidget *parent) | - | ||||||||||||||||||||||||
219 | : QWidget(parent), isPressed(false) | - | ||||||||||||||||||||||||
220 | { | - | ||||||||||||||||||||||||
221 | (void)subWindow;; | - | ||||||||||||||||||||||||
222 | setFocusPolicy(Qt::NoFocus); | - | ||||||||||||||||||||||||
223 | updateWindowIcon(); | - | ||||||||||||||||||||||||
224 | setFixedSize(label.size()); | - | ||||||||||||||||||||||||
225 | } never executed: end of block | 0 | ||||||||||||||||||||||||
226 | - | |||||||||||||||||||||||||
227 | - | |||||||||||||||||||||||||
228 | - | |||||||||||||||||||||||||
229 | - | |||||||||||||||||||||||||
230 | QSize ControlLabel::sizeHint() const | - | ||||||||||||||||||||||||
231 | { | - | ||||||||||||||||||||||||
232 | return never executed: label.size();return label.size(); never executed: return label.size(); | 0 | ||||||||||||||||||||||||
233 | } | - | ||||||||||||||||||||||||
234 | - | |||||||||||||||||||||||||
235 | - | |||||||||||||||||||||||||
236 | - | |||||||||||||||||||||||||
237 | - | |||||||||||||||||||||||||
238 | bool ControlLabel::event(QEvent *event) | - | ||||||||||||||||||||||||
239 | { | - | ||||||||||||||||||||||||
240 | if (event->type() == QEvent::WindowIconChange
| 0 | ||||||||||||||||||||||||
241 | updateWindowIcon(); never executed: updateWindowIcon(); | 0 | ||||||||||||||||||||||||
242 | - | |||||||||||||||||||||||||
243 | else if (event->type() == QEvent::ToolTip
| 0 | ||||||||||||||||||||||||
244 | QStyleOptionTitleBar options; | - | ||||||||||||||||||||||||
245 | options.initFrom(this); | - | ||||||||||||||||||||||||
246 | showToolTip(static_cast<QHelpEvent *>(event), this, options, | - | ||||||||||||||||||||||||
247 | QStyle::CC_TitleBar, QStyle::SC_TitleBarSysMenu); | - | ||||||||||||||||||||||||
248 | } never executed: end of block | 0 | ||||||||||||||||||||||||
249 | - | |||||||||||||||||||||||||
250 | return never executed: QWidget::event(event);return QWidget::event(event); never executed: return QWidget::event(event); | 0 | ||||||||||||||||||||||||
251 | } | - | ||||||||||||||||||||||||
252 | - | |||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||
254 | - | |||||||||||||||||||||||||
255 | - | |||||||||||||||||||||||||
256 | void ControlLabel::paintEvent(QPaintEvent * ) | - | ||||||||||||||||||||||||
257 | { | - | ||||||||||||||||||||||||
258 | QPainter painter(this); | - | ||||||||||||||||||||||||
259 | painter.drawPixmap(0, 0, label); | - | ||||||||||||||||||||||||
260 | } never executed: end of block | 0 | ||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||
262 | - | |||||||||||||||||||||||||
263 | - | |||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | void ControlLabel::mousePressEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
266 | { | - | ||||||||||||||||||||||||
267 | if (mouseEvent->button() != Qt::LeftButton
| 0 | ||||||||||||||||||||||||
268 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
269 | return; never executed: return; | 0 | ||||||||||||||||||||||||
270 | } | - | ||||||||||||||||||||||||
271 | isPressed = true; | - | ||||||||||||||||||||||||
272 | } never executed: end of block | 0 | ||||||||||||||||||||||||
273 | - | |||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||
277 | void ControlLabel::mouseDoubleClickEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
278 | { | - | ||||||||||||||||||||||||
279 | if (mouseEvent->button() != Qt::LeftButton
| 0 | ||||||||||||||||||||||||
280 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
281 | return; never executed: return; | 0 | ||||||||||||||||||||||||
282 | } | - | ||||||||||||||||||||||||
283 | isPressed = false; | - | ||||||||||||||||||||||||
284 | _q_doubleClicked(); | - | ||||||||||||||||||||||||
285 | } never executed: end of block | 0 | ||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||
287 | - | |||||||||||||||||||||||||
288 | - | |||||||||||||||||||||||||
289 | - | |||||||||||||||||||||||||
290 | void ControlLabel::mouseReleaseEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
291 | { | - | ||||||||||||||||||||||||
292 | if (mouseEvent->button() != Qt::LeftButton
| 0 | ||||||||||||||||||||||||
293 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
294 | return; never executed: return; | 0 | ||||||||||||||||||||||||
295 | } | - | ||||||||||||||||||||||||
296 | if (isPressed
| 0 | ||||||||||||||||||||||||
297 | isPressed = false; | - | ||||||||||||||||||||||||
298 | _q_clicked(); | - | ||||||||||||||||||||||||
299 | } never executed: end of block | 0 | ||||||||||||||||||||||||
300 | } never executed: end of block | 0 | ||||||||||||||||||||||||
301 | - | |||||||||||||||||||||||||
302 | - | |||||||||||||||||||||||||
303 | - | |||||||||||||||||||||||||
304 | - | |||||||||||||||||||||||||
305 | void ControlLabel::updateWindowIcon() | - | ||||||||||||||||||||||||
306 | { | - | ||||||||||||||||||||||||
307 | QIcon menuIcon = windowIcon(); | - | ||||||||||||||||||||||||
308 | if (menuIcon.isNull()
| 0 | ||||||||||||||||||||||||
309 | menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget()); never executed: menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget()); | 0 | ||||||||||||||||||||||||
310 | label = menuIcon.pixmap(16, 16); | - | ||||||||||||||||||||||||
311 | update(); | - | ||||||||||||||||||||||||
312 | } never executed: end of block | 0 | ||||||||||||||||||||||||
313 | - | |||||||||||||||||||||||||
314 | namespace QMdi { | - | ||||||||||||||||||||||||
315 | - | |||||||||||||||||||||||||
316 | - | |||||||||||||||||||||||||
317 | - | |||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||
319 | class ControllerWidget : public QWidget | - | ||||||||||||||||||||||||
320 | { | - | ||||||||||||||||||||||||
321 | public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } | - | ||||||||||||||||||||||||
322 | #pragma GCC diagnostic push | - | ||||||||||||||||||||||||
323 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||||||||||||||
324 | #pragma GCC diagnostic pop | - | ||||||||||||||||||||||||
325 | struct QPrivateSignal {}; | - | ||||||||||||||||||||||||
326 | public: | - | ||||||||||||||||||||||||
327 | ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent = 0); | - | ||||||||||||||||||||||||
328 | QSize sizeHint() const override; | - | ||||||||||||||||||||||||
329 | void setControlVisible(QMdiSubWindowPrivate::WindowStateAction action, bool visible); | - | ||||||||||||||||||||||||
330 | inline bool hasVisibleControls() const | - | ||||||||||||||||||||||||
331 | { | - | ||||||||||||||||||||||||
332 | return never executed: (visibleControls & QStyle::SC_MdiMinButton)return (visibleControls & QStyle::SC_MdiMinButton) || (visibleControls & QStyle::SC_MdiNormalButton) || (visibleControls & QStyle::SC_MdiCloseButton); never executed: return (visibleControls & QStyle::SC_MdiMinButton) || (visibleControls & QStyle::SC_MdiNormalButton) || (visibleControls & QStyle::SC_MdiCloseButton); | 0 | ||||||||||||||||||||||||
333 | || (visibleControls & QStyle::SC_MdiNormalButton) never executed: return (visibleControls & QStyle::SC_MdiMinButton) || (visibleControls & QStyle::SC_MdiNormalButton) || (visibleControls & QStyle::SC_MdiCloseButton); | 0 | ||||||||||||||||||||||||
334 | || (visibleControls & QStyle::SC_MdiCloseButton); never executed: return (visibleControls & QStyle::SC_MdiMinButton) || (visibleControls & QStyle::SC_MdiNormalButton) || (visibleControls & QStyle::SC_MdiCloseButton); | 0 | ||||||||||||||||||||||||
335 | } | - | ||||||||||||||||||||||||
336 | - | |||||||||||||||||||||||||
337 | public : | - | ||||||||||||||||||||||||
338 | void _q_minimize(); | - | ||||||||||||||||||||||||
339 | void _q_restore(); | - | ||||||||||||||||||||||||
340 | void _q_close(); | - | ||||||||||||||||||||||||
341 | - | |||||||||||||||||||||||||
342 | protected: | - | ||||||||||||||||||||||||
343 | void paintEvent(QPaintEvent *event) override; | - | ||||||||||||||||||||||||
344 | void mousePressEvent(QMouseEvent *event) override; | - | ||||||||||||||||||||||||
345 | void mouseReleaseEvent(QMouseEvent *event) override; | - | ||||||||||||||||||||||||
346 | void mouseMoveEvent(QMouseEvent *event) override; | - | ||||||||||||||||||||||||
347 | void leaveEvent(QEvent *event) override; | - | ||||||||||||||||||||||||
348 | bool event(QEvent *event) override; | - | ||||||||||||||||||||||||
349 | - | |||||||||||||||||||||||||
350 | private: | - | ||||||||||||||||||||||||
351 | QStyle::SubControl activeControl; | - | ||||||||||||||||||||||||
352 | QStyle::SubControl hoverControl; | - | ||||||||||||||||||||||||
353 | QStyle::SubControls visibleControls; | - | ||||||||||||||||||||||||
354 | void initStyleOption(QStyleOptionComplex *option) const; | - | ||||||||||||||||||||||||
355 | QMdiArea *mdiArea; | - | ||||||||||||||||||||||||
356 | inline QStyle::SubControl getSubControl(const QPoint &pos) const | - | ||||||||||||||||||||||||
357 | { | - | ||||||||||||||||||||||||
358 | QStyleOptionComplex opt; | - | ||||||||||||||||||||||||
359 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
360 | return never executed: style()->hitTestComplexControl(QStyle::CC_MdiControls, &opt, pos, mdiArea);return style()->hitTestComplexControl(QStyle::CC_MdiControls, &opt, pos, mdiArea); never executed: return style()->hitTestComplexControl(QStyle::CC_MdiControls, &opt, pos, mdiArea); | 0 | ||||||||||||||||||||||||
361 | } | - | ||||||||||||||||||||||||
362 | }; | - | ||||||||||||||||||||||||
363 | } | - | ||||||||||||||||||||||||
364 | - | |||||||||||||||||||||||||
365 | - | |||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||
367 | - | |||||||||||||||||||||||||
368 | ControllerWidget::ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent) | - | ||||||||||||||||||||||||
369 | : QWidget(parent), | - | ||||||||||||||||||||||||
370 | activeControl(QStyle::SC_None), | - | ||||||||||||||||||||||||
371 | hoverControl(QStyle::SC_None), | - | ||||||||||||||||||||||||
372 | visibleControls(QStyle::SC_None), | - | ||||||||||||||||||||||||
373 | mdiArea(0) | - | ||||||||||||||||||||||||
374 | { | - | ||||||||||||||||||||||||
375 | if (subWindow->parentWidget()
| 0 | ||||||||||||||||||||||||
376 | mdiArea = qobject_cast<QMdiArea *>(subWindow->parentWidget()->parentWidget()); never executed: mdiArea = qobject_cast<QMdiArea *>(subWindow->parentWidget()->parentWidget()); | 0 | ||||||||||||||||||||||||
377 | setFocusPolicy(Qt::NoFocus); | - | ||||||||||||||||||||||||
378 | setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); | - | ||||||||||||||||||||||||
379 | setMouseTracking(true); | - | ||||||||||||||||||||||||
380 | } never executed: end of block | 0 | ||||||||||||||||||||||||
381 | - | |||||||||||||||||||||||||
382 | - | |||||||||||||||||||||||||
383 | - | |||||||||||||||||||||||||
384 | - | |||||||||||||||||||||||||
385 | QSize ControllerWidget::sizeHint() const | - | ||||||||||||||||||||||||
386 | { | - | ||||||||||||||||||||||||
387 | ensurePolished(); | - | ||||||||||||||||||||||||
388 | QStyleOptionComplex opt; | - | ||||||||||||||||||||||||
389 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
390 | QSize size(48, 16); | - | ||||||||||||||||||||||||
391 | return never executed: style()->sizeFromContents(QStyle::CT_MdiControls, &opt, size, mdiArea);return style()->sizeFromContents(QStyle::CT_MdiControls, &opt, size, mdiArea); never executed: return style()->sizeFromContents(QStyle::CT_MdiControls, &opt, size, mdiArea); | 0 | ||||||||||||||||||||||||
392 | } | - | ||||||||||||||||||||||||
393 | - | |||||||||||||||||||||||||
394 | void ControllerWidget::setControlVisible(QMdiSubWindowPrivate::WindowStateAction action, bool visible) | - | ||||||||||||||||||||||||
395 | { | - | ||||||||||||||||||||||||
396 | QStyle::SubControl subControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
397 | - | |||||||||||||||||||||||||
398 | - | |||||||||||||||||||||||||
399 | if (action == QMdiSubWindowPrivate::MaximizeAction
| 0 | ||||||||||||||||||||||||
400 | subControl = QStyle::SC_MdiNormalButton; never executed: subControl = QStyle::SC_MdiNormalButton; | 0 | ||||||||||||||||||||||||
401 | else if (action == QMdiSubWindowPrivate::CloseAction
| 0 | ||||||||||||||||||||||||
402 | subControl = QStyle::SC_MdiCloseButton; never executed: subControl = QStyle::SC_MdiCloseButton; | 0 | ||||||||||||||||||||||||
403 | else if (action == QMdiSubWindowPrivate::MinimizeAction
| 0 | ||||||||||||||||||||||||
404 | subControl = QStyle::SC_MdiMinButton; never executed: subControl = QStyle::SC_MdiMinButton; | 0 | ||||||||||||||||||||||||
405 | - | |||||||||||||||||||||||||
406 | if (subControl == QStyle::SC_None
| 0 | ||||||||||||||||||||||||
407 | return; never executed: return; | 0 | ||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||
409 | visibleControls.setFlag(subControl, visible && !(visibleControls & subControl)); | - | ||||||||||||||||||||||||
410 | } never executed: end of block | 0 | ||||||||||||||||||||||||
411 | - | |||||||||||||||||||||||||
412 | - | |||||||||||||||||||||||||
413 | - | |||||||||||||||||||||||||
414 | - | |||||||||||||||||||||||||
415 | void ControllerWidget::paintEvent(QPaintEvent * ) | - | ||||||||||||||||||||||||
416 | { | - | ||||||||||||||||||||||||
417 | QStyleOptionComplex opt; | - | ||||||||||||||||||||||||
418 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
419 | if (activeControl == hoverControl
| 0 | ||||||||||||||||||||||||
420 | opt.activeSubControls = activeControl; | - | ||||||||||||||||||||||||
421 | opt.state |= QStyle::State_Sunken; | - | ||||||||||||||||||||||||
422 | } never executed: else if (hoverControl != QStyle::SC_Noneend of block
| 0 | ||||||||||||||||||||||||
423 | opt.activeSubControls = hoverControl; | - | ||||||||||||||||||||||||
424 | opt.state |= QStyle::State_MouseOver; | - | ||||||||||||||||||||||||
425 | } never executed: end of block | 0 | ||||||||||||||||||||||||
426 | QPainter painter(this); | - | ||||||||||||||||||||||||
427 | style()->drawComplexControl(QStyle::CC_MdiControls, &opt, &painter, mdiArea); | - | ||||||||||||||||||||||||
428 | } never executed: end of block | 0 | ||||||||||||||||||||||||
429 | - | |||||||||||||||||||||||||
430 | - | |||||||||||||||||||||||||
431 | - | |||||||||||||||||||||||||
432 | - | |||||||||||||||||||||||||
433 | void ControllerWidget::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
434 | { | - | ||||||||||||||||||||||||
435 | if (event->button() != Qt::LeftButton
| 0 | ||||||||||||||||||||||||
436 | event->ignore(); | - | ||||||||||||||||||||||||
437 | return; never executed: return; | 0 | ||||||||||||||||||||||||
438 | } | - | ||||||||||||||||||||||||
439 | activeControl = getSubControl(event->pos()); | - | ||||||||||||||||||||||||
440 | update(); | - | ||||||||||||||||||||||||
441 | } never executed: end of block | 0 | ||||||||||||||||||||||||
442 | - | |||||||||||||||||||||||||
443 | - | |||||||||||||||||||||||||
444 | - | |||||||||||||||||||||||||
445 | - | |||||||||||||||||||||||||
446 | void ControllerWidget::mouseReleaseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
447 | { | - | ||||||||||||||||||||||||
448 | if (event->button() != Qt::LeftButton
| 0 | ||||||||||||||||||||||||
449 | event->ignore(); | - | ||||||||||||||||||||||||
450 | return; never executed: return; | 0 | ||||||||||||||||||||||||
451 | } | - | ||||||||||||||||||||||||
452 | - | |||||||||||||||||||||||||
453 | QStyle::SubControl under_mouse = getSubControl(event->pos()); | - | ||||||||||||||||||||||||
454 | if (under_mouse == activeControl
| 0 | ||||||||||||||||||||||||
455 | switch (activeControl) { | - | ||||||||||||||||||||||||
456 | case never executed: QStyle::SC_MdiCloseButton:case QStyle::SC_MdiCloseButton: never executed: case QStyle::SC_MdiCloseButton: | 0 | ||||||||||||||||||||||||
457 | _q_close(); | - | ||||||||||||||||||||||||
458 | break; never executed: break; | 0 | ||||||||||||||||||||||||
459 | case never executed: QStyle::SC_MdiNormalButton:case QStyle::SC_MdiNormalButton: never executed: case QStyle::SC_MdiNormalButton: | 0 | ||||||||||||||||||||||||
460 | _q_restore(); | - | ||||||||||||||||||||||||
461 | break; never executed: break; | 0 | ||||||||||||||||||||||||
462 | case never executed: QStyle::SC_MdiMinButton:case QStyle::SC_MdiMinButton: never executed: case QStyle::SC_MdiMinButton: | 0 | ||||||||||||||||||||||||
463 | _q_minimize(); | - | ||||||||||||||||||||||||
464 | break; never executed: break; | 0 | ||||||||||||||||||||||||
465 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
466 | break; never executed: break; | 0 | ||||||||||||||||||||||||
467 | } | - | ||||||||||||||||||||||||
468 | } | - | ||||||||||||||||||||||||
469 | - | |||||||||||||||||||||||||
470 | activeControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
471 | update(); | - | ||||||||||||||||||||||||
472 | } never executed: end of block | 0 | ||||||||||||||||||||||||
473 | - | |||||||||||||||||||||||||
474 | - | |||||||||||||||||||||||||
475 | - | |||||||||||||||||||||||||
476 | - | |||||||||||||||||||||||||
477 | void ControllerWidget::mouseMoveEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
478 | { | - | ||||||||||||||||||||||||
479 | QStyle::SubControl under_mouse = getSubControl(event->pos()); | - | ||||||||||||||||||||||||
480 | - | |||||||||||||||||||||||||
481 | if (hoverControl != under_mouse
| 0 | ||||||||||||||||||||||||
482 | hoverControl = under_mouse; | - | ||||||||||||||||||||||||
483 | update(); | - | ||||||||||||||||||||||||
484 | } never executed: end of block | 0 | ||||||||||||||||||||||||
485 | } never executed: end of block | 0 | ||||||||||||||||||||||||
486 | - | |||||||||||||||||||||||||
487 | - | |||||||||||||||||||||||||
488 | - | |||||||||||||||||||||||||
489 | - | |||||||||||||||||||||||||
490 | void ControllerWidget::leaveEvent(QEvent * ) | - | ||||||||||||||||||||||||
491 | { | - | ||||||||||||||||||||||||
492 | hoverControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
493 | update(); | - | ||||||||||||||||||||||||
494 | } never executed: end of block | 0 | ||||||||||||||||||||||||
495 | - | |||||||||||||||||||||||||
496 | - | |||||||||||||||||||||||||
497 | - | |||||||||||||||||||||||||
498 | - | |||||||||||||||||||||||||
499 | bool ControllerWidget::event(QEvent *event) | - | ||||||||||||||||||||||||
500 | { | - | ||||||||||||||||||||||||
501 | - | |||||||||||||||||||||||||
502 | if (event->type() == QEvent::ToolTip
| 0 | ||||||||||||||||||||||||
503 | QStyleOptionComplex opt; | - | ||||||||||||||||||||||||
504 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
505 | QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); | - | ||||||||||||||||||||||||
506 | showToolTip(helpEvent, this, opt, QStyle::CC_MdiControls, getSubControl(helpEvent->pos())); | - | ||||||||||||||||||||||||
507 | } never executed: end of block | 0 | ||||||||||||||||||||||||
508 | - | |||||||||||||||||||||||||
509 | return never executed: QWidget::event(event);return QWidget::event(event); never executed: return QWidget::event(event); | 0 | ||||||||||||||||||||||||
510 | } | - | ||||||||||||||||||||||||
511 | - | |||||||||||||||||||||||||
512 | - | |||||||||||||||||||||||||
513 | - | |||||||||||||||||||||||||
514 | - | |||||||||||||||||||||||||
515 | void ControllerWidget::initStyleOption(QStyleOptionComplex *option) const | - | ||||||||||||||||||||||||
516 | { | - | ||||||||||||||||||||||||
517 | option->initFrom(this); | - | ||||||||||||||||||||||||
518 | option->subControls = visibleControls; | - | ||||||||||||||||||||||||
519 | option->activeSubControls = QStyle::SC_None; | - | ||||||||||||||||||||||||
520 | } never executed: end of block | 0 | ||||||||||||||||||||||||
521 | - | |||||||||||||||||||||||||
522 | - | |||||||||||||||||||||||||
523 | - | |||||||||||||||||||||||||
524 | - | |||||||||||||||||||||||||
525 | ControlContainer::ControlContainer(QMdiSubWindow *mdiChild) | - | ||||||||||||||||||||||||
526 | : QObject(mdiChild), | - | ||||||||||||||||||||||||
527 | previousLeft(0), | - | ||||||||||||||||||||||||
528 | previousRight(0), | - | ||||||||||||||||||||||||
529 | - | |||||||||||||||||||||||||
530 | m_menuBar(0), | - | ||||||||||||||||||||||||
531 | - | |||||||||||||||||||||||||
532 | mdiChild(mdiChild) | - | ||||||||||||||||||||||||
533 | { | - | ||||||||||||||||||||||||
534 | ((!(mdiChild)) ? qt_assert("mdiChild",__FILE__,703) : qt_noop()); | - | ||||||||||||||||||||||||
535 | - | |||||||||||||||||||||||||
536 | m_controllerWidget = new ControlElement<ControllerWidget>(mdiChild); | - | ||||||||||||||||||||||||
537 | connect(m_controllerWidget, qFlagLocation("2""_q_close()" "\0" __FILE__ ":" "706"), mdiChild, qFlagLocation("1""close()" "\0" __FILE__ ":" "706")); | - | ||||||||||||||||||||||||
538 | connect(m_controllerWidget, qFlagLocation("2""_q_restore()" "\0" __FILE__ ":" "707"), mdiChild, qFlagLocation("1""showNormal()" "\0" __FILE__ ":" "707")); | - | ||||||||||||||||||||||||
539 | connect(m_controllerWidget, qFlagLocation("2""_q_minimize()" "\0" __FILE__ ":" "708"), mdiChild, qFlagLocation("1""showMinimized()" "\0" __FILE__ ":" "708")); | - | ||||||||||||||||||||||||
540 | - | |||||||||||||||||||||||||
541 | m_menuLabel = new ControlElement<ControlLabel>(mdiChild); | - | ||||||||||||||||||||||||
542 | m_menuLabel->setWindowIcon(mdiChild->windowIcon()); | - | ||||||||||||||||||||||||
543 | - | |||||||||||||||||||||||||
544 | connect(m_menuLabel, qFlagLocation("2""_q_clicked()" "\0" __FILE__ ":" "713"), mdiChild, qFlagLocation("1""showSystemMenu()" "\0" __FILE__ ":" "713")); | - | ||||||||||||||||||||||||
545 | - | |||||||||||||||||||||||||
546 | connect(m_menuLabel, qFlagLocation("2""_q_doubleClicked()" "\0" __FILE__ ":" "715"), mdiChild, qFlagLocation("1""close()" "\0" __FILE__ ":" "715")); | - | ||||||||||||||||||||||||
547 | } never executed: end of block | 0 | ||||||||||||||||||||||||
548 | - | |||||||||||||||||||||||||
549 | ControlContainer::~ControlContainer() | - | ||||||||||||||||||||||||
550 | { | - | ||||||||||||||||||||||||
551 | - | |||||||||||||||||||||||||
552 | removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
553 | - | |||||||||||||||||||||||||
554 | delete m_menuLabel; | - | ||||||||||||||||||||||||
555 | m_menuLabel = 0; | - | ||||||||||||||||||||||||
556 | delete m_controllerWidget; | - | ||||||||||||||||||||||||
557 | m_controllerWidget = 0; | - | ||||||||||||||||||||||||
558 | } never executed: end of block | 0 | ||||||||||||||||||||||||
559 | - | |||||||||||||||||||||||||
560 | - | |||||||||||||||||||||||||
561 | - | |||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||
563 | - | |||||||||||||||||||||||||
564 | QMenuBar *QMdiSubWindowPrivate::menuBar() const | - | ||||||||||||||||||||||||
565 | { | - | ||||||||||||||||||||||||
566 | - | |||||||||||||||||||||||||
567 | - | |||||||||||||||||||||||||
568 | - | |||||||||||||||||||||||||
569 | const QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
570 | if (!q->isMaximized()
| 0 | ||||||||||||||||||||||||
571 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
572 | - | |||||||||||||||||||||||||
573 | if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window())
| 0 | ||||||||||||||||||||||||
574 | return never executed: mainWindow->menuBar();return mainWindow->menuBar(); never executed: return mainWindow->menuBar(); | 0 | ||||||||||||||||||||||||
575 | - | |||||||||||||||||||||||||
576 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
577 | - | |||||||||||||||||||||||||
578 | } | - | ||||||||||||||||||||||||
579 | - | |||||||||||||||||||||||||
580 | - | |||||||||||||||||||||||||
581 | - | |||||||||||||||||||||||||
582 | - | |||||||||||||||||||||||||
583 | void ControlContainer::showButtonsInMenuBar(QMenuBar *menuBar) | - | ||||||||||||||||||||||||
584 | { | - | ||||||||||||||||||||||||
585 | if (!menuBar
| 0 | ||||||||||||||||||||||||
586 | return; never executed: return; | 0 | ||||||||||||||||||||||||
587 | m_menuBar = menuBar; | - | ||||||||||||||||||||||||
588 | - | |||||||||||||||||||||||||
589 | if (m_menuLabel
| 0 | ||||||||||||||||||||||||
590 | QWidget *currentLeft = menuBar->cornerWidget(Qt::TopLeftCorner); | - | ||||||||||||||||||||||||
591 | if (currentLeft
| 0 | ||||||||||||||||||||||||
592 | currentLeft->hide(); never executed: currentLeft->hide(); | 0 | ||||||||||||||||||||||||
593 | if (currentLeft != m_menuLabel
| 0 | ||||||||||||||||||||||||
594 | menuBar->setCornerWidget(m_menuLabel, Qt::TopLeftCorner); | - | ||||||||||||||||||||||||
595 | previousLeft = currentLeft; | - | ||||||||||||||||||||||||
596 | } never executed: end of block | 0 | ||||||||||||||||||||||||
597 | m_menuLabel->show(); | - | ||||||||||||||||||||||||
598 | } never executed: end of block | 0 | ||||||||||||||||||||||||
599 | ControllerWidget *controllerWidget = qobject_cast<ControllerWidget *>(m_controllerWidget); | - | ||||||||||||||||||||||||
600 | if (controllerWidget
| 0 | ||||||||||||||||||||||||
601 | QWidget *currentRight = menuBar->cornerWidget(Qt::TopRightCorner); | - | ||||||||||||||||||||||||
602 | if (currentRight
| 0 | ||||||||||||||||||||||||
603 | currentRight->hide(); never executed: currentRight->hide(); | 0 | ||||||||||||||||||||||||
604 | if (currentRight != m_controllerWidget
| 0 | ||||||||||||||||||||||||
605 | menuBar->setCornerWidget(m_controllerWidget, Qt::TopRightCorner); | - | ||||||||||||||||||||||||
606 | previousRight = currentRight; | - | ||||||||||||||||||||||||
607 | } never executed: end of block | 0 | ||||||||||||||||||||||||
608 | m_controllerWidget->show(); | - | ||||||||||||||||||||||||
609 | } never executed: end of block | 0 | ||||||||||||||||||||||||
610 | mdiChild->d_func()->setNewWindowTitle(); | - | ||||||||||||||||||||||||
611 | } never executed: end of block | 0 | ||||||||||||||||||||||||
612 | - | |||||||||||||||||||||||||
613 | - | |||||||||||||||||||||||||
614 | - | |||||||||||||||||||||||||
615 | - | |||||||||||||||||||||||||
616 | void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar) | - | ||||||||||||||||||||||||
617 | { | - | ||||||||||||||||||||||||
618 | if (menuBar
| 0 | ||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||
620 | previousRight = 0; | - | ||||||||||||||||||||||||
621 | previousLeft = 0; | - | ||||||||||||||||||||||||
622 | m_menuBar = menuBar; | - | ||||||||||||||||||||||||
623 | } never executed: end of block | 0 | ||||||||||||||||||||||||
624 | - | |||||||||||||||||||||||||
625 | if (!m_menuBar
| 0 | ||||||||||||||||||||||||
626 | return; never executed: return; | 0 | ||||||||||||||||||||||||
627 | - | |||||||||||||||||||||||||
628 | QMdiSubWindow *child = 0; | - | ||||||||||||||||||||||||
629 | if (m_controllerWidget
| 0 | ||||||||||||||||||||||||
630 | QWidget *currentRight = m_menuBar->cornerWidget(Qt::TopRightCorner); | - | ||||||||||||||||||||||||
631 | if (currentRight == m_controllerWidget
| 0 | ||||||||||||||||||||||||
632 | if (ControlElement<ControllerWidget> *ce = ptr<ControllerWidget>(previousRight)
| 0 | ||||||||||||||||||||||||
633 | if (!ce->mdiChild
| 0 | ||||||||||||||||||||||||
634 | previousRight = 0; never executed: previousRight = 0; | 0 | ||||||||||||||||||||||||
635 | else | - | ||||||||||||||||||||||||
636 | child = ce->mdiChild; never executed: child = ce->mdiChild; | 0 | ||||||||||||||||||||||||
637 | } | - | ||||||||||||||||||||||||
638 | m_menuBar->setCornerWidget(previousRight, Qt::TopRightCorner); | - | ||||||||||||||||||||||||
639 | if (previousRight
| 0 | ||||||||||||||||||||||||
640 | previousRight->show(); | - | ||||||||||||||||||||||||
641 | previousRight = 0; | - | ||||||||||||||||||||||||
642 | } never executed: end of block | 0 | ||||||||||||||||||||||||
643 | } never executed: end of block | 0 | ||||||||||||||||||||||||
644 | m_controllerWidget->hide(); | - | ||||||||||||||||||||||||
645 | m_controllerWidget->setParent(0); | - | ||||||||||||||||||||||||
646 | } never executed: end of block | 0 | ||||||||||||||||||||||||
647 | if (m_menuLabel
| 0 | ||||||||||||||||||||||||
648 | QWidget *currentLeft = m_menuBar->cornerWidget(Qt::TopLeftCorner); | - | ||||||||||||||||||||||||
649 | if (currentLeft == m_menuLabel
| 0 | ||||||||||||||||||||||||
650 | if (ControlElement<ControlLabel> *ce = ptr<ControlLabel>(previousLeft)
| 0 | ||||||||||||||||||||||||
651 | if (!ce->mdiChild
| 0 | ||||||||||||||||||||||||
652 | previousLeft = 0; never executed: previousLeft = 0; | 0 | ||||||||||||||||||||||||
653 | else if (!child
| 0 | ||||||||||||||||||||||||
654 | child = mdiChild; never executed: child = mdiChild; | 0 | ||||||||||||||||||||||||
655 | } never executed: end of block | 0 | ||||||||||||||||||||||||
656 | m_menuBar->setCornerWidget(previousLeft, Qt::TopLeftCorner); | - | ||||||||||||||||||||||||
657 | if (previousLeft
| 0 | ||||||||||||||||||||||||
658 | previousLeft->show(); | - | ||||||||||||||||||||||||
659 | previousLeft = 0; | - | ||||||||||||||||||||||||
660 | } never executed: end of block | 0 | ||||||||||||||||||||||||
661 | } never executed: end of block | 0 | ||||||||||||||||||||||||
662 | m_menuLabel->hide(); | - | ||||||||||||||||||||||||
663 | m_menuLabel->setParent(0); | - | ||||||||||||||||||||||||
664 | } never executed: end of block | 0 | ||||||||||||||||||||||||
665 | m_menuBar->update(); | - | ||||||||||||||||||||||||
666 | if (child
| 0 | ||||||||||||||||||||||||
667 | child->d_func()->setNewWindowTitle(); never executed: child->d_func()->setNewWindowTitle(); | 0 | ||||||||||||||||||||||||
668 | else if (mdiChild
| 0 | ||||||||||||||||||||||||
669 | mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle()); never executed: mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle()); | 0 | ||||||||||||||||||||||||
670 | } never executed: end of block | 0 | ||||||||||||||||||||||||
671 | - | |||||||||||||||||||||||||
672 | - | |||||||||||||||||||||||||
673 | - | |||||||||||||||||||||||||
674 | void ControlContainer::updateWindowIcon(const QIcon &windowIcon) | - | ||||||||||||||||||||||||
675 | { | - | ||||||||||||||||||||||||
676 | if (m_menuLabel
| 0 | ||||||||||||||||||||||||
677 | m_menuLabel->setWindowIcon(windowIcon); never executed: m_menuLabel->setWindowIcon(windowIcon); | 0 | ||||||||||||||||||||||||
678 | } never executed: end of block | 0 | ||||||||||||||||||||||||
679 | - | |||||||||||||||||||||||||
680 | - | |||||||||||||||||||||||||
681 | - | |||||||||||||||||||||||||
682 | - | |||||||||||||||||||||||||
683 | QMdiSubWindowPrivate::QMdiSubWindowPrivate() | - | ||||||||||||||||||||||||
684 | : baseWidget(0), | - | ||||||||||||||||||||||||
685 | restoreFocusWidget(0), | - | ||||||||||||||||||||||||
686 | controlContainer(0), | - | ||||||||||||||||||||||||
687 | - | |||||||||||||||||||||||||
688 | sizeGrip(0), | - | ||||||||||||||||||||||||
689 | - | |||||||||||||||||||||||||
690 | - | |||||||||||||||||||||||||
691 | rubberBand(0), | - | ||||||||||||||||||||||||
692 | - | |||||||||||||||||||||||||
693 | userMinimumSize(0,0), | - | ||||||||||||||||||||||||
694 | resizeEnabled(true), | - | ||||||||||||||||||||||||
695 | moveEnabled(true), | - | ||||||||||||||||||||||||
696 | isInInteractiveMode(false), | - | ||||||||||||||||||||||||
697 | - | |||||||||||||||||||||||||
698 | isInRubberBandMode(false), | - | ||||||||||||||||||||||||
699 | - | |||||||||||||||||||||||||
700 | isShadeMode(false), | - | ||||||||||||||||||||||||
701 | ignoreWindowTitleChange(false), | - | ||||||||||||||||||||||||
702 | ignoreNextActivationEvent(false), | - | ||||||||||||||||||||||||
703 | activationEnabled(true), | - | ||||||||||||||||||||||||
704 | isShadeRequestFromMinimizeMode(false), | - | ||||||||||||||||||||||||
705 | isMaximizeMode(false), | - | ||||||||||||||||||||||||
706 | isWidgetHiddenByUs(false), | - | ||||||||||||||||||||||||
707 | isActive(false), | - | ||||||||||||||||||||||||
708 | isExplicitlyDeactivated(false), | - | ||||||||||||||||||||||||
709 | keyboardSingleStep(5), | - | ||||||||||||||||||||||||
710 | keyboardPageStep(20), | - | ||||||||||||||||||||||||
711 | resizeTimerId(-1), | - | ||||||||||||||||||||||||
712 | currentOperation(None), | - | ||||||||||||||||||||||||
713 | hoveredSubControl(QStyle::SC_None), | - | ||||||||||||||||||||||||
714 | activeSubControl(QStyle::SC_None), | - | ||||||||||||||||||||||||
715 | focusInReason(Qt::ActiveWindowFocusReason) | - | ||||||||||||||||||||||||
716 | { | - | ||||||||||||||||||||||||
717 | initOperationMap(); | - | ||||||||||||||||||||||||
718 | } never executed: end of block | 0 | ||||||||||||||||||||||||
719 | - | |||||||||||||||||||||||||
720 | - | |||||||||||||||||||||||||
721 | - | |||||||||||||||||||||||||
722 | - | |||||||||||||||||||||||||
723 | void QMdiSubWindowPrivate::_q_updateStaysOnTopHint() | - | ||||||||||||||||||||||||
724 | { | - | ||||||||||||||||||||||||
725 | - | |||||||||||||||||||||||||
726 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
727 | if (QAction *senderAction = qobject_cast<QAction *>(q->sender())
| 0 | ||||||||||||||||||||||||
728 | if (senderAction->isChecked()
| 0 | ||||||||||||||||||||||||
729 | q->setWindowFlags(q->windowFlags() | Qt::WindowStaysOnTopHint); | - | ||||||||||||||||||||||||
730 | q->raise(); | - | ||||||||||||||||||||||||
731 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
732 | q->setWindowFlags(q->windowFlags() & ~Qt::WindowStaysOnTopHint); | - | ||||||||||||||||||||||||
733 | q->lower(); | - | ||||||||||||||||||||||||
734 | } never executed: end of block | 0 | ||||||||||||||||||||||||
735 | } | - | ||||||||||||||||||||||||
736 | - | |||||||||||||||||||||||||
737 | } never executed: end of block | 0 | ||||||||||||||||||||||||
738 | - | |||||||||||||||||||||||||
739 | - | |||||||||||||||||||||||||
740 | - | |||||||||||||||||||||||||
741 | - | |||||||||||||||||||||||||
742 | void QMdiSubWindowPrivate::_q_enterInteractiveMode() | - | ||||||||||||||||||||||||
743 | { | - | ||||||||||||||||||||||||
744 | - | |||||||||||||||||||||||||
745 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
746 | QAction *action = qobject_cast<QAction *>(q->sender()); | - | ||||||||||||||||||||||||
747 | if (!action
| 0 | ||||||||||||||||||||||||
748 | return; never executed: return; | 0 | ||||||||||||||||||||||||
749 | - | |||||||||||||||||||||||||
750 | QPoint pressPos; | - | ||||||||||||||||||||||||
751 | if (actions[MoveAction]
| 0 | ||||||||||||||||||||||||
752 | currentOperation = Move; | - | ||||||||||||||||||||||||
753 | pressPos = QPoint(q->width() / 2, titleBarHeight() - 1); | - | ||||||||||||||||||||||||
754 | } never executed: else if (actions[ResizeAction]end of block
| 0 | ||||||||||||||||||||||||
755 | currentOperation = q->isLeftToRight()
| 0 | ||||||||||||||||||||||||
756 | int offset = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q) / 2; | - | ||||||||||||||||||||||||
757 | int x = q->isLeftToRight()
| 0 | ||||||||||||||||||||||||
758 | pressPos = QPoint(x, q->height() - offset); | - | ||||||||||||||||||||||||
759 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
760 | return; never executed: return; | 0 | ||||||||||||||||||||||||
761 | } | - | ||||||||||||||||||||||||
762 | - | |||||||||||||||||||||||||
763 | updateCursor(); | - | ||||||||||||||||||||||||
764 | - | |||||||||||||||||||||||||
765 | q->cursor().setPos(q->mapToGlobal(pressPos)); | - | ||||||||||||||||||||||||
766 | - | |||||||||||||||||||||||||
767 | mousePressPosition = q->mapToParent(pressPos); | - | ||||||||||||||||||||||||
768 | oldGeometry = q->geometry(); | - | ||||||||||||||||||||||||
769 | isInInteractiveMode = true; | - | ||||||||||||||||||||||||
770 | q->setFocus(); | - | ||||||||||||||||||||||||
771 | - | |||||||||||||||||||||||||
772 | if ((q->testOption(QMdiSubWindow::RubberBandResize)
| 0 | ||||||||||||||||||||||||
773 | && (currentOperation == BottomRightResize
| 0 | ||||||||||||||||||||||||
774 | || (q->testOption(QMdiSubWindow::RubberBandMove)
| 0 | ||||||||||||||||||||||||
775 | enterRubberBandMode(); | - | ||||||||||||||||||||||||
776 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
777 | - | |||||||||||||||||||||||||
778 | { | - | ||||||||||||||||||||||||
779 | q->grabMouse(); | - | ||||||||||||||||||||||||
780 | } never executed: end of block | 0 | ||||||||||||||||||||||||
781 | - | |||||||||||||||||||||||||
782 | } | - | ||||||||||||||||||||||||
783 | - | |||||||||||||||||||||||||
784 | - | |||||||||||||||||||||||||
785 | - | |||||||||||||||||||||||||
786 | - | |||||||||||||||||||||||||
787 | void QMdiSubWindowPrivate::_q_processFocusChanged(QWidget *old, QWidget *now) | - | ||||||||||||||||||||||||
788 | { | - | ||||||||||||||||||||||||
789 | (void)old;; | - | ||||||||||||||||||||||||
790 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
791 | if (now
| 0 | ||||||||||||||||||||||||
792 | if (now == q
| 0 | ||||||||||||||||||||||||
793 | setFocusWidget(); never executed: setFocusWidget(); | 0 | ||||||||||||||||||||||||
794 | setActive(true); | - | ||||||||||||||||||||||||
795 | } never executed: end of block | 0 | ||||||||||||||||||||||||
796 | } never executed: end of block | 0 | ||||||||||||||||||||||||
797 | - | |||||||||||||||||||||||||
798 | - | |||||||||||||||||||||||||
799 | - | |||||||||||||||||||||||||
800 | - | |||||||||||||||||||||||||
801 | void QMdiSubWindowPrivate::leaveInteractiveMode() | - | ||||||||||||||||||||||||
802 | { | - | ||||||||||||||||||||||||
803 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
804 | - | |||||||||||||||||||||||||
805 | if (isInRubberBandMode
| 0 | ||||||||||||||||||||||||
806 | leaveRubberBandMode(); never executed: leaveRubberBandMode(); | 0 | ||||||||||||||||||||||||
807 | else | - | ||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||
809 | q->releaseMouse(); never executed: q->releaseMouse(); | 0 | ||||||||||||||||||||||||
810 | isInInteractiveMode = false; | - | ||||||||||||||||||||||||
811 | currentOperation = None; | - | ||||||||||||||||||||||||
812 | updateDirtyRegions(); | - | ||||||||||||||||||||||||
813 | updateCursor(); | - | ||||||||||||||||||||||||
814 | if (baseWidget
| 0 | ||||||||||||||||||||||||
815 | baseWidget->focusWidget()->setFocus(); never executed: baseWidget->focusWidget()->setFocus(); | 0 | ||||||||||||||||||||||||
816 | } never executed: end of block | 0 | ||||||||||||||||||||||||
817 | - | |||||||||||||||||||||||||
818 | - | |||||||||||||||||||||||||
819 | - | |||||||||||||||||||||||||
820 | - | |||||||||||||||||||||||||
821 | void QMdiSubWindowPrivate::removeBaseWidget() | - | ||||||||||||||||||||||||
822 | { | - | ||||||||||||||||||||||||
823 | if (!baseWidget
| 0 | ||||||||||||||||||||||||
824 | return; never executed: return; | 0 | ||||||||||||||||||||||||
825 | - | |||||||||||||||||||||||||
826 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
827 | baseWidget->removeEventFilter(q); | - | ||||||||||||||||||||||||
828 | if (layout
| 0 | ||||||||||||||||||||||||
829 | layout->removeWidget(baseWidget); never executed: layout->removeWidget(baseWidget); | 0 | ||||||||||||||||||||||||
830 | if (baseWidget->windowTitle() == q->windowTitle()
| 0 | ||||||||||||||||||||||||
831 | ignoreWindowTitleChange = true; | - | ||||||||||||||||||||||||
832 | q->setWindowTitle(QString()); | - | ||||||||||||||||||||||||
833 | ignoreWindowTitleChange = false; | - | ||||||||||||||||||||||||
834 | q->setWindowModified(false); | - | ||||||||||||||||||||||||
835 | } never executed: end of block | 0 | ||||||||||||||||||||||||
836 | lastChildWindowTitle.clear(); | - | ||||||||||||||||||||||||
837 | - | |||||||||||||||||||||||||
838 | if (baseWidget->parentWidget() == q
| 0 | ||||||||||||||||||||||||
839 | baseWidget->setParent(0); never executed: baseWidget->setParent(0); | 0 | ||||||||||||||||||||||||
840 | baseWidget = 0; | - | ||||||||||||||||||||||||
841 | isWidgetHiddenByUs = false; | - | ||||||||||||||||||||||||
842 | } never executed: end of block | 0 | ||||||||||||||||||||||||
843 | - | |||||||||||||||||||||||||
844 | - | |||||||||||||||||||||||||
845 | - | |||||||||||||||||||||||||
846 | - | |||||||||||||||||||||||||
847 | void QMdiSubWindowPrivate::initOperationMap() | - | ||||||||||||||||||||||||
848 | { | - | ||||||||||||||||||||||||
849 | operationMap.insert(Move, OperationInfo(HMove | VMove, Qt::ArrowCursor, false)); | - | ||||||||||||||||||||||||
850 | operationMap.insert(TopResize, OperationInfo(VMove | VResize | VResizeReverse, Qt::SizeVerCursor)); | - | ||||||||||||||||||||||||
851 | operationMap.insert(BottomResize, OperationInfo(VResize, Qt::SizeVerCursor)); | - | ||||||||||||||||||||||||
852 | operationMap.insert(LeftResize, OperationInfo(HMove | HResize | HResizeReverse, Qt::SizeHorCursor)); | - | ||||||||||||||||||||||||
853 | operationMap.insert(RightResize, OperationInfo(HResize, Qt::SizeHorCursor)); | - | ||||||||||||||||||||||||
854 | operationMap.insert(TopLeftResize, OperationInfo(HMove | VMove | HResize | VResize | VResizeReverse | - | ||||||||||||||||||||||||
855 | | HResizeReverse, Qt::SizeFDiagCursor)); | - | ||||||||||||||||||||||||
856 | operationMap.insert(TopRightResize, OperationInfo(VMove | HResize | VResize | - | ||||||||||||||||||||||||
857 | | VResizeReverse, Qt::SizeBDiagCursor)); | - | ||||||||||||||||||||||||
858 | operationMap.insert(BottomLeftResize, OperationInfo(HMove | HResize | VResize | HResizeReverse, | - | ||||||||||||||||||||||||
859 | Qt::SizeBDiagCursor)); | - | ||||||||||||||||||||||||
860 | operationMap.insert(BottomRightResize, OperationInfo(HResize | VResize, Qt::SizeFDiagCursor)); | - | ||||||||||||||||||||||||
861 | } never executed: end of block | 0 | ||||||||||||||||||||||||
862 | - | |||||||||||||||||||||||||
863 | - | |||||||||||||||||||||||||
864 | - | |||||||||||||||||||||||||
865 | - | |||||||||||||||||||||||||
866 | - | |||||||||||||||||||||||||
867 | - | |||||||||||||||||||||||||
868 | void QMdiSubWindowPrivate::createSystemMenu() | - | ||||||||||||||||||||||||
869 | { | - | ||||||||||||||||||||||||
870 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
871 | ((!(q)) ? qt_assert_x("QMdiSubWindowPrivate::createSystemMenu", "You can NOT call this function before QMdiSubWindow's ctor", | - | ||||||||||||||||||||||||
872 | __FILE__ | - | ||||||||||||||||||||||||
873 | , | - | ||||||||||||||||||||||||
874 | 1041 | - | ||||||||||||||||||||||||
875 | ) : qt_noop()) | - | ||||||||||||||||||||||||
876 | ; | - | ||||||||||||||||||||||||
877 | systemMenu = new QMenu(q); | - | ||||||||||||||||||||||||
878 | systemMenu->installEventFilter(q); | - | ||||||||||||||||||||||||
879 | const QStyle *style = q->style(); | - | ||||||||||||||||||||||||
880 | addToSystemMenu(RestoreAction, QMdiSubWindow::tr("&Restore"), qFlagLocation("1""showNormal()" "\0" __FILE__ ":" "1045")); | - | ||||||||||||||||||||||||
881 | actions[RestoreAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarNormalButton, 0, q)); | - | ||||||||||||||||||||||||
882 | actions[RestoreAction]->setEnabled(false); | - | ||||||||||||||||||||||||
883 | addToSystemMenu(MoveAction, QMdiSubWindow::tr("&Move"), qFlagLocation("1""_q_enterInteractiveMode()" "\0" __FILE__ ":" "1048")); | - | ||||||||||||||||||||||||
884 | addToSystemMenu(ResizeAction, QMdiSubWindow::tr("&Size"), qFlagLocation("1""_q_enterInteractiveMode()" "\0" __FILE__ ":" "1049")); | - | ||||||||||||||||||||||||
885 | addToSystemMenu(MinimizeAction, QMdiSubWindow::tr("Mi&nimize"), qFlagLocation("1""showMinimized()" "\0" __FILE__ ":" "1050")); | - | ||||||||||||||||||||||||
886 | actions[MinimizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMinButton, 0, q)); | - | ||||||||||||||||||||||||
887 | addToSystemMenu(MaximizeAction, QMdiSubWindow::tr("Ma&ximize"), qFlagLocation("1""showMaximized()" "\0" __FILE__ ":" "1052")); | - | ||||||||||||||||||||||||
888 | actions[MaximizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMaxButton, 0, q)); | - | ||||||||||||||||||||||||
889 | addToSystemMenu(StayOnTopAction, QMdiSubWindow::tr("Stay on &Top"), qFlagLocation("1""_q_updateStaysOnTopHint()" "\0" __FILE__ ":" "1054")); | - | ||||||||||||||||||||||||
890 | actions[StayOnTopAction]->setCheckable(true); | - | ||||||||||||||||||||||||
891 | systemMenu->addSeparator(); | - | ||||||||||||||||||||||||
892 | addToSystemMenu(CloseAction, QMdiSubWindow::tr("&Close"), qFlagLocation("1""close()" "\0" __FILE__ ":" "1057")); | - | ||||||||||||||||||||||||
893 | actions[CloseAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarCloseButton, 0, q)); | - | ||||||||||||||||||||||||
894 | - | |||||||||||||||||||||||||
895 | actions[CloseAction]->setShortcuts(QKeySequence::Close); | - | ||||||||||||||||||||||||
896 | - | |||||||||||||||||||||||||
897 | updateActions(); | - | ||||||||||||||||||||||||
898 | } never executed: end of block | 0 | ||||||||||||||||||||||||
899 | - | |||||||||||||||||||||||||
900 | - | |||||||||||||||||||||||||
901 | - | |||||||||||||||||||||||||
902 | - | |||||||||||||||||||||||||
903 | - | |||||||||||||||||||||||||
904 | void QMdiSubWindowPrivate::updateCursor() | - | ||||||||||||||||||||||||
905 | { | - | ||||||||||||||||||||||||
906 | - | |||||||||||||||||||||||||
907 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
908 | - | |||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||
910 | - | |||||||||||||||||||||||||
911 | - | |||||||||||||||||||||||||
912 | - | |||||||||||||||||||||||||
913 | if (currentOperation == None
| 0 | ||||||||||||||||||||||||
914 | q->unsetCursor(); | - | ||||||||||||||||||||||||
915 | return; never executed: return; | 0 | ||||||||||||||||||||||||
916 | } | - | ||||||||||||||||||||||||
917 | - | |||||||||||||||||||||||||
918 | if (currentOperation == Move
| 0 | ||||||||||||||||||||||||
919 | q->setCursor(operationMap.find(currentOperation).value().cursorShape); | - | ||||||||||||||||||||||||
920 | return; never executed: return; | 0 | ||||||||||||||||||||||||
921 | } | - | ||||||||||||||||||||||||
922 | - | |||||||||||||||||||||||||
923 | } never executed: end of block | 0 | ||||||||||||||||||||||||
924 | - | |||||||||||||||||||||||||
925 | - | |||||||||||||||||||||||||
926 | - | |||||||||||||||||||||||||
927 | - | |||||||||||||||||||||||||
928 | void QMdiSubWindowPrivate::updateDirtyRegions() | - | ||||||||||||||||||||||||
929 | { | - | ||||||||||||||||||||||||
930 | - | |||||||||||||||||||||||||
931 | if (!parent
| 0 | ||||||||||||||||||||||||
932 | return; never executed: return; | 0 | ||||||||||||||||||||||||
933 | - | |||||||||||||||||||||||||
934 | for (OperationInfoMap::iterator it = operationMap.begin(), end = operationMap.end(); it != end
| 0 | ||||||||||||||||||||||||
935 | it.value().region = getRegion(it.key()); never executed: it.value().region = getRegion(it.key()); | 0 | ||||||||||||||||||||||||
936 | } never executed: end of block | 0 | ||||||||||||||||||||||||
937 | - | |||||||||||||||||||||||||
938 | - | |||||||||||||||||||||||||
939 | - | |||||||||||||||||||||||||
940 | - | |||||||||||||||||||||||||
941 | void QMdiSubWindowPrivate::updateGeometryConstraints() | - | ||||||||||||||||||||||||
942 | { | - | ||||||||||||||||||||||||
943 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
944 | if (!parent
| 0 | ||||||||||||||||||||||||
945 | return; never executed: return; | 0 | ||||||||||||||||||||||||
946 | - | |||||||||||||||||||||||||
947 | internalMinimumSize = (!q->isMinimized()
| 0 | ||||||||||||||||||||||||
948 | ? q->minimumSize() : q->minimumSizeHint(); | - | ||||||||||||||||||||||||
949 | int margin, minWidth; | - | ||||||||||||||||||||||||
950 | sizeParameters(&margin, &minWidth); | - | ||||||||||||||||||||||||
951 | q->setContentsMargins(margin, titleBarHeight(), margin, margin); | - | ||||||||||||||||||||||||
952 | if (q->isMaximized()
| 0 | ||||||||||||||||||||||||
953 | moveEnabled = false; | - | ||||||||||||||||||||||||
954 | resizeEnabled = false; | - | ||||||||||||||||||||||||
955 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
956 | moveEnabled = true; | - | ||||||||||||||||||||||||
957 | if ((
| 0 | ||||||||||||||||||||||||
958 | resizeEnabled = false; never executed: resizeEnabled = false; | 0 | ||||||||||||||||||||||||
959 | else | - | ||||||||||||||||||||||||
960 | resizeEnabled = true; never executed: resizeEnabled = true; | 0 | ||||||||||||||||||||||||
961 | } | - | ||||||||||||||||||||||||
962 | updateDirtyRegions(); | - | ||||||||||||||||||||||||
963 | } never executed: end of block | 0 | ||||||||||||||||||||||||
964 | - | |||||||||||||||||||||||||
965 | - | |||||||||||||||||||||||||
966 | - | |||||||||||||||||||||||||
967 | - | |||||||||||||||||||||||||
968 | void QMdiSubWindowPrivate::updateMask() | - | ||||||||||||||||||||||||
969 | { | - | ||||||||||||||||||||||||
970 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
971 | if (!q->mask().isEmpty()
| 0 | ||||||||||||||||||||||||
972 | q->clearMask(); never executed: q->clearMask(); | 0 | ||||||||||||||||||||||||
973 | - | |||||||||||||||||||||||||
974 | if (!parent
| 0 | ||||||||||||||||||||||||
975 | return; never executed: return; | 0 | ||||||||||||||||||||||||
976 | - | |||||||||||||||||||||||||
977 | if ((q->isMaximized()
| 0 | ||||||||||||||||||||||||
978 | || q->windowFlags() & Qt::FramelessWindowHint
| 0 | ||||||||||||||||||||||||
979 | return; never executed: return; | 0 | ||||||||||||||||||||||||
980 | - | |||||||||||||||||||||||||
981 | if (resizeTimerId == -1
| 0 | ||||||||||||||||||||||||
982 | cachedStyleOptions = titleBarOptions(); never executed: cachedStyleOptions = titleBarOptions(); | 0 | ||||||||||||||||||||||||
983 | cachedStyleOptions.rect = q->rect(); | - | ||||||||||||||||||||||||
984 | QStyleHintReturnMask frameMask; | - | ||||||||||||||||||||||||
985 | q->style()->styleHint(QStyle::SH_WindowFrame_Mask, &cachedStyleOptions, q, &frameMask); | - | ||||||||||||||||||||||||
986 | if (!frameMask.region.isEmpty()
| 0 | ||||||||||||||||||||||||
987 | q->setMask(frameMask.region); never executed: q->setMask(frameMask.region); | 0 | ||||||||||||||||||||||||
988 | } never executed: end of block | 0 | ||||||||||||||||||||||||
989 | - | |||||||||||||||||||||||||
990 | - | |||||||||||||||||||||||||
991 | - | |||||||||||||||||||||||||
992 | - | |||||||||||||||||||||||||
993 | void QMdiSubWindowPrivate::setNewGeometry(const QPoint &pos) | - | ||||||||||||||||||||||||
994 | { | - | ||||||||||||||||||||||||
995 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
996 | ((!(currentOperation != None)) ? qt_assert("currentOperation != None",__FILE__,1161) : qt_noop()); | - | ||||||||||||||||||||||||
997 | ((!(parent)) ? qt_assert("parent",__FILE__,1162) : qt_noop()); | - | ||||||||||||||||||||||||
998 | - | |||||||||||||||||||||||||
999 | uint cflags = operationMap.find(currentOperation).value().changeFlags; | - | ||||||||||||||||||||||||
1000 | int posX = pos.x(); | - | ||||||||||||||||||||||||
1001 | int posY = pos.y(); | - | ||||||||||||||||||||||||
1002 | - | |||||||||||||||||||||||||
1003 | const bool restrictHorizontal = !q->testOption(QMdiSubWindow::AllowOutsideAreaHorizontally); | - | ||||||||||||||||||||||||
1004 | const bool restrictVertical = !q->testOption(QMdiSubWindow::AllowOutsideAreaVertically); | - | ||||||||||||||||||||||||
1005 | - | |||||||||||||||||||||||||
1006 | if (restrictHorizontal
| 0 | ||||||||||||||||||||||||
1007 | QRect parentRect = q->parentWidget()->rect(); | - | ||||||||||||||||||||||||
1008 | if (restrictVertical
| 0 | ||||||||||||||||||||||||
1009 | posY = qMin(qMax(mousePressPosition.y() - oldGeometry.y(), posY), | - | ||||||||||||||||||||||||
1010 | parentRect.height() - BoundaryMargin); | - | ||||||||||||||||||||||||
1011 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1012 | if (currentOperation == Move
| 0 | ||||||||||||||||||||||||
1013 | if (restrictHorizontal
| 0 | ||||||||||||||||||||||||
1014 | posX = qMin(qMax(BoundaryMargin, posX), parentRect.width() - BoundaryMargin); never executed: posX = qMin(qMax(BoundaryMargin, posX), parentRect.width() - BoundaryMargin); | 0 | ||||||||||||||||||||||||
1015 | if (restrictVertical
| 0 | ||||||||||||||||||||||||
1016 | posY = qMin(posY, parentRect.height() - BoundaryMargin); never executed: posY = qMin(posY, parentRect.height() - BoundaryMargin); | 0 | ||||||||||||||||||||||||
1017 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1018 | if (restrictHorizontal
| 0 | ||||||||||||||||||||||||
1019 | if (cflags & HResizeReverse
| 0 | ||||||||||||||||||||||||
1020 | posX = qMax(mousePressPosition.x() - oldGeometry.x(), posX); never executed: posX = qMax(mousePressPosition.x() - oldGeometry.x(), posX); | 0 | ||||||||||||||||||||||||
1021 | else | - | ||||||||||||||||||||||||
1022 | posX = qMin(parentRect.width() - (oldGeometry.x() + oldGeometry.width() never executed: posX = qMin(parentRect.width() - (oldGeometry.x() + oldGeometry.width() - mousePressPosition.x()), posX); | 0 | ||||||||||||||||||||||||
1023 | - mousePressPosition.x()), posX); never executed: posX = qMin(parentRect.width() - (oldGeometry.x() + oldGeometry.width() - mousePressPosition.x()), posX); | 0 | ||||||||||||||||||||||||
1024 | } | - | ||||||||||||||||||||||||
1025 | if (restrictVertical
| 0 | ||||||||||||||||||||||||
1026 | posY = qMin(parentRect.height() - (oldGeometry.y() + oldGeometry.height() | - | ||||||||||||||||||||||||
1027 | - mousePressPosition.y()), posY); | - | ||||||||||||||||||||||||
1028 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1029 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1030 | } | - | ||||||||||||||||||||||||
1031 | - | |||||||||||||||||||||||||
1032 | QRect geometry; | - | ||||||||||||||||||||||||
1033 | if (cflags & (HMove | VMove)
| 0 | ||||||||||||||||||||||||
1034 | int dx = getMoveDeltaComponent(cflags, HMove, HResize, posX - mousePressPosition.x(), | - | ||||||||||||||||||||||||
1035 | oldGeometry.width() - internalMinimumSize.width(), | - | ||||||||||||||||||||||||
1036 | oldGeometry.width() - q->maximumWidth()); | - | ||||||||||||||||||||||||
1037 | int dy = getMoveDeltaComponent(cflags, VMove, VResize, posY - mousePressPosition.y(), | - | ||||||||||||||||||||||||
1038 | oldGeometry.height() - internalMinimumSize.height(), | - | ||||||||||||||||||||||||
1039 | oldGeometry.height() - q->maximumHeight()); | - | ||||||||||||||||||||||||
1040 | geometry.setTopLeft(oldGeometry.topLeft() + QPoint(dx, dy)); | - | ||||||||||||||||||||||||
1041 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1042 | geometry.setTopLeft(q->geometry().topLeft()); | - | ||||||||||||||||||||||||
1043 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1044 | - | |||||||||||||||||||||||||
1045 | if (cflags & (HResize | VResize)
| 0 | ||||||||||||||||||||||||
1046 | int dx = getResizeDeltaComponent(cflags, HResize, HResizeReverse, | - | ||||||||||||||||||||||||
1047 | posX - mousePressPosition.x()); | - | ||||||||||||||||||||||||
1048 | int dy = getResizeDeltaComponent(cflags, VResize, VResizeReverse, | - | ||||||||||||||||||||||||
1049 | posY - mousePressPosition.y()); | - | ||||||||||||||||||||||||
1050 | geometry.setSize(oldGeometry.size() + QSize(dx, dy)); | - | ||||||||||||||||||||||||
1051 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1052 | geometry.setSize(q->geometry().size()); | - | ||||||||||||||||||||||||
1053 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1054 | - | |||||||||||||||||||||||||
1055 | setNewGeometry(&geometry); | - | ||||||||||||||||||||||||
1056 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1057 | - | |||||||||||||||||||||||||
1058 | - | |||||||||||||||||||||||||
1059 | - | |||||||||||||||||||||||||
1060 | - | |||||||||||||||||||||||||
1061 | void QMdiSubWindowPrivate::setMinimizeMode() | - | ||||||||||||||||||||||||
1062 | { | - | ||||||||||||||||||||||||
1063 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1064 | ((!(parent)) ? qt_assert("parent",__FILE__,1229) : qt_noop()); | - | ||||||||||||||||||||||||
1065 | - | |||||||||||||||||||||||||
1066 | ensureWindowState(Qt::WindowMinimized); | - | ||||||||||||||||||||||||
1067 | isShadeRequestFromMinimizeMode = true; | - | ||||||||||||||||||||||||
1068 | q->showShaded(); | - | ||||||||||||||||||||||||
1069 | isShadeRequestFromMinimizeMode = false; | - | ||||||||||||||||||||||||
1070 | - | |||||||||||||||||||||||||
1071 | moveEnabled = false; | - | ||||||||||||||||||||||||
1072 | - | |||||||||||||||||||||||||
1073 | setEnabled(MoveAction, moveEnabled); | - | ||||||||||||||||||||||||
1074 | - | |||||||||||||||||||||||||
1075 | - | |||||||||||||||||||||||||
1076 | ((!(q->windowState() & Qt::WindowMinimized)) ? qt_assert("q->windowState() & Qt::WindowMinimized",__FILE__,1241) : qt_noop()); | - | ||||||||||||||||||||||||
1077 | ((!(!(q->windowState() & Qt::WindowMaximized))) ? qt_assert("!(q->windowState() & Qt::WindowMaximized)",__FILE__,1242) : qt_noop()); | - | ||||||||||||||||||||||||
1078 | - | |||||||||||||||||||||||||
1079 | - | |||||||||||||||||||||||||
1080 | - | |||||||||||||||||||||||||
1081 | - | |||||||||||||||||||||||||
1082 | - | |||||||||||||||||||||||||
1083 | setActive(true); | - | ||||||||||||||||||||||||
1084 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1085 | - | |||||||||||||||||||||||||
1086 | - | |||||||||||||||||||||||||
1087 | - | |||||||||||||||||||||||||
1088 | - | |||||||||||||||||||||||||
1089 | void QMdiSubWindowPrivate::setNormalMode() | - | ||||||||||||||||||||||||
1090 | { | - | ||||||||||||||||||||||||
1091 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1092 | ((!(parent)) ? qt_assert("parent",__FILE__,1257) : qt_noop()); | - | ||||||||||||||||||||||||
1093 | - | |||||||||||||||||||||||||
1094 | isShadeMode = false; | - | ||||||||||||||||||||||||
1095 | isMaximizeMode = false; | - | ||||||||||||||||||||||||
1096 | - | |||||||||||||||||||||||||
1097 | ensureWindowState(Qt::WindowNoState); | - | ||||||||||||||||||||||||
1098 | - | |||||||||||||||||||||||||
1099 | removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
1100 | - | |||||||||||||||||||||||||
1101 | - | |||||||||||||||||||||||||
1102 | - | |||||||||||||||||||||||||
1103 | - | |||||||||||||||||||||||||
1104 | const bool wasVisible = q->isVisible(); | - | ||||||||||||||||||||||||
1105 | if (wasVisible
| 0 | ||||||||||||||||||||||||
1106 | q->setVisible(false); never executed: q->setVisible(false); | 0 | ||||||||||||||||||||||||
1107 | - | |||||||||||||||||||||||||
1108 | - | |||||||||||||||||||||||||
1109 | if (!userMinimumSize.isNull()
| 0 | ||||||||||||||||||||||||
1110 | q->setMinimumSize(userMinimumSize); | - | ||||||||||||||||||||||||
1111 | userMinimumSize = QSize(0, 0); | - | ||||||||||||||||||||||||
1112 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1113 | - | |||||||||||||||||||||||||
1114 | - | |||||||||||||||||||||||||
1115 | if (baseWidget
| 0 | ||||||||||||||||||||||||
1116 | baseWidget->show(); | - | ||||||||||||||||||||||||
1117 | isWidgetHiddenByUs = false; | - | ||||||||||||||||||||||||
1118 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1119 | - | |||||||||||||||||||||||||
1120 | updateGeometryConstraints(); | - | ||||||||||||||||||||||||
1121 | QRect newGeometry = oldGeometry; | - | ||||||||||||||||||||||||
1122 | newGeometry.setSize(restoreSize.expandedTo(internalMinimumSize)); | - | ||||||||||||||||||||||||
1123 | q->setGeometry(newGeometry); | - | ||||||||||||||||||||||||
1124 | - | |||||||||||||||||||||||||
1125 | if (wasVisible
| 0 | ||||||||||||||||||||||||
1126 | q->setVisible(true); never executed: q->setVisible(true); | 0 | ||||||||||||||||||||||||
1127 | - | |||||||||||||||||||||||||
1128 | - | |||||||||||||||||||||||||
1129 | restoreSize.setWidth(-1); | - | ||||||||||||||||||||||||
1130 | restoreSize.setHeight(-1); | - | ||||||||||||||||||||||||
1131 | - | |||||||||||||||||||||||||
1132 | - | |||||||||||||||||||||||||
1133 | setSizeGripVisible(true); | - | ||||||||||||||||||||||||
1134 | - | |||||||||||||||||||||||||
1135 | - | |||||||||||||||||||||||||
1136 | - | |||||||||||||||||||||||||
1137 | setEnabled(MoveAction, true); | - | ||||||||||||||||||||||||
1138 | setEnabled(MaximizeAction, true); | - | ||||||||||||||||||||||||
1139 | setEnabled(MinimizeAction, true); | - | ||||||||||||||||||||||||
1140 | setEnabled(RestoreAction, false); | - | ||||||||||||||||||||||||
1141 | setEnabled(ResizeAction, resizeEnabled); | - | ||||||||||||||||||||||||
1142 | - | |||||||||||||||||||||||||
1143 | - | |||||||||||||||||||||||||
1144 | ((!(!(q_func()->windowState() & Qt::WindowMinimized))) ? qt_assert("!(q_func()->windowState() & Qt::WindowMinimized)",__FILE__,1309) : qt_noop()); | - | ||||||||||||||||||||||||
1145 | - | |||||||||||||||||||||||||
1146 | - | |||||||||||||||||||||||||
1147 | - | |||||||||||||||||||||||||
1148 | ((!((isMaximizeMode && q_func()->windowState() & Qt::WindowMaximized) || (!isMaximizeMode && !(q_func()->windowState() & Qt::WindowMaximized)))) ? qt_assert("(isMaximizeMode && q_func()->windowState() & Qt::WindowMaximized) || (!isMaximizeMode && !(q_func()->windowState() & Qt::WindowMaximized))", | - | ||||||||||||||||||||||||
1149 | __FILE__ | - | ||||||||||||||||||||||||
1150 | , | - | ||||||||||||||||||||||||
1151 | 1314 | - | ||||||||||||||||||||||||
1152 | ) : qt_noop()) | - | ||||||||||||||||||||||||
1153 | ; | - | ||||||||||||||||||||||||
1154 | ((!(!isShadeMode)) ? qt_assert("!isShadeMode",__FILE__,1315) : qt_noop()); | - | ||||||||||||||||||||||||
1155 | - | |||||||||||||||||||||||||
1156 | setActive(true); | - | ||||||||||||||||||||||||
1157 | restoreFocus(); | - | ||||||||||||||||||||||||
1158 | updateMask(); | - | ||||||||||||||||||||||||
1159 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1160 | - | |||||||||||||||||||||||||
1161 | inline void QMdiSubWindowPrivate::storeFocusWidget() | - | ||||||||||||||||||||||||
1162 | { | - | ||||||||||||||||||||||||
1163 | if (QWidget *focus = QApplication::focusWidget()
| 0 | ||||||||||||||||||||||||
1164 | if (!restoreFocusWidget
| 0 | ||||||||||||||||||||||||
1165 | restoreFocusWidget = focus; never executed: restoreFocusWidget = focus; | 0 | ||||||||||||||||||||||||
1166 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1167 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1168 | - | |||||||||||||||||||||||||
1169 | - | |||||||||||||||||||||||||
1170 | - | |||||||||||||||||||||||||
1171 | - | |||||||||||||||||||||||||
1172 | void QMdiSubWindowPrivate::setMaximizeMode() | - | ||||||||||||||||||||||||
1173 | { | - | ||||||||||||||||||||||||
1174 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1175 | ((!(parent)) ? qt_assert("parent",__FILE__,1336) : qt_noop()); | - | ||||||||||||||||||||||||
1176 | - | |||||||||||||||||||||||||
1177 | ensureWindowState(Qt::WindowMaximized); | - | ||||||||||||||||||||||||
1178 | isShadeMode = false; | - | ||||||||||||||||||||||||
1179 | isMaximizeMode = true; | - | ||||||||||||||||||||||||
1180 | - | |||||||||||||||||||||||||
1181 | storeFocusWidget(); | - | ||||||||||||||||||||||||
1182 | - | |||||||||||||||||||||||||
1183 | - | |||||||||||||||||||||||||
1184 | setSizeGripVisible(false); | - | ||||||||||||||||||||||||
1185 | - | |||||||||||||||||||||||||
1186 | - | |||||||||||||||||||||||||
1187 | - | |||||||||||||||||||||||||
1188 | if (!restoreSize.isValid()
| 0 | ||||||||||||||||||||||||
1189 | oldGeometry = q->geometry(); | - | ||||||||||||||||||||||||
1190 | restoreSize.setWidth(oldGeometry.width()); | - | ||||||||||||||||||||||||
1191 | restoreSize.setHeight(oldGeometry.height()); | - | ||||||||||||||||||||||||
1192 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1193 | - | |||||||||||||||||||||||||
1194 | - | |||||||||||||||||||||||||
1195 | - | |||||||||||||||||||||||||
1196 | const bool wasVisible = q->isVisible(); | - | ||||||||||||||||||||||||
1197 | if (wasVisible
| 0 | ||||||||||||||||||||||||
1198 | q->setVisible(false); never executed: q->setVisible(false); | 0 | ||||||||||||||||||||||||
1199 | - | |||||||||||||||||||||||||
1200 | - | |||||||||||||||||||||||||
1201 | if (baseWidget
| 0 | ||||||||||||||||||||||||
1202 | baseWidget->show(); | - | ||||||||||||||||||||||||
1203 | isWidgetHiddenByUs = false; | - | ||||||||||||||||||||||||
1204 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1205 | - | |||||||||||||||||||||||||
1206 | updateGeometryConstraints(); | - | ||||||||||||||||||||||||
1207 | - | |||||||||||||||||||||||||
1208 | if (wasVisible
| 0 | ||||||||||||||||||||||||
1209 | - | |||||||||||||||||||||||||
1210 | if (QMenuBar *mBar = menuBar()
| 0 | ||||||||||||||||||||||||
1211 | showButtonsInMenuBar(mBar); never executed: showButtonsInMenuBar(mBar); | 0 | ||||||||||||||||||||||||
1212 | else | - | ||||||||||||||||||||||||
1213 | - | |||||||||||||||||||||||||
1214 | if (!controlContainer
| 0 | ||||||||||||||||||||||||
1215 | controlContainer = new ControlContainer(q); never executed: controlContainer = new ControlContainer(q); | 0 | ||||||||||||||||||||||||
1216 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1217 | - | |||||||||||||||||||||||||
1218 | QWidget *parent = q->parentWidget(); | - | ||||||||||||||||||||||||
1219 | QRect availableRect = parent->contentsRect(); | - | ||||||||||||||||||||||||
1220 | - | |||||||||||||||||||||||||
1221 | - | |||||||||||||||||||||||||
1222 | QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent->parentWidget()); | - | ||||||||||||||||||||||||
1223 | if (scrollArea
| 0 | ||||||||||||||||||||||||
1224 | QScrollBar *hbar = scrollArea->horizontalScrollBar(); | - | ||||||||||||||||||||||||
1225 | QScrollBar *vbar = scrollArea->verticalScrollBar(); | - | ||||||||||||||||||||||||
1226 | const int xOffset = hbar
| 0 | ||||||||||||||||||||||||
1227 | const int yOffset = vbar
| 0 | ||||||||||||||||||||||||
1228 | availableRect.adjust(-xOffset, -yOffset, -xOffset, -yOffset); | - | ||||||||||||||||||||||||
1229 | oldGeometry.adjust(xOffset, yOffset, xOffset, yOffset); | - | ||||||||||||||||||||||||
1230 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1231 | - | |||||||||||||||||||||||||
1232 | setNewGeometry(&availableRect); | - | ||||||||||||||||||||||||
1233 | - | |||||||||||||||||||||||||
1234 | ensureWindowState(Qt::WindowMaximized); | - | ||||||||||||||||||||||||
1235 | - | |||||||||||||||||||||||||
1236 | if (wasVisible
| 0 | ||||||||||||||||||||||||
1237 | q->setVisible(true); never executed: q->setVisible(true); | 0 | ||||||||||||||||||||||||
1238 | - | |||||||||||||||||||||||||
1239 | resizeEnabled = false; | - | ||||||||||||||||||||||||
1240 | moveEnabled = false; | - | ||||||||||||||||||||||||
1241 | - | |||||||||||||||||||||||||
1242 | - | |||||||||||||||||||||||||
1243 | setEnabled(MoveAction, moveEnabled); | - | ||||||||||||||||||||||||
1244 | setEnabled(MaximizeAction, false); | - | ||||||||||||||||||||||||
1245 | setEnabled(MinimizeAction, true); | - | ||||||||||||||||||||||||
1246 | setEnabled(RestoreAction, true); | - | ||||||||||||||||||||||||
1247 | setEnabled(ResizeAction, resizeEnabled); | - | ||||||||||||||||||||||||
1248 | - | |||||||||||||||||||||||||
1249 | - | |||||||||||||||||||||||||
1250 | ((!(q->windowState() & Qt::WindowMaximized)) ? qt_assert("q->windowState() & Qt::WindowMaximized",__FILE__,1411) : qt_noop()); | - | ||||||||||||||||||||||||
1251 | ((!(!(q->windowState() & Qt::WindowMinimized))) ? qt_assert("!(q->windowState() & Qt::WindowMinimized)",__FILE__,1412) : qt_noop()); | - | ||||||||||||||||||||||||
1252 | - | |||||||||||||||||||||||||
1253 | restoreFocus(); | - | ||||||||||||||||||||||||
1254 | updateMask(); | - | ||||||||||||||||||||||||
1255 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1256 | - | |||||||||||||||||||||||||
1257 | - | |||||||||||||||||||||||||
1258 | - | |||||||||||||||||||||||||
1259 | - | |||||||||||||||||||||||||
1260 | void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus) | - | ||||||||||||||||||||||||
1261 | { | - | ||||||||||||||||||||||||
1262 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1263 | if (!parent
| 0 | ||||||||||||||||||||||||
1264 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1265 | - | |||||||||||||||||||||||||
1266 | if (activate
| 0 | ||||||||||||||||||||||||
1267 | isActive = true; | - | ||||||||||||||||||||||||
1268 | isExplicitlyDeactivated = false; | - | ||||||||||||||||||||||||
1269 | Qt::WindowStates oldWindowState = q->windowState(); | - | ||||||||||||||||||||||||
1270 | ensureWindowState(Qt::WindowActive); | - | ||||||||||||||||||||||||
1271 | q->aboutToActivate(); | - | ||||||||||||||||||||||||
1272 | - | |||||||||||||||||||||||||
1273 | if (QMenuBar *mBar = menuBar()
| 0 | ||||||||||||||||||||||||
1274 | showButtonsInMenuBar(mBar); never executed: showButtonsInMenuBar(mBar); | 0 | ||||||||||||||||||||||||
1275 | - | |||||||||||||||||||||||||
1276 | ((!(isActive)) ? qt_assert("isActive",__FILE__,1437) : qt_noop()); | - | ||||||||||||||||||||||||
1277 | q->windowStateChanged(oldWindowState, q->windowState()); | - | ||||||||||||||||||||||||
1278 | } never executed: else if (!activateend of block
| 0 | ||||||||||||||||||||||||
1279 | isActive = false; | - | ||||||||||||||||||||||||
1280 | Qt::WindowStates oldWindowState = q->windowState(); | - | ||||||||||||||||||||||||
1281 | q->overrideWindowState(q->windowState() & ~Qt::WindowActive); | - | ||||||||||||||||||||||||
1282 | if (changeFocus
| 0 | ||||||||||||||||||||||||
1283 | storeFocusWidget(); | - | ||||||||||||||||||||||||
1284 | QWidget *focusWidget = QApplication::focusWidget(); | - | ||||||||||||||||||||||||
1285 | if (focusWidget
| 0 | ||||||||||||||||||||||||
1286 | focusWidget->clearFocus(); never executed: focusWidget->clearFocus(); | 0 | ||||||||||||||||||||||||
1287 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1288 | if (baseWidget
| 0 | ||||||||||||||||||||||||
1289 | baseWidget->overrideWindowState(baseWidget->windowState() & ~Qt::WindowActive); never executed: baseWidget->overrideWindowState(baseWidget->windowState() & ~Qt::WindowActive); | 0 | ||||||||||||||||||||||||
1290 | ((!(!isActive)) ? qt_assert("!isActive",__FILE__,1451) : qt_noop()); | - | ||||||||||||||||||||||||
1291 | q->windowStateChanged(oldWindowState, q->windowState()); | - | ||||||||||||||||||||||||
1292 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1293 | - | |||||||||||||||||||||||||
1294 | if (activate
| 0 | ||||||||||||||||||||||||
1295 | && !q->isAncestorOf(QApplication::focusWidget())
| 0 | ||||||||||||||||||||||||
1296 | if (changeFocus
| 0 | ||||||||||||||||||||||||
1297 | setFocusWidget(); never executed: setFocusWidget(); | 0 | ||||||||||||||||||||||||
1298 | ensureWindowState(Qt::WindowActive); | - | ||||||||||||||||||||||||
1299 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1300 | - | |||||||||||||||||||||||||
1301 | int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); | - | ||||||||||||||||||||||||
1302 | int titleBarHeight = this->titleBarHeight(); | - | ||||||||||||||||||||||||
1303 | QRegion windowDecoration = QRegion(0, 0, q->width(), q->height()); | - | ||||||||||||||||||||||||
1304 | windowDecoration -= QRegion(frameWidth, titleBarHeight, q->width() - 2 * frameWidth, | - | ||||||||||||||||||||||||
1305 | q->height() - titleBarHeight - frameWidth); | - | ||||||||||||||||||||||||
1306 | - | |||||||||||||||||||||||||
1307 | - | |||||||||||||||||||||||||
1308 | - | |||||||||||||||||||||||||
1309 | if (resizeTimerId != -1
| 0 | ||||||||||||||||||||||||
1310 | q->killTimer(resizeTimerId); | - | ||||||||||||||||||||||||
1311 | resizeTimerId = -1; | - | ||||||||||||||||||||||||
1312 | updateDirtyRegions(); | - | ||||||||||||||||||||||||
1313 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1314 | - | |||||||||||||||||||||||||
1315 | q->update(windowDecoration); | - | ||||||||||||||||||||||||
1316 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1317 | - | |||||||||||||||||||||||||
1318 | - | |||||||||||||||||||||||||
1319 | - | |||||||||||||||||||||||||
1320 | - | |||||||||||||||||||||||||
1321 | void QMdiSubWindowPrivate::processClickedSubControl() | - | ||||||||||||||||||||||||
1322 | { | - | ||||||||||||||||||||||||
1323 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1324 | switch (activeSubControl) { | - | ||||||||||||||||||||||||
1325 | case never executed: QStyle::SC_TitleBarContextHelpButton:case QStyle::SC_TitleBarContextHelpButton: never executed: case QStyle::SC_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||
1326 | - | |||||||||||||||||||||||||
1327 | QWhatsThis::enterWhatsThisMode(); | - | ||||||||||||||||||||||||
1328 | - | |||||||||||||||||||||||||
1329 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1330 | case never executed: QStyle::SC_TitleBarShadeButton:case QStyle::SC_TitleBarShadeButton: never executed: case QStyle::SC_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||
1331 | q->showShaded(); | - | ||||||||||||||||||||||||
1332 | hoveredSubControl = QStyle::SC_TitleBarUnshadeButton; | - | ||||||||||||||||||||||||
1333 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1334 | case never executed: QStyle::SC_TitleBarUnshadeButton:case QStyle::SC_TitleBarUnshadeButton: never executed: case QStyle::SC_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||
1335 | if (q->isShaded()
| 0 | ||||||||||||||||||||||||
1336 | hoveredSubControl = QStyle::SC_TitleBarShadeButton; never executed: hoveredSubControl = QStyle::SC_TitleBarShadeButton; | 0 | ||||||||||||||||||||||||
1337 | q->showNormal(); | - | ||||||||||||||||||||||||
1338 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1339 | case never executed: QStyle::SC_TitleBarMinButton:case QStyle::SC_TitleBarMinButton: never executed: case QStyle::SC_TitleBarMinButton: | 0 | ||||||||||||||||||||||||
1340 | q->showMinimized(); | - | ||||||||||||||||||||||||
1341 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1342 | case never executed: QStyle::SC_TitleBarNormalButton:case QStyle::SC_TitleBarNormalButton: never executed: case QStyle::SC_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||
1343 | if (q->isShaded()
| 0 | ||||||||||||||||||||||||
1344 | hoveredSubControl = QStyle::SC_TitleBarMinButton; never executed: hoveredSubControl = QStyle::SC_TitleBarMinButton; | 0 | ||||||||||||||||||||||||
1345 | q->showNormal(); | - | ||||||||||||||||||||||||
1346 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1347 | case never executed: QStyle::SC_TitleBarMaxButton:case QStyle::SC_TitleBarMaxButton: never executed: case QStyle::SC_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||
1348 | q->showMaximized(); | - | ||||||||||||||||||||||||
1349 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1350 | case never executed: QStyle::SC_TitleBarCloseButton:case QStyle::SC_TitleBarCloseButton: never executed: case QStyle::SC_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||
1351 | q->close(); | - | ||||||||||||||||||||||||
1352 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1353 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1354 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1355 | } | - | ||||||||||||||||||||||||
1356 | } | - | ||||||||||||||||||||||||
1357 | - | |||||||||||||||||||||||||
1358 | - | |||||||||||||||||||||||||
1359 | - | |||||||||||||||||||||||||
1360 | - | |||||||||||||||||||||||||
1361 | QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const | - | ||||||||||||||||||||||||
1362 | { | - | ||||||||||||||||||||||||
1363 | const QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1364 | int width = q->width(); | - | ||||||||||||||||||||||||
1365 | int height = q->height(); | - | ||||||||||||||||||||||||
1366 | int titleBarHeight = this->titleBarHeight(); | - | ||||||||||||||||||||||||
1367 | int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); | - | ||||||||||||||||||||||||
1368 | int cornerConst = titleBarHeight - frameWidth; | - | ||||||||||||||||||||||||
1369 | int titleBarConst = 2 * titleBarHeight; | - | ||||||||||||||||||||||||
1370 | - | |||||||||||||||||||||||||
1371 | if (operation == Move
| 0 | ||||||||||||||||||||||||
1372 | QStyleOptionTitleBar titleBarOptions = this->titleBarOptions(); | - | ||||||||||||||||||||||||
1373 | QRegion move(frameWidth, frameWidth, width - 2 * frameWidth, cornerConst); | - | ||||||||||||||||||||||||
1374 | - | |||||||||||||||||||||||||
1375 | - | |||||||||||||||||||||||||
1376 | for (int i = 0; i < NumSubControls
| 0 | ||||||||||||||||||||||||
1377 | if (SubControls[i] == QStyle::SC_TitleBarLabel
| 0 | ||||||||||||||||||||||||
1378 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1379 | move -= QRegion(q->style()->subControlRect(QStyle::CC_TitleBar, &titleBarOptions, | - | ||||||||||||||||||||||||
1380 | SubControls[i])); | - | ||||||||||||||||||||||||
1381 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1382 | return never executed: move;return move; never executed: return move; | 0 | ||||||||||||||||||||||||
1383 | } | - | ||||||||||||||||||||||||
1384 | - | |||||||||||||||||||||||||
1385 | QRegion region; | - | ||||||||||||||||||||||||
1386 | - | |||||||||||||||||||||||||
1387 | - | |||||||||||||||||||||||||
1388 | - | |||||||||||||||||||||||||
1389 | - | |||||||||||||||||||||||||
1390 | - | |||||||||||||||||||||||||
1391 | switch (operation) { | - | ||||||||||||||||||||||||
1392 | case never executed: TopResize:case TopResize: never executed: case TopResize: | 0 | ||||||||||||||||||||||||
1393 | region = QRegion(titleBarHeight, 0, width - titleBarConst, frameWidth); | - | ||||||||||||||||||||||||
1394 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1395 | case never executed: BottomResize:case BottomResize: never executed: case BottomResize: | 0 | ||||||||||||||||||||||||
1396 | region = QRegion(titleBarHeight, height - frameWidth, width - titleBarConst, frameWidth); | - | ||||||||||||||||||||||||
1397 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1398 | case never executed: LeftResize:case LeftResize: never executed: case LeftResize: | 0 | ||||||||||||||||||||||||
1399 | region = QRegion(0, titleBarHeight, frameWidth, height - titleBarConst); | - | ||||||||||||||||||||||||
1400 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1401 | case never executed: RightResize:case RightResize: never executed: case RightResize: | 0 | ||||||||||||||||||||||||
1402 | region = QRegion(width - frameWidth, titleBarHeight, frameWidth, height - titleBarConst); | - | ||||||||||||||||||||||||
1403 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1404 | case never executed: TopLeftResize:case TopLeftResize: never executed: case TopLeftResize: | 0 | ||||||||||||||||||||||||
1405 | region = QRegion(0, 0, titleBarHeight, titleBarHeight) | - | ||||||||||||||||||||||||
1406 | - QRegion(frameWidth, frameWidth, cornerConst, cornerConst); | - | ||||||||||||||||||||||||
1407 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1408 | case never executed: TopRightResize:case TopRightResize: never executed: case TopRightResize: | 0 | ||||||||||||||||||||||||
1409 | region = QRegion(width - titleBarHeight, 0, titleBarHeight, titleBarHeight) | - | ||||||||||||||||||||||||
1410 | - QRegion(width - titleBarHeight, frameWidth, cornerConst, cornerConst); | - | ||||||||||||||||||||||||
1411 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1412 | case never executed: BottomLeftResize:case BottomLeftResize: never executed: case BottomLeftResize: | 0 | ||||||||||||||||||||||||
1413 | region = QRegion(0, height - titleBarHeight, titleBarHeight, titleBarHeight) | - | ||||||||||||||||||||||||
1414 | - QRegion(frameWidth, height - titleBarHeight, cornerConst, cornerConst); | - | ||||||||||||||||||||||||
1415 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1416 | case never executed: BottomRightResize:case BottomRightResize: never executed: case BottomRightResize: | 0 | ||||||||||||||||||||||||
1417 | region = QRegion(width - titleBarHeight, height - titleBarHeight, titleBarHeight, titleBarHeight) | - | ||||||||||||||||||||||||
1418 | - QRegion(width - titleBarHeight, height - titleBarHeight, cornerConst, cornerConst); | - | ||||||||||||||||||||||||
1419 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1420 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1421 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1422 | } | - | ||||||||||||||||||||||||
1423 | - | |||||||||||||||||||||||||
1424 | return never executed: region;return region; never executed: return region; | 0 | ||||||||||||||||||||||||
1425 | } | - | ||||||||||||||||||||||||
1426 | - | |||||||||||||||||||||||||
1427 | - | |||||||||||||||||||||||||
1428 | - | |||||||||||||||||||||||||
1429 | - | |||||||||||||||||||||||||
1430 | QMdiSubWindowPrivate::Operation QMdiSubWindowPrivate::getOperation(const QPoint &pos) const | - | ||||||||||||||||||||||||
1431 | { | - | ||||||||||||||||||||||||
1432 | OperationInfoMap::const_iterator it; | - | ||||||||||||||||||||||||
1433 | for (it = operationMap.constBegin(); it != operationMap.constEnd()
| 0 | ||||||||||||||||||||||||
1434 | if (it.value().region.contains(pos)
| 0 | ||||||||||||||||||||||||
1435 | return never executed: it.key();return it.key(); never executed: return it.key(); | 0 | ||||||||||||||||||||||||
1436 | return never executed: None;return None; never executed: return None; | 0 | ||||||||||||||||||||||||
1437 | } | - | ||||||||||||||||||||||||
1438 | - | |||||||||||||||||||||||||
1439 | extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*); | - | ||||||||||||||||||||||||
1440 | - | |||||||||||||||||||||||||
1441 | - | |||||||||||||||||||||||||
1442 | - | |||||||||||||||||||||||||
1443 | - | |||||||||||||||||||||||||
1444 | QStyleOptionTitleBar QMdiSubWindowPrivate::titleBarOptions() const | - | ||||||||||||||||||||||||
1445 | { | - | ||||||||||||||||||||||||
1446 | const QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1447 | QStyleOptionTitleBar titleBarOptions; | - | ||||||||||||||||||||||||
1448 | titleBarOptions.initFrom(q); | - | ||||||||||||||||||||||||
1449 | if (activeSubControl != QStyle::SC_None
| 0 | ||||||||||||||||||||||||
1450 | if (hoveredSubControl == activeSubControl
| 0 | ||||||||||||||||||||||||
1451 | titleBarOptions.state |= QStyle::State_Sunken; | - | ||||||||||||||||||||||||
1452 | titleBarOptions.activeSubControls = activeSubControl; | - | ||||||||||||||||||||||||
1453 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1454 | } never executed: else if (autoRaise()end of block
| 0 | ||||||||||||||||||||||||
1455 | && hoveredSubControl != QStyle::SC_TitleBarLabel
| 0 | ||||||||||||||||||||||||
1456 | titleBarOptions.state |= QStyle::State_MouseOver; | - | ||||||||||||||||||||||||
1457 | titleBarOptions.activeSubControls = hoveredSubControl; | - | ||||||||||||||||||||||||
1458 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1459 | titleBarOptions.state &= ~QStyle::State_MouseOver; | - | ||||||||||||||||||||||||
1460 | titleBarOptions.activeSubControls = QStyle::SC_None; | - | ||||||||||||||||||||||||
1461 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1462 | - | |||||||||||||||||||||||||
1463 | titleBarOptions.subControls = QStyle::SC_All; | - | ||||||||||||||||||||||||
1464 | titleBarOptions.titleBarFlags = q->windowFlags(); | - | ||||||||||||||||||||||||
1465 | titleBarOptions.titleBarState = q->windowState(); | - | ||||||||||||||||||||||||
1466 | titleBarOptions.palette = titleBarPalette; | - | ||||||||||||||||||||||||
1467 | titleBarOptions.icon = menuIcon; | - | ||||||||||||||||||||||||
1468 | - | |||||||||||||||||||||||||
1469 | if (isActive
| 0 | ||||||||||||||||||||||||
1470 | titleBarOptions.state |= QStyle::State_Active; | - | ||||||||||||||||||||||||
1471 | titleBarOptions.titleBarState |= QStyle::State_Active; | - | ||||||||||||||||||||||||
1472 | titleBarOptions.palette.setCurrentColorGroup(QPalette::Active); | - | ||||||||||||||||||||||||
1473 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1474 | titleBarOptions.state &= ~QStyle::State_Active; | - | ||||||||||||||||||||||||
1475 | titleBarOptions.palette.setCurrentColorGroup(QPalette::Inactive); | - | ||||||||||||||||||||||||
1476 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1477 | - | |||||||||||||||||||||||||
1478 | int border = hasBorder(titleBarOptions)
| 0 | ||||||||||||||||||||||||
1479 | int paintHeight = titleBarHeight(titleBarOptions); | - | ||||||||||||||||||||||||
1480 | paintHeight -= q->isMinimized()
| 0 | ||||||||||||||||||||||||
1481 | titleBarOptions.rect = QRect(border, border, q->width() - 2 * border, paintHeight); | - | ||||||||||||||||||||||||
1482 | - | |||||||||||||||||||||||||
1483 | if (!windowTitle.isEmpty()
| 0 | ||||||||||||||||||||||||
1484 | - | |||||||||||||||||||||||||
1485 | - | |||||||||||||||||||||||||
1486 | titleBarOptions.text = windowTitle; | - | ||||||||||||||||||||||||
1487 | titleBarOptions.fontMetrics = QFontMetrics(font); | - | ||||||||||||||||||||||||
1488 | int width = q->style()->subControlRect(QStyle::CC_TitleBar, &titleBarOptions, | - | ||||||||||||||||||||||||
1489 | QStyle::SC_TitleBarLabel, q).width(); | - | ||||||||||||||||||||||||
1490 | - | |||||||||||||||||||||||||
1491 | titleBarOptions.text = titleBarOptions.fontMetrics.elidedText(windowTitle, Qt::ElideRight, width); | - | ||||||||||||||||||||||||
1492 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1493 | return never executed: titleBarOptions;return titleBarOptions; never executed: return titleBarOptions; | 0 | ||||||||||||||||||||||||
1494 | } | - | ||||||||||||||||||||||||
1495 | - | |||||||||||||||||||||||||
1496 | - | |||||||||||||||||||||||||
1497 | - | |||||||||||||||||||||||||
1498 | - | |||||||||||||||||||||||||
1499 | void QMdiSubWindowPrivate::ensureWindowState(Qt::WindowState state) | - | ||||||||||||||||||||||||
1500 | { | - | ||||||||||||||||||||||||
1501 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1502 | Qt::WindowStates windowStates = q->windowState() | state; | - | ||||||||||||||||||||||||
1503 | switch (state) { | - | ||||||||||||||||||||||||
1504 | case never executed: Qt::WindowMinimized:case Qt::WindowMinimized: never executed: case Qt::WindowMinimized: | 0 | ||||||||||||||||||||||||
1505 | windowStates &= ~Qt::WindowMaximized; | - | ||||||||||||||||||||||||
1506 | windowStates &= ~Qt::WindowFullScreen; | - | ||||||||||||||||||||||||
1507 | windowStates &= ~Qt::WindowNoState; | - | ||||||||||||||||||||||||
1508 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1509 | case never executed: Qt::WindowMaximized:case Qt::WindowMaximized: never executed: case Qt::WindowMaximized: | 0 | ||||||||||||||||||||||||
1510 | windowStates &= ~Qt::WindowMinimized; | - | ||||||||||||||||||||||||
1511 | windowStates &= ~Qt::WindowFullScreen; | - | ||||||||||||||||||||||||
1512 | windowStates &= ~Qt::WindowNoState; | - | ||||||||||||||||||||||||
1513 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1514 | case never executed: Qt::WindowNoState:case Qt::WindowNoState: never executed: case Qt::WindowNoState: | 0 | ||||||||||||||||||||||||
1515 | windowStates &= ~Qt::WindowMinimized; | - | ||||||||||||||||||||||||
1516 | windowStates &= ~Qt::WindowMaximized; | - | ||||||||||||||||||||||||
1517 | windowStates &= ~Qt::WindowFullScreen; | - | ||||||||||||||||||||||||
1518 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1519 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
1520 | break; never executed: break; | 0 | ||||||||||||||||||||||||
1521 | } | - | ||||||||||||||||||||||||
1522 | if (baseWidget
| 0 | ||||||||||||||||||||||||
1523 | if (!(baseWidget->windowState() & Qt::WindowActive)
| 0 | ||||||||||||||||||||||||
1524 | baseWidget->overrideWindowState(windowStates & ~Qt::WindowActive); never executed: baseWidget->overrideWindowState(windowStates & ~Qt::WindowActive); | 0 | ||||||||||||||||||||||||
1525 | else | - | ||||||||||||||||||||||||
1526 | baseWidget->overrideWindowState(windowStates); never executed: baseWidget->overrideWindowState(windowStates); | 0 | ||||||||||||||||||||||||
1527 | } | - | ||||||||||||||||||||||||
1528 | q->overrideWindowState(windowStates); | - | ||||||||||||||||||||||||
1529 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1530 | - | |||||||||||||||||||||||||
1531 | - | |||||||||||||||||||||||||
1532 | - | |||||||||||||||||||||||||
1533 | - | |||||||||||||||||||||||||
1534 | int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const | - | ||||||||||||||||||||||||
1535 | { | - | ||||||||||||||||||||||||
1536 | const QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1537 | if (!parent
| 0 | ||||||||||||||||||||||||
1538 | || (q->isMaximized()
| 0 | ||||||||||||||||||||||||
1539 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
1540 | } | - | ||||||||||||||||||||||||
1541 | - | |||||||||||||||||||||||||
1542 | int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q); | - | ||||||||||||||||||||||||
1543 | if (hasBorder(options)
| 0 | ||||||||||||||||||||||||
1544 | height += q->isMinimized()
never executed: height += q->isMinimized() ? 8 : 4; | 0 | ||||||||||||||||||||||||
1545 | return never executed: height;return height; never executed: return height; | 0 | ||||||||||||||||||||||||
1546 | } | - | ||||||||||||||||||||||||
1547 | - | |||||||||||||||||||||||||
1548 | - | |||||||||||||||||||||||||
1549 | - | |||||||||||||||||||||||||
1550 | - | |||||||||||||||||||||||||
1551 | void QMdiSubWindowPrivate::sizeParameters(int *margin, int *minWidth) const | - | ||||||||||||||||||||||||
1552 | { | - | ||||||||||||||||||||||||
1553 | const QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1554 | Qt::WindowFlags flags = q->windowFlags(); | - | ||||||||||||||||||||||||
1555 | if (!parent
| 0 | ||||||||||||||||||||||||
1556 | *margin = 0; | - | ||||||||||||||||||||||||
1557 | *minWidth = 0; | - | ||||||||||||||||||||||||
1558 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1559 | } | - | ||||||||||||||||||||||||
1560 | - | |||||||||||||||||||||||||
1561 | if (q->isMaximized()
| 0 | ||||||||||||||||||||||||
1562 | * never executed: margin = 0;*margin = 0; never executed: *margin = 0; | 0 | ||||||||||||||||||||||||
1563 | else | - | ||||||||||||||||||||||||
1564 | * never executed: margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q);*margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); never executed: *margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); | 0 | ||||||||||||||||||||||||
1565 | - | |||||||||||||||||||||||||
1566 | QStyleOptionTitleBar opt = this->titleBarOptions(); | - | ||||||||||||||||||||||||
1567 | int tempWidth = 0; | - | ||||||||||||||||||||||||
1568 | for (int i = 0; i < NumSubControls
| 0 | ||||||||||||||||||||||||
1569 | if (SubControls[i] == QStyle::SC_TitleBarLabel
| 0 | ||||||||||||||||||||||||
1570 | tempWidth += 30; | - | ||||||||||||||||||||||||
1571 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1572 | } | - | ||||||||||||||||||||||||
1573 | QRect rect = q->style()->subControlRect(QStyle::CC_TitleBar, &opt, SubControls[i], q); | - | ||||||||||||||||||||||||
1574 | if (!rect.isValid()
| 0 | ||||||||||||||||||||||||
1575 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
1576 | tempWidth += rect.width(); | - | ||||||||||||||||||||||||
1577 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1578 | *minWidth = tempWidth; | - | ||||||||||||||||||||||||
1579 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1580 | - | |||||||||||||||||||||||||
1581 | - | |||||||||||||||||||||||||
1582 | - | |||||||||||||||||||||||||
1583 | - | |||||||||||||||||||||||||
1584 | bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const | - | ||||||||||||||||||||||||
1585 | { | - | ||||||||||||||||||||||||
1586 | const QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1587 | if (q->window()->testAttribute(Qt::WA_CanHostQMdiSubWindowTitleBar)
| 0 | ||||||||||||||||||||||||
1588 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1589 | - | |||||||||||||||||||||||||
1590 | if (isChildOfTabbedQMdiArea(q)
| 0 | ||||||||||||||||||||||||
1591 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1592 | - | |||||||||||||||||||||||||
1593 | - | |||||||||||||||||||||||||
1594 | - | |||||||||||||||||||||||||
1595 | - | |||||||||||||||||||||||||
1596 | - | |||||||||||||||||||||||||
1597 | if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q)
| 0 | ||||||||||||||||||||||||
1598 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1599 | - | |||||||||||||||||||||||||
1600 | - | |||||||||||||||||||||||||
1601 | - | |||||||||||||||||||||||||
1602 | - | |||||||||||||||||||||||||
1603 | QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window()); | - | ||||||||||||||||||||||||
1604 | if (!mainWindow
| 0 | ||||||||||||||||||||||||
1605 | || mainWindow->menuWidget()->isHidden()
| 0 | ||||||||||||||||||||||||
1606 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1607 | - | |||||||||||||||||||||||||
1608 | return never executed: isChildOfQMdiSubWindow(q);return isChildOfQMdiSubWindow(q); never executed: return isChildOfQMdiSubWindow(q); | 0 | ||||||||||||||||||||||||
1609 | - | |||||||||||||||||||||||||
1610 | - | |||||||||||||||||||||||||
1611 | } | - | ||||||||||||||||||||||||
1612 | - | |||||||||||||||||||||||||
1613 | - | |||||||||||||||||||||||||
1614 | - | |||||||||||||||||||||||||
1615 | - | |||||||||||||||||||||||||
1616 | - | |||||||||||||||||||||||||
1617 | - | |||||||||||||||||||||||||
1618 | void QMdiSubWindowPrivate::showButtonsInMenuBar(QMenuBar *menuBar) | - | ||||||||||||||||||||||||
1619 | { | - | ||||||||||||||||||||||||
1620 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1621 | ((!(q->isMaximized() && !drawTitleBarWhenMaximized())) ? qt_assert("q->isMaximized() && !drawTitleBarWhenMaximized()",__FILE__,1800) : qt_noop()); | - | ||||||||||||||||||||||||
1622 | - | |||||||||||||||||||||||||
1623 | if (isChildOfTabbedQMdiArea(q)
| 0 | ||||||||||||||||||||||||
1624 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1625 | - | |||||||||||||||||||||||||
1626 | removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
1627 | if (!controlContainer
| 0 | ||||||||||||||||||||||||
1628 | controlContainer = new ControlContainer(q); never executed: controlContainer = new ControlContainer(q); | 0 | ||||||||||||||||||||||||
1629 | - | |||||||||||||||||||||||||
1630 | ignoreWindowTitleChange = true; | - | ||||||||||||||||||||||||
1631 | controlContainer->showButtonsInMenuBar(menuBar); | - | ||||||||||||||||||||||||
1632 | ignoreWindowTitleChange = false; | - | ||||||||||||||||||||||||
1633 | - | |||||||||||||||||||||||||
1634 | QWidget *topLevelWindow = q->window(); | - | ||||||||||||||||||||||||
1635 | topLevelWindow->setWindowModified(q->isWindowModified()); | - | ||||||||||||||||||||||||
1636 | topLevelWindow->installEventFilter(q); | - | ||||||||||||||||||||||||
1637 | - | |||||||||||||||||||||||||
1638 | int buttonHeight = 0; | - | ||||||||||||||||||||||||
1639 | if (controlContainer->controllerWidget()
| 0 | ||||||||||||||||||||||||
1640 | buttonHeight = controlContainer->controllerWidget()->height(); never executed: buttonHeight = controlContainer->controllerWidget()->height(); | 0 | ||||||||||||||||||||||||
1641 | else if (controlContainer->systemMenuLabel()
| 0 | ||||||||||||||||||||||||
1642 | buttonHeight = controlContainer->systemMenuLabel()->height(); never executed: buttonHeight = controlContainer->systemMenuLabel()->height(); | 0 | ||||||||||||||||||||||||
1643 | - | |||||||||||||||||||||||||
1644 | - | |||||||||||||||||||||||||
1645 | if (menuBar
| 0 | ||||||||||||||||||||||||
1646 | && topLevelWindow->layout()
| 0 | ||||||||||||||||||||||||
1647 | - | |||||||||||||||||||||||||
1648 | - | |||||||||||||||||||||||||
1649 | QEvent event(QEvent::LayoutRequest); | - | ||||||||||||||||||||||||
1650 | QApplication::sendEvent(topLevelWindow, &event); | - | ||||||||||||||||||||||||
1651 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1652 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1653 | - | |||||||||||||||||||||||||
1654 | - | |||||||||||||||||||||||||
1655 | - | |||||||||||||||||||||||||
1656 | - | |||||||||||||||||||||||||
1657 | void QMdiSubWindowPrivate::removeButtonsFromMenuBar() | - | ||||||||||||||||||||||||
1658 | { | - | ||||||||||||||||||||||||
1659 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1660 | - | |||||||||||||||||||||||||
1661 | if (!controlContainer
| 0 | ||||||||||||||||||||||||
1662 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1663 | - | |||||||||||||||||||||||||
1664 | QMenuBar *currentMenuBar = 0; | - | ||||||||||||||||||||||||
1665 | - | |||||||||||||||||||||||||
1666 | if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window())
| 0 | ||||||||||||||||||||||||
1667 | - | |||||||||||||||||||||||||
1668 | - | |||||||||||||||||||||||||
1669 | currentMenuBar = qobject_cast<QMenuBar *>(mainWindow->menuWidget()); | - | ||||||||||||||||||||||||
1670 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1671 | - | |||||||||||||||||||||||||
1672 | - | |||||||||||||||||||||||||
1673 | ignoreWindowTitleChange = true; | - | ||||||||||||||||||||||||
1674 | controlContainer->removeButtonsFromMenuBar(currentMenuBar); | - | ||||||||||||||||||||||||
1675 | ignoreWindowTitleChange = false; | - | ||||||||||||||||||||||||
1676 | - | |||||||||||||||||||||||||
1677 | QWidget *topLevelWindow = q->window(); | - | ||||||||||||||||||||||||
1678 | topLevelWindow->removeEventFilter(q); | - | ||||||||||||||||||||||||
1679 | if (baseWidget
| 0 | ||||||||||||||||||||||||
1680 | topLevelWindow->setWindowModified(false); never executed: topLevelWindow->setWindowModified(false); | 0 | ||||||||||||||||||||||||
1681 | originalTitle = QString::null; | - | ||||||||||||||||||||||||
1682 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1683 | - | |||||||||||||||||||||||||
1684 | - | |||||||||||||||||||||||||
1685 | - | |||||||||||||||||||||||||
1686 | void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild) | - | ||||||||||||||||||||||||
1687 | { | - | ||||||||||||||||||||||||
1688 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1689 | if (isRequestFromChild
| 0 | ||||||||||||||||||||||||
1690 | && lastChildWindowTitle != q->windowTitle()
| 0 | ||||||||||||||||||||||||
1691 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1692 | } | - | ||||||||||||||||||||||||
1693 | - | |||||||||||||||||||||||||
1694 | QWidget *titleWidget = 0; | - | ||||||||||||||||||||||||
1695 | if (isRequestFromChild
| 0 | ||||||||||||||||||||||||
1696 | titleWidget = baseWidget; never executed: titleWidget = baseWidget; | 0 | ||||||||||||||||||||||||
1697 | else | - | ||||||||||||||||||||||||
1698 | titleWidget = q; never executed: titleWidget = q; | 0 | ||||||||||||||||||||||||
1699 | if (!titleWidget
| 0 | ||||||||||||||||||||||||
1700 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1701 | - | |||||||||||||||||||||||||
1702 | ignoreWindowTitleChange = true; | - | ||||||||||||||||||||||||
1703 | q->setWindowTitle(titleWidget->windowTitle()); | - | ||||||||||||||||||||||||
1704 | if (q->maximizedButtonsWidget()
| 0 | ||||||||||||||||||||||||
1705 | setNewWindowTitle(); never executed: setNewWindowTitle(); | 0 | ||||||||||||||||||||||||
1706 | ignoreWindowTitleChange = false; | - | ||||||||||||||||||||||||
1707 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1708 | - | |||||||||||||||||||||||||
1709 | - | |||||||||||||||||||||||||
1710 | void QMdiSubWindowPrivate::enterRubberBandMode() | - | ||||||||||||||||||||||||
1711 | { | - | ||||||||||||||||||||||||
1712 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1713 | if (q->isMaximized()
| 0 | ||||||||||||||||||||||||
1714 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1715 | ((!(oldGeometry.isValid())) ? qt_assert("oldGeometry.isValid()",__FILE__,1894) : qt_noop()); | - | ||||||||||||||||||||||||
1716 | ((!(parent)) ? qt_assert("parent",__FILE__,1895) : qt_noop()); | - | ||||||||||||||||||||||||
1717 | if (!rubberBand
| 0 | ||||||||||||||||||||||||
1718 | rubberBand = new QRubberBand(QRubberBand::Rectangle, q->parentWidget()); | - | ||||||||||||||||||||||||
1719 | - | |||||||||||||||||||||||||
1720 | rubberBand->setObjectName(QLatin1String("qt_rubberband")); | - | ||||||||||||||||||||||||
1721 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1722 | QPoint rubberBandPos = q->mapToParent(QPoint(0, 0)); | - | ||||||||||||||||||||||||
1723 | rubberBand->setGeometry(rubberBandPos.x(), rubberBandPos.y(), | - | ||||||||||||||||||||||||
1724 | oldGeometry.width(), oldGeometry.height()); | - | ||||||||||||||||||||||||
1725 | rubberBand->show(); | - | ||||||||||||||||||||||||
1726 | isInRubberBandMode = true; | - | ||||||||||||||||||||||||
1727 | q->grabMouse(); | - | ||||||||||||||||||||||||
1728 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1729 | - | |||||||||||||||||||||||||
1730 | void QMdiSubWindowPrivate::leaveRubberBandMode() | - | ||||||||||||||||||||||||
1731 | { | - | ||||||||||||||||||||||||
1732 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1733 | ((!(rubberBand)) ? qt_assert("rubberBand",__FILE__,1912) : qt_noop()); | - | ||||||||||||||||||||||||
1734 | ((!(isInRubberBandMode)) ? qt_assert("isInRubberBandMode",__FILE__,1913) : qt_noop()); | - | ||||||||||||||||||||||||
1735 | q->releaseMouse(); | - | ||||||||||||||||||||||||
1736 | isInRubberBandMode = false; | - | ||||||||||||||||||||||||
1737 | q->setGeometry(rubberBand->geometry()); | - | ||||||||||||||||||||||||
1738 | rubberBand->hide(); | - | ||||||||||||||||||||||||
1739 | currentOperation = None; | - | ||||||||||||||||||||||||
1740 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1741 | - | |||||||||||||||||||||||||
1742 | - | |||||||||||||||||||||||||
1743 | - | |||||||||||||||||||||||||
1744 | QPalette QMdiSubWindowPrivate::desktopPalette() const | - | ||||||||||||||||||||||||
1745 | { | - | ||||||||||||||||||||||||
1746 | const QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1747 | QPalette newPalette = q->palette(); | - | ||||||||||||||||||||||||
1748 | - | |||||||||||||||||||||||||
1749 | bool colorsInitialized = false; | - | ||||||||||||||||||||||||
1750 | if (!colorsInitialized
| 0 | ||||||||||||||||||||||||
1751 | newPalette.setColor(QPalette::Active, QPalette::Highlight, | - | ||||||||||||||||||||||||
1752 | newPalette.color(QPalette::Active, QPalette::Highlight)); | - | ||||||||||||||||||||||||
1753 | newPalette.setColor(QPalette::Active, QPalette::Base, | - | ||||||||||||||||||||||||
1754 | newPalette.color(QPalette::Active, QPalette::Highlight)); | - | ||||||||||||||||||||||||
1755 | newPalette.setColor(QPalette::Inactive, QPalette::Highlight, | - | ||||||||||||||||||||||||
1756 | newPalette.color(QPalette::Inactive, QPalette::Dark)); | - | ||||||||||||||||||||||||
1757 | newPalette.setColor(QPalette::Inactive, QPalette::Base, | - | ||||||||||||||||||||||||
1758 | newPalette.color(QPalette::Inactive, QPalette::Dark)); | - | ||||||||||||||||||||||||
1759 | newPalette.setColor(QPalette::Inactive, QPalette::HighlightedText, | - | ||||||||||||||||||||||||
1760 | newPalette.color(QPalette::Inactive, QPalette::Window)); | - | ||||||||||||||||||||||||
1761 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1762 | - | |||||||||||||||||||||||||
1763 | return never executed: newPalette;return newPalette; never executed: return newPalette; | 0 | ||||||||||||||||||||||||
1764 | } | - | ||||||||||||||||||||||||
1765 | - | |||||||||||||||||||||||||
1766 | void QMdiSubWindowPrivate::updateActions() | - | ||||||||||||||||||||||||
1767 | { | - | ||||||||||||||||||||||||
1768 | Qt::WindowFlags windowFlags = q_func()->windowFlags(); | - | ||||||||||||||||||||||||
1769 | - | |||||||||||||||||||||||||
1770 | for (int i = 0; i < NumWindowStateActions
| 0 | ||||||||||||||||||||||||
1771 | setVisible(WindowStateAction(i), false); never executed: setVisible(WindowStateAction(i), false); | 0 | ||||||||||||||||||||||||
1772 | - | |||||||||||||||||||||||||
1773 | if (windowFlags & Qt::FramelessWindowHint
| 0 | ||||||||||||||||||||||||
1774 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1775 | - | |||||||||||||||||||||||||
1776 | setVisible(StayOnTopAction, true); | - | ||||||||||||||||||||||||
1777 | setVisible(MoveAction, moveEnabled); | - | ||||||||||||||||||||||||
1778 | setVisible(ResizeAction, resizeEnabled); | - | ||||||||||||||||||||||||
1779 | - | |||||||||||||||||||||||||
1780 | - | |||||||||||||||||||||||||
1781 | if (windowFlags & Qt::WindowSystemMenuHint
| 0 | ||||||||||||||||||||||||
1782 | setVisible(CloseAction, true); never executed: setVisible(CloseAction, true); | 0 | ||||||||||||||||||||||||
1783 | - | |||||||||||||||||||||||||
1784 | - | |||||||||||||||||||||||||
1785 | if (windowFlags & (Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint)
| 0 | ||||||||||||||||||||||||
1786 | setVisible(RestoreAction, true); never executed: setVisible(RestoreAction, true); | 0 | ||||||||||||||||||||||||
1787 | - | |||||||||||||||||||||||||
1788 | - | |||||||||||||||||||||||||
1789 | if (windowFlags & Qt::WindowMinimizeButtonHint
| 0 | ||||||||||||||||||||||||
1790 | setVisible(MinimizeAction, true); never executed: setVisible(MinimizeAction, true); | 0 | ||||||||||||||||||||||||
1791 | - | |||||||||||||||||||||||||
1792 | - | |||||||||||||||||||||||||
1793 | if (windowFlags & Qt::WindowMaximizeButtonHint
| 0 | ||||||||||||||||||||||||
1794 | setVisible(MaximizeAction, true); never executed: setVisible(MaximizeAction, true); | 0 | ||||||||||||||||||||||||
1795 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1796 | - | |||||||||||||||||||||||||
1797 | void QMdiSubWindowPrivate::setFocusWidget() | - | ||||||||||||||||||||||||
1798 | { | - | ||||||||||||||||||||||||
1799 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1800 | if (!baseWidget
| 0 | ||||||||||||||||||||||||
1801 | q->setFocus(); | - | ||||||||||||||||||||||||
1802 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1803 | } | - | ||||||||||||||||||||||||
1804 | - | |||||||||||||||||||||||||
1805 | - | |||||||||||||||||||||||||
1806 | - | |||||||||||||||||||||||||
1807 | - | |||||||||||||||||||||||||
1808 | if (focusInReason == Qt::TabFocusReason
| 0 | ||||||||||||||||||||||||
1809 | q->focusNextChild(); | - | ||||||||||||||||||||||||
1810 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1811 | } | - | ||||||||||||||||||||||||
1812 | - | |||||||||||||||||||||||||
1813 | - | |||||||||||||||||||||||||
1814 | if (focusInReason == Qt::BacktabFocusReason
| 0 | ||||||||||||||||||||||||
1815 | q->focusPreviousChild(); | - | ||||||||||||||||||||||||
1816 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1817 | } | - | ||||||||||||||||||||||||
1818 | - | |||||||||||||||||||||||||
1819 | if (!(q->windowState() & Qt::WindowMinimized)
| 0 | ||||||||||||||||||||||||
1820 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1821 | - | |||||||||||||||||||||||||
1822 | if (QWidget *focusWidget = baseWidget->focusWidget()
| 0 | ||||||||||||||||||||||||
1823 | if (!focusWidget->hasFocus()
| 0 | ||||||||||||||||||||||||
1824 | && focusWidget->isVisible()
| 0 | ||||||||||||||||||||||||
1825 | && focusWidget->focusPolicy() != Qt::NoFocus
| 0 | ||||||||||||||||||||||||
1826 | focusWidget->setFocus(); | - | ||||||||||||||||||||||||
1827 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
1828 | q->setFocus(); | - | ||||||||||||||||||||||||
1829 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1830 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1831 | } | - | ||||||||||||||||||||||||
1832 | - | |||||||||||||||||||||||||
1833 | QWidget *focusWidget = q->nextInFocusChain(); | - | ||||||||||||||||||||||||
1834 | while (focusWidget
| 0 | ||||||||||||||||||||||||
1835 | focusWidget = focusWidget->nextInFocusChain(); never executed: focusWidget = focusWidget->nextInFocusChain(); | 0 | ||||||||||||||||||||||||
1836 | if (focusWidget
| 0 | ||||||||||||||||||||||||
1837 | focusWidget->setFocus(); never executed: focusWidget->setFocus(); | 0 | ||||||||||||||||||||||||
1838 | else if (baseWidget->focusPolicy() != Qt::NoFocus
| 0 | ||||||||||||||||||||||||
1839 | baseWidget->setFocus(); never executed: baseWidget->setFocus(); | 0 | ||||||||||||||||||||||||
1840 | else if (!q->hasFocus()
| 0 | ||||||||||||||||||||||||
1841 | q->setFocus(); never executed: q->setFocus(); | 0 | ||||||||||||||||||||||||
1842 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1843 | - | |||||||||||||||||||||||||
1844 | bool QMdiSubWindowPrivate::restoreFocus() | - | ||||||||||||||||||||||||
1845 | { | - | ||||||||||||||||||||||||
1846 | if (restoreFocusWidget.isNull()
| 0 | ||||||||||||||||||||||||
1847 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||
1848 | QWidget *candidate = restoreFocusWidget; | - | ||||||||||||||||||||||||
1849 | restoreFocusWidget.clear(); | - | ||||||||||||||||||||||||
1850 | if (!candidate->hasFocus()
| 0 | ||||||||||||||||||||||||
1851 | && candidate->isVisible()
| 0 | ||||||||||||||||||||||||
1852 | && candidate->focusPolicy() != Qt::NoFocus
| 0 | ||||||||||||||||||||||||
1853 | candidate->setFocus(); | - | ||||||||||||||||||||||||
1854 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||
1855 | } | - | ||||||||||||||||||||||||
1856 | return never executed: candidate->hasFocus();return candidate->hasFocus(); never executed: return candidate->hasFocus(); | 0 | ||||||||||||||||||||||||
1857 | } | - | ||||||||||||||||||||||||
1858 | - | |||||||||||||||||||||||||
1859 | - | |||||||||||||||||||||||||
1860 | - | |||||||||||||||||||||||||
1861 | - | |||||||||||||||||||||||||
1862 | void QMdiSubWindowPrivate::setWindowFlags(Qt::WindowFlags windowFlags) | - | ||||||||||||||||||||||||
1863 | { | - | ||||||||||||||||||||||||
1864 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1865 | - | |||||||||||||||||||||||||
1866 | if (!parent
| 0 | ||||||||||||||||||||||||
1867 | QWidgetPrivate::setWindowFlags(windowFlags); | - | ||||||||||||||||||||||||
1868 | return; never executed: return; | 0 | ||||||||||||||||||||||||
1869 | } | - | ||||||||||||||||||||||||
1870 | - | |||||||||||||||||||||||||
1871 | Qt::WindowFlags windowType = windowFlags & Qt::WindowType_Mask; | - | ||||||||||||||||||||||||
1872 | if (windowType == Qt::Dialog
| 0 | ||||||||||||||||||||||||
1873 | windowFlags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint; never executed: windowFlags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint; | 0 | ||||||||||||||||||||||||
1874 | - | |||||||||||||||||||||||||
1875 | - | |||||||||||||||||||||||||
1876 | if (!(windowFlags & CustomizeWindowFlags)
| 0 | ||||||||||||||||||||||||
1877 | windowFlags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint; never executed: windowFlags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint; | 0 | ||||||||||||||||||||||||
1878 | else if (windowFlags & Qt::FramelessWindowHint
| 0 | ||||||||||||||||||||||||
1879 | windowFlags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint; never executed: windowFlags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint; | 0 | ||||||||||||||||||||||||
1880 | else if (windowFlags & Qt::FramelessWindowHint
| 0 | ||||||||||||||||||||||||
1881 | windowFlags = Qt::FramelessWindowHint; never executed: windowFlags = Qt::FramelessWindowHint; | 0 | ||||||||||||||||||||||||
1882 | - | |||||||||||||||||||||||||
1883 | windowFlags &= ~windowType; | - | ||||||||||||||||||||||||
1884 | windowFlags &= ~Qt::WindowFullscreenButtonHint; | - | ||||||||||||||||||||||||
1885 | windowFlags |= Qt::SubWindow; | - | ||||||||||||||||||||||||
1886 | - | |||||||||||||||||||||||||
1887 | - | |||||||||||||||||||||||||
1888 | if (QAction *stayOnTopAction = actions[QMdiSubWindowPrivate::StayOnTopAction]
| 0 | ||||||||||||||||||||||||
1889 | if (windowFlags & Qt::WindowStaysOnTopHint
| 0 | ||||||||||||||||||||||||
1890 | stayOnTopAction->setChecked(true); never executed: stayOnTopAction->setChecked(true); | 0 | ||||||||||||||||||||||||
1891 | else | - | ||||||||||||||||||||||||
1892 | stayOnTopAction->setChecked(false); never executed: stayOnTopAction->setChecked(false); | 0 | ||||||||||||||||||||||||
1893 | } | - | ||||||||||||||||||||||||
1894 | - | |||||||||||||||||||||||||
1895 | - | |||||||||||||||||||||||||
1896 | - | |||||||||||||||||||||||||
1897 | if ((
| 0 | ||||||||||||||||||||||||
1898 | delete sizeGrip; never executed: delete sizeGrip; | 0 | ||||||||||||||||||||||||
1899 | - | |||||||||||||||||||||||||
1900 | - | |||||||||||||||||||||||||
1901 | QWidgetPrivate::setWindowFlags(windowFlags); | - | ||||||||||||||||||||||||
1902 | updateGeometryConstraints(); | - | ||||||||||||||||||||||||
1903 | updateActions(); | - | ||||||||||||||||||||||||
1904 | QSize currentSize = q->size(); | - | ||||||||||||||||||||||||
1905 | if (q->isVisible()
| 0 | ||||||||||||||||||||||||
1906 | || currentSize.height() < internalMinimumSize.height()
| 0 | ||||||||||||||||||||||||
1907 | q->resize(currentSize.expandedTo(internalMinimumSize)); | - | ||||||||||||||||||||||||
1908 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1909 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1910 | - | |||||||||||||||||||||||||
1911 | void QMdiSubWindowPrivate::setVisible(WindowStateAction action, bool visible) | - | ||||||||||||||||||||||||
1912 | { | - | ||||||||||||||||||||||||
1913 | - | |||||||||||||||||||||||||
1914 | if (actions[action]
| 0 | ||||||||||||||||||||||||
1915 | actions[action]->setVisible(visible); never executed: actions[action]->setVisible(visible); | 0 | ||||||||||||||||||||||||
1916 | - | |||||||||||||||||||||||||
1917 | - | |||||||||||||||||||||||||
1918 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
1919 | if (!controlContainer
| 0 | ||||||||||||||||||||||||
1920 | controlContainer = new ControlContainer(q); never executed: controlContainer = new ControlContainer(q); | 0 | ||||||||||||||||||||||||
1921 | - | |||||||||||||||||||||||||
1922 | if (ControllerWidget *ctrlWidget = qobject_cast<ControllerWidget *>
| 0 | ||||||||||||||||||||||||
1923 | (controlContainer->controllerWidget())
| 0 | ||||||||||||||||||||||||
1924 | ctrlWidget->setControlVisible(action, visible); | - | ||||||||||||||||||||||||
1925 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1926 | } never executed: end of block | 0 | ||||||||||||||||||||||||
1927 | - | |||||||||||||||||||||||||
1928 | - | |||||||||||||||||||||||||
1929 | void QMdiSubWindowPrivate::setEnabled(WindowStateAction action, bool enable) | -< |