| 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) | - | ||||||||||||||||||||||||
| 1930 | { | - | ||||||||||||||||||||||||
| 1931 | if (actions[action]
| 0 | ||||||||||||||||||||||||
| 1932 | actions[action]->setEnabled(enable); never executed: actions[action]->setEnabled(enable); | 0 | ||||||||||||||||||||||||
| 1933 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1934 | - | |||||||||||||||||||||||||
| 1935 | - | |||||||||||||||||||||||||
| 1936 | void QMdiSubWindowPrivate::addToSystemMenu(WindowStateAction action, const QString &text, | - | ||||||||||||||||||||||||
| 1937 | const char *slot) | - | ||||||||||||||||||||||||
| 1938 | { | - | ||||||||||||||||||||||||
| 1939 | if (!systemMenu
| 0 | ||||||||||||||||||||||||
| 1940 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1941 | actions[action] = systemMenu->addAction(text, q_func(), slot); | - | ||||||||||||||||||||||||
| 1942 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1943 | - | |||||||||||||||||||||||||
| 1944 | - | |||||||||||||||||||||||||
| 1945 | - | |||||||||||||||||||||||||
| 1946 | - | |||||||||||||||||||||||||
| 1947 | - | |||||||||||||||||||||||||
| 1948 | - | |||||||||||||||||||||||||
| 1949 | QSize QMdiSubWindowPrivate::iconSize() const | - | ||||||||||||||||||||||||
| 1950 | { | - | ||||||||||||||||||||||||
| 1951 | const QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
| 1952 | if (!parent
| 0 | ||||||||||||||||||||||||
| 1953 | return never executed: QSize(-1, -1);return QSize(-1, -1);never executed: return QSize(-1, -1); | 0 | ||||||||||||||||||||||||
| 1954 | return never executed: QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight());return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight());never executed: return QSize(q->style()->pixelMetric(QStyle::PM_MdiSubWindowMinimizedWidth, 0, q), titleBarHeight()); | 0 | ||||||||||||||||||||||||
| 1955 | } | - | ||||||||||||||||||||||||
| 1956 | - | |||||||||||||||||||||||||
| 1957 | - | |||||||||||||||||||||||||
| 1958 | - | |||||||||||||||||||||||||
| 1959 | - | |||||||||||||||||||||||||
| 1960 | - | |||||||||||||||||||||||||
| 1961 | - | |||||||||||||||||||||||||
| 1962 | void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip) | - | ||||||||||||||||||||||||
| 1963 | { | - | ||||||||||||||||||||||||
| 1964 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
| 1965 | if (!newSizeGrip
| 0 | ||||||||||||||||||||||||
| 1966 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1967 | - | |||||||||||||||||||||||||
| 1968 | if (layout
| 0 | ||||||||||||||||||||||||
| 1969 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1970 | newSizeGrip->setFixedSize(newSizeGrip->sizeHint()); | - | ||||||||||||||||||||||||
| 1971 | bool putSizeGripInLayout = layout
| 0 | ||||||||||||||||||||||||
| 1972 | - | |||||||||||||||||||||||||
| 1973 | - | |||||||||||||||||||||||||
| 1974 | - | |||||||||||||||||||||||||
| 1975 | - | |||||||||||||||||||||||||
| 1976 | if (putSizeGripInLayout
| 0 | ||||||||||||||||||||||||
| 1977 | layout->addWidget(newSizeGrip); | - | ||||||||||||||||||||||||
| 1978 | layout->setAlignment(newSizeGrip, Qt::AlignBottom | Qt::AlignRight); | - | ||||||||||||||||||||||||
| 1979 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1980 | newSizeGrip->setParent(q); | - | ||||||||||||||||||||||||
| 1981 | newSizeGrip->move(q->isLeftToRight() ? q->width() - newSizeGrip->width() : 0, | - | ||||||||||||||||||||||||
| 1982 | q->height() - newSizeGrip->height()); | - | ||||||||||||||||||||||||
| 1983 | sizeGrip = newSizeGrip; | - | ||||||||||||||||||||||||
| 1984 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1985 | newSizeGrip->raise(); | - | ||||||||||||||||||||||||
| 1986 | updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 1987 | newSizeGrip->installEventFilter(q); | - | ||||||||||||||||||||||||
| 1988 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1989 | - | |||||||||||||||||||||||||
| 1990 | - | |||||||||||||||||||||||||
| 1991 | - | |||||||||||||||||||||||||
| 1992 | - | |||||||||||||||||||||||||
| 1993 | void QMdiSubWindowPrivate::setSizeGripVisible(bool visible) const | - | ||||||||||||||||||||||||
| 1994 | { | - | ||||||||||||||||||||||||
| 1995 | - | |||||||||||||||||||||||||
| 1996 | const QList<QSizeGrip *> sizeGrips = q_func()->findChildren<QSizeGrip *>(); | - | ||||||||||||||||||||||||
| 1997 | for (QSizeGrip *grip : sizeGrips) | - | ||||||||||||||||||||||||
| 1998 | grip->setVisible(visible); never executed: grip->setVisible(visible); | 0 | ||||||||||||||||||||||||
| 1999 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2000 | - | |||||||||||||||||||||||||
| 2001 | - | |||||||||||||||||||||||||
| 2002 | - | |||||||||||||||||||||||||
| 2003 | - | |||||||||||||||||||||||||
| 2004 | - | |||||||||||||||||||||||||
| 2005 | - | |||||||||||||||||||||||||
| 2006 | void QMdiSubWindowPrivate::updateInternalWindowTitle() | - | ||||||||||||||||||||||||
| 2007 | { | - | ||||||||||||||||||||||||
| 2008 | QMdiSubWindow * const q = q_func(); | - | ||||||||||||||||||||||||
| 2009 | if (q->isWindowModified()
| 0 | ||||||||||||||||||||||||
| 2010 | windowTitle = q->windowTitle(); | - | ||||||||||||||||||||||||
| 2011 | windowTitle.replace(QLatin1String("[*]"), QLatin1String("*")); | - | ||||||||||||||||||||||||
| 2012 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2013 | windowTitle = qt_setWindowTitle_helperHelper(q->windowTitle(), q); | - | ||||||||||||||||||||||||
| 2014 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2015 | q->update(0, 0, q->width(), titleBarHeight()); | - | ||||||||||||||||||||||||
| 2016 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2017 | QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags) | - | ||||||||||||||||||||||||
| 2018 | : QWidget(*new QMdiSubWindowPrivate, parent, 0) | - | ||||||||||||||||||||||||
| 2019 | { | - | ||||||||||||||||||||||||
| 2020 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2021 | - | |||||||||||||||||||||||||
| 2022 | d->createSystemMenu(); | - | ||||||||||||||||||||||||
| 2023 | addActions(d->systemMenu->actions()); | - | ||||||||||||||||||||||||
| 2024 | - | |||||||||||||||||||||||||
| 2025 | d->setWindowFlags(flags); | - | ||||||||||||||||||||||||
| 2026 | setBackgroundRole(QPalette::Window); | - | ||||||||||||||||||||||||
| 2027 | setAutoFillBackground(true); | - | ||||||||||||||||||||||||
| 2028 | setMouseTracking(true); | - | ||||||||||||||||||||||||
| 2029 | setLayout(new QVBoxLayout); | - | ||||||||||||||||||||||||
| 2030 | setFocusPolicy(Qt::StrongFocus); | - | ||||||||||||||||||||||||
| 2031 | layout()->setMargin(0); | - | ||||||||||||||||||||||||
| 2032 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2033 | setAttribute(Qt::WA_Resized, false); | - | ||||||||||||||||||||||||
| 2034 | d->titleBarPalette = d->desktopPalette(); | - | ||||||||||||||||||||||||
| 2035 | d->font = QApplication::font("QMdiSubWindowTitleBar"); | - | ||||||||||||||||||||||||
| 2036 | - | |||||||||||||||||||||||||
| 2037 | - | |||||||||||||||||||||||||
| 2038 | if (windowIcon().isNull()
| 0 | ||||||||||||||||||||||||
| 2039 | d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); never executed: d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); | 0 | ||||||||||||||||||||||||
| 2040 | else | - | ||||||||||||||||||||||||
| 2041 | d->menuIcon = windowIcon(); never executed: d->menuIcon = windowIcon(); | 0 | ||||||||||||||||||||||||
| 2042 | - | |||||||||||||||||||||||||
| 2043 | connect((static_cast<QApplication *>(QCoreApplication::instance())), qFlagLocation("2""focusChanged(QWidget*,QWidget*)" "\0" __FILE__ ":" "2278"), | - | ||||||||||||||||||||||||
| 2044 | this, qFlagLocation("1""_q_processFocusChanged(QWidget*,QWidget*)" "\0" __FILE__ ":" "2279")); | - | ||||||||||||||||||||||||
| 2045 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2046 | - | |||||||||||||||||||||||||
| 2047 | - | |||||||||||||||||||||||||
| 2048 | - | |||||||||||||||||||||||||
| 2049 | - | |||||||||||||||||||||||||
| 2050 | - | |||||||||||||||||||||||||
| 2051 | - | |||||||||||||||||||||||||
| 2052 | QMdiSubWindow::~QMdiSubWindow() | - | ||||||||||||||||||||||||
| 2053 | { | - | ||||||||||||||||||||||||
| 2054 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2055 | - | |||||||||||||||||||||||||
| 2056 | d->removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 2057 | - | |||||||||||||||||||||||||
| 2058 | d->setActive(false); | - | ||||||||||||||||||||||||
| 2059 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2060 | void QMdiSubWindow::setWidget(QWidget *widget) | - | ||||||||||||||||||||||||
| 2061 | { | - | ||||||||||||||||||||||||
| 2062 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2063 | if (!widget
| 0 | ||||||||||||||||||||||||
| 2064 | d->removeBaseWidget(); | - | ||||||||||||||||||||||||
| 2065 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2066 | } | - | ||||||||||||||||||||||||
| 2067 | - | |||||||||||||||||||||||||
| 2068 | if (__builtin_expect(!!(widget == d->baseWidget), false)
| 0 | ||||||||||||||||||||||||
| 2069 | QMessageLogger(__FILE__, 2316, __PRETTY_FUNCTION__).warning("QMdiSubWindow::setWidget: widget is already set"); | - | ||||||||||||||||||||||||
| 2070 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2071 | } | - | ||||||||||||||||||||||||
| 2072 | - | |||||||||||||||||||||||||
| 2073 | bool wasResized = testAttribute(Qt::WA_Resized); | - | ||||||||||||||||||||||||
| 2074 | d->removeBaseWidget(); | - | ||||||||||||||||||||||||
| 2075 | - | |||||||||||||||||||||||||
| 2076 | if (QLayout *layout = this->layout()
| 0 | ||||||||||||||||||||||||
| 2077 | layout->addWidget(widget); never executed: layout->addWidget(widget); | 0 | ||||||||||||||||||||||||
| 2078 | else | - | ||||||||||||||||||||||||
| 2079 | widget->setParent(this); never executed: widget->setParent(this); | 0 | ||||||||||||||||||||||||
| 2080 | - | |||||||||||||||||||||||||
| 2081 | - | |||||||||||||||||||||||||
| 2082 | QSizeGrip *sizeGrip = widget->findChild<QSizeGrip *>(); | - | ||||||||||||||||||||||||
| 2083 | if (sizeGrip
| 0 | ||||||||||||||||||||||||
| 2084 | sizeGrip->installEventFilter(this); never executed: sizeGrip->installEventFilter(this); | 0 | ||||||||||||||||||||||||
| 2085 | if (d->sizeGrip
| 0 | ||||||||||||||||||||||||
| 2086 | d->sizeGrip->raise(); never executed: d->sizeGrip->raise(); | 0 | ||||||||||||||||||||||||
| 2087 | - | |||||||||||||||||||||||||
| 2088 | - | |||||||||||||||||||||||||
| 2089 | d->baseWidget = widget; | - | ||||||||||||||||||||||||
| 2090 | d->baseWidget->installEventFilter(this); | - | ||||||||||||||||||||||||
| 2091 | - | |||||||||||||||||||||||||
| 2092 | d->ignoreWindowTitleChange = true; | - | ||||||||||||||||||||||||
| 2093 | bool isWindowModified = this->isWindowModified(); | - | ||||||||||||||||||||||||
| 2094 | if (windowTitle().isEmpty()
| 0 | ||||||||||||||||||||||||
| 2095 | d->updateWindowTitle(true); | - | ||||||||||||||||||||||||
| 2096 | isWindowModified = d->baseWidget->isWindowModified(); | - | ||||||||||||||||||||||||
| 2097 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2098 | if (!this->isWindowModified()
| 0 | ||||||||||||||||||||||||
| 2099 | && windowTitle().contains(QLatin1String("[*]"))
| 0 | ||||||||||||||||||||||||
| 2100 | setWindowModified(isWindowModified); | - | ||||||||||||||||||||||||
| 2101 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2102 | d->lastChildWindowTitle = d->baseWidget->windowTitle(); | - | ||||||||||||||||||||||||
| 2103 | d->ignoreWindowTitleChange = false; | - | ||||||||||||||||||||||||
| 2104 | - | |||||||||||||||||||||||||
| 2105 | if (windowIcon().isNull()
| 0 | ||||||||||||||||||||||||
| 2106 | setWindowIcon(d->baseWidget->windowIcon()); never executed: setWindowIcon(d->baseWidget->windowIcon()); | 0 | ||||||||||||||||||||||||
| 2107 | - | |||||||||||||||||||||||||
| 2108 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2109 | if (!wasResized
| 0 | ||||||||||||||||||||||||
| 2110 | setAttribute(Qt::WA_Resized, false); never executed: setAttribute(Qt::WA_Resized, false); | 0 | ||||||||||||||||||||||||
| 2111 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2112 | - | |||||||||||||||||||||||||
| 2113 | - | |||||||||||||||||||||||||
| 2114 | - | |||||||||||||||||||||||||
| 2115 | - | |||||||||||||||||||||||||
| 2116 | - | |||||||||||||||||||||||||
| 2117 | - | |||||||||||||||||||||||||
| 2118 | QWidget *QMdiSubWindow::widget() const | - | ||||||||||||||||||||||||
| 2119 | { | - | ||||||||||||||||||||||||
| 2120 | return never executed: d_func()->baseWidget;return d_func()->baseWidget;never executed: return d_func()->baseWidget; | 0 | ||||||||||||||||||||||||
| 2121 | } | - | ||||||||||||||||||||||||
| 2122 | - | |||||||||||||||||||||||||
| 2123 | - | |||||||||||||||||||||||||
| 2124 | - | |||||||||||||||||||||||||
| 2125 | - | |||||||||||||||||||||||||
| 2126 | - | |||||||||||||||||||||||||
| 2127 | QWidget *QMdiSubWindow::maximizedButtonsWidget() const | - | ||||||||||||||||||||||||
| 2128 | { | - | ||||||||||||||||||||||||
| 2129 | const QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2130 | if (isVisible()
| 0 | ||||||||||||||||||||||||
| 2131 | && !isChildOfTabbedQMdiArea(this)
| 0 | ||||||||||||||||||||||||
| 2132 | return never executed: d->controlContainer->controllerWidget();return d->controlContainer->controllerWidget();never executed: return d->controlContainer->controllerWidget(); | 0 | ||||||||||||||||||||||||
| 2133 | } | - | ||||||||||||||||||||||||
| 2134 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 2135 | } | - | ||||||||||||||||||||||||
| 2136 | - | |||||||||||||||||||||||||
| 2137 | - | |||||||||||||||||||||||||
| 2138 | - | |||||||||||||||||||||||||
| 2139 | - | |||||||||||||||||||||||||
| 2140 | QWidget *QMdiSubWindow::maximizedSystemMenuIconWidget() const | - | ||||||||||||||||||||||||
| 2141 | { | - | ||||||||||||||||||||||||
| 2142 | const QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2143 | if (isVisible()
| 0 | ||||||||||||||||||||||||
| 2144 | && !isChildOfTabbedQMdiArea(this)
| 0 | ||||||||||||||||||||||||
| 2145 | return never executed: d->controlContainer->systemMenuLabel();return d->controlContainer->systemMenuLabel();never executed: return d->controlContainer->systemMenuLabel(); | 0 | ||||||||||||||||||||||||
| 2146 | } | - | ||||||||||||||||||||||||
| 2147 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 2148 | } | - | ||||||||||||||||||||||||
| 2149 | - | |||||||||||||||||||||||||
| 2150 | - | |||||||||||||||||||||||||
| 2151 | - | |||||||||||||||||||||||||
| 2152 | - | |||||||||||||||||||||||||
| 2153 | - | |||||||||||||||||||||||||
| 2154 | - | |||||||||||||||||||||||||
| 2155 | - | |||||||||||||||||||||||||
| 2156 | bool QMdiSubWindow::isShaded() const | - | ||||||||||||||||||||||||
| 2157 | { | - | ||||||||||||||||||||||||
| 2158 | return never executed: d_func()->isShadeMode;return d_func()->isShadeMode;never executed: return d_func()->isShadeMode; | 0 | ||||||||||||||||||||||||
| 2159 | } | - | ||||||||||||||||||||||||
| 2160 | - | |||||||||||||||||||||||||
| 2161 | - | |||||||||||||||||||||||||
| 2162 | - | |||||||||||||||||||||||||
| 2163 | - | |||||||||||||||||||||||||
| 2164 | - | |||||||||||||||||||||||||
| 2165 | - | |||||||||||||||||||||||||
| 2166 | - | |||||||||||||||||||||||||
| 2167 | void QMdiSubWindow::setOption(SubWindowOption option, bool on) | - | ||||||||||||||||||||||||
| 2168 | { | - | ||||||||||||||||||||||||
| 2169 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2170 | d->options.setFlag(option, on); | - | ||||||||||||||||||||||||
| 2171 | - | |||||||||||||||||||||||||
| 2172 | - | |||||||||||||||||||||||||
| 2173 | if ((
| 0 | ||||||||||||||||||||||||
| 2174 | d->leaveRubberBandMode(); never executed: d->leaveRubberBandMode(); | 0 | ||||||||||||||||||||||||
| 2175 | - | |||||||||||||||||||||||||
| 2176 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2177 | - | |||||||||||||||||||||||||
| 2178 | - | |||||||||||||||||||||||||
| 2179 | - | |||||||||||||||||||||||||
| 2180 | - | |||||||||||||||||||||||||
| 2181 | - | |||||||||||||||||||||||||
| 2182 | - | |||||||||||||||||||||||||
| 2183 | bool QMdiSubWindow::testOption(SubWindowOption option) const | - | ||||||||||||||||||||||||
| 2184 | { | - | ||||||||||||||||||||||||
| 2185 | return never executed: d_func()->options & option;return d_func()->options & option;never executed: return d_func()->options & option; | 0 | ||||||||||||||||||||||||
| 2186 | } | - | ||||||||||||||||||||||||
| 2187 | int QMdiSubWindow::keyboardSingleStep() const | - | ||||||||||||||||||||||||
| 2188 | { | - | ||||||||||||||||||||||||
| 2189 | return never executed: d_func()->keyboardSingleStep;return d_func()->keyboardSingleStep;never executed: return d_func()->keyboardSingleStep; | 0 | ||||||||||||||||||||||||
| 2190 | } | - | ||||||||||||||||||||||||
| 2191 | - | |||||||||||||||||||||||||
| 2192 | void QMdiSubWindow::setKeyboardSingleStep(int step) | - | ||||||||||||||||||||||||
| 2193 | { | - | ||||||||||||||||||||||||
| 2194 | - | |||||||||||||||||||||||||
| 2195 | - | |||||||||||||||||||||||||
| 2196 | - | |||||||||||||||||||||||||
| 2197 | d_func()->keyboardSingleStep = step; | - | ||||||||||||||||||||||||
| 2198 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2199 | int QMdiSubWindow::keyboardPageStep() const | - | ||||||||||||||||||||||||
| 2200 | { | - | ||||||||||||||||||||||||
| 2201 | return never executed: d_func()->keyboardPageStep;return d_func()->keyboardPageStep;never executed: return d_func()->keyboardPageStep; | 0 | ||||||||||||||||||||||||
| 2202 | } | - | ||||||||||||||||||||||||
| 2203 | - | |||||||||||||||||||||||||
| 2204 | void QMdiSubWindow::setKeyboardPageStep(int step) | - | ||||||||||||||||||||||||
| 2205 | { | - | ||||||||||||||||||||||||
| 2206 | - | |||||||||||||||||||||||||
| 2207 | - | |||||||||||||||||||||||||
| 2208 | - | |||||||||||||||||||||||||
| 2209 | d_func()->keyboardPageStep = step; | - | ||||||||||||||||||||||||
| 2210 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2211 | void QMdiSubWindow::setSystemMenu(QMenu *systemMenu) | - | ||||||||||||||||||||||||
| 2212 | { | - | ||||||||||||||||||||||||
| 2213 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2214 | if (__builtin_expect(!!(systemMenu && systemMenu == d->systemMenu), false)
| 0 | ||||||||||||||||||||||||
| 2215 | QMessageLogger(__FILE__, 2511, __PRETTY_FUNCTION__).warning("QMdiSubWindow::setSystemMenu: system menu is already set"); | - | ||||||||||||||||||||||||
| 2216 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2217 | } | - | ||||||||||||||||||||||||
| 2218 | - | |||||||||||||||||||||||||
| 2219 | if (d->systemMenu
| 0 | ||||||||||||||||||||||||
| 2220 | delete d->systemMenu; | - | ||||||||||||||||||||||||
| 2221 | d->systemMenu = 0; | - | ||||||||||||||||||||||||
| 2222 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2223 | - | |||||||||||||||||||||||||
| 2224 | if (!systemMenu
| 0 | ||||||||||||||||||||||||
| 2225 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2226 | - | |||||||||||||||||||||||||
| 2227 | if (systemMenu->parent() != this
| 0 | ||||||||||||||||||||||||
| 2228 | systemMenu->setParent(this); never executed: systemMenu->setParent(this); | 0 | ||||||||||||||||||||||||
| 2229 | d->systemMenu = systemMenu; | - | ||||||||||||||||||||||||
| 2230 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2231 | QMenu *QMdiSubWindow::systemMenu() const | - | ||||||||||||||||||||||||
| 2232 | { | - | ||||||||||||||||||||||||
| 2233 | return never executed: d_func()->systemMenu;return d_func()->systemMenu;never executed: return d_func()->systemMenu; | 0 | ||||||||||||||||||||||||
| 2234 | } | - | ||||||||||||||||||||||||
| 2235 | - | |||||||||||||||||||||||||
| 2236 | - | |||||||||||||||||||||||||
| 2237 | - | |||||||||||||||||||||||||
| 2238 | - | |||||||||||||||||||||||||
| 2239 | - | |||||||||||||||||||||||||
| 2240 | - | |||||||||||||||||||||||||
| 2241 | void QMdiSubWindow::showSystemMenu() | - | ||||||||||||||||||||||||
| 2242 | { | - | ||||||||||||||||||||||||
| 2243 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2244 | if (!d->systemMenu
| 0 | ||||||||||||||||||||||||
| 2245 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2246 | - | |||||||||||||||||||||||||
| 2247 | QPoint globalPopupPos; | - | ||||||||||||||||||||||||
| 2248 | if (QWidget *icon = maximizedSystemMenuIconWidget()
| 0 | ||||||||||||||||||||||||
| 2249 | if (isLeftToRight()
| 0 | ||||||||||||||||||||||||
| 2250 | globalPopupPos = icon->mapToGlobal(QPoint(0, icon->y() + icon->height())); never executed: globalPopupPos = icon->mapToGlobal(QPoint(0, icon->y() + icon->height())); | 0 | ||||||||||||||||||||||||
| 2251 | else | - | ||||||||||||||||||||||||
| 2252 | globalPopupPos = icon->mapToGlobal(QPoint(icon->width(), icon->y() + icon->height())); never executed: globalPopupPos = icon->mapToGlobal(QPoint(icon->width(), icon->y() + icon->height())); | 0 | ||||||||||||||||||||||||
| 2253 | } else { | - | ||||||||||||||||||||||||
| 2254 | if (isLeftToRight()
| 0 | ||||||||||||||||||||||||
| 2255 | globalPopupPos = mapToGlobal(contentsRect().topLeft()); never executed: globalPopupPos = mapToGlobal(contentsRect().topLeft()); | 0 | ||||||||||||||||||||||||
| 2256 | else | - | ||||||||||||||||||||||||
| 2257 | globalPopupPos = mapToGlobal(contentsRect().topRight()) + QPoint(1, 0); never executed: globalPopupPos = mapToGlobal(contentsRect().topRight()) + QPoint(1, 0); | 0 | ||||||||||||||||||||||||
| 2258 | } | - | ||||||||||||||||||||||||
| 2259 | - | |||||||||||||||||||||||||
| 2260 | - | |||||||||||||||||||||||||
| 2261 | if (isRightToLeft()
| 0 | ||||||||||||||||||||||||
| 2262 | globalPopupPos -= QPoint(d->systemMenu->sizeHint().width(), 0); never executed: globalPopupPos -= QPoint(d->systemMenu->sizeHint().width(), 0); | 0 | ||||||||||||||||||||||||
| 2263 | d->systemMenu->popup(globalPopupPos); | - | ||||||||||||||||||||||||
| 2264 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2265 | QMdiArea *QMdiSubWindow::mdiArea() const | - | ||||||||||||||||||||||||
| 2266 | { | - | ||||||||||||||||||||||||
| 2267 | QWidget *parent = parentWidget(); | - | ||||||||||||||||||||||||
| 2268 | while (parent
| 0 | ||||||||||||||||||||||||
| 2269 | if (QMdiArea *area = qobject_cast<QMdiArea *>(parent)
| 0 | ||||||||||||||||||||||||
| 2270 | if (area->viewport() == parentWidget()
| 0 | ||||||||||||||||||||||||
| 2271 | return never executed: area;return area;never executed: return area; | 0 | ||||||||||||||||||||||||
| 2272 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2273 | parent = parent->parentWidget(); | - | ||||||||||||||||||||||||
| 2274 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2275 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 2276 | } | - | ||||||||||||||||||||||||
| 2277 | void QMdiSubWindow::showShaded() | - | ||||||||||||||||||||||||
| 2278 | { | - | ||||||||||||||||||||||||
| 2279 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2280 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2281 | - | |||||||||||||||||||||||||
| 2282 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2283 | - | |||||||||||||||||||||||||
| 2284 | if (!d->isShadeRequestFromMinimizeMode
| 0 | ||||||||||||||||||||||||
| 2285 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2286 | - | |||||||||||||||||||||||||
| 2287 | d->isMaximizeMode = false; | - | ||||||||||||||||||||||||
| 2288 | - | |||||||||||||||||||||||||
| 2289 | d->storeFocusWidget(); | - | ||||||||||||||||||||||||
| 2290 | - | |||||||||||||||||||||||||
| 2291 | if (!d->isShadeRequestFromMinimizeMode
| 0 | ||||||||||||||||||||||||
| 2292 | d->isShadeMode = true; | - | ||||||||||||||||||||||||
| 2293 | d->ensureWindowState(Qt::WindowMinimized); | - | ||||||||||||||||||||||||
| 2294 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2295 | - | |||||||||||||||||||||||||
| 2296 | - | |||||||||||||||||||||||||
| 2297 | d->removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 2298 | - | |||||||||||||||||||||||||
| 2299 | - | |||||||||||||||||||||||||
| 2300 | - | |||||||||||||||||||||||||
| 2301 | - | |||||||||||||||||||||||||
| 2302 | - | |||||||||||||||||||||||||
| 2303 | if (hasFocus()
| 0 | ||||||||||||||||||||||||
| 2304 | d->ensureWindowState(Qt::WindowActive); never executed: d->ensureWindowState(Qt::WindowActive); | 0 | ||||||||||||||||||||||||
| 2305 | - | |||||||||||||||||||||||||
| 2306 | - | |||||||||||||||||||||||||
| 2307 | d->setSizeGripVisible(false); | - | ||||||||||||||||||||||||
| 2308 | - | |||||||||||||||||||||||||
| 2309 | - | |||||||||||||||||||||||||
| 2310 | if (!d->restoreSize.isValid()
| 0 | ||||||||||||||||||||||||
| 2311 | d->oldGeometry = geometry(); | - | ||||||||||||||||||||||||
| 2312 | d->restoreSize.setWidth(d->oldGeometry.width()); | - | ||||||||||||||||||||||||
| 2313 | d->restoreSize.setHeight(d->oldGeometry.height()); | - | ||||||||||||||||||||||||
| 2314 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2315 | - | |||||||||||||||||||||||||
| 2316 | - | |||||||||||||||||||||||||
| 2317 | - | |||||||||||||||||||||||||
| 2318 | const bool wasVisible = isVisible(); | - | ||||||||||||||||||||||||
| 2319 | if (wasVisible
| 0 | ||||||||||||||||||||||||
| 2320 | setVisible(false); never executed: setVisible(false); | 0 | ||||||||||||||||||||||||
| 2321 | - | |||||||||||||||||||||||||
| 2322 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2323 | - | |||||||||||||||||||||||||
| 2324 | if (!minimumSize().isNull()
| 0 | ||||||||||||||||||||||||
| 2325 | d->userMinimumSize = minimumSize(); | - | ||||||||||||||||||||||||
| 2326 | setMinimumSize(d->internalMinimumSize); | - | ||||||||||||||||||||||||
| 2327 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2328 | resize(d->internalMinimumSize); | - | ||||||||||||||||||||||||
| 2329 | - | |||||||||||||||||||||||||
| 2330 | - | |||||||||||||||||||||||||
| 2331 | if (d->baseWidget
| 0 | ||||||||||||||||||||||||
| 2332 | d->baseWidget->hide(); | - | ||||||||||||||||||||||||
| 2333 | d->isWidgetHiddenByUs = true; | - | ||||||||||||||||||||||||
| 2334 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2335 | - | |||||||||||||||||||||||||
| 2336 | if (wasVisible
| 0 | ||||||||||||||||||||||||
| 2337 | setVisible(true); never executed: setVisible(true); | 0 | ||||||||||||||||||||||||
| 2338 | - | |||||||||||||||||||||||||
| 2339 | d->setFocusWidget(); | - | ||||||||||||||||||||||||
| 2340 | d->resizeEnabled = false; | - | ||||||||||||||||||||||||
| 2341 | d->moveEnabled = true; | - | ||||||||||||||||||||||||
| 2342 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2343 | d->updateMask(); | - | ||||||||||||||||||||||||
| 2344 | - | |||||||||||||||||||||||||
| 2345 | - | |||||||||||||||||||||||||
| 2346 | d->setEnabled(QMdiSubWindowPrivate::MinimizeAction, false); | - | ||||||||||||||||||||||||
| 2347 | d->setEnabled(QMdiSubWindowPrivate::ResizeAction, d->resizeEnabled); | - | ||||||||||||||||||||||||
| 2348 | d->setEnabled(QMdiSubWindowPrivate::MaximizeAction, true); | - | ||||||||||||||||||||||||
| 2349 | d->setEnabled(QMdiSubWindowPrivate::RestoreAction, true); | - | ||||||||||||||||||||||||
| 2350 | d->setEnabled(QMdiSubWindowPrivate::MoveAction, d->moveEnabled); | - | ||||||||||||||||||||||||
| 2351 | - | |||||||||||||||||||||||||
| 2352 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2353 | - | |||||||||||||||||||||||||
| 2354 | - | |||||||||||||||||||||||||
| 2355 | - | |||||||||||||||||||||||||
| 2356 | - | |||||||||||||||||||||||||
| 2357 | bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event) | - | ||||||||||||||||||||||||
| 2358 | { | - | ||||||||||||||||||||||||
| 2359 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2360 | if (!object
| 0 | ||||||||||||||||||||||||
| 2361 | return never executed: QWidget::eventFilter(object, event);return QWidget::eventFilter(object, event);never executed: return QWidget::eventFilter(object, event); | 0 | ||||||||||||||||||||||||
| 2362 | - | |||||||||||||||||||||||||
| 2363 | - | |||||||||||||||||||||||||
| 2364 | - | |||||||||||||||||||||||||
| 2365 | if (d->systemMenu
| 0 | ||||||||||||||||||||||||
| 2366 | if (event->type() == QEvent::MouseButtonDblClick
| 0 | ||||||||||||||||||||||||
| 2367 | const QMouseEvent *mouseEvent = static_cast<const QMouseEvent *>(event); | - | ||||||||||||||||||||||||
| 2368 | const QAction *action = d->systemMenu->actionAt(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 2369 | if (!action
| 0 | ||||||||||||||||||||||||
| 2370 | close(); never executed: close(); | 0 | ||||||||||||||||||||||||
| 2371 | } never executed: else if (event->type() == QEvent::MouseMoveend of block
| 0 | ||||||||||||||||||||||||
| 2372 | QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); | - | ||||||||||||||||||||||||
| 2373 | d->hoveredSubControl = d->getSubControl(mapFromGlobal(mouseEvent->globalPos())); | - | ||||||||||||||||||||||||
| 2374 | } never executed: else if (event->type() == QEvent::Hideend of block
| 0 | ||||||||||||||||||||||||
| 2375 | d->activeSubControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 2376 | update(QRegion(0, 0, width(), d->titleBarHeight())); | - | ||||||||||||||||||||||||
| 2377 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2378 | return never executed: QWidget::eventFilter(object, event);return QWidget::eventFilter(object, event);never executed: return QWidget::eventFilter(object, event); | 0 | ||||||||||||||||||||||||
| 2379 | } | - | ||||||||||||||||||||||||
| 2380 | - | |||||||||||||||||||||||||
| 2381 | - | |||||||||||||||||||||||||
| 2382 | - | |||||||||||||||||||||||||
| 2383 | if (object != d->baseWidget
| 0 | ||||||||||||||||||||||||
| 2384 | if (event->type() != QEvent::MouseButtonPress
| 0 | ||||||||||||||||||||||||
| 2385 | return never executed: QWidget::eventFilter(object, event);return QWidget::eventFilter(object, event);never executed: return QWidget::eventFilter(object, event); | 0 | ||||||||||||||||||||||||
| 2386 | const QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); | - | ||||||||||||||||||||||||
| 2387 | d->mousePressPosition = parentWidget()->mapFromGlobal(mouseEvent->globalPos()); | - | ||||||||||||||||||||||||
| 2388 | d->oldGeometry = geometry(); | - | ||||||||||||||||||||||||
| 2389 | d->currentOperation = isLeftToRight()
| 0 | ||||||||||||||||||||||||
| 2390 | : QMdiSubWindowPrivate::BottomLeftResize; | - | ||||||||||||||||||||||||
| 2391 | - | |||||||||||||||||||||||||
| 2392 | d->enterRubberBandMode(); | - | ||||||||||||||||||||||||
| 2393 | - | |||||||||||||||||||||||||
| 2394 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 2395 | } | - | ||||||||||||||||||||||||
| 2396 | - | |||||||||||||||||||||||||
| 2397 | - | |||||||||||||||||||||||||
| 2398 | if (object != d->baseWidget
| 0 | ||||||||||||||||||||||||
| 2399 | return never executed: QWidget::eventFilter(object, event);return QWidget::eventFilter(object, event);never executed: return QWidget::eventFilter(object, event); | 0 | ||||||||||||||||||||||||
| 2400 | - | |||||||||||||||||||||||||
| 2401 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 2402 | case never executed: QEvent::Show:case QEvent::Show:never executed: case QEvent::Show: | 0 | ||||||||||||||||||||||||
| 2403 | d->setActive(true); | - | ||||||||||||||||||||||||
| 2404 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2405 | case never executed: QEvent::ShowToParent:case QEvent::ShowToParent:never executed: case QEvent::ShowToParent: | 0 | ||||||||||||||||||||||||
| 2406 | if (!d->isWidgetHiddenByUs
| 0 | ||||||||||||||||||||||||
| 2407 | show(); never executed: show(); | 0 | ||||||||||||||||||||||||
| 2408 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2409 | case never executed: QEvent::WindowStateChange:case QEvent::WindowStateChange:never executed: {case QEvent::WindowStateChange: | 0 | ||||||||||||||||||||||||
| 2410 | QWindowStateChangeEvent *changeEvent = static_cast<QWindowStateChangeEvent*>(event); | - | ||||||||||||||||||||||||
| 2411 | if (changeEvent->isOverride()
| 0 | ||||||||||||||||||||||||
| 2412 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2413 | Qt::WindowStates oldState = changeEvent->oldState(); | - | ||||||||||||||||||||||||
| 2414 | Qt::WindowStates newState = d->baseWidget->windowState(); | - | ||||||||||||||||||||||||
| 2415 | if (!(oldState & Qt::WindowMinimized)
| 0 | ||||||||||||||||||||||||
| 2416 | showMinimized(); never executed: showMinimized(); | 0 | ||||||||||||||||||||||||
| 2417 | else if (!(oldState & Qt::WindowMaximized)
| 0 | ||||||||||||||||||||||||
| 2418 | showMaximized(); never executed: showMaximized(); | 0 | ||||||||||||||||||||||||
| 2419 | else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen))
| 0 | ||||||||||||||||||||||||
| 2420 | showNormal(); never executed: showNormal(); | 0 | ||||||||||||||||||||||||
| 2421 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2422 | } | - | ||||||||||||||||||||||||
| 2423 | case never executed: QEvent::Enter:case QEvent::Enter:never executed: case QEvent::Enter: | 0 | ||||||||||||||||||||||||
| 2424 | d->currentOperation = QMdiSubWindowPrivate::None; | - | ||||||||||||||||||||||||
| 2425 | d->updateCursor(); | - | ||||||||||||||||||||||||
| 2426 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2427 | case never executed: QEvent::LayoutRequest:case QEvent::LayoutRequest:never executed: case QEvent::LayoutRequest: | 0 | ||||||||||||||||||||||||
| 2428 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2429 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2430 | case never executed: QEvent::WindowTitleChange:case QEvent::WindowTitleChange:never executed: case QEvent::WindowTitleChange: | 0 | ||||||||||||||||||||||||
| 2431 | if (d->ignoreWindowTitleChange
| 0 | ||||||||||||||||||||||||
| 2432 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2433 | if (object == d->baseWidget
| 0 | ||||||||||||||||||||||||
| 2434 | d->updateWindowTitle(true); | - | ||||||||||||||||||||||||
| 2435 | d->lastChildWindowTitle = d->baseWidget->windowTitle(); | - | ||||||||||||||||||||||||
| 2436 | - | |||||||||||||||||||||||||
| 2437 | } never executed: else if (maximizedButtonsWidget()end of block
| 0 | ||||||||||||||||||||||||
| 2438 | ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()
| 0 | ||||||||||||||||||||||||
| 2439 | d->originalTitle = QString::null; | - | ||||||||||||||||||||||||
| 2440 | if (d->baseWidget
| 0 | ||||||||||||||||||||||||
| 2441 | d->updateWindowTitle(true); never executed: d->updateWindowTitle(true); | 0 | ||||||||||||||||||||||||
| 2442 | else | - | ||||||||||||||||||||||||
| 2443 | d->updateWindowTitle(false); never executed: d->updateWindowTitle(false); | 0 | ||||||||||||||||||||||||
| 2444 | - | |||||||||||||||||||||||||
| 2445 | } | - | ||||||||||||||||||||||||
| 2446 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2447 | case never executed: QEvent::ModifiedChange:case QEvent::ModifiedChange:never executed: {case QEvent::ModifiedChange: | 0 | ||||||||||||||||||||||||
| 2448 | if (object != d->baseWidget
| 0 | ||||||||||||||||||||||||
| 2449 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2450 | bool windowModified = d->baseWidget->isWindowModified(); | - | ||||||||||||||||||||||||
| 2451 | if (!windowModified
| 0 | ||||||||||||||||||||||||
| 2452 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2453 | if (windowTitle().contains(QLatin1String("[*]"))
| 0 | ||||||||||||||||||||||||
| 2454 | setWindowModified(windowModified); never executed: setWindowModified(windowModified); | 0 | ||||||||||||||||||||||||
| 2455 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2456 | } | - | ||||||||||||||||||||||||
| 2457 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 2458 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2459 | } | - | ||||||||||||||||||||||||
| 2460 | return never executed: QWidget::eventFilter(object, event);return QWidget::eventFilter(object, event);never executed: return QWidget::eventFilter(object, event); | 0 | ||||||||||||||||||||||||
| 2461 | } | - | ||||||||||||||||||||||||
| 2462 | - | |||||||||||||||||||||||||
| 2463 | - | |||||||||||||||||||||||||
| 2464 | - | |||||||||||||||||||||||||
| 2465 | - | |||||||||||||||||||||||||
| 2466 | bool QMdiSubWindow::event(QEvent *event) | - | ||||||||||||||||||||||||
| 2467 | { | - | ||||||||||||||||||||||||
| 2468 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2469 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 2470 | case never executed: QEvent::StyleChange:case QEvent::StyleChange:never executed: {case QEvent::StyleChange: | 0 | ||||||||||||||||||||||||
| 2471 | bool wasShaded = isShaded(); | - | ||||||||||||||||||||||||
| 2472 | bool wasMinimized = isMinimized(); | - | ||||||||||||||||||||||||
| 2473 | bool wasMaximized = isMaximized(); | - | ||||||||||||||||||||||||
| 2474 | - | |||||||||||||||||||||||||
| 2475 | const QScopedValueRollback<bool> activationEnabledSaver(d->activationEnabled); | - | ||||||||||||||||||||||||
| 2476 | d->activationEnabled = false; | - | ||||||||||||||||||||||||
| 2477 | - | |||||||||||||||||||||||||
| 2478 | ensurePolished(); | - | ||||||||||||||||||||||||
| 2479 | setContentsMargins(0, 0, 0, 0); | - | ||||||||||||||||||||||||
| 2480 | if (wasMinimized
| 0 | ||||||||||||||||||||||||
| 2481 | showNormal(); never executed: showNormal(); | 0 | ||||||||||||||||||||||||
| 2482 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2483 | resize(d->internalMinimumSize.expandedTo(size())); | - | ||||||||||||||||||||||||
| 2484 | d->updateMask(); | - | ||||||||||||||||||||||||
| 2485 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2486 | if (wasShaded
| 0 | ||||||||||||||||||||||||
| 2487 | showShaded(); never executed: showShaded(); | 0 | ||||||||||||||||||||||||
| 2488 | else if (wasMinimized
| 0 | ||||||||||||||||||||||||
| 2489 | showMinimized(); never executed: showMinimized(); | 0 | ||||||||||||||||||||||||
| 2490 | else if (wasMaximized
| 0 | ||||||||||||||||||||||||
| 2491 | showMaximized(); never executed: showMaximized(); | 0 | ||||||||||||||||||||||||
| 2492 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2493 | } | - | ||||||||||||||||||||||||
| 2494 | case never executed: QEvent::ParentAboutToChange:case QEvent::ParentAboutToChange:never executed: case QEvent::ParentAboutToChange: | 0 | ||||||||||||||||||||||||
| 2495 | d->setActive(false); | - | ||||||||||||||||||||||||
| 2496 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2497 | case never executed: QEvent::ParentChange:case QEvent::ParentChange:never executed: {case QEvent::ParentChange: | 0 | ||||||||||||||||||||||||
| 2498 | bool wasResized = testAttribute(Qt::WA_Resized); | - | ||||||||||||||||||||||||
| 2499 | - | |||||||||||||||||||||||||
| 2500 | d->removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 2501 | - | |||||||||||||||||||||||||
| 2502 | d->currentOperation = QMdiSubWindowPrivate::None; | - | ||||||||||||||||||||||||
| 2503 | d->activeSubControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 2504 | d->hoveredSubControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 2505 | - | |||||||||||||||||||||||||
| 2506 | if (d->isInRubberBandMode
| 0 | ||||||||||||||||||||||||
| 2507 | d->leaveRubberBandMode(); never executed: d->leaveRubberBandMode(); | 0 | ||||||||||||||||||||||||
| 2508 | - | |||||||||||||||||||||||||
| 2509 | d->isShadeMode = false; | - | ||||||||||||||||||||||||
| 2510 | d->isMaximizeMode = false; | - | ||||||||||||||||||||||||
| 2511 | d->isWidgetHiddenByUs = false; | - | ||||||||||||||||||||||||
| 2512 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2513 | - | |||||||||||||||||||||||||
| 2514 | - | |||||||||||||||||||||||||
| 2515 | - | |||||||||||||||||||||||||
| 2516 | - | |||||||||||||||||||||||||
| 2517 | setOption(RubberBandResize, false); | - | ||||||||||||||||||||||||
| 2518 | setOption(RubberBandMove, false); | - | ||||||||||||||||||||||||
| 2519 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2520 | d->setWindowFlags(windowFlags()); | - | ||||||||||||||||||||||||
| 2521 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2522 | setContentsMargins(0, 0, 0, 0); | - | ||||||||||||||||||||||||
| 2523 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2524 | d->updateCursor(); | - | ||||||||||||||||||||||||
| 2525 | d->updateMask(); | - | ||||||||||||||||||||||||
| 2526 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2527 | d->updateActions(); | - | ||||||||||||||||||||||||
| 2528 | if (!wasResized
| 0 | ||||||||||||||||||||||||
| 2529 | setAttribute(Qt::WA_Resized, false); never executed: setAttribute(Qt::WA_Resized, false); | 0 | ||||||||||||||||||||||||
| 2530 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2531 | } | - | ||||||||||||||||||||||||
| 2532 | case never executed: QEvent::WindowActivate:case QEvent::WindowActivate:never executed: case QEvent::WindowActivate: | 0 | ||||||||||||||||||||||||
| 2533 | if (d->ignoreNextActivationEvent
| 0 | ||||||||||||||||||||||||
| 2534 | d->ignoreNextActivationEvent = false; | - | ||||||||||||||||||||||||
| 2535 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2536 | } | - | ||||||||||||||||||||||||
| 2537 | d->isExplicitlyDeactivated = false; | - | ||||||||||||||||||||||||
| 2538 | d->setActive(true); | - | ||||||||||||||||||||||||
| 2539 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2540 | case never executed: QEvent::WindowDeactivate:case QEvent::WindowDeactivate:never executed: case QEvent::WindowDeactivate: | 0 | ||||||||||||||||||||||||
| 2541 | if (d->ignoreNextActivationEvent
| 0 | ||||||||||||||||||||||||
| 2542 | d->ignoreNextActivationEvent = false; | - | ||||||||||||||||||||||||
| 2543 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2544 | } | - | ||||||||||||||||||||||||
| 2545 | d->isExplicitlyDeactivated = true; | - | ||||||||||||||||||||||||
| 2546 | d->setActive(false); | - | ||||||||||||||||||||||||
| 2547 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2548 | case never executed: QEvent::WindowTitleChange:case QEvent::WindowTitleChange:never executed: case QEvent::WindowTitleChange: | 0 | ||||||||||||||||||||||||
| 2549 | if (!d->ignoreWindowTitleChange
| 0 | ||||||||||||||||||||||||
| 2550 | d->updateWindowTitle(false); never executed: d->updateWindowTitle(false); | 0 | ||||||||||||||||||||||||
| 2551 | d->updateInternalWindowTitle(); | - | ||||||||||||||||||||||||
| 2552 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2553 | case never executed: QEvent::ModifiedChange:case QEvent::ModifiedChange:never executed: case QEvent::ModifiedChange: | 0 | ||||||||||||||||||||||||
| 2554 | if (!windowTitle().contains(QLatin1String("[*]"))
| 0 | ||||||||||||||||||||||||
| 2555 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2556 | - | |||||||||||||||||||||||||
| 2557 | if (maximizedButtonsWidget()
| 0 | ||||||||||||||||||||||||
| 2558 | ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()
| 0 | ||||||||||||||||||||||||
| 2559 | window()->setWindowModified(isWindowModified()); | - | ||||||||||||||||||||||||
| 2560 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2561 | - | |||||||||||||||||||||||||
| 2562 | d->updateInternalWindowTitle(); | - | ||||||||||||||||||||||||
| 2563 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2564 | case never executed: QEvent::LayoutDirectionChange:case QEvent::LayoutDirectionChange:never executed: case QEvent::LayoutDirectionChange: | 0 | ||||||||||||||||||||||||
| 2565 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2566 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2567 | case never executed: QEvent::LayoutRequest:case QEvent::LayoutRequest:never executed: case QEvent::LayoutRequest: | 0 | ||||||||||||||||||||||||
| 2568 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2569 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2570 | case never executed: QEvent::WindowIconChange:case QEvent::WindowIconChange:never executed: case QEvent::WindowIconChange: | 0 | ||||||||||||||||||||||||
| 2571 | d->menuIcon = windowIcon(); | - | ||||||||||||||||||||||||
| 2572 | if (d->menuIcon.isNull()
| 0 | ||||||||||||||||||||||||
| 2573 | d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); never executed: d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); | 0 | ||||||||||||||||||||||||
| 2574 | if (d->controlContainer
| 0 | ||||||||||||||||||||||||
| 2575 | d->controlContainer->updateWindowIcon(d->menuIcon); never executed: d->controlContainer->updateWindowIcon(d->menuIcon); | 0 | ||||||||||||||||||||||||
| 2576 | if (!maximizedSystemMenuIconWidget()
| 0 | ||||||||||||||||||||||||
| 2577 | update(0, 0, width(), d->titleBarHeight()); never executed: update(0, 0, width(), d->titleBarHeight()); | 0 | ||||||||||||||||||||||||
| 2578 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2579 | case never executed: QEvent::PaletteChange:case QEvent::PaletteChange:never executed: case QEvent::PaletteChange: | 0 | ||||||||||||||||||||||||
| 2580 | d->titleBarPalette = d->desktopPalette(); | - | ||||||||||||||||||||||||
| 2581 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2582 | case never executed: QEvent::FontChange:case QEvent::FontChange:never executed: case QEvent::FontChange: | 0 | ||||||||||||||||||||||||
| 2583 | d->font = font(); | - | ||||||||||||||||||||||||
| 2584 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2585 | - | |||||||||||||||||||||||||
| 2586 | case never executed: QEvent::ToolTip:case QEvent::ToolTip:never executed: case QEvent::ToolTip: | 0 | ||||||||||||||||||||||||
| 2587 | showToolTip(static_cast<QHelpEvent *>(event), this, d->titleBarOptions(), | - | ||||||||||||||||||||||||
| 2588 | QStyle::CC_TitleBar, d->hoveredSubControl); | - | ||||||||||||||||||||||||
| 2589 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2590 | - | |||||||||||||||||||||||||
| 2591 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 2592 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2593 | } | - | ||||||||||||||||||||||||
| 2594 | return never executed: QWidget::event(event);return QWidget::event(event);never executed: return QWidget::event(event); | 0 | ||||||||||||||||||||||||
| 2595 | } | - | ||||||||||||||||||||||||
| 2596 | - | |||||||||||||||||||||||||
| 2597 | - | |||||||||||||||||||||||||
| 2598 | - | |||||||||||||||||||||||||
| 2599 | - | |||||||||||||||||||||||||
| 2600 | void QMdiSubWindow::showEvent(QShowEvent *showEvent) | - | ||||||||||||||||||||||||
| 2601 | { | - | ||||||||||||||||||||||||
| 2602 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2603 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2604 | QWidget::showEvent(showEvent); | - | ||||||||||||||||||||||||
| 2605 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2606 | } | - | ||||||||||||||||||||||||
| 2607 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2608 | - | |||||||||||||||||||||||||
| 2609 | - | |||||||||||||||||||||||||
| 2610 | - | |||||||||||||||||||||||||
| 2611 | if (d->controlContainer
| 0 | ||||||||||||||||||||||||
| 2612 | if (QMenuBar *menuBar = d->menuBar()
| 0 | ||||||||||||||||||||||||
| 2613 | if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget()
| 0 | ||||||||||||||||||||||||
| 2614 | d->showButtonsInMenuBar(menuBar); never executed: d->showButtonsInMenuBar(menuBar); | 0 | ||||||||||||||||||||||||
| 2615 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2616 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2617 | - | |||||||||||||||||||||||||
| 2618 | d->setActive(true); | - | ||||||||||||||||||||||||
| 2619 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2620 | - | |||||||||||||||||||||||||
| 2621 | - | |||||||||||||||||||||||||
| 2622 | - | |||||||||||||||||||||||||
| 2623 | - | |||||||||||||||||||||||||
| 2624 | void QMdiSubWindow::hideEvent(QHideEvent * ) | - | ||||||||||||||||||||||||
| 2625 | { | - | ||||||||||||||||||||||||
| 2626 | - | |||||||||||||||||||||||||
| 2627 | d_func()->removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 2628 | - | |||||||||||||||||||||||||
| 2629 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2630 | - | |||||||||||||||||||||||||
| 2631 | - | |||||||||||||||||||||||||
| 2632 | - | |||||||||||||||||||||||||
| 2633 | - | |||||||||||||||||||||||||
| 2634 | void QMdiSubWindow::changeEvent(QEvent *changeEvent) | - | ||||||||||||||||||||||||
| 2635 | { | - | ||||||||||||||||||||||||
| 2636 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2637 | QWidget::changeEvent(changeEvent); | - | ||||||||||||||||||||||||
| 2638 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2639 | } | - | ||||||||||||||||||||||||
| 2640 | - | |||||||||||||||||||||||||
| 2641 | if (changeEvent->type() != QEvent::WindowStateChange
| 0 | ||||||||||||||||||||||||
| 2642 | QWidget::changeEvent(changeEvent); | - | ||||||||||||||||||||||||
| 2643 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2644 | } | - | ||||||||||||||||||||||||
| 2645 | - | |||||||||||||||||||||||||
| 2646 | QWindowStateChangeEvent *event = static_cast<QWindowStateChangeEvent *>(changeEvent); | - | ||||||||||||||||||||||||
| 2647 | if (event->isOverride()
| 0 | ||||||||||||||||||||||||
| 2648 | event->ignore(); | - | ||||||||||||||||||||||||
| 2649 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2650 | } | - | ||||||||||||||||||||||||
| 2651 | - | |||||||||||||||||||||||||
| 2652 | Qt::WindowStates oldState = event->oldState(); | - | ||||||||||||||||||||||||
| 2653 | Qt::WindowStates newState = windowState(); | - | ||||||||||||||||||||||||
| 2654 | if (oldState == newState
| 0 | ||||||||||||||||||||||||
| 2655 | changeEvent->ignore(); | - | ||||||||||||||||||||||||
| 2656 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2657 | } | - | ||||||||||||||||||||||||
| 2658 | - | |||||||||||||||||||||||||
| 2659 | - | |||||||||||||||||||||||||
| 2660 | - | |||||||||||||||||||||||||
| 2661 | - | |||||||||||||||||||||||||
| 2662 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2663 | if (!isVisible()
| 0 | ||||||||||||||||||||||||
| 2664 | d->ensureWindowState(Qt::WindowNoState); | - | ||||||||||||||||||||||||
| 2665 | setVisible(true); | - | ||||||||||||||||||||||||
| 2666 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2667 | - | |||||||||||||||||||||||||
| 2668 | if (!d->oldGeometry.isValid()
| 0 | ||||||||||||||||||||||||
| 2669 | d->oldGeometry = geometry(); never executed: d->oldGeometry = geometry(); | 0 | ||||||||||||||||||||||||
| 2670 | - | |||||||||||||||||||||||||
| 2671 | if ((
| 0 | ||||||||||||||||||||||||
| 2672 | d->currentOperation = QMdiSubWindowPrivate::None; never executed: d->currentOperation = QMdiSubWindowPrivate::None; | 0 | ||||||||||||||||||||||||
| 2673 | - | |||||||||||||||||||||||||
| 2674 | if (!(oldState & Qt::WindowMinimized)
| 0 | ||||||||||||||||||||||||
| 2675 | d->setMinimizeMode(); never executed: d->setMinimizeMode(); | 0 | ||||||||||||||||||||||||
| 2676 | else if (!(oldState & Qt::WindowMaximized)
| 0 | ||||||||||||||||||||||||
| 2677 | d->setMaximizeMode(); never executed: d->setMaximizeMode(); | 0 | ||||||||||||||||||||||||
| 2678 | else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen))
| 0 | ||||||||||||||||||||||||
| 2679 | d->setNormalMode(); never executed: d->setNormalMode(); | 0 | ||||||||||||||||||||||||
| 2680 | - | |||||||||||||||||||||||||
| 2681 | if (d->isActive
| 0 | ||||||||||||||||||||||||
| 2682 | d->ensureWindowState(Qt::WindowActive); never executed: d->ensureWindowState(Qt::WindowActive); | 0 | ||||||||||||||||||||||||
| 2683 | if (d->activationEnabled
| 0 | ||||||||||||||||||||||||
| 2684 | windowStateChanged(oldState, windowState()); never executed: windowStateChanged(oldState, windowState()); | 0 | ||||||||||||||||||||||||
| 2685 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2686 | - | |||||||||||||||||||||||||
| 2687 | - | |||||||||||||||||||||||||
| 2688 | - | |||||||||||||||||||||||||
| 2689 | - | |||||||||||||||||||||||||
| 2690 | void QMdiSubWindow::closeEvent(QCloseEvent *closeEvent) | - | ||||||||||||||||||||||||
| 2691 | { | - | ||||||||||||||||||||||||
| 2692 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2693 | bool acceptClose = true; | - | ||||||||||||||||||||||||
| 2694 | if (d->baseWidget
| 0 | ||||||||||||||||||||||||
| 2695 | acceptClose = d->baseWidget->close(); never executed: acceptClose = d->baseWidget->close(); | 0 | ||||||||||||||||||||||||
| 2696 | if (!acceptClose
| 0 | ||||||||||||||||||||||||
| 2697 | closeEvent->ignore(); | - | ||||||||||||||||||||||||
| 2698 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2699 | } | - | ||||||||||||||||||||||||
| 2700 | - | |||||||||||||||||||||||||
| 2701 | d->removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 2702 | - | |||||||||||||||||||||||||
| 2703 | d->setActive(false); | - | ||||||||||||||||||||||||
| 2704 | if (parentWidget()
| 0 | ||||||||||||||||||||||||
| 2705 | QChildEvent childRemoved(QEvent::ChildRemoved, this); | - | ||||||||||||||||||||||||
| 2706 | QApplication::sendEvent(parentWidget(), &childRemoved); | - | ||||||||||||||||||||||||
| 2707 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2708 | closeEvent->accept(); | - | ||||||||||||||||||||||||
| 2709 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2710 | - | |||||||||||||||||||||||||
| 2711 | - | |||||||||||||||||||||||||
| 2712 | - | |||||||||||||||||||||||||
| 2713 | - | |||||||||||||||||||||||||
| 2714 | void QMdiSubWindow::leaveEvent(QEvent * ) | - | ||||||||||||||||||||||||
| 2715 | { | - | ||||||||||||||||||||||||
| 2716 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2717 | if (d->hoveredSubControl != QStyle::SC_None
| 0 | ||||||||||||||||||||||||
| 2718 | d->hoveredSubControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 2719 | update(QRegion(0, 0, width(), d->titleBarHeight())); | - | ||||||||||||||||||||||||
| 2720 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2721 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2722 | - | |||||||||||||||||||||||||
| 2723 | - | |||||||||||||||||||||||||
| 2724 | - | |||||||||||||||||||||||||
| 2725 | - | |||||||||||||||||||||||||
| 2726 | - | |||||||||||||||||||||||||
| 2727 | - | |||||||||||||||||||||||||
| 2728 | - | |||||||||||||||||||||||||
| 2729 | void QMdiSubWindow::resizeEvent(QResizeEvent *resizeEvent) | - | ||||||||||||||||||||||||
| 2730 | { | - | ||||||||||||||||||||||||
| 2731 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2732 | - | |||||||||||||||||||||||||
| 2733 | if (d->sizeGrip
| 0 | ||||||||||||||||||||||||
| 2734 | d->sizeGrip->move(isLeftToRight() ? width() - d->sizeGrip->width() : 0, | - | ||||||||||||||||||||||||
| 2735 | height() - d->sizeGrip->height()); | - | ||||||||||||||||||||||||
| 2736 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2737 | - | |||||||||||||||||||||||||
| 2738 | - | |||||||||||||||||||||||||
| 2739 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2740 | QWidget::resizeEvent(resizeEvent); | - | ||||||||||||||||||||||||
| 2741 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2742 | } | - | ||||||||||||||||||||||||
| 2743 | - | |||||||||||||||||||||||||
| 2744 | if (d->isMaximizeMode
| 0 | ||||||||||||||||||||||||
| 2745 | d->ensureWindowState(Qt::WindowMaximized); never executed: d->ensureWindowState(Qt::WindowMaximized); | 0 | ||||||||||||||||||||||||
| 2746 | - | |||||||||||||||||||||||||
| 2747 | d->updateMask(); | - | ||||||||||||||||||||||||
| 2748 | if (!isVisible()
| 0 | ||||||||||||||||||||||||
| 2749 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2750 | - | |||||||||||||||||||||||||
| 2751 | if (d->resizeTimerId <= 0
| 0 | ||||||||||||||||||||||||
| 2752 | d->cachedStyleOptions = d->titleBarOptions(); never executed: d->cachedStyleOptions = d->titleBarOptions(); | 0 | ||||||||||||||||||||||||
| 2753 | else | - | ||||||||||||||||||||||||
| 2754 | killTimer(d->resizeTimerId); never executed: killTimer(d->resizeTimerId); | 0 | ||||||||||||||||||||||||
| 2755 | d->resizeTimerId = startTimer(200); | - | ||||||||||||||||||||||||
| 2756 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2757 | - | |||||||||||||||||||||||||
| 2758 | - | |||||||||||||||||||||||||
| 2759 | - | |||||||||||||||||||||||||
| 2760 | - | |||||||||||||||||||||||||
| 2761 | void QMdiSubWindow::timerEvent(QTimerEvent *timerEvent) | - | ||||||||||||||||||||||||
| 2762 | { | - | ||||||||||||||||||||||||
| 2763 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2764 | if (timerEvent->timerId() == d->resizeTimerId
| 0 | ||||||||||||||||||||||||
| 2765 | killTimer(d->resizeTimerId); | - | ||||||||||||||||||||||||
| 2766 | d->resizeTimerId = -1; | - | ||||||||||||||||||||||||
| 2767 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2768 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2769 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2770 | - | |||||||||||||||||||||||||
| 2771 | - | |||||||||||||||||||||||||
| 2772 | - | |||||||||||||||||||||||||
| 2773 | - | |||||||||||||||||||||||||
| 2774 | void QMdiSubWindow::moveEvent(QMoveEvent *moveEvent) | - | ||||||||||||||||||||||||
| 2775 | { | - | ||||||||||||||||||||||||
| 2776 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2777 | QWidget::moveEvent(moveEvent); | - | ||||||||||||||||||||||||
| 2778 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2779 | } | - | ||||||||||||||||||||||||
| 2780 | - | |||||||||||||||||||||||||
| 2781 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2782 | if (d->isMaximizeMode
| 0 | ||||||||||||||||||||||||
| 2783 | d->ensureWindowState(Qt::WindowMaximized); never executed: d->ensureWindowState(Qt::WindowMaximized); | 0 | ||||||||||||||||||||||||
| 2784 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2785 | - | |||||||||||||||||||||||||
| 2786 | - | |||||||||||||||||||||||||
| 2787 | - | |||||||||||||||||||||||||
| 2788 | - | |||||||||||||||||||||||||
| 2789 | void QMdiSubWindow::paintEvent(QPaintEvent *paintEvent) | - | ||||||||||||||||||||||||
| 2790 | { | - | ||||||||||||||||||||||||
| 2791 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2792 | QWidget::paintEvent(paintEvent); | - | ||||||||||||||||||||||||
| 2793 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2794 | } | - | ||||||||||||||||||||||||
| 2795 | - | |||||||||||||||||||||||||
| 2796 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2797 | if (isMaximized()
| 0 | ||||||||||||||||||||||||
| 2798 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2799 | - | |||||||||||||||||||||||||
| 2800 | if (d->resizeTimerId != -1
| 0 | ||||||||||||||||||||||||
| 2801 | - | |||||||||||||||||||||||||
| 2802 | int border = d->hasBorder(d->cachedStyleOptions)
| 0 | ||||||||||||||||||||||||
| 2803 | int titleBarHeight = d->titleBarHeight(d->cachedStyleOptions); | - | ||||||||||||||||||||||||
| 2804 | titleBarHeight -= isMinimized()
| 0 | ||||||||||||||||||||||||
| 2805 | d->cachedStyleOptions.rect = QRect(border, border, width() - 2 * border, titleBarHeight); | - | ||||||||||||||||||||||||
| 2806 | if (!d->windowTitle.isEmpty()
| 0 | ||||||||||||||||||||||||
| 2807 | int width = style()->subControlRect(QStyle::CC_TitleBar, &d->cachedStyleOptions, | - | ||||||||||||||||||||||||
| 2808 | QStyle::SC_TitleBarLabel, this).width(); | - | ||||||||||||||||||||||||
| 2809 | d->cachedStyleOptions.text = d->cachedStyleOptions.fontMetrics | - | ||||||||||||||||||||||||
| 2810 | .elidedText(d->windowTitle, Qt::ElideRight, width); | - | ||||||||||||||||||||||||
| 2811 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2812 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2813 | - | |||||||||||||||||||||||||
| 2814 | d->cachedStyleOptions = d->titleBarOptions(); | - | ||||||||||||||||||||||||
| 2815 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2816 | - | |||||||||||||||||||||||||
| 2817 | QStylePainter painter(this); | - | ||||||||||||||||||||||||
| 2818 | if (!d->windowTitle.isEmpty()
| 0 | ||||||||||||||||||||||||
| 2819 | painter.setFont(d->font); never executed: painter.setFont(d->font); | 0 | ||||||||||||||||||||||||
| 2820 | painter.drawComplexControl(QStyle::CC_TitleBar, d->cachedStyleOptions); | - | ||||||||||||||||||||||||
| 2821 | - | |||||||||||||||||||||||||
| 2822 | if (isMinimized()
| 0 | ||||||||||||||||||||||||
| 2823 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2824 | - | |||||||||||||||||||||||||
| 2825 | QStyleOptionFrame frameOptions; | - | ||||||||||||||||||||||||
| 2826 | frameOptions.initFrom(this); | - | ||||||||||||||||||||||||
| 2827 | frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, this); | - | ||||||||||||||||||||||||
| 2828 | frameOptions.state.setFlag(QStyle::State_Active, d->isActive); | - | ||||||||||||||||||||||||
| 2829 | - | |||||||||||||||||||||||||
| 2830 | - | |||||||||||||||||||||||||
| 2831 | if (!isMinimized()
| 0 | ||||||||||||||||||||||||
| 2832 | painter.setClipRect(rect().adjusted(0, d->titleBarHeight(d->cachedStyleOptions), 0, 0)); never executed: painter.setClipRect(rect().adjusted(0, d->titleBarHeight(d->cachedStyleOptions), 0, 0)); | 0 | ||||||||||||||||||||||||
| 2833 | if (!isMinimized()
| 0 | ||||||||||||||||||||||||
| 2834 | painter.drawPrimitive(QStyle::PE_FrameWindow, frameOptions); never executed: painter.drawPrimitive(QStyle::PE_FrameWindow, frameOptions); | 0 | ||||||||||||||||||||||||
| 2835 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2836 | - | |||||||||||||||||||||||||
| 2837 | - | |||||||||||||||||||||||||
| 2838 | - | |||||||||||||||||||||||||
| 2839 | - | |||||||||||||||||||||||||
| 2840 | void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 2841 | { | - | ||||||||||||||||||||||||
| 2842 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2843 | QWidget::mousePressEvent(mouseEvent); | - | ||||||||||||||||||||||||
| 2844 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2845 | } | - | ||||||||||||||||||||||||
| 2846 | - | |||||||||||||||||||||||||
| 2847 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2848 | if (d->isInInteractiveMode
| 0 | ||||||||||||||||||||||||
| 2849 | d->leaveInteractiveMode(); never executed: d->leaveInteractiveMode(); | 0 | ||||||||||||||||||||||||
| 2850 | - | |||||||||||||||||||||||||
| 2851 | if (d->isInRubberBandMode
| 0 | ||||||||||||||||||||||||
| 2852 | d->leaveRubberBandMode(); never executed: d->leaveRubberBandMode(); | 0 | ||||||||||||||||||||||||
| 2853 | - | |||||||||||||||||||||||||
| 2854 | - | |||||||||||||||||||||||||
| 2855 | if (mouseEvent->button() != Qt::LeftButton
| 0 | ||||||||||||||||||||||||
| 2856 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
| 2857 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2858 | } | - | ||||||||||||||||||||||||
| 2859 | - | |||||||||||||||||||||||||
| 2860 | if (d->currentOperation != QMdiSubWindowPrivate::None
| 0 | ||||||||||||||||||||||||
| 2861 | d->updateCursor(); | - | ||||||||||||||||||||||||
| 2862 | d->mousePressPosition = mapToParent(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 2863 | if (d->resizeEnabled
| 0 | ||||||||||||||||||||||||
| 2864 | d->oldGeometry = geometry(); never executed: d->oldGeometry = geometry(); | 0 | ||||||||||||||||||||||||
| 2865 | - | |||||||||||||||||||||||||
| 2866 | if ((testOption(QMdiSubWindow::RubberBandResize)
| 0 | ||||||||||||||||||||||||
| 2867 | || (testOption(QMdiSubWindow::RubberBandMove)
| 0 | ||||||||||||||||||||||||
| 2868 | d->enterRubberBandMode(); | - | ||||||||||||||||||||||||
| 2869 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2870 | - | |||||||||||||||||||||||||
| 2871 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2872 | } | - | ||||||||||||||||||||||||
| 2873 | - | |||||||||||||||||||||||||
| 2874 | d->activeSubControl = d->hoveredSubControl; | - | ||||||||||||||||||||||||
| 2875 | - | |||||||||||||||||||||||||
| 2876 | if (d->activeSubControl == QStyle::SC_TitleBarSysMenu
| 0 | ||||||||||||||||||||||||
| 2877 | showSystemMenu(); never executed: showSystemMenu(); | 0 | ||||||||||||||||||||||||
| 2878 | else | - | ||||||||||||||||||||||||
| 2879 | - | |||||||||||||||||||||||||
| 2880 | update(QRegion(0, 0, width(), d->titleBarHeight())); never executed: update(QRegion(0, 0, width(), d->titleBarHeight())); | 0 | ||||||||||||||||||||||||
| 2881 | } | - | ||||||||||||||||||||||||
| 2882 | - | |||||||||||||||||||||||||
| 2883 | - | |||||||||||||||||||||||||
| 2884 | - | |||||||||||||||||||||||||
| 2885 | - | |||||||||||||||||||||||||
| 2886 | void QMdiSubWindow::mouseDoubleClickEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 2887 | { | - | ||||||||||||||||||||||||
| 2888 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2889 | QWidget::mouseDoubleClickEvent(mouseEvent); | - | ||||||||||||||||||||||||
| 2890 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2891 | } | - | ||||||||||||||||||||||||
| 2892 | - | |||||||||||||||||||||||||
| 2893 | if (mouseEvent->button() != Qt::LeftButton
| 0 | ||||||||||||||||||||||||
| 2894 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
| 2895 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2896 | } | - | ||||||||||||||||||||||||
| 2897 | - | |||||||||||||||||||||||||
| 2898 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2899 | if (!d->isMoveOperation()
| 0 | ||||||||||||||||||||||||
| 2900 | - | |||||||||||||||||||||||||
| 2901 | if (d->hoveredSubControl == QStyle::SC_TitleBarSysMenu
| 0 | ||||||||||||||||||||||||
| 2902 | close(); never executed: close(); | 0 | ||||||||||||||||||||||||
| 2903 | - | |||||||||||||||||||||||||
| 2904 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2905 | } | - | ||||||||||||||||||||||||
| 2906 | - | |||||||||||||||||||||||||
| 2907 | Qt::WindowFlags flags = windowFlags(); | - | ||||||||||||||||||||||||
| 2908 | if (isMinimized()
| 0 | ||||||||||||||||||||||||
| 2909 | if ((isShaded()
| 0 | ||||||||||||||||||||||||
| 2910 | || (
| 0 | ||||||||||||||||||||||||
| 2911 | showNormal(); | - | ||||||||||||||||||||||||
| 2912 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2913 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2914 | } | - | ||||||||||||||||||||||||
| 2915 | - | |||||||||||||||||||||||||
| 2916 | if (isMaximized()
| 0 | ||||||||||||||||||||||||
| 2917 | if (flags & Qt::WindowMaximizeButtonHint
| 0 | ||||||||||||||||||||||||
| 2918 | showNormal(); never executed: showNormal(); | 0 | ||||||||||||||||||||||||
| 2919 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2920 | } | - | ||||||||||||||||||||||||
| 2921 | - | |||||||||||||||||||||||||
| 2922 | if (flags & Qt::WindowShadeButtonHint
| 0 | ||||||||||||||||||||||||
| 2923 | showShaded(); never executed: showShaded(); | 0 | ||||||||||||||||||||||||
| 2924 | else if (flags & Qt::WindowMaximizeButtonHint
| 0 | ||||||||||||||||||||||||
| 2925 | showMaximized(); never executed: showMaximized(); | 0 | ||||||||||||||||||||||||
| 2926 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2927 | - | |||||||||||||||||||||||||
| 2928 | - | |||||||||||||||||||||||||
| 2929 | - | |||||||||||||||||||||||||
| 2930 | - | |||||||||||||||||||||||||
| 2931 | void QMdiSubWindow::mouseReleaseEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 2932 | { | - | ||||||||||||||||||||||||
| 2933 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2934 | QWidget::mouseReleaseEvent(mouseEvent); | - | ||||||||||||||||||||||||
| 2935 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2936 | } | - | ||||||||||||||||||||||||
| 2937 | - | |||||||||||||||||||||||||
| 2938 | if (mouseEvent->button() != Qt::LeftButton
| 0 | ||||||||||||||||||||||||
| 2939 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
| 2940 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2941 | } | - | ||||||||||||||||||||||||
| 2942 | - | |||||||||||||||||||||||||
| 2943 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2944 | if (d->currentOperation != QMdiSubWindowPrivate::None
| 0 | ||||||||||||||||||||||||
| 2945 | - | |||||||||||||||||||||||||
| 2946 | if (d->isInRubberBandMode
| 0 | ||||||||||||||||||||||||
| 2947 | d->leaveRubberBandMode(); never executed: d->leaveRubberBandMode(); | 0 | ||||||||||||||||||||||||
| 2948 | - | |||||||||||||||||||||||||
| 2949 | if (d->resizeEnabled
| 0 | ||||||||||||||||||||||||
| 2950 | d->oldGeometry = geometry(); never executed: d->oldGeometry = geometry(); | 0 | ||||||||||||||||||||||||
| 2951 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2952 | - | |||||||||||||||||||||||||
| 2953 | d->currentOperation = d->getOperation(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 2954 | d->updateCursor(); | - | ||||||||||||||||||||||||
| 2955 | - | |||||||||||||||||||||||||
| 2956 | d->hoveredSubControl = d->getSubControl(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 2957 | if (d->activeSubControl != QStyle::SC_None
| 0 | ||||||||||||||||||||||||
| 2958 | && d->activeSubControl == d->hoveredSubControl
| 0 | ||||||||||||||||||||||||
| 2959 | d->processClickedSubControl(); | - | ||||||||||||||||||||||||
| 2960 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2961 | d->activeSubControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 2962 | update(QRegion(0, 0, width(), d->titleBarHeight())); | - | ||||||||||||||||||||||||
| 2963 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2964 | - | |||||||||||||||||||||||||
| 2965 | - | |||||||||||||||||||||||||
| 2966 | - | |||||||||||||||||||||||||
| 2967 | - | |||||||||||||||||||||||||
| 2968 | void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 2969 | { | - | ||||||||||||||||||||||||
| 2970 | if (!parent()
| 0 | ||||||||||||||||||||||||
| 2971 | QWidget::mouseMoveEvent(mouseEvent); | - | ||||||||||||||||||||||||
| 2972 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2973 | } | - | ||||||||||||||||||||||||
| 2974 | - | |||||||||||||||||||||||||
| 2975 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2976 | - | |||||||||||||||||||||||||
| 2977 | if (!d->isMoveOperation()
| 0 | ||||||||||||||||||||||||
| 2978 | - | |||||||||||||||||||||||||
| 2979 | const QStyleOptionTitleBar options = d->titleBarOptions(); | - | ||||||||||||||||||||||||
| 2980 | QStyle::SubControl oldHover = d->hoveredSubControl; | - | ||||||||||||||||||||||||
| 2981 | d->hoveredSubControl = d->getSubControl(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 2982 | QRegion hoverRegion; | - | ||||||||||||||||||||||||
| 2983 | if (isHoverControl(oldHover)
| 0 | ||||||||||||||||||||||||
| 2984 | hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, oldHover, this); never executed: hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, oldHover, this); | 0 | ||||||||||||||||||||||||
| 2985 | if (isHoverControl(d->hoveredSubControl)
| 0 | ||||||||||||||||||||||||
| 2986 | hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, | - | ||||||||||||||||||||||||
| 2987 | d->hoveredSubControl, this); | - | ||||||||||||||||||||||||
| 2988 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2989 | - | |||||||||||||||||||||||||
| 2990 | - | |||||||||||||||||||||||||
| 2991 | - | |||||||||||||||||||||||||
| 2992 | - | |||||||||||||||||||||||||
| 2993 | if (!hoverRegion.isEmpty()
| 0 | ||||||||||||||||||||||||
| 2994 | update(hoverRegion); never executed: update(hoverRegion); | 0 | ||||||||||||||||||||||||
| 2995 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2996 | - | |||||||||||||||||||||||||
| 2997 | if ((
| 0 | ||||||||||||||||||||||||
| 2998 | if ((d->isResizeOperation()
| 0 | ||||||||||||||||||||||||
| 2999 | d->setNewGeometry(mapToParent(mouseEvent->pos())); never executed: d->setNewGeometry(mapToParent(mouseEvent->pos())); | 0 | ||||||||||||||||||||||||
| 3000 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3001 | } | - | ||||||||||||||||||||||||
| 3002 | - | |||||||||||||||||||||||||
| 3003 | - | |||||||||||||||||||||||||
| 3004 | d->currentOperation = d->getOperation(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 3005 | if ((d->isResizeOperation()
| 0 | ||||||||||||||||||||||||
| 3006 | d->currentOperation = QMdiSubWindowPrivate::None; never executed: d->currentOperation = QMdiSubWindowPrivate::None; | 0 | ||||||||||||||||||||||||
| 3007 | d->updateCursor(); | - | ||||||||||||||||||||||||
| 3008 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3009 | - | |||||||||||||||||||||||||
| 3010 | - | |||||||||||||||||||||||||
| 3011 | - | |||||||||||||||||||||||||
| 3012 | - | |||||||||||||||||||||||||
| 3013 | void QMdiSubWindow::keyPressEvent(QKeyEvent *keyEvent) | - | ||||||||||||||||||||||||
| 3014 | { | - | ||||||||||||||||||||||||
| 3015 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3016 | if (!d->isInInteractiveMode
| 0 | ||||||||||||||||||||||||
| 3017 | keyEvent->ignore(); | - | ||||||||||||||||||||||||
| 3018 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3019 | } | - | ||||||||||||||||||||||||
| 3020 | - | |||||||||||||||||||||||||
| 3021 | QPoint delta; | - | ||||||||||||||||||||||||
| 3022 | switch (keyEvent->key()) { | - | ||||||||||||||||||||||||
| 3023 | case never executed: Qt::Key_Right:case Qt::Key_Right:never executed: case Qt::Key_Right: | 0 | ||||||||||||||||||||||||
| 3024 | if (keyEvent->modifiers() & Qt::ShiftModifier
| 0 | ||||||||||||||||||||||||
| 3025 | delta = QPoint(d->keyboardPageStep, 0); never executed: delta = QPoint(d->keyboardPageStep, 0); | 0 | ||||||||||||||||||||||||
| 3026 | else | - | ||||||||||||||||||||||||
| 3027 | delta = QPoint(d->keyboardSingleStep, 0); never executed: delta = QPoint(d->keyboardSingleStep, 0); | 0 | ||||||||||||||||||||||||
| 3028 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3029 | case never executed: Qt::Key_Up:case Qt::Key_Up:never executed: case Qt::Key_Up: | 0 | ||||||||||||||||||||||||
| 3030 | if (keyEvent->modifiers() & Qt::ShiftModifier
| 0 | ||||||||||||||||||||||||
| 3031 | delta = QPoint(0, -d->keyboardPageStep); never executed: delta = QPoint(0, -d->keyboardPageStep); | 0 | ||||||||||||||||||||||||
| 3032 | else | - | ||||||||||||||||||||||||
| 3033 | delta = QPoint(0, -d->keyboardSingleStep); never executed: delta = QPoint(0, -d->keyboardSingleStep); | 0 | ||||||||||||||||||||||||
| 3034 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3035 | case never executed: Qt::Key_Left:case Qt::Key_Left:never executed: case Qt::Key_Left: | 0 | ||||||||||||||||||||||||
| 3036 | if (keyEvent->modifiers() & Qt::ShiftModifier
| 0 | ||||||||||||||||||||||||
| 3037 | delta = QPoint(-d->keyboardPageStep, 0); never executed: delta = QPoint(-d->keyboardPageStep, 0); | 0 | ||||||||||||||||||||||||
| 3038 | else | - | ||||||||||||||||||||||||
| 3039 | delta = QPoint(-d->keyboardSingleStep, 0); never executed: delta = QPoint(-d->keyboardSingleStep, 0); | 0 | ||||||||||||||||||||||||
| 3040 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3041 | case never executed: Qt::Key_Down:case Qt::Key_Down:never executed: case Qt::Key_Down: | 0 | ||||||||||||||||||||||||
| 3042 | if (keyEvent->modifiers() & Qt::ShiftModifier
| 0 | ||||||||||||||||||||||||
| 3043 | delta = QPoint(0, d->keyboardPageStep); never executed: delta = QPoint(0, d->keyboardPageStep); | 0 | ||||||||||||||||||||||||
| 3044 | else | - | ||||||||||||||||||||||||
| 3045 | delta = QPoint(0, d->keyboardSingleStep); never executed: delta = QPoint(0, d->keyboardSingleStep); | 0 | ||||||||||||||||||||||||
| 3046 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3047 | case never executed: Qt::Key_Escape:case Qt::Key_Escape:never executed: case Qt::Key_Escape: | 0 | ||||||||||||||||||||||||
| 3048 | case never executed: Qt::Key_Return:case Qt::Key_Return:never executed: case Qt::Key_Return: | 0 | ||||||||||||||||||||||||
| 3049 | case never executed: Qt::Key_Enter:case Qt::Key_Enter:never executed: case Qt::Key_Enter: | 0 | ||||||||||||||||||||||||
| 3050 | d->leaveInteractiveMode(); | - | ||||||||||||||||||||||||
| 3051 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3052 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 3053 | keyEvent->ignore(); | - | ||||||||||||||||||||||||
| 3054 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3055 | } | - | ||||||||||||||||||||||||
| 3056 | - | |||||||||||||||||||||||||
| 3057 | - | |||||||||||||||||||||||||
| 3058 | QPoint newPosition = parentWidget()->mapFromGlobal(cursor().pos() + delta); | - | ||||||||||||||||||||||||
| 3059 | QRect oldGeometry = | - | ||||||||||||||||||||||||
| 3060 | - | |||||||||||||||||||||||||
| 3061 | d->isInRubberBandMode
| 0 | ||||||||||||||||||||||||
| 3062 | - | |||||||||||||||||||||||||
| 3063 | geometry(); | - | ||||||||||||||||||||||||
| 3064 | d->setNewGeometry(newPosition); | - | ||||||||||||||||||||||||
| 3065 | QRect currentGeometry = | - | ||||||||||||||||||||||||
| 3066 | - | |||||||||||||||||||||||||
| 3067 | d->isInRubberBandMode
| 0 | ||||||||||||||||||||||||
| 3068 | - | |||||||||||||||||||||||||
| 3069 | geometry(); | - | ||||||||||||||||||||||||
| 3070 | if (currentGeometry == oldGeometry
| 0 | ||||||||||||||||||||||||
| 3071 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3072 | - | |||||||||||||||||||||||||
| 3073 | - | |||||||||||||||||||||||||
| 3074 | - | |||||||||||||||||||||||||
| 3075 | QPoint actualDelta; | - | ||||||||||||||||||||||||
| 3076 | if (d->isMoveOperation()
| 0 | ||||||||||||||||||||||||
| 3077 | actualDelta = QPoint(currentGeometry.x() - oldGeometry.x(), | - | ||||||||||||||||||||||||
| 3078 | currentGeometry.y() - oldGeometry.y()); | - | ||||||||||||||||||||||||
| 3079 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 3080 | int dx = isLeftToRight()
| 0 | ||||||||||||||||||||||||
| 3081 | : currentGeometry.x() - oldGeometry.x(); | - | ||||||||||||||||||||||||
| 3082 | actualDelta = QPoint(dx, currentGeometry.height() - oldGeometry.height()); | - | ||||||||||||||||||||||||
| 3083 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3084 | - | |||||||||||||||||||||||||
| 3085 | - | |||||||||||||||||||||||||
| 3086 | if (actualDelta != delta
| 0 | ||||||||||||||||||||||||
| 3087 | newPosition += (actualDelta - delta); never executed: newPosition += (actualDelta - delta); | 0 | ||||||||||||||||||||||||
| 3088 | cursor().setPos(parentWidget()->mapToGlobal(newPosition)); | - | ||||||||||||||||||||||||
| 3089 | - | |||||||||||||||||||||||||
| 3090 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3091 | - | |||||||||||||||||||||||||
| 3092 | - | |||||||||||||||||||||||||
| 3093 | - | |||||||||||||||||||||||||
| 3094 | - | |||||||||||||||||||||||||
| 3095 | - | |||||||||||||||||||||||||
| 3096 | void QMdiSubWindow::contextMenuEvent(QContextMenuEvent *contextMenuEvent) | - | ||||||||||||||||||||||||
| 3097 | { | - | ||||||||||||||||||||||||
| 3098 | QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3099 | if (!d->systemMenu
| 0 | ||||||||||||||||||||||||
| 3100 | contextMenuEvent->ignore(); | - | ||||||||||||||||||||||||
| 3101 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3102 | } | - | ||||||||||||||||||||||||
| 3103 | - | |||||||||||||||||||||||||
| 3104 | if (d->hoveredSubControl == QStyle::SC_TitleBarSysMenu
| 0 | ||||||||||||||||||||||||
| 3105 | || d->getRegion(QMdiSubWindowPrivate::Move).contains(contextMenuEvent->pos())
| 0 | ||||||||||||||||||||||||
| 3106 | d->systemMenu->exec(contextMenuEvent->globalPos()); | - | ||||||||||||||||||||||||
| 3107 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 3108 | contextMenuEvent->ignore(); | - | ||||||||||||||||||||||||
| 3109 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3110 | } | - | ||||||||||||||||||||||||
| 3111 | - | |||||||||||||||||||||||||
| 3112 | - | |||||||||||||||||||||||||
| 3113 | - | |||||||||||||||||||||||||
| 3114 | - | |||||||||||||||||||||||||
| 3115 | - | |||||||||||||||||||||||||
| 3116 | void QMdiSubWindow::focusInEvent(QFocusEvent *focusInEvent) | - | ||||||||||||||||||||||||
| 3117 | { | - | ||||||||||||||||||||||||
| 3118 | d_func()->focusInReason = focusInEvent->reason(); | - | ||||||||||||||||||||||||
| 3119 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3120 | - | |||||||||||||||||||||||||
| 3121 | - | |||||||||||||||||||||||||
| 3122 | - | |||||||||||||||||||||||||
| 3123 | - | |||||||||||||||||||||||||
| 3124 | void QMdiSubWindow::focusOutEvent(QFocusEvent * ) | - | ||||||||||||||||||||||||
| 3125 | { | - | ||||||||||||||||||||||||
| 3126 | - | |||||||||||||||||||||||||
| 3127 | } | - | ||||||||||||||||||||||||
| 3128 | - | |||||||||||||||||||||||||
| 3129 | - | |||||||||||||||||||||||||
| 3130 | - | |||||||||||||||||||||||||
| 3131 | - | |||||||||||||||||||||||||
| 3132 | void QMdiSubWindow::childEvent(QChildEvent *childEvent) | - | ||||||||||||||||||||||||
| 3133 | { | - | ||||||||||||||||||||||||
| 3134 | if (childEvent->type() != QEvent::ChildPolished
| 0 | ||||||||||||||||||||||||
| 3135 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3136 | - | |||||||||||||||||||||||||
| 3137 | if (QSizeGrip *sizeGrip = qobject_cast<QSizeGrip *>(childEvent->child())
| 0 | ||||||||||||||||||||||||
| 3138 | d_func()->setSizeGrip(sizeGrip); never executed: d_func()->setSizeGrip(sizeGrip); | 0 | ||||||||||||||||||||||||
| 3139 | - | |||||||||||||||||||||||||
| 3140 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3141 | - | |||||||||||||||||||||||||
| 3142 | - | |||||||||||||||||||||||||
| 3143 | - | |||||||||||||||||||||||||
| 3144 | - | |||||||||||||||||||||||||
| 3145 | QSize QMdiSubWindow::sizeHint() const | - | ||||||||||||||||||||||||
| 3146 | { | - | ||||||||||||||||||||||||
| 3147 | const QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3148 | int margin, minWidth; | - | ||||||||||||||||||||||||
| 3149 | d->sizeParameters(&margin, &minWidth); | - | ||||||||||||||||||||||||
| 3150 | QSize size(2 * margin, d->titleBarHeight() + margin); | - | ||||||||||||||||||||||||
| 3151 | if (d->baseWidget
| 0 | ||||||||||||||||||||||||
| 3152 | size += d->baseWidget->sizeHint(); never executed: size += d->baseWidget->sizeHint(); | 0 | ||||||||||||||||||||||||
| 3153 | return never executed: size.expandedTo(minimumSizeHint());return size.expandedTo(minimumSizeHint());never executed: return size.expandedTo(minimumSizeHint()); | 0 | ||||||||||||||||||||||||
| 3154 | } | - | ||||||||||||||||||||||||
| 3155 | - | |||||||||||||||||||||||||
| 3156 | - | |||||||||||||||||||||||||
| 3157 | - | |||||||||||||||||||||||||
| 3158 | - | |||||||||||||||||||||||||
| 3159 | QSize QMdiSubWindow::minimumSizeHint() const | - | ||||||||||||||||||||||||
| 3160 | { | - | ||||||||||||||||||||||||
| 3161 | const QMdiSubWindowPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3162 | if (isVisible()
| 0 | ||||||||||||||||||||||||
| 3163 | ensurePolished(); never executed: ensurePolished(); | 0 | ||||||||||||||||||||||||
| 3164 | - | |||||||||||||||||||||||||
| 3165 | - | |||||||||||||||||||||||||
| 3166 | if (parent()
| 0 | ||||||||||||||||||||||||
| 3167 | return never executed: d->iconSize();return d->iconSize();never executed: return d->iconSize(); | 0 | ||||||||||||||||||||||||
| 3168 | - | |||||||||||||||||||||||||
| 3169 | - | |||||||||||||||||||||||||
| 3170 | int margin, minWidth; | - | ||||||||||||||||||||||||
| 3171 | d->sizeParameters(&margin, &minWidth); | - | ||||||||||||||||||||||||
| 3172 | int decorationHeight = margin + d->titleBarHeight(); | - | ||||||||||||||||||||||||
| 3173 | int minHeight = decorationHeight; | - | ||||||||||||||||||||||||
| 3174 | - | |||||||||||||||||||||||||
| 3175 | - | |||||||||||||||||||||||||
| 3176 | if (parent()
| 0 | ||||||||||||||||||||||||
| 3177 | return never executed: QSize(qMax(minWidth, width()), d->titleBarHeight());return QSize(qMax(minWidth, width()), d->titleBarHeight());never executed: return QSize(qMax(minWidth, width()), d->titleBarHeight()); | 0 | ||||||||||||||||||||||||
| 3178 | - | |||||||||||||||||||||||||
| 3179 | - | |||||||||||||||||||||||||
| 3180 | if (layout()
| 0 | ||||||||||||||||||||||||
| 3181 | QSize minLayoutSize = layout()->minimumSize(); | - | ||||||||||||||||||||||||
| 3182 | if (minLayoutSize.isValid()
| 0 | ||||||||||||||||||||||||
| 3183 | minWidth = qMax(minWidth, minLayoutSize.width() + 2 * margin); | - | ||||||||||||||||||||||||
| 3184 | minHeight += minLayoutSize.height(); | - | ||||||||||||||||||||||||
| 3185 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3186 | } never executed: else if (d->baseWidgetend of block
| 0 | ||||||||||||||||||||||||
| 3187 | QSize minBaseWidgetSize = d->baseWidget->minimumSizeHint(); | - | ||||||||||||||||||||||||
| 3188 | if (minBaseWidgetSize.isValid()
| 0 | ||||||||||||||||||||||||
| 3189 | minWidth = qMax(minWidth, minBaseWidgetSize.width() + 2 * margin); | - | ||||||||||||||||||||||||
| 3190 | minHeight += minBaseWidgetSize.height(); | - | ||||||||||||||||||||||||
| 3191 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3192 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3193 | - | |||||||||||||||||||||||||
| 3194 | - | |||||||||||||||||||||||||
| 3195 | - | |||||||||||||||||||||||||
| 3196 | int sizeGripHeight = 0; | - | ||||||||||||||||||||||||
| 3197 | if (d->sizeGrip
| 0 | ||||||||||||||||||||||||
| 3198 | sizeGripHeight = d->sizeGrip->height(); never executed: sizeGripHeight = d->sizeGrip->height(); | 0 | ||||||||||||||||||||||||
| 3199 | - | |||||||||||||||||||||||||
| 3200 | - | |||||||||||||||||||||||||
| 3201 | - | |||||||||||||||||||||||||
| 3202 | - | |||||||||||||||||||||||||
| 3203 | minHeight = qMax(minHeight, decorationHeight + sizeGripHeight); | - | ||||||||||||||||||||||||
| 3204 | - | |||||||||||||||||||||||||
| 3205 | - | |||||||||||||||||||||||||
| 3206 | return never executed: QSize(minWidth, minHeight).expandedTo(QApplication::globalStrut());return QSize(minWidth, minHeight).expandedTo(QApplication::globalStrut());never executed: return QSize(minWidth, minHeight).expandedTo(QApplication::globalStrut()); | 0 | ||||||||||||||||||||||||
| 3207 | } | - | ||||||||||||||||||||||||
| 3208 | - | |||||||||||||||||||||||||
| 3209 | - | |||||||||||||||||||||||||
| 3210 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |