| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qmdisubwindow.cpp | 
| Source code | Switch to Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||
| 6 | ** This file is part of the QtWidgets module of the Qt Toolkit. | - | ||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | /*! | - | ||||||||||||||||||||||||
| 41 | \class QMdiSubWindow | - | ||||||||||||||||||||||||
| 42 | \brief The QMdiSubWindow class provides a subwindow class for | - | ||||||||||||||||||||||||
| 43 | QMdiArea. | - | ||||||||||||||||||||||||
| 44 | \since 4.3 | - | ||||||||||||||||||||||||
| 45 | \ingroup mainwindow-classes | - | ||||||||||||||||||||||||
| 46 | \inmodule QtWidgets | - | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | QMdiSubWindow represents a top-level window in a QMdiArea, and consists | - | ||||||||||||||||||||||||
| 49 | of a title bar with window decorations, an internal widget, and | - | ||||||||||||||||||||||||
| 50 | (depending on the current style) a window frame and a size | - | ||||||||||||||||||||||||
| 51 | grip. QMdiSubWindow has its own layout, which consists of the | - | ||||||||||||||||||||||||
| 52 | title bar and a center area for the internal widget. | - | ||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | \image qmdisubwindowlayout.png | - | ||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | The most common way to construct a QMdiSubWindow is to call | - | ||||||||||||||||||||||||
| 57 | QMdiArea::addSubWindow() with the internal widget as the argument. | - | ||||||||||||||||||||||||
| 58 | You can also create a subwindow yourself, and set an internal | - | ||||||||||||||||||||||||
| 59 | widget by calling setWidget(). | - | ||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | You use the same API when programming with subwindows as with | - | ||||||||||||||||||||||||
| 62 | regular top-level windows (e.g., you can call functions such as | - | ||||||||||||||||||||||||
| 63 | show(), hide(), showMaximized(), and setWindowTitle()). | - | ||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||
| 65 | \section1 Subwindow Handling | - | ||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | QMdiSubWindow also supports behavior specific to subwindows in | - | ||||||||||||||||||||||||
| 68 | an MDI area. | - | ||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | By default, each QMdiSubWindow is visible inside the MDI area | - | ||||||||||||||||||||||||
| 71 | viewport when moved around, but it is also possible to specify | - | ||||||||||||||||||||||||
| 72 | transparent window movement and resizing behavior, where only | - | ||||||||||||||||||||||||
| 73 | the outline of a subwindow is updated during these operations. | - | ||||||||||||||||||||||||
| 74 | The setOption() function is used to enable this behavior. | - | ||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||
| 76 | The isShaded() function detects whether the subwindow is | - | ||||||||||||||||||||||||
| 77 | currently shaded (i.e., the window is collapsed so that only the | - | ||||||||||||||||||||||||
| 78 | title bar is visible). To enter shaded mode, call showShaded(). | - | ||||||||||||||||||||||||
| 79 | QMdiSubWindow emits the windowStateChanged() signal whenever the | - | ||||||||||||||||||||||||
| 80 | window state has changed (e.g., when the window becomes minimized, | - | ||||||||||||||||||||||||
| 81 | or is restored). It also emits aboutToActivate() before it is | - | ||||||||||||||||||||||||
| 82 | activated. | - | ||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||
| 84 | In keyboard-interactive mode, the windows are moved and resized | - | ||||||||||||||||||||||||
| 85 | with the keyboard. You can enter this mode through the system menu | - | ||||||||||||||||||||||||
| 86 | of the window. The keyboardSingleStep and keyboardPageStep | - | ||||||||||||||||||||||||
| 87 | properties control the distance the widget is moved or resized for | - | ||||||||||||||||||||||||
| 88 | each keypress event. When shift is pressed down page step is used; | - | ||||||||||||||||||||||||
| 89 | otherwise single step is used. | - | ||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||
| 91 | You can also change the active window with the keyboard. By | - | ||||||||||||||||||||||||
| 92 | pressing the control and tab keys at the same time, the next | - | ||||||||||||||||||||||||
| 93 | (using the current \l{QMdiArea::}{WindowOrder}) subwindow will be | - | ||||||||||||||||||||||||
| 94 | activated. By pressing control, shift, and tab, you will activate | - | ||||||||||||||||||||||||
| 95 | the previous window. This is equivalent to calling | - | ||||||||||||||||||||||||
| 96 | \l{QMdiArea::}{activateNextSubWindow()} and | - | ||||||||||||||||||||||||
| 97 | \l{QMdiArea::}{activatePreviousSubWindow()}. Note that these | - | ||||||||||||||||||||||||
| 98 | shortcuts overrides global shortcuts, but not the \l{QMdiArea}s | - | ||||||||||||||||||||||||
| 99 | shortcuts. | - | ||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | \sa QMdiArea | - | ||||||||||||||||||||||||
| 102 | */ | - | ||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | /*! | - | ||||||||||||||||||||||||
| 105 | \enum QMdiSubWindow::SubWindowOption | - | ||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 | This enum describes options that customize the behavior | - | ||||||||||||||||||||||||
| 108 | of QMdiSubWindow. | - | ||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | \omitvalue AllowOutsideAreaHorizontally | - | ||||||||||||||||||||||||
| 111 | \omitvalue AllowOutsideAreaVertically | - | ||||||||||||||||||||||||
| 112 | - | |||||||||||||||||||||||||
| 113 | \value RubberBandResize If you enable this option, a rubber band | - | ||||||||||||||||||||||||
| 114 | control is used to represent the subwindow's outline, and the user | - | ||||||||||||||||||||||||
| 115 | resizes this instead of the subwindow itself. | - | ||||||||||||||||||||||||
| 116 | As a result, the subwindow maintains its original position and size | - | ||||||||||||||||||||||||
| 117 | until the resize operation has been completed, at which time it will | - | ||||||||||||||||||||||||
| 118 | receive a single QResizeEvent. | - | ||||||||||||||||||||||||
| 119 | By default, this option is disabled. | - | ||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | \value RubberBandMove If you enable this option, a rubber band | - | ||||||||||||||||||||||||
| 122 | control is used to represent the subwindow's outline, and the user | - | ||||||||||||||||||||||||
| 123 | moves this instead of the subwindow itself. | - | ||||||||||||||||||||||||
| 124 | As a result, the subwindow remains in its original position until | - | ||||||||||||||||||||||||
| 125 | the move operation has completed, at which time a QMoveEvent is | - | ||||||||||||||||||||||||
| 126 | sent to the window. By default, this option is disabled. | - | ||||||||||||||||||||||||
| 127 | */ | - | ||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | /*! | - | ||||||||||||||||||||||||
| 130 | \fn QMdiSubWindow::windowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState) | - | ||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | QMdiSubWindow emits this signal after the window state changes. \a | - | ||||||||||||||||||||||||
| 133 | oldState is the window state before it changed, and \a newState is the | - | ||||||||||||||||||||||||
| 134 | new, current state. | - | ||||||||||||||||||||||||
| 135 | */ | - | ||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | /*! | - | ||||||||||||||||||||||||
| 138 | \fn QMdiSubWindow::aboutToActivate() | - | ||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||
| 140 | QMdiSubWindow emits this signal immediately before it is | - | ||||||||||||||||||||||||
| 141 | activated. After the subwindow has been activated, the QMdiArea that | - | ||||||||||||||||||||||||
| 142 | manages the subwindow will also emit the | - | ||||||||||||||||||||||||
| 143 | \l{QMdiArea::}{subWindowActivated()} signal. | - | ||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||
| 145 | \sa QMdiArea::subWindowActivated() | - | ||||||||||||||||||||||||
| 146 | */ | - | ||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||
| 148 | #include "qmdisubwindow_p.h" | - | ||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | #ifndef QT_NO_MDIAREA | - | ||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||
| 152 | #include <QApplication> | - | ||||||||||||||||||||||||
| 153 | #include <QStylePainter> | - | ||||||||||||||||||||||||
| 154 | #include <QVBoxLayout> | - | ||||||||||||||||||||||||
| 155 | #include <QMouseEvent> | - | ||||||||||||||||||||||||
| 156 | #include <QWhatsThis> | - | ||||||||||||||||||||||||
| 157 | #include <QToolTip> | - | ||||||||||||||||||||||||
| 158 | #include <QMainWindow> | - | ||||||||||||||||||||||||
| 159 | #include <QScrollBar> | - | ||||||||||||||||||||||||
| 160 | #include <QDebug> | - | ||||||||||||||||||||||||
| 161 | #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 162 | #include <private/qmacstyle_mac_p.h> | - | ||||||||||||||||||||||||
| 163 | #endif | - | ||||||||||||||||||||||||
| 164 | #include <QMdiArea> | - | ||||||||||||||||||||||||
| 165 | #include <QScopedValueRollback> | - | ||||||||||||||||||||||||
| 166 | - | |||||||||||||||||||||||||
| 167 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||
| 169 | using namespace QMdi; | - | ||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||
| 171 | static const QStyle::SubControl SubControls[] = | - | ||||||||||||||||||||||||
| 172 | { | - | ||||||||||||||||||||||||
| 173 | QStyle::SC_TitleBarLabel, // 1 | - | ||||||||||||||||||||||||
| 174 | QStyle::SC_TitleBarSysMenu, // 2 | - | ||||||||||||||||||||||||
| 175 | QStyle::SC_TitleBarMinButton, // 3 | - | ||||||||||||||||||||||||
| 176 | QStyle::SC_TitleBarMaxButton, // 4 | - | ||||||||||||||||||||||||
| 177 | QStyle::SC_TitleBarShadeButton, // 5 | - | ||||||||||||||||||||||||
| 178 | QStyle::SC_TitleBarCloseButton, // 6 | - | ||||||||||||||||||||||||
| 179 | QStyle::SC_TitleBarNormalButton, // 7 | - | ||||||||||||||||||||||||
| 180 | QStyle::SC_TitleBarUnshadeButton, // 8 | - | ||||||||||||||||||||||||
| 181 | QStyle::SC_TitleBarContextHelpButton // 9 | - | ||||||||||||||||||||||||
| 182 | }; | - | ||||||||||||||||||||||||
| 183 | static const int NumSubControls = sizeof(SubControls) / sizeof(SubControls[0]); | - | ||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||
| 185 | static const Qt::WindowFlags CustomizeWindowFlags = | - | ||||||||||||||||||||||||
| 186 | Qt::FramelessWindowHint | - | ||||||||||||||||||||||||
| 187 | | Qt::CustomizeWindowHint | - | ||||||||||||||||||||||||
| 188 | | Qt::WindowTitleHint | - | ||||||||||||||||||||||||
| 189 | | Qt::WindowSystemMenuHint | - | ||||||||||||||||||||||||
| 190 | | Qt::WindowMinimizeButtonHint | - | ||||||||||||||||||||||||
| 191 | | Qt::WindowMaximizeButtonHint | - | ||||||||||||||||||||||||
| 192 | | Qt::WindowMinMaxButtonsHint; | - | ||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | static const int BoundaryMargin = 5; | - | ||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | static inline int getMoveDeltaComponent(uint cflags, uint moveFlag, uint resizeFlag, | - | ||||||||||||||||||||||||
| 198 | int delta, int maxDelta, int minDelta) | - | ||||||||||||||||||||||||
| 199 | { | - | ||||||||||||||||||||||||
| 200 | if (cflags & moveFlag) { 
 | 0 | ||||||||||||||||||||||||
| 201 | if (delta > 0) 
 | 0 | ||||||||||||||||||||||||
| 202 | return (cflags & resizeFlag) ? qMin(delta, maxDelta) : delta; never executed:  return (cflags & resizeFlag) ? qMin(delta, maxDelta) : delta; | 0 | ||||||||||||||||||||||||
| 203 | return (cflags & resizeFlag) ? qMax(delta, minDelta) : delta; never executed:  return (cflags & resizeFlag) ? qMax(delta, minDelta) : delta; | 0 | ||||||||||||||||||||||||
| 204 | } | - | ||||||||||||||||||||||||
| 205 | return 0; never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 206 | } | - | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | static inline int getResizeDeltaComponent(uint cflags, uint resizeFlag, | - | ||||||||||||||||||||||||
| 209 | uint resizeReverseFlag, int delta) | - | ||||||||||||||||||||||||
| 210 | { | - | ||||||||||||||||||||||||
| 211 | if (cflags & resizeFlag) { 
 | 0 | ||||||||||||||||||||||||
| 212 | if (cflags & resizeReverseFlag) 
 | 0 | ||||||||||||||||||||||||
| 213 | return -delta; never executed:  return -delta; | 0 | ||||||||||||||||||||||||
| 214 | return delta; never executed:  return delta; | 0 | ||||||||||||||||||||||||
| 215 | } | - | ||||||||||||||||||||||||
| 216 | return 0; never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 217 | } | - | ||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | static inline bool isChildOfQMdiSubWindow(const QWidget *child) | - | ||||||||||||||||||||||||
| 220 | { | - | ||||||||||||||||||||||||
| 221 | Q_ASSERT(child); | - | ||||||||||||||||||||||||
| 222 | QWidget *parent = child->parentWidget(); | - | ||||||||||||||||||||||||
| 223 | while (parent) { 
 | 0 | ||||||||||||||||||||||||
| 224 | if (qobject_cast<QMdiSubWindow *>(parent)) 
 | 0 | ||||||||||||||||||||||||
| 225 | return true; never executed:  return true; | 0 | ||||||||||||||||||||||||
| 226 | parent = parent->parentWidget(); | - | ||||||||||||||||||||||||
| 227 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 228 | return false; never executed:  return false; | 0 | ||||||||||||||||||||||||
| 229 | } | - | ||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | static inline bool isChildOfTabbedQMdiArea(const QMdiSubWindow *child) | - | ||||||||||||||||||||||||
| 232 | { | - | ||||||||||||||||||||||||
| 233 | Q_ASSERT(child); | - | ||||||||||||||||||||||||
| 234 | if (QMdiArea *mdiArea = child->mdiArea()) { 
 | 0 | ||||||||||||||||||||||||
| 235 | if (mdiArea->viewMode() == QMdiArea::TabbedView) 
 | 0 | ||||||||||||||||||||||||
| 236 | return true; never executed:  return true; | 0 | ||||||||||||||||||||||||
| 237 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 238 | return false; never executed:  return false; | 0 | ||||||||||||||||||||||||
| 239 | } | - | ||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | template<typename T> | - | ||||||||||||||||||||||||
| 242 | static inline ControlElement<T> *ptr(QWidget *widget) | - | ||||||||||||||||||||||||
| 243 | { | - | ||||||||||||||||||||||||
| 244 | if (widget && widget->qt_metacast("ControlElement") 
 
 | 0 | ||||||||||||||||||||||||
| 245 | && strcmp(widget->metaObject()->className(), T::staticMetaObject.className()) == 0) { 
 | 0 | ||||||||||||||||||||||||
| 246 | return static_cast<ControlElement<T> *>(widget); never executed:  return static_cast<ControlElement<T> *>(widget); | 0 | ||||||||||||||||||||||||
| 247 | } | - | ||||||||||||||||||||||||
| 248 | return 0; never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 249 | } | - | ||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||
| 251 | QString QMdiSubWindowPrivate::originalWindowTitle() | - | ||||||||||||||||||||||||
| 252 | { | - | ||||||||||||||||||||||||
| 253 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 254 | if (originalTitle.isNull()) { 
 | 0 | ||||||||||||||||||||||||
| 255 | originalTitle = q->window()->windowTitle(); | - | ||||||||||||||||||||||||
| 256 | if (originalTitle.isNull()) 
 | 0 | ||||||||||||||||||||||||
| 257 | originalTitle = QLatin1String(""); never executed:  originalTitle = QLatin1String(""); | 0 | ||||||||||||||||||||||||
| 258 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 259 | return originalTitle; never executed:  return originalTitle; | 0 | ||||||||||||||||||||||||
| 260 | } | - | ||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | void QMdiSubWindowPrivate::setNewWindowTitle() | - | ||||||||||||||||||||||||
| 263 | { | - | ||||||||||||||||||||||||
| 264 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 265 | QString childTitle = q->windowTitle(); | - | ||||||||||||||||||||||||
| 266 | if (childTitle.isEmpty()) 
 | 0 | ||||||||||||||||||||||||
| 267 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 268 | QString original = originalWindowTitle(); | - | ||||||||||||||||||||||||
| 269 | if (!original.isEmpty()) { 
 | 0 | ||||||||||||||||||||||||
| 270 | if (!original.contains(QMdiSubWindow::tr("- [%1]").arg(childTitle))) 
 | 0 | ||||||||||||||||||||||||
| 271 | q->window()->setWindowTitle(QMdiSubWindow::tr("%1 - [%2]").arg(original, childTitle)); never executed:  q->window()->setWindowTitle(QMdiSubWindow::tr("%1 - [%2]").arg(original, childTitle)); | 0 | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 274 | q->window()->setWindowTitle(childTitle); | - | ||||||||||||||||||||||||
| 275 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 276 | } | - | ||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||
| 278 | static inline bool isHoverControl(QStyle::SubControl control) | - | ||||||||||||||||||||||||
| 279 | { | - | ||||||||||||||||||||||||
| 280 | return control != QStyle::SC_None && control != QStyle::SC_TitleBarLabel; never executed:  return control != QStyle::SC_None && control != QStyle::SC_TitleBarLabel; | 0 | ||||||||||||||||||||||||
| 281 | } | - | ||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | #if defined(Q_DEAD_CODE_FROM_QT4_WIN) | - | ||||||||||||||||||||||||
| 284 | static inline QRgb colorref2qrgb(COLORREF col) | - | ||||||||||||||||||||||||
| 285 | { | - | ||||||||||||||||||||||||
| 286 | return qRgb(GetRValue(col),GetGValue(col),GetBValue(col)); | - | ||||||||||||||||||||||||
| 287 | } | - | ||||||||||||||||||||||||
| 288 | #endif | - | ||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||
| 290 | #ifndef QT_NO_TOOLTIP | - | ||||||||||||||||||||||||
| 291 | static void showToolTip(QHelpEvent *helpEvent, QWidget *widget, const QStyleOptionComplex &opt, | - | ||||||||||||||||||||||||
| 292 | QStyle::ComplexControl complexControl, QStyle::SubControl subControl) | - | ||||||||||||||||||||||||
| 293 | { | - | ||||||||||||||||||||||||
| 294 | Q_ASSERT(helpEvent); | - | ||||||||||||||||||||||||
| 295 | Q_ASSERT(helpEvent->type() == QEvent::ToolTip); | - | ||||||||||||||||||||||||
| 296 | Q_ASSERT(widget); | - | ||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||
| 298 | #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 299 | // Native Mac windows don't show tool tip. | - | ||||||||||||||||||||||||
| 300 | if (qobject_cast<QMacStyle *>(widget->style())) | - | ||||||||||||||||||||||||
| 301 | return; | - | ||||||||||||||||||||||||
| 302 | #endif | - | ||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||
| 304 | // Convert CC_MdiControls to CC_TitleBar. Sub controls of different complex | - | ||||||||||||||||||||||||
| 305 | // controls cannot be in the same switch as they might have the same value. | - | ||||||||||||||||||||||||
| 306 | if (complexControl == QStyle::CC_MdiControls) { 
 | 0 | ||||||||||||||||||||||||
| 307 | if (subControl == QStyle::SC_MdiMinButton) 
 | 0 | ||||||||||||||||||||||||
| 308 | subControl = QStyle::SC_TitleBarMinButton; never executed:  subControl = QStyle::SC_TitleBarMinButton; | 0 | ||||||||||||||||||||||||
| 309 | else if (subControl == QStyle::SC_MdiCloseButton) 
 | 0 | ||||||||||||||||||||||||
| 310 | subControl = QStyle::SC_TitleBarCloseButton; never executed:  subControl = QStyle::SC_TitleBarCloseButton; | 0 | ||||||||||||||||||||||||
| 311 | else if (subControl == QStyle::SC_MdiNormalButton) 
 | 0 | ||||||||||||||||||||||||
| 312 | subControl = QStyle::SC_TitleBarNormalButton; never executed:  subControl = QStyle::SC_TitleBarNormalButton; | 0 | ||||||||||||||||||||||||
| 313 | else | - | ||||||||||||||||||||||||
| 314 | subControl = QStyle::SC_None; never executed:  subControl = QStyle::SC_None; | 0 | ||||||||||||||||||||||||
| 315 | } | - | ||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||
| 317 | // Don't change the tooltip for the base widget itself. | - | ||||||||||||||||||||||||
| 318 | if (subControl == QStyle::SC_None) 
 | 0 | ||||||||||||||||||||||||
| 319 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 320 | - | |||||||||||||||||||||||||
| 321 | QString toolTip; | - | ||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||
| 323 | switch (subControl) { | - | ||||||||||||||||||||||||
| 324 | case QStyle::SC_TitleBarMinButton: never executed:  case QStyle::SC_TitleBarMinButton: | 0 | ||||||||||||||||||||||||
| 325 | toolTip = QMdiSubWindow::tr("Minimize"); | - | ||||||||||||||||||||||||
| 326 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 327 | case QStyle::SC_TitleBarMaxButton: never executed:  case QStyle::SC_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||
| 328 | toolTip = QMdiSubWindow::tr("Maximize"); | - | ||||||||||||||||||||||||
| 329 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 330 | case QStyle::SC_TitleBarUnshadeButton: never executed:  case QStyle::SC_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||
| 331 | toolTip = QMdiSubWindow::tr("Unshade"); | - | ||||||||||||||||||||||||
| 332 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 333 | case QStyle::SC_TitleBarShadeButton: never executed:  case QStyle::SC_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||
| 334 | toolTip = QMdiSubWindow::tr("Shade"); | - | ||||||||||||||||||||||||
| 335 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 336 | case QStyle::SC_TitleBarNormalButton: never executed:  case QStyle::SC_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||
| 337 | if (widget->isMaximized() || !qobject_cast<QMdiSubWindow *>(widget)) 
 
 | 0 | ||||||||||||||||||||||||
| 338 | toolTip = QMdiSubWindow::tr("Restore Down"); never executed:  toolTip = QMdiSubWindow::tr("Restore Down"); | 0 | ||||||||||||||||||||||||
| 339 | else | - | ||||||||||||||||||||||||
| 340 | toolTip = QMdiSubWindow::tr("Restore"); never executed:  toolTip = QMdiSubWindow::tr("Restore"); | 0 | ||||||||||||||||||||||||
| 341 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 342 | case QStyle::SC_TitleBarCloseButton: never executed:  case QStyle::SC_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||
| 343 | toolTip = QMdiSubWindow::tr("Close"); | - | ||||||||||||||||||||||||
| 344 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 345 | case QStyle::SC_TitleBarContextHelpButton: never executed:  case QStyle::SC_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||
| 346 | toolTip = QMdiSubWindow::tr("Help"); | - | ||||||||||||||||||||||||
| 347 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 348 | case QStyle::SC_TitleBarSysMenu: never executed:  case QStyle::SC_TitleBarSysMenu: | 0 | ||||||||||||||||||||||||
| 349 | toolTip = QMdiSubWindow::tr("Menu"); | - | ||||||||||||||||||||||||
| 350 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 351 | default: never executed:  default: | 0 | ||||||||||||||||||||||||
| 352 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 353 | } | - | ||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||
| 355 | const QRect rect = widget->style()->subControlRect(complexControl, &opt, subControl, widget); | - | ||||||||||||||||||||||||
| 356 | QToolTip::showText(helpEvent->globalPos(), toolTip, widget, rect); | - | ||||||||||||||||||||||||
| 357 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 358 | #endif // QT_NO_TOOLTIP | - | ||||||||||||||||||||||||
| 359 | - | |||||||||||||||||||||||||
| 360 | namespace QMdi { | - | ||||||||||||||||||||||||
| 361 | /* | - | ||||||||||||||||||||||||
| 362 | \class ControlLabel | - | ||||||||||||||||||||||||
| 363 | \internal | - | ||||||||||||||||||||||||
| 364 | */ | - | ||||||||||||||||||||||||
| 365 | class ControlLabel : public QWidget | - | ||||||||||||||||||||||||
| 366 | { | - | ||||||||||||||||||||||||
| 367 | Q_OBJECT | - | ||||||||||||||||||||||||
| 368 | public: | - | ||||||||||||||||||||||||
| 369 | ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = 0); | - | ||||||||||||||||||||||||
| 370 | - | |||||||||||||||||||||||||
| 371 | QSize sizeHint() const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 372 | - | |||||||||||||||||||||||||
| 373 | signals: | - | ||||||||||||||||||||||||
| 374 | void _q_clicked(); | - | ||||||||||||||||||||||||
| 375 | void _q_doubleClicked(); | - | ||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | protected: | - | ||||||||||||||||||||||||
| 378 | bool event(QEvent *event) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 379 | void paintEvent(QPaintEvent *paintEvent) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 380 | void mousePressEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 381 | void mouseDoubleClickEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 382 | void mouseReleaseEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | private: | - | ||||||||||||||||||||||||
| 385 | QPixmap label; | - | ||||||||||||||||||||||||
| 386 | bool isPressed; | - | ||||||||||||||||||||||||
| 387 | void updateWindowIcon(); | - | ||||||||||||||||||||||||
| 388 | }; | - | ||||||||||||||||||||||||
| 389 | } // namespace QMdi | - | ||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||
| 391 | ControlLabel::ControlLabel(QMdiSubWindow *subWindow, QWidget *parent) | - | ||||||||||||||||||||||||
| 392 | : QWidget(parent), isPressed(false) | - | ||||||||||||||||||||||||
| 393 | { | - | ||||||||||||||||||||||||
| 394 | Q_UNUSED(subWindow); | - | ||||||||||||||||||||||||
| 395 | setFocusPolicy(Qt::NoFocus); | - | ||||||||||||||||||||||||
| 396 | updateWindowIcon(); | - | ||||||||||||||||||||||||
| 397 | setFixedSize(label.size()); | - | ||||||||||||||||||||||||
| 398 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||
| 400 | /* | - | ||||||||||||||||||||||||
| 401 | \internal | - | ||||||||||||||||||||||||
| 402 | */ | - | ||||||||||||||||||||||||
| 403 | QSize ControlLabel::sizeHint() const | - | ||||||||||||||||||||||||
| 404 | { | - | ||||||||||||||||||||||||
| 405 | return label.size(); never executed:  return label.size(); | 0 | ||||||||||||||||||||||||
| 406 | } | - | ||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||
| 408 | /* | - | ||||||||||||||||||||||||
| 409 | \internal | - | ||||||||||||||||||||||||
| 410 | */ | - | ||||||||||||||||||||||||
| 411 | bool ControlLabel::event(QEvent *event) | - | ||||||||||||||||||||||||
| 412 | { | - | ||||||||||||||||||||||||
| 413 | if (event->type() == QEvent::WindowIconChange) 
 | 0 | ||||||||||||||||||||||||
| 414 | updateWindowIcon(); never executed:  updateWindowIcon(); | 0 | ||||||||||||||||||||||||
| 415 | #ifndef QT_NO_TOOLTIP | - | ||||||||||||||||||||||||
| 416 | else if (event->type() == QEvent::ToolTip) { 
 | 0 | ||||||||||||||||||||||||
| 417 | QStyleOptionTitleBar options; | - | ||||||||||||||||||||||||
| 418 | options.initFrom(this); | - | ||||||||||||||||||||||||
| 419 | showToolTip(static_cast<QHelpEvent *>(event), this, options, | - | ||||||||||||||||||||||||
| 420 | QStyle::CC_TitleBar, QStyle::SC_TitleBarSysMenu); | - | ||||||||||||||||||||||||
| 421 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 422 | #endif | - | ||||||||||||||||||||||||
| 423 | return QWidget::event(event); never executed:  return QWidget::event(event); | 0 | ||||||||||||||||||||||||
| 424 | } | - | ||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | /* | - | ||||||||||||||||||||||||
| 427 | \internal | - | ||||||||||||||||||||||||
| 428 | */ | - | ||||||||||||||||||||||||
| 429 | void ControlLabel::paintEvent(QPaintEvent * /*paintEvent*/) | - | ||||||||||||||||||||||||
| 430 | { | - | ||||||||||||||||||||||||
| 431 | QPainter painter(this); | - | ||||||||||||||||||||||||
| 432 | painter.drawPixmap(0, 0, label); | - | ||||||||||||||||||||||||
| 433 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | /* | - | ||||||||||||||||||||||||
| 436 | \internal | - | ||||||||||||||||||||||||
| 437 | */ | - | ||||||||||||||||||||||||
| 438 | void ControlLabel::mousePressEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 439 | { | - | ||||||||||||||||||||||||
| 440 | if (mouseEvent->button() != Qt::LeftButton) { 
 | 0 | ||||||||||||||||||||||||
| 441 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
| 442 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 443 | } | - | ||||||||||||||||||||||||
| 444 | isPressed = true; | - | ||||||||||||||||||||||||
| 445 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 446 | - | |||||||||||||||||||||||||
| 447 | /* | - | ||||||||||||||||||||||||
| 448 | \internal | - | ||||||||||||||||||||||||
| 449 | */ | - | ||||||||||||||||||||||||
| 450 | void ControlLabel::mouseDoubleClickEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 451 | { | - | ||||||||||||||||||||||||
| 452 | if (mouseEvent->button() != Qt::LeftButton) { 
 | 0 | ||||||||||||||||||||||||
| 453 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
| 454 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 455 | } | - | ||||||||||||||||||||||||
| 456 | isPressed = false; | - | ||||||||||||||||||||||||
| 457 | emit _q_doubleClicked(); | - | ||||||||||||||||||||||||
| 458 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 459 | - | |||||||||||||||||||||||||
| 460 | /* | - | ||||||||||||||||||||||||
| 461 | \internal | - | ||||||||||||||||||||||||
| 462 | */ | - | ||||||||||||||||||||||||
| 463 | void ControlLabel::mouseReleaseEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 464 | { | - | ||||||||||||||||||||||||
| 465 | if (mouseEvent->button() != Qt::LeftButton) { 
 | 0 | ||||||||||||||||||||||||
| 466 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
| 467 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 468 | } | - | ||||||||||||||||||||||||
| 469 | if (isPressed) { 
 | 0 | ||||||||||||||||||||||||
| 470 | isPressed = false; | - | ||||||||||||||||||||||||
| 471 | emit _q_clicked(); | - | ||||||||||||||||||||||||
| 472 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 473 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||
| 475 | /* | - | ||||||||||||||||||||||||
| 476 | \internal | - | ||||||||||||||||||||||||
| 477 | */ | - | ||||||||||||||||||||||||
| 478 | void ControlLabel::updateWindowIcon() | - | ||||||||||||||||||||||||
| 479 | { | - | ||||||||||||||||||||||||
| 480 | QIcon menuIcon = windowIcon(); | - | ||||||||||||||||||||||||
| 481 | if (menuIcon.isNull()) 
 | 0 | ||||||||||||||||||||||||
| 482 | menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget()); never executed:  menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget()); | 0 | ||||||||||||||||||||||||
| 483 | label = menuIcon.pixmap(16, 16); | - | ||||||||||||||||||||||||
| 484 | update(); | - | ||||||||||||||||||||||||
| 485 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 486 | - | |||||||||||||||||||||||||
| 487 | namespace QMdi { | - | ||||||||||||||||||||||||
| 488 | /* | - | ||||||||||||||||||||||||
| 489 | \class ControllerWidget | - | ||||||||||||||||||||||||
| 490 | \internal | - | ||||||||||||||||||||||||
| 491 | */ | - | ||||||||||||||||||||||||
| 492 | class ControllerWidget : public QWidget | - | ||||||||||||||||||||||||
| 493 | { | - | ||||||||||||||||||||||||
| 494 | Q_OBJECT | - | ||||||||||||||||||||||||
| 495 | public: | - | ||||||||||||||||||||||||
| 496 | ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent = 0); | - | ||||||||||||||||||||||||
| 497 | QSize sizeHint() const Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 498 | void setControlVisible(QMdiSubWindowPrivate::WindowStateAction action, bool visible); | - | ||||||||||||||||||||||||
| 499 | inline bool hasVisibleControls() const | - | ||||||||||||||||||||||||
| 500 | { | - | ||||||||||||||||||||||||
| 501 | return (visibleControls & QStyle::SC_MdiMinButton) never executed:  return (visibleControls & QStyle::SC_MdiMinButton) || (visibleControls & QStyle::SC_MdiNormalButton) || (visibleControls & QStyle::SC_MdiCloseButton); | 0 | ||||||||||||||||||||||||
| 502 | || (visibleControls & QStyle::SC_MdiNormalButton) never executed:  return (visibleControls & QStyle::SC_MdiMinButton) || (visibleControls & QStyle::SC_MdiNormalButton) || (visibleControls & QStyle::SC_MdiCloseButton); | 0 | ||||||||||||||||||||||||
| 503 | || (visibleControls & QStyle::SC_MdiCloseButton); never executed:  return (visibleControls & QStyle::SC_MdiMinButton) || (visibleControls & QStyle::SC_MdiNormalButton) || (visibleControls & QStyle::SC_MdiCloseButton); | 0 | ||||||||||||||||||||||||
| 504 | } | - | ||||||||||||||||||||||||
| 505 | - | |||||||||||||||||||||||||
| 506 | signals: | - | ||||||||||||||||||||||||
| 507 | void _q_minimize(); | - | ||||||||||||||||||||||||
| 508 | void _q_restore(); | - | ||||||||||||||||||||||||
| 509 | void _q_close(); | - | ||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||
| 511 | protected: | - | ||||||||||||||||||||||||
| 512 | void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 513 | void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 514 | void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 515 | void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 516 | void leaveEvent(QEvent *event) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 517 | bool event(QEvent *event) Q_DECL_OVERRIDE; | - | ||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||
| 519 | private: | - | ||||||||||||||||||||||||
| 520 | QStyle::SubControl activeControl; | - | ||||||||||||||||||||||||
| 521 | QStyle::SubControl hoverControl; | - | ||||||||||||||||||||||||
| 522 | QStyle::SubControls visibleControls; | - | ||||||||||||||||||||||||
| 523 | void initStyleOption(QStyleOptionComplex *option) const; | - | ||||||||||||||||||||||||
| 524 | QMdiArea *mdiArea; | - | ||||||||||||||||||||||||
| 525 | inline QStyle::SubControl getSubControl(const QPoint &pos) const | - | ||||||||||||||||||||||||
| 526 | { | - | ||||||||||||||||||||||||
| 527 | QStyleOptionComplex opt; | - | ||||||||||||||||||||||||
| 528 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 529 | return style()->hitTestComplexControl(QStyle::CC_MdiControls, &opt, pos, mdiArea); never executed:  return style()->hitTestComplexControl(QStyle::CC_MdiControls, &opt, pos, mdiArea); | 0 | ||||||||||||||||||||||||
| 530 | } | - | ||||||||||||||||||||||||
| 531 | }; | - | ||||||||||||||||||||||||
| 532 | } // namespace QMdi | - | ||||||||||||||||||||||||
| 533 | - | |||||||||||||||||||||||||
| 534 | /* | - | ||||||||||||||||||||||||
| 535 | \internal | - | ||||||||||||||||||||||||
| 536 | */ | - | ||||||||||||||||||||||||
| 537 | ControllerWidget::ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent) | - | ||||||||||||||||||||||||
| 538 | : QWidget(parent), | - | ||||||||||||||||||||||||
| 539 | activeControl(QStyle::SC_None), | - | ||||||||||||||||||||||||
| 540 | hoverControl(QStyle::SC_None), | - | ||||||||||||||||||||||||
| 541 | visibleControls(QStyle::SC_None), | - | ||||||||||||||||||||||||
| 542 | mdiArea(0) | - | ||||||||||||||||||||||||
| 543 | { | - | ||||||||||||||||||||||||
| 544 | if (subWindow->parentWidget()) 
 | 0 | ||||||||||||||||||||||||
| 545 | mdiArea = qobject_cast<QMdiArea *>(subWindow->parentWidget()->parentWidget()); never executed:  mdiArea = qobject_cast<QMdiArea *>(subWindow->parentWidget()->parentWidget()); | 0 | ||||||||||||||||||||||||
| 546 | setFocusPolicy(Qt::NoFocus); | - | ||||||||||||||||||||||||
| 547 | setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); | - | ||||||||||||||||||||||||
| 548 | setMouseTracking(true); | - | ||||||||||||||||||||||||
| 549 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 550 | - | |||||||||||||||||||||||||
| 551 | /* | - | ||||||||||||||||||||||||
| 552 | \internal | - | ||||||||||||||||||||||||
| 553 | */ | - | ||||||||||||||||||||||||
| 554 | QSize ControllerWidget::sizeHint() const | - | ||||||||||||||||||||||||
| 555 | { | - | ||||||||||||||||||||||||
| 556 | ensurePolished(); | - | ||||||||||||||||||||||||
| 557 | QStyleOptionComplex opt; | - | ||||||||||||||||||||||||
| 558 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 559 | QSize size(48, 16); | - | ||||||||||||||||||||||||
| 560 | return style()->sizeFromContents(QStyle::CT_MdiControls, &opt, size, mdiArea); never executed:  return style()->sizeFromContents(QStyle::CT_MdiControls, &opt, size, mdiArea); | 0 | ||||||||||||||||||||||||
| 561 | } | - | ||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||
| 563 | void ControllerWidget::setControlVisible(QMdiSubWindowPrivate::WindowStateAction action, bool visible) | - | ||||||||||||||||||||||||
| 564 | { | - | ||||||||||||||||||||||||
| 565 | QStyle::SubControl subControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 566 | - | |||||||||||||||||||||||||
| 567 | // Map action from QMdiSubWindowPrivate::WindowStateAction to QStyle::SubControl. | - | ||||||||||||||||||||||||
| 568 | if (action == QMdiSubWindowPrivate::MaximizeAction) 
 | 0 | ||||||||||||||||||||||||
| 569 | subControl = QStyle::SC_MdiNormalButton; never executed:  subControl = QStyle::SC_MdiNormalButton; | 0 | ||||||||||||||||||||||||
| 570 | else if (action == QMdiSubWindowPrivate::CloseAction) 
 | 0 | ||||||||||||||||||||||||
| 571 | subControl = QStyle::SC_MdiCloseButton; never executed:  subControl = QStyle::SC_MdiCloseButton; | 0 | ||||||||||||||||||||||||
| 572 | else if (action == QMdiSubWindowPrivate::MinimizeAction) 
 | 0 | ||||||||||||||||||||||||
| 573 | subControl = QStyle::SC_MdiMinButton; never executed:  subControl = QStyle::SC_MdiMinButton; | 0 | ||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| 575 | if (subControl == QStyle::SC_None) 
 | 0 | ||||||||||||||||||||||||
| 576 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||
| 578 | visibleControls.setFlag(subControl, visible && !(visibleControls & subControl)); | - | ||||||||||||||||||||||||
| 579 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 580 | - | |||||||||||||||||||||||||
| 581 | /* | - | ||||||||||||||||||||||||
| 582 | \internal | - | ||||||||||||||||||||||||
| 583 | */ | - | ||||||||||||||||||||||||
| 584 | void ControllerWidget::paintEvent(QPaintEvent * /*paintEvent*/) | - | ||||||||||||||||||||||||
| 585 | { | - | ||||||||||||||||||||||||
| 586 | QStyleOptionComplex opt; | - | ||||||||||||||||||||||||
| 587 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 588 | if (activeControl == hoverControl) { 
 | 0 | ||||||||||||||||||||||||
| 589 | opt.activeSubControls = activeControl; | - | ||||||||||||||||||||||||
| 590 | opt.state |= QStyle::State_Sunken; | - | ||||||||||||||||||||||||
| 591 | } else if (hoverControl != QStyle::SC_None && (activeControl == QStyle::SC_None)) { never executed:  end of block
 
 | 0 | ||||||||||||||||||||||||
| 592 | opt.activeSubControls = hoverControl; | - | ||||||||||||||||||||||||
| 593 | opt.state |= QStyle::State_MouseOver; | - | ||||||||||||||||||||||||
| 594 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 595 | QPainter painter(this); | - | ||||||||||||||||||||||||
| 596 | style()->drawComplexControl(QStyle::CC_MdiControls, &opt, &painter, mdiArea); | - | ||||||||||||||||||||||||
| 597 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 598 | - | |||||||||||||||||||||||||
| 599 | /* | - | ||||||||||||||||||||||||
| 600 | \internal | - | ||||||||||||||||||||||||
| 601 | */ | - | ||||||||||||||||||||||||
| 602 | void ControllerWidget::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 603 | { | - | ||||||||||||||||||||||||
| 604 | if (event->button() != Qt::LeftButton) { 
 | 0 | ||||||||||||||||||||||||
| 605 | event->ignore(); | - | ||||||||||||||||||||||||
| 606 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 607 | } | - | ||||||||||||||||||||||||
| 608 | activeControl = getSubControl(event->pos()); | - | ||||||||||||||||||||||||
| 609 | update(); | - | ||||||||||||||||||||||||
| 610 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 611 | - | |||||||||||||||||||||||||
| 612 | /* | - | ||||||||||||||||||||||||
| 613 | \internal | - | ||||||||||||||||||||||||
| 614 | */ | - | ||||||||||||||||||||||||
| 615 | void ControllerWidget::mouseReleaseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 616 | { | - | ||||||||||||||||||||||||
| 617 | if (event->button() != Qt::LeftButton) { 
 | 0 | ||||||||||||||||||||||||
| 618 | event->ignore(); | - | ||||||||||||||||||||||||
| 619 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 620 | } | - | ||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | QStyle::SubControl under_mouse = getSubControl(event->pos()); | - | ||||||||||||||||||||||||
| 623 | if (under_mouse == activeControl) { 
 | 0 | ||||||||||||||||||||||||
| 624 | switch (activeControl) { | - | ||||||||||||||||||||||||
| 625 | case QStyle::SC_MdiCloseButton: never executed:  case QStyle::SC_MdiCloseButton: | 0 | ||||||||||||||||||||||||
| 626 | emit _q_close(); | - | ||||||||||||||||||||||||
| 627 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 628 | case QStyle::SC_MdiNormalButton: never executed:  case QStyle::SC_MdiNormalButton: | 0 | ||||||||||||||||||||||||
| 629 | emit _q_restore(); | - | ||||||||||||||||||||||||
| 630 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 631 | case QStyle::SC_MdiMinButton: never executed:  case QStyle::SC_MdiMinButton: | 0 | ||||||||||||||||||||||||
| 632 | emit _q_minimize(); | - | ||||||||||||||||||||||||
| 633 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 634 | default: never executed:  default: | 0 | ||||||||||||||||||||||||
| 635 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 636 | } | - | ||||||||||||||||||||||||
| 637 | } | - | ||||||||||||||||||||||||
| 638 | - | |||||||||||||||||||||||||
| 639 | activeControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 640 | update(); | - | ||||||||||||||||||||||||
| 641 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||
| 643 | /* | - | ||||||||||||||||||||||||
| 644 | \internal | - | ||||||||||||||||||||||||
| 645 | */ | - | ||||||||||||||||||||||||
| 646 | void ControllerWidget::mouseMoveEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 647 | { | - | ||||||||||||||||||||||||
| 648 | QStyle::SubControl under_mouse = getSubControl(event->pos()); | - | ||||||||||||||||||||||||
| 649 | //test if hover state changes | - | ||||||||||||||||||||||||
| 650 | if (hoverControl != under_mouse) { 
 | 0 | ||||||||||||||||||||||||
| 651 | hoverControl = under_mouse; | - | ||||||||||||||||||||||||
| 652 | update(); | - | ||||||||||||||||||||||||
| 653 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 654 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||
| 656 | /* | - | ||||||||||||||||||||||||
| 657 | \internal | - | ||||||||||||||||||||||||
| 658 | */ | - | ||||||||||||||||||||||||
| 659 | void ControllerWidget::leaveEvent(QEvent * /*event*/) | - | ||||||||||||||||||||||||
| 660 | { | - | ||||||||||||||||||||||||
| 661 | hoverControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 662 | update(); | - | ||||||||||||||||||||||||
| 663 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||
| 665 | /* | - | ||||||||||||||||||||||||
| 666 | \internal | - | ||||||||||||||||||||||||
| 667 | */ | - | ||||||||||||||||||||||||
| 668 | bool ControllerWidget::event(QEvent *event) | - | ||||||||||||||||||||||||
| 669 | { | - | ||||||||||||||||||||||||
| 670 | #ifndef QT_NO_TOOLTIP | - | ||||||||||||||||||||||||
| 671 | if (event->type() == QEvent::ToolTip) { 
 | 0 | ||||||||||||||||||||||||
| 672 | QStyleOptionComplex opt; | - | ||||||||||||||||||||||||
| 673 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 674 | QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event); | - | ||||||||||||||||||||||||
| 675 | showToolTip(helpEvent, this, opt, QStyle::CC_MdiControls, getSubControl(helpEvent->pos())); | - | ||||||||||||||||||||||||
| 676 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 677 | #endif // QT_NO_TOOLTIP | - | ||||||||||||||||||||||||
| 678 | return QWidget::event(event); never executed:  return QWidget::event(event); | 0 | ||||||||||||||||||||||||
| 679 | } | - | ||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||
| 681 | /* | - | ||||||||||||||||||||||||
| 682 | \internal | - | ||||||||||||||||||||||||
| 683 | */ | - | ||||||||||||||||||||||||
| 684 | void ControllerWidget::initStyleOption(QStyleOptionComplex *option) const | - | ||||||||||||||||||||||||
| 685 | { | - | ||||||||||||||||||||||||
| 686 | option->initFrom(this); | - | ||||||||||||||||||||||||
| 687 | option->subControls = visibleControls; | - | ||||||||||||||||||||||||
| 688 | option->activeSubControls = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 689 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 690 | - | |||||||||||||||||||||||||
| 691 | /* | - | ||||||||||||||||||||||||
| 692 | \internal | - | ||||||||||||||||||||||||
| 693 | */ | - | ||||||||||||||||||||||||
| 694 | ControlContainer::ControlContainer(QMdiSubWindow *mdiChild) | - | ||||||||||||||||||||||||
| 695 | : QObject(mdiChild), | - | ||||||||||||||||||||||||
| 696 | previousLeft(0), | - | ||||||||||||||||||||||||
| 697 | previousRight(0), | - | ||||||||||||||||||||||||
| 698 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 699 | m_menuBar(0), | - | ||||||||||||||||||||||||
| 700 | #endif | - | ||||||||||||||||||||||||
| 701 | mdiChild(mdiChild) | - | ||||||||||||||||||||||||
| 702 | { | - | ||||||||||||||||||||||||
| 703 | Q_ASSERT(mdiChild); | - | ||||||||||||||||||||||||
| 704 | - | |||||||||||||||||||||||||
| 705 | m_controllerWidget = new ControlElement<ControllerWidget>(mdiChild); | - | ||||||||||||||||||||||||
| 706 | connect(m_controllerWidget, SIGNAL(_q_close()), mdiChild, SLOT(close())); | - | ||||||||||||||||||||||||
| 707 | connect(m_controllerWidget, SIGNAL(_q_restore()), mdiChild, SLOT(showNormal())); | - | ||||||||||||||||||||||||
| 708 | connect(m_controllerWidget, SIGNAL(_q_minimize()), mdiChild, SLOT(showMinimized())); | - | ||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||
| 710 | m_menuLabel = new ControlElement<ControlLabel>(mdiChild); | - | ||||||||||||||||||||||||
| 711 | m_menuLabel->setWindowIcon(mdiChild->windowIcon()); | - | ||||||||||||||||||||||||
| 712 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 713 | connect(m_menuLabel, SIGNAL(_q_clicked()), mdiChild, SLOT(showSystemMenu())); | - | ||||||||||||||||||||||||
| 714 | #endif | - | ||||||||||||||||||||||||
| 715 | connect(m_menuLabel, SIGNAL(_q_doubleClicked()), mdiChild, SLOT(close())); | - | ||||||||||||||||||||||||
| 716 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 717 | - | |||||||||||||||||||||||||
| 718 | ControlContainer::~ControlContainer() | - | ||||||||||||||||||||||||
| 719 | { | - | ||||||||||||||||||||||||
| 720 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 721 | removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 722 | #endif | - | ||||||||||||||||||||||||
| 723 | delete m_menuLabel; | - | ||||||||||||||||||||||||
| 724 | m_menuLabel = 0; | - | ||||||||||||||||||||||||
| 725 | delete m_controllerWidget; | - | ||||||||||||||||||||||||
| 726 | m_controllerWidget = 0; | - | ||||||||||||||||||||||||
| 727 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 728 | - | |||||||||||||||||||||||||
| 729 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 730 | /* | - | ||||||||||||||||||||||||
| 731 | \internal | - | ||||||||||||||||||||||||
| 732 | */ | - | ||||||||||||||||||||||||
| 733 | QMenuBar *QMdiSubWindowPrivate::menuBar() const | - | ||||||||||||||||||||||||
| 734 | { | - | ||||||||||||||||||||||||
| 735 | #if defined(QT_NO_MAINWINDOW) | - | ||||||||||||||||||||||||
| 736 | return 0; | - | ||||||||||||||||||||||||
| 737 | #else | - | ||||||||||||||||||||||||
| 738 | Q_Q(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 739 | if (!q->isMaximized() || drawTitleBarWhenMaximized() || isChildOfTabbedQMdiArea(q)) 
 
 
 | 0 | ||||||||||||||||||||||||
| 740 | return 0; never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 741 | - | |||||||||||||||||||||||||
| 742 | if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window())) 
 | 0 | ||||||||||||||||||||||||
| 743 | return mainWindow->menuBar(); never executed:  return mainWindow->menuBar(); | 0 | ||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||
| 745 | return 0; never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 746 | #endif | - | ||||||||||||||||||||||||
| 747 | } | - | ||||||||||||||||||||||||
| 748 | - | |||||||||||||||||||||||||
| 749 | /* | - | ||||||||||||||||||||||||
| 750 | \internal | - | ||||||||||||||||||||||||
| 751 | */ | - | ||||||||||||||||||||||||
| 752 | void ControlContainer::showButtonsInMenuBar(QMenuBar *menuBar) | - | ||||||||||||||||||||||||
| 753 | { | - | ||||||||||||||||||||||||
| 754 | if (!menuBar || !mdiChild || mdiChild->windowFlags() & Qt::FramelessWindowHint) 
 
 
 | 0 | ||||||||||||||||||||||||
| 755 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 756 | m_menuBar = menuBar; | - | ||||||||||||||||||||||||
| 757 | - | |||||||||||||||||||||||||
| 758 | if (m_menuLabel && mdiChild->windowFlags() & Qt::WindowSystemMenuHint) { 
 
 | 0 | ||||||||||||||||||||||||
| 759 | QWidget *currentLeft = menuBar->cornerWidget(Qt::TopLeftCorner); | - | ||||||||||||||||||||||||
| 760 | if (currentLeft) 
 | 0 | ||||||||||||||||||||||||
| 761 | currentLeft->hide(); never executed:  currentLeft->hide(); | 0 | ||||||||||||||||||||||||
| 762 | if (currentLeft != m_menuLabel) { 
 | 0 | ||||||||||||||||||||||||
| 763 | menuBar->setCornerWidget(m_menuLabel, Qt::TopLeftCorner); | - | ||||||||||||||||||||||||
| 764 | previousLeft = currentLeft; | - | ||||||||||||||||||||||||
| 765 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 766 | m_menuLabel->show(); | - | ||||||||||||||||||||||||
| 767 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 768 | ControllerWidget *controllerWidget = qobject_cast<ControllerWidget *>(m_controllerWidget); | - | ||||||||||||||||||||||||
| 769 | if (controllerWidget && controllerWidget->hasVisibleControls()) { 
 
 | 0 | ||||||||||||||||||||||||
| 770 | QWidget *currentRight = menuBar->cornerWidget(Qt::TopRightCorner); | - | ||||||||||||||||||||||||
| 771 | if (currentRight) 
 | 0 | ||||||||||||||||||||||||
| 772 | currentRight->hide(); never executed:  currentRight->hide(); | 0 | ||||||||||||||||||||||||
| 773 | if (currentRight != m_controllerWidget) { 
 | 0 | ||||||||||||||||||||||||
| 774 | menuBar->setCornerWidget(m_controllerWidget, Qt::TopRightCorner); | - | ||||||||||||||||||||||||
| 775 | previousRight = currentRight; | - | ||||||||||||||||||||||||
| 776 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 777 | m_controllerWidget->show(); | - | ||||||||||||||||||||||||
| 778 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 779 | mdiChild->d_func()->setNewWindowTitle(); | - | ||||||||||||||||||||||||
| 780 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 781 | - | |||||||||||||||||||||||||
| 782 | /* | - | ||||||||||||||||||||||||
| 783 | \internal | - | ||||||||||||||||||||||||
| 784 | */ | - | ||||||||||||||||||||||||
| 785 | void ControlContainer::removeButtonsFromMenuBar(QMenuBar *menuBar) | - | ||||||||||||||||||||||||
| 786 | { | - | ||||||||||||||||||||||||
| 787 | if (menuBar && menuBar != m_menuBar) { 
 
 | 0 | ||||||||||||||||||||||||
| 788 | // m_menubar was deleted while sub-window was maximized | - | ||||||||||||||||||||||||
| 789 | previousRight = 0; | - | ||||||||||||||||||||||||
| 790 | previousLeft = 0; | - | ||||||||||||||||||||||||
| 791 | m_menuBar = menuBar; | - | ||||||||||||||||||||||||
| 792 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 793 | - | |||||||||||||||||||||||||
| 794 | if (!m_menuBar || !mdiChild || qt_widget_private(mdiChild->window())->data.in_destructor) 
 
 
 | 0 | ||||||||||||||||||||||||
| 795 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 796 | - | |||||||||||||||||||||||||
| 797 | QMdiSubWindow *child = 0; | - | ||||||||||||||||||||||||
| 798 | if (m_controllerWidget) { 
 | 0 | ||||||||||||||||||||||||
| 799 | QWidget *currentRight = m_menuBar->cornerWidget(Qt::TopRightCorner); | - | ||||||||||||||||||||||||
| 800 | if (currentRight == m_controllerWidget) { 
 | 0 | ||||||||||||||||||||||||
| 801 | if (ControlElement<ControllerWidget> *ce = ptr<ControllerWidget>(previousRight)) { 
 | 0 | ||||||||||||||||||||||||
| 802 | if (!ce->mdiChild || !ce->mdiChild->isMaximized()) 
 
 | 0 | ||||||||||||||||||||||||
| 803 | previousRight = 0; never executed:  previousRight = 0; | 0 | ||||||||||||||||||||||||
| 804 | else | - | ||||||||||||||||||||||||
| 805 | child = ce->mdiChild; never executed:  child = ce->mdiChild; | 0 | ||||||||||||||||||||||||
| 806 | } | - | ||||||||||||||||||||||||
| 807 | m_menuBar->setCornerWidget(previousRight, Qt::TopRightCorner); | - | ||||||||||||||||||||||||
| 808 | if (previousRight) { 
 | 0 | ||||||||||||||||||||||||
| 809 | previousRight->show(); | - | ||||||||||||||||||||||||
| 810 | previousRight = 0; | - | ||||||||||||||||||||||||
| 811 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 812 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 813 | m_controllerWidget->hide(); | - | ||||||||||||||||||||||||
| 814 | m_controllerWidget->setParent(0); | - | ||||||||||||||||||||||||
| 815 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 816 | if (m_menuLabel) { 
 | 0 | ||||||||||||||||||||||||
| 817 | QWidget *currentLeft = m_menuBar->cornerWidget(Qt::TopLeftCorner); | - | ||||||||||||||||||||||||
| 818 | if (currentLeft == m_menuLabel) { 
 | 0 | ||||||||||||||||||||||||
| 819 | if (ControlElement<ControlLabel> *ce = ptr<ControlLabel>(previousLeft)) { 
 | 0 | ||||||||||||||||||||||||
| 820 | if (!ce->mdiChild || !ce->mdiChild->isMaximized()) 
 
 | 0 | ||||||||||||||||||||||||
| 821 | previousLeft = 0; never executed:  previousLeft = 0; | 0 | ||||||||||||||||||||||||
| 822 | else if (!child) 
 | 0 | ||||||||||||||||||||||||
| 823 | child = mdiChild; never executed:  child = mdiChild; | 0 | ||||||||||||||||||||||||
| 824 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 825 | m_menuBar->setCornerWidget(previousLeft, Qt::TopLeftCorner); | - | ||||||||||||||||||||||||
| 826 | if (previousLeft) { 
 | 0 | ||||||||||||||||||||||||
| 827 | previousLeft->show(); | - | ||||||||||||||||||||||||
| 828 | previousLeft = 0; | - | ||||||||||||||||||||||||
| 829 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 830 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 831 | m_menuLabel->hide(); | - | ||||||||||||||||||||||||
| 832 | m_menuLabel->setParent(0); | - | ||||||||||||||||||||||||
| 833 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 834 | m_menuBar->update(); | - | ||||||||||||||||||||||||
| 835 | if (child) 
 | 0 | ||||||||||||||||||||||||
| 836 | child->d_func()->setNewWindowTitle(); never executed:  child->d_func()->setNewWindowTitle(); | 0 | ||||||||||||||||||||||||
| 837 | else if (mdiChild) 
 | 0 | ||||||||||||||||||||||||
| 838 | mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle()); never executed:  mdiChild->window()->setWindowTitle(mdiChild->d_func()->originalWindowTitle()); | 0 | ||||||||||||||||||||||||
| 839 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||
| 841 | #endif // QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 842 | - | |||||||||||||||||||||||||
| 843 | void ControlContainer::updateWindowIcon(const QIcon &windowIcon) | - | ||||||||||||||||||||||||
| 844 | { | - | ||||||||||||||||||||||||
| 845 | if (m_menuLabel) 
 | 0 | ||||||||||||||||||||||||
| 846 | m_menuLabel->setWindowIcon(windowIcon); never executed:  m_menuLabel->setWindowIcon(windowIcon); | 0 | ||||||||||||||||||||||||
| 847 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 848 | - | |||||||||||||||||||||||||
| 849 | /*! | - | ||||||||||||||||||||||||
| 850 | \internal | - | ||||||||||||||||||||||||
| 851 | */ | - | ||||||||||||||||||||||||
| 852 | QMdiSubWindowPrivate::QMdiSubWindowPrivate() | - | ||||||||||||||||||||||||
| 853 | : baseWidget(0), | - | ||||||||||||||||||||||||
| 854 | restoreFocusWidget(0), | - | ||||||||||||||||||||||||
| 855 | controlContainer(0), | - | ||||||||||||||||||||||||
| 856 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 857 | sizeGrip(0), | - | ||||||||||||||||||||||||
| 858 | #endif | - | ||||||||||||||||||||||||
| 859 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 860 | rubberBand(0), | - | ||||||||||||||||||||||||
| 861 | #endif | - | ||||||||||||||||||||||||
| 862 | userMinimumSize(0,0), | - | ||||||||||||||||||||||||
| 863 | resizeEnabled(true), | - | ||||||||||||||||||||||||
| 864 | moveEnabled(true), | - | ||||||||||||||||||||||||
| 865 | isInInteractiveMode(false), | - | ||||||||||||||||||||||||
| 866 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 867 | isInRubberBandMode(false), | - | ||||||||||||||||||||||||
| 868 | #endif | - | ||||||||||||||||||||||||
| 869 | isShadeMode(false), | - | ||||||||||||||||||||||||
| 870 | ignoreWindowTitleChange(false), | - | ||||||||||||||||||||||||
| 871 | ignoreNextActivationEvent(false), | - | ||||||||||||||||||||||||
| 872 | activationEnabled(true), | - | ||||||||||||||||||||||||
| 873 | isShadeRequestFromMinimizeMode(false), | - | ||||||||||||||||||||||||
| 874 | isMaximizeMode(false), | - | ||||||||||||||||||||||||
| 875 | isWidgetHiddenByUs(false), | - | ||||||||||||||||||||||||
| 876 | isActive(false), | - | ||||||||||||||||||||||||
| 877 | isExplicitlyDeactivated(false), | - | ||||||||||||||||||||||||
| 878 | keyboardSingleStep(5), | - | ||||||||||||||||||||||||
| 879 | keyboardPageStep(20), | - | ||||||||||||||||||||||||
| 880 | resizeTimerId(-1), | - | ||||||||||||||||||||||||
| 881 | currentOperation(None), | - | ||||||||||||||||||||||||
| 882 | hoveredSubControl(QStyle::SC_None), | - | ||||||||||||||||||||||||
| 883 | activeSubControl(QStyle::SC_None), | - | ||||||||||||||||||||||||
| 884 | focusInReason(Qt::ActiveWindowFocusReason) | - | ||||||||||||||||||||||||
| 885 | { | - | ||||||||||||||||||||||||
| 886 | initOperationMap(); | - | ||||||||||||||||||||||||
| 887 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 888 | - | |||||||||||||||||||||||||
| 889 | /*! | - | ||||||||||||||||||||||||
| 890 | \internal | - | ||||||||||||||||||||||||
| 891 | */ | - | ||||||||||||||||||||||||
| 892 | void QMdiSubWindowPrivate::_q_updateStaysOnTopHint() | - | ||||||||||||||||||||||||
| 893 | { | - | ||||||||||||||||||||||||
| 894 | #ifndef QT_NO_ACTION | - | ||||||||||||||||||||||||
| 895 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 896 | if (QAction *senderAction = qobject_cast<QAction *>(q->sender())) { 
 | 0 | ||||||||||||||||||||||||
| 897 | if (senderAction->isChecked()) { 
 | 0 | ||||||||||||||||||||||||
| 898 | q->setWindowFlags(q->windowFlags() | Qt::WindowStaysOnTopHint); | - | ||||||||||||||||||||||||
| 899 | q->raise(); | - | ||||||||||||||||||||||||
| 900 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 901 | q->setWindowFlags(q->windowFlags() & ~Qt::WindowStaysOnTopHint); | - | ||||||||||||||||||||||||
| 902 | q->lower(); | - | ||||||||||||||||||||||||
| 903 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 904 | } | - | ||||||||||||||||||||||||
| 905 | #endif // QT_NO_ACTION | - | ||||||||||||||||||||||||
| 906 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 907 | - | |||||||||||||||||||||||||
| 908 | /*! | - | ||||||||||||||||||||||||
| 909 | \internal | - | ||||||||||||||||||||||||
| 910 | */ | - | ||||||||||||||||||||||||
| 911 | void QMdiSubWindowPrivate::_q_enterInteractiveMode() | - | ||||||||||||||||||||||||
| 912 | { | - | ||||||||||||||||||||||||
| 913 | #ifndef QT_NO_ACTION | - | ||||||||||||||||||||||||
| 914 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 915 | QAction *action = qobject_cast<QAction *>(q->sender()); | - | ||||||||||||||||||||||||
| 916 | if (!action) 
 | 0 | ||||||||||||||||||||||||
| 917 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 918 | - | |||||||||||||||||||||||||
| 919 | QPoint pressPos; | - | ||||||||||||||||||||||||
| 920 | if (actions[MoveAction] && actions[MoveAction] == action) { 
 
 | 0 | ||||||||||||||||||||||||
| 921 | currentOperation = Move; | - | ||||||||||||||||||||||||
| 922 | pressPos = QPoint(q->width() / 2, titleBarHeight() - 1); | - | ||||||||||||||||||||||||
| 923 | } else if (actions[ResizeAction] && actions[ResizeAction] == action) { never executed:  end of block
 
 | 0 | ||||||||||||||||||||||||
| 924 | currentOperation = q->isLeftToRight() ? BottomRightResize : BottomLeftResize; 
 | 0 | ||||||||||||||||||||||||
| 925 | int offset = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q) / 2; | - | ||||||||||||||||||||||||
| 926 | int x = q->isLeftToRight() ? q->width() - offset : offset; 
 | 0 | ||||||||||||||||||||||||
| 927 | pressPos = QPoint(x, q->height() - offset); | - | ||||||||||||||||||||||||
| 928 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 929 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 930 | } | - | ||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||
| 932 | updateCursor(); | - | ||||||||||||||||||||||||
| 933 | #ifndef QT_NO_CURSOR | - | ||||||||||||||||||||||||
| 934 | q->cursor().setPos(q->mapToGlobal(pressPos)); | - | ||||||||||||||||||||||||
| 935 | #endif | - | ||||||||||||||||||||||||
| 936 | mousePressPosition = q->mapToParent(pressPos); | - | ||||||||||||||||||||||||
| 937 | oldGeometry = q->geometry(); | - | ||||||||||||||||||||||||
| 938 | isInInteractiveMode = true; | - | ||||||||||||||||||||||||
| 939 | q->setFocus(); | - | ||||||||||||||||||||||||
| 940 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 941 | if ((q->testOption(QMdiSubWindow::RubberBandResize) 
 | 0 | ||||||||||||||||||||||||
| 942 | && (currentOperation == BottomRightResize || currentOperation == BottomLeftResize)) 
 
 | 0 | ||||||||||||||||||||||||
| 943 | || (q->testOption(QMdiSubWindow::RubberBandMove) && currentOperation == Move)) { 
 
 | 0 | ||||||||||||||||||||||||
| 944 | enterRubberBandMode(); | - | ||||||||||||||||||||||||
| 945 | } else never executed:  end of block | 0 | ||||||||||||||||||||||||
| 946 | #endif // QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 947 | { | - | ||||||||||||||||||||||||
| 948 | q->grabMouse(); | - | ||||||||||||||||||||||||
| 949 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 950 | #endif // QT_NO_ACTION | - | ||||||||||||||||||||||||
| 951 | } | - | ||||||||||||||||||||||||
| 952 | - | |||||||||||||||||||||||||
| 953 | /*! | - | ||||||||||||||||||||||||
| 954 | \internal | - | ||||||||||||||||||||||||
| 955 | */ | - | ||||||||||||||||||||||||
| 956 | void QMdiSubWindowPrivate::_q_processFocusChanged(QWidget *old, QWidget *now) | - | ||||||||||||||||||||||||
| 957 | { | - | ||||||||||||||||||||||||
| 958 | Q_UNUSED(old); | - | ||||||||||||||||||||||||
| 959 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 960 | if (now && (now == q || q->isAncestorOf(now))) { 
 
 
 | 0 | ||||||||||||||||||||||||
| 961 | if (now == q && !isInInteractiveMode) 
 
 | 0 | ||||||||||||||||||||||||
| 962 | setFocusWidget(); never executed:  setFocusWidget(); | 0 | ||||||||||||||||||||||||
| 963 | setActive(true); | - | ||||||||||||||||||||||||
| 964 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 965 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||
| 967 | /*! | - | ||||||||||||||||||||||||
| 968 | \internal | - | ||||||||||||||||||||||||
| 969 | */ | - | ||||||||||||||||||||||||
| 970 | void QMdiSubWindowPrivate::leaveInteractiveMode() | - | ||||||||||||||||||||||||
| 971 | { | - | ||||||||||||||||||||||||
| 972 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 973 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 974 | if (isInRubberBandMode) 
 | 0 | ||||||||||||||||||||||||
| 975 | leaveRubberBandMode(); never executed:  leaveRubberBandMode(); | 0 | ||||||||||||||||||||||||
| 976 | else | - | ||||||||||||||||||||||||
| 977 | #endif | - | ||||||||||||||||||||||||
| 978 | q->releaseMouse(); never executed:  q->releaseMouse(); | 0 | ||||||||||||||||||||||||
| 979 | isInInteractiveMode = false; | - | ||||||||||||||||||||||||
| 980 | currentOperation = None; | - | ||||||||||||||||||||||||
| 981 | updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 982 | updateCursor(); | - | ||||||||||||||||||||||||
| 983 | if (baseWidget && baseWidget->focusWidget()) 
 
 | 0 | ||||||||||||||||||||||||
| 984 | baseWidget->focusWidget()->setFocus(); never executed:  baseWidget->focusWidget()->setFocus(); | 0 | ||||||||||||||||||||||||
| 985 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 986 | - | |||||||||||||||||||||||||
| 987 | /*! | - | ||||||||||||||||||||||||
| 988 | \internal | - | ||||||||||||||||||||||||
| 989 | */ | - | ||||||||||||||||||||||||
| 990 | void QMdiSubWindowPrivate::removeBaseWidget() | - | ||||||||||||||||||||||||
| 991 | { | - | ||||||||||||||||||||||||
| 992 | if (!baseWidget) 
 | 0 | ||||||||||||||||||||||||
| 993 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 994 | - | |||||||||||||||||||||||||
| 995 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 996 | baseWidget->removeEventFilter(q); | - | ||||||||||||||||||||||||
| 997 | if (layout) 
 | 0 | ||||||||||||||||||||||||
| 998 | layout->removeWidget(baseWidget); never executed:  layout->removeWidget(baseWidget); | 0 | ||||||||||||||||||||||||
| 999 | if (baseWidget->windowTitle() == q->windowTitle()) { 
 | 0 | ||||||||||||||||||||||||
| 1000 | ignoreWindowTitleChange = true; | - | ||||||||||||||||||||||||
| 1001 | q->setWindowTitle(QString()); | - | ||||||||||||||||||||||||
| 1002 | ignoreWindowTitleChange = false; | - | ||||||||||||||||||||||||
| 1003 | q->setWindowModified(false); | - | ||||||||||||||||||||||||
| 1004 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1005 | lastChildWindowTitle.clear(); | - | ||||||||||||||||||||||||
| 1006 | // QTBUG-47993: parent widget can be reset before this call | - | ||||||||||||||||||||||||
| 1007 | if (baseWidget->parentWidget() == q) 
 | 0 | ||||||||||||||||||||||||
| 1008 | baseWidget->setParent(0); never executed:  baseWidget->setParent(0); | 0 | ||||||||||||||||||||||||
| 1009 | baseWidget = 0; | - | ||||||||||||||||||||||||
| 1010 | isWidgetHiddenByUs = false; | - | ||||||||||||||||||||||||
| 1011 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||
| 1013 | /*! | - | ||||||||||||||||||||||||
| 1014 | \internal | - | ||||||||||||||||||||||||
| 1015 | */ | - | ||||||||||||||||||||||||
| 1016 | void QMdiSubWindowPrivate::initOperationMap() | - | ||||||||||||||||||||||||
| 1017 | { | - | ||||||||||||||||||||||||
| 1018 | operationMap.insert(Move, OperationInfo(HMove | VMove, Qt::ArrowCursor, false)); | - | ||||||||||||||||||||||||
| 1019 | operationMap.insert(TopResize, OperationInfo(VMove | VResize | VResizeReverse, Qt::SizeVerCursor)); | - | ||||||||||||||||||||||||
| 1020 | operationMap.insert(BottomResize, OperationInfo(VResize, Qt::SizeVerCursor)); | - | ||||||||||||||||||||||||
| 1021 | operationMap.insert(LeftResize, OperationInfo(HMove | HResize | HResizeReverse, Qt::SizeHorCursor)); | - | ||||||||||||||||||||||||
| 1022 | operationMap.insert(RightResize, OperationInfo(HResize, Qt::SizeHorCursor)); | - | ||||||||||||||||||||||||
| 1023 | operationMap.insert(TopLeftResize, OperationInfo(HMove | VMove | HResize | VResize | VResizeReverse | - | ||||||||||||||||||||||||
| 1024 | | HResizeReverse, Qt::SizeFDiagCursor)); | - | ||||||||||||||||||||||||
| 1025 | operationMap.insert(TopRightResize, OperationInfo(VMove | HResize | VResize | - | ||||||||||||||||||||||||
| 1026 | | VResizeReverse, Qt::SizeBDiagCursor)); | - | ||||||||||||||||||||||||
| 1027 | operationMap.insert(BottomLeftResize, OperationInfo(HMove | HResize | VResize | HResizeReverse, | - | ||||||||||||||||||||||||
| 1028 | Qt::SizeBDiagCursor)); | - | ||||||||||||||||||||||||
| 1029 | operationMap.insert(BottomRightResize, OperationInfo(HResize | VResize, Qt::SizeFDiagCursor)); | - | ||||||||||||||||||||||||
| 1030 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1031 | - | |||||||||||||||||||||||||
| 1032 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 1033 | - | |||||||||||||||||||||||||
| 1034 | /*! | - | ||||||||||||||||||||||||
| 1035 | \internal | - | ||||||||||||||||||||||||
| 1036 | */ | - | ||||||||||||||||||||||||
| 1037 | void QMdiSubWindowPrivate::createSystemMenu() | - | ||||||||||||||||||||||||
| 1038 | { | - | ||||||||||||||||||||||||
| 1039 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1040 | Q_ASSERT_X(q, "QMdiSubWindowPrivate::createSystemMenu", | - | ||||||||||||||||||||||||
| 1041 | "You can NOT call this function before QMdiSubWindow's ctor"); | - | ||||||||||||||||||||||||
| 1042 | systemMenu = new QMenu(q); | - | ||||||||||||||||||||||||
| 1043 | systemMenu->installEventFilter(q); | - | ||||||||||||||||||||||||
| 1044 | const QStyle *style = q->style(); | - | ||||||||||||||||||||||||
| 1045 | addToSystemMenu(RestoreAction, QMdiSubWindow::tr("&Restore"), SLOT(showNormal())); | - | ||||||||||||||||||||||||
| 1046 | actions[RestoreAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarNormalButton, 0, q)); | - | ||||||||||||||||||||||||
| 1047 | actions[RestoreAction]->setEnabled(false); | - | ||||||||||||||||||||||||
| 1048 | addToSystemMenu(MoveAction, QMdiSubWindow::tr("&Move"), SLOT(_q_enterInteractiveMode())); | - | ||||||||||||||||||||||||
| 1049 | addToSystemMenu(ResizeAction, QMdiSubWindow::tr("&Size"), SLOT(_q_enterInteractiveMode())); | - | ||||||||||||||||||||||||
| 1050 | addToSystemMenu(MinimizeAction, QMdiSubWindow::tr("Mi&nimize"), SLOT(showMinimized())); | - | ||||||||||||||||||||||||
| 1051 | actions[MinimizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMinButton, 0, q)); | - | ||||||||||||||||||||||||
| 1052 | addToSystemMenu(MaximizeAction, QMdiSubWindow::tr("Ma&ximize"), SLOT(showMaximized())); | - | ||||||||||||||||||||||||
| 1053 | actions[MaximizeAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarMaxButton, 0, q)); | - | ||||||||||||||||||||||||
| 1054 | addToSystemMenu(StayOnTopAction, QMdiSubWindow::tr("Stay on &Top"), SLOT(_q_updateStaysOnTopHint())); | - | ||||||||||||||||||||||||
| 1055 | actions[StayOnTopAction]->setCheckable(true); | - | ||||||||||||||||||||||||
| 1056 | systemMenu->addSeparator(); | - | ||||||||||||||||||||||||
| 1057 | addToSystemMenu(CloseAction, QMdiSubWindow::tr("&Close"), SLOT(close())); | - | ||||||||||||||||||||||||
| 1058 | actions[CloseAction]->setIcon(style->standardIcon(QStyle::SP_TitleBarCloseButton, 0, q)); | - | ||||||||||||||||||||||||
| 1059 | #if !defined(QT_NO_SHORTCUT) | - | ||||||||||||||||||||||||
| 1060 | actions[CloseAction]->setShortcuts(QKeySequence::Close); | - | ||||||||||||||||||||||||
| 1061 | #endif | - | ||||||||||||||||||||||||
| 1062 | updateActions(); | - | ||||||||||||||||||||||||
| 1063 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1064 | #endif | - | ||||||||||||||||||||||||
| 1065 | - | |||||||||||||||||||||||||
| 1066 | /*! | - | ||||||||||||||||||||||||
| 1067 | \internal | - | ||||||||||||||||||||||||
| 1068 | */ | - | ||||||||||||||||||||||||
| 1069 | void QMdiSubWindowPrivate::updateCursor() | - | ||||||||||||||||||||||||
| 1070 | { | - | ||||||||||||||||||||||||
| 1071 | #ifndef QT_NO_CURSOR | - | ||||||||||||||||||||||||
| 1072 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1073 | #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 1074 | if (qobject_cast<QMacStyle *>(q->style())) | - | ||||||||||||||||||||||||
| 1075 | return; | - | ||||||||||||||||||||||||
| 1076 | #endif | - | ||||||||||||||||||||||||
| 1077 | - | |||||||||||||||||||||||||
| 1078 | if (currentOperation == None) { 
 | 0 | ||||||||||||||||||||||||
| 1079 | q->unsetCursor(); | - | ||||||||||||||||||||||||
| 1080 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1081 | } | - | ||||||||||||||||||||||||
| 1082 | - | |||||||||||||||||||||||||
| 1083 | if (currentOperation == Move || operationMap.find(currentOperation).value().hover) { 
 
 | 0 | ||||||||||||||||||||||||
| 1084 | q->setCursor(operationMap.find(currentOperation).value().cursorShape); | - | ||||||||||||||||||||||||
| 1085 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1086 | } | - | ||||||||||||||||||||||||
| 1087 | #endif | - | ||||||||||||||||||||||||
| 1088 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1089 | - | |||||||||||||||||||||||||
| 1090 | /*! | - | ||||||||||||||||||||||||
| 1091 | \internal | - | ||||||||||||||||||||||||
| 1092 | */ | - | ||||||||||||||||||||||||
| 1093 | void QMdiSubWindowPrivate::updateDirtyRegions() | - | ||||||||||||||||||||||||
| 1094 | { | - | ||||||||||||||||||||||||
| 1095 | // No update necessary | - | ||||||||||||||||||||||||
| 1096 | if (!parent) 
 | 0 | ||||||||||||||||||||||||
| 1097 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1098 | - | |||||||||||||||||||||||||
| 1099 | for (OperationInfoMap::iterator it = operationMap.begin(), end = operationMap.end(); it != end; ++it) 
 | 0 | ||||||||||||||||||||||||
| 1100 | it.value().region = getRegion(it.key()); never executed:  it.value().region = getRegion(it.key()); | 0 | ||||||||||||||||||||||||
| 1101 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1102 | - | |||||||||||||||||||||||||
| 1103 | /*! | - | ||||||||||||||||||||||||
| 1104 | \internal | - | ||||||||||||||||||||||||
| 1105 | */ | - | ||||||||||||||||||||||||
| 1106 | void QMdiSubWindowPrivate::updateGeometryConstraints() | - | ||||||||||||||||||||||||
| 1107 | { | - | ||||||||||||||||||||||||
| 1108 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1109 | if (!parent) 
 | 0 | ||||||||||||||||||||||||
| 1110 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1111 | - | |||||||||||||||||||||||||
| 1112 | internalMinimumSize = (!q->isMinimized() && !q->minimumSize().isNull()) 
 
 | 0 | ||||||||||||||||||||||||
| 1113 | ? q->minimumSize() : q->minimumSizeHint(); | - | ||||||||||||||||||||||||
| 1114 | int margin, minWidth; | - | ||||||||||||||||||||||||
| 1115 | sizeParameters(&margin, &minWidth); | - | ||||||||||||||||||||||||
| 1116 | q->setContentsMargins(margin, titleBarHeight(), margin, margin); | - | ||||||||||||||||||||||||
| 1117 | if (q->isMaximized() || (q->isMinimized() && !q->isShaded())) { 
 
 
 | 0 | ||||||||||||||||||||||||
| 1118 | moveEnabled = false; | - | ||||||||||||||||||||||||
| 1119 | resizeEnabled = false; | - | ||||||||||||||||||||||||
| 1120 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1121 | moveEnabled = true; | - | ||||||||||||||||||||||||
| 1122 | if ((q->windowFlags() & Qt::MSWindowsFixedSizeDialogHint) || q->isShaded()) 
 
 | 0 | ||||||||||||||||||||||||
| 1123 | resizeEnabled = false; never executed:  resizeEnabled = false; | 0 | ||||||||||||||||||||||||
| 1124 | else | - | ||||||||||||||||||||||||
| 1125 | resizeEnabled = true; never executed:  resizeEnabled = true; | 0 | ||||||||||||||||||||||||
| 1126 | } | - | ||||||||||||||||||||||||
| 1127 | updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 1128 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1129 | - | |||||||||||||||||||||||||
| 1130 | /*! | - | ||||||||||||||||||||||||
| 1131 | \internal | - | ||||||||||||||||||||||||
| 1132 | */ | - | ||||||||||||||||||||||||
| 1133 | void QMdiSubWindowPrivate::updateMask() | - | ||||||||||||||||||||||||
| 1134 | { | - | ||||||||||||||||||||||||
| 1135 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1136 | if (!q->mask().isEmpty()) 
 | 0 | ||||||||||||||||||||||||
| 1137 | q->clearMask(); never executed:  q->clearMask(); | 0 | ||||||||||||||||||||||||
| 1138 | - | |||||||||||||||||||||||||
| 1139 | if (!parent) 
 | 0 | ||||||||||||||||||||||||
| 1140 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1141 | - | |||||||||||||||||||||||||
| 1142 | if ((q->isMaximized() && !drawTitleBarWhenMaximized()) 
 
 | 0 | ||||||||||||||||||||||||
| 1143 | || q->windowFlags() & Qt::FramelessWindowHint) 
 | 0 | ||||||||||||||||||||||||
| 1144 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1145 | - | |||||||||||||||||||||||||
| 1146 | if (resizeTimerId == -1) 
 | 0 | ||||||||||||||||||||||||
| 1147 | cachedStyleOptions = titleBarOptions(); never executed:  cachedStyleOptions = titleBarOptions(); | 0 | ||||||||||||||||||||||||
| 1148 | cachedStyleOptions.rect = q->rect(); | - | ||||||||||||||||||||||||
| 1149 | QStyleHintReturnMask frameMask; | - | ||||||||||||||||||||||||
| 1150 | q->style()->styleHint(QStyle::SH_WindowFrame_Mask, &cachedStyleOptions, q, &frameMask); | - | ||||||||||||||||||||||||
| 1151 | if (!frameMask.region.isEmpty()) 
 | 0 | ||||||||||||||||||||||||
| 1152 | q->setMask(frameMask.region); never executed:  q->setMask(frameMask.region); | 0 | ||||||||||||||||||||||||
| 1153 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||
| 1155 | /*! | - | ||||||||||||||||||||||||
| 1156 | \internal | - | ||||||||||||||||||||||||
| 1157 | */ | - | ||||||||||||||||||||||||
| 1158 | void QMdiSubWindowPrivate::setNewGeometry(const QPoint &pos) | - | ||||||||||||||||||||||||
| 1159 | { | - | ||||||||||||||||||||||||
| 1160 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1161 | Q_ASSERT(currentOperation != None); | - | ||||||||||||||||||||||||
| 1162 | Q_ASSERT(parent); | - | ||||||||||||||||||||||||
| 1163 | - | |||||||||||||||||||||||||
| 1164 | uint cflags = operationMap.find(currentOperation).value().changeFlags; | - | ||||||||||||||||||||||||
| 1165 | int posX = pos.x(); | - | ||||||||||||||||||||||||
| 1166 | int posY = pos.y(); | - | ||||||||||||||||||||||||
| 1167 | - | |||||||||||||||||||||||||
| 1168 | const bool restrictHorizontal = !q->testOption(QMdiSubWindow::AllowOutsideAreaHorizontally); | - | ||||||||||||||||||||||||
| 1169 | const bool restrictVertical = !q->testOption(QMdiSubWindow::AllowOutsideAreaVertically); | - | ||||||||||||||||||||||||
| 1170 | - | |||||||||||||||||||||||||
| 1171 | if (restrictHorizontal || restrictVertical) { 
 
 | 0 | ||||||||||||||||||||||||
| 1172 | QRect parentRect = q->parentWidget()->rect(); | - | ||||||||||||||||||||||||
| 1173 | if (restrictVertical && (cflags & VResizeReverse || currentOperation == Move)) { 
 
 
 | 0 | ||||||||||||||||||||||||
| 1174 | posY = qMin(qMax(mousePressPosition.y() - oldGeometry.y(), posY), | - | ||||||||||||||||||||||||
| 1175 | parentRect.height() - BoundaryMargin); | - | ||||||||||||||||||||||||
| 1176 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1177 | if (currentOperation == Move) { 
 | 0 | ||||||||||||||||||||||||
| 1178 | if (restrictHorizontal) 
 | 0 | ||||||||||||||||||||||||
| 1179 | posX = qMin(qMax(BoundaryMargin, posX), parentRect.width() - BoundaryMargin); never executed:  posX = qMin(qMax(BoundaryMargin, posX), parentRect.width() - BoundaryMargin); | 0 | ||||||||||||||||||||||||
| 1180 | if (restrictVertical) 
 | 0 | ||||||||||||||||||||||||
| 1181 | posY = qMin(posY, parentRect.height() - BoundaryMargin); never executed:  posY = qMin(posY, parentRect.height() - BoundaryMargin); | 0 | ||||||||||||||||||||||||
| 1182 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1183 | if (restrictHorizontal) { 
 | 0 | ||||||||||||||||||||||||
| 1184 | if (cflags & HResizeReverse) 
 | 0 | ||||||||||||||||||||||||
| 1185 | posX = qMax(mousePressPosition.x() - oldGeometry.x(), posX); never executed:  posX = qMax(mousePressPosition.x() - oldGeometry.x(), posX); | 0 | ||||||||||||||||||||||||
| 1186 | else | - | ||||||||||||||||||||||||
| 1187 | posX = qMin(parentRect.width() - (oldGeometry.x() + oldGeometry.width() never executed:  posX = qMin(parentRect.width() - (oldGeometry.x() + oldGeometry.width() - mousePressPosition.x()), posX); | 0 | ||||||||||||||||||||||||
| 1188 | - mousePressPosition.x()), posX); never executed:  posX = qMin(parentRect.width() - (oldGeometry.x() + oldGeometry.width() - mousePressPosition.x()), posX); | 0 | ||||||||||||||||||||||||
| 1189 | } | - | ||||||||||||||||||||||||
| 1190 | if (restrictVertical && !(cflags & VResizeReverse)) { 
 
 | 0 | ||||||||||||||||||||||||
| 1191 | posY = qMin(parentRect.height() - (oldGeometry.y() + oldGeometry.height() | - | ||||||||||||||||||||||||
| 1192 | - mousePressPosition.y()), posY); | - | ||||||||||||||||||||||||
| 1193 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1194 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1195 | } | - | ||||||||||||||||||||||||
| 1196 | - | |||||||||||||||||||||||||
| 1197 | QRect geometry; | - | ||||||||||||||||||||||||
| 1198 | if (cflags & (HMove | VMove)) { 
 | 0 | ||||||||||||||||||||||||
| 1199 | int dx = getMoveDeltaComponent(cflags, HMove, HResize, posX - mousePressPosition.x(), | - | ||||||||||||||||||||||||
| 1200 | oldGeometry.width() - internalMinimumSize.width(), | - | ||||||||||||||||||||||||
| 1201 | oldGeometry.width() - q->maximumWidth()); | - | ||||||||||||||||||||||||
| 1202 | int dy = getMoveDeltaComponent(cflags, VMove, VResize, posY - mousePressPosition.y(), | - | ||||||||||||||||||||||||
| 1203 | oldGeometry.height() - internalMinimumSize.height(), | - | ||||||||||||||||||||||||
| 1204 | oldGeometry.height() - q->maximumHeight()); | - | ||||||||||||||||||||||||
| 1205 | geometry.setTopLeft(oldGeometry.topLeft() + QPoint(dx, dy)); | - | ||||||||||||||||||||||||
| 1206 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1207 | geometry.setTopLeft(q->geometry().topLeft()); | - | ||||||||||||||||||||||||
| 1208 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1209 | - | |||||||||||||||||||||||||
| 1210 | if (cflags & (HResize | VResize)) { 
 | 0 | ||||||||||||||||||||||||
| 1211 | int dx = getResizeDeltaComponent(cflags, HResize, HResizeReverse, | - | ||||||||||||||||||||||||
| 1212 | posX - mousePressPosition.x()); | - | ||||||||||||||||||||||||
| 1213 | int dy = getResizeDeltaComponent(cflags, VResize, VResizeReverse, | - | ||||||||||||||||||||||||
| 1214 | posY - mousePressPosition.y()); | - | ||||||||||||||||||||||||
| 1215 | geometry.setSize(oldGeometry.size() + QSize(dx, dy)); | - | ||||||||||||||||||||||||
| 1216 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1217 | geometry.setSize(q->geometry().size()); | - | ||||||||||||||||||||||||
| 1218 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1219 | - | |||||||||||||||||||||||||
| 1220 | setNewGeometry(&geometry); | - | ||||||||||||||||||||||||
| 1221 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1222 | - | |||||||||||||||||||||||||
| 1223 | /*! | - | ||||||||||||||||||||||||
| 1224 | \internal | - | ||||||||||||||||||||||||
| 1225 | */ | - | ||||||||||||||||||||||||
| 1226 | void QMdiSubWindowPrivate::setMinimizeMode() | - | ||||||||||||||||||||||||
| 1227 | { | - | ||||||||||||||||||||||||
| 1228 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1229 | Q_ASSERT(parent); | - | ||||||||||||||||||||||||
| 1230 | - | |||||||||||||||||||||||||
| 1231 | ensureWindowState(Qt::WindowMinimized); | - | ||||||||||||||||||||||||
| 1232 | isShadeRequestFromMinimizeMode = true; | - | ||||||||||||||||||||||||
| 1233 | q->showShaded(); | - | ||||||||||||||||||||||||
| 1234 | isShadeRequestFromMinimizeMode = false; | - | ||||||||||||||||||||||||
| 1235 | - | |||||||||||||||||||||||||
| 1236 | moveEnabled = false; | - | ||||||||||||||||||||||||
| 1237 | #ifndef QT_NO_ACTION | - | ||||||||||||||||||||||||
| 1238 | setEnabled(MoveAction, moveEnabled); | - | ||||||||||||||||||||||||
| 1239 | #endif | - | ||||||||||||||||||||||||
| 1240 | - | |||||||||||||||||||||||||
| 1241 | Q_ASSERT(q->windowState() & Qt::WindowMinimized); | - | ||||||||||||||||||||||||
| 1242 | Q_ASSERT(!(q->windowState() & Qt::WindowMaximized)); | - | ||||||||||||||||||||||||
| 1243 | // This should be a valid assert, but people can actually re-implement | - | ||||||||||||||||||||||||
| 1244 | // setVisible and do crazy stuff, so we're not guaranteed that | - | ||||||||||||||||||||||||
| 1245 | // the widget is hidden after calling hide(). | - | ||||||||||||||||||||||||
| 1246 | // Q_ASSERT(baseWidget ? baseWidget->isHidden() : true); | - | ||||||||||||||||||||||||
| 1247 | - | |||||||||||||||||||||||||
| 1248 | setActive(true); | - | ||||||||||||||||||||||||
| 1249 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1250 | - | |||||||||||||||||||||||||
| 1251 | /*! | - | ||||||||||||||||||||||||
| 1252 | \internal | - | ||||||||||||||||||||||||
| 1253 | */ | - | ||||||||||||||||||||||||
| 1254 | void QMdiSubWindowPrivate::setNormalMode() | - | ||||||||||||||||||||||||
| 1255 | { | - | ||||||||||||||||||||||||
| 1256 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1257 | Q_ASSERT(parent); | - | ||||||||||||||||||||||||
| 1258 | - | |||||||||||||||||||||||||
| 1259 | isShadeMode = false; | - | ||||||||||||||||||||||||
| 1260 | isMaximizeMode = false; | - | ||||||||||||||||||||||||
| 1261 | - | |||||||||||||||||||||||||
| 1262 | ensureWindowState(Qt::WindowNoState); | - | ||||||||||||||||||||||||
| 1263 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 1264 | removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 1265 | #endif | - | ||||||||||||||||||||||||
| 1266 | - | |||||||||||||||||||||||||
| 1267 | // Hide the window before we change the geometry to avoid multiple resize | - | ||||||||||||||||||||||||
| 1268 | // events and wrong window state. | - | ||||||||||||||||||||||||
| 1269 | const bool wasVisible = q->isVisible(); | - | ||||||||||||||||||||||||
| 1270 | if (wasVisible) 
 | 0 | ||||||||||||||||||||||||
| 1271 | q->setVisible(false); never executed:  q->setVisible(false); | 0 | ||||||||||||||||||||||||
| 1272 | - | |||||||||||||||||||||||||
| 1273 | // Restore minimum size if set by user. | - | ||||||||||||||||||||||||
| 1274 | if (!userMinimumSize.isNull()) { 
 | 0 | ||||||||||||||||||||||||
| 1275 | q->setMinimumSize(userMinimumSize); | - | ||||||||||||||||||||||||
| 1276 | userMinimumSize = QSize(0, 0); | - | ||||||||||||||||||||||||
| 1277 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1278 | - | |||||||||||||||||||||||||
| 1279 | // Show the internal widget if it was hidden by us, | - | ||||||||||||||||||||||||
| 1280 | if (baseWidget && isWidgetHiddenByUs) { 
 
 | 0 | ||||||||||||||||||||||||
| 1281 | baseWidget->show(); | - | ||||||||||||||||||||||||
| 1282 | isWidgetHiddenByUs = false; | - | ||||||||||||||||||||||||
| 1283 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1284 | - | |||||||||||||||||||||||||
| 1285 | updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 1286 | QRect newGeometry = oldGeometry; | - | ||||||||||||||||||||||||
| 1287 | newGeometry.setSize(restoreSize.expandedTo(internalMinimumSize)); | - | ||||||||||||||||||||||||
| 1288 | q->setGeometry(newGeometry); | - | ||||||||||||||||||||||||
| 1289 | - | |||||||||||||||||||||||||
| 1290 | if (wasVisible) 
 | 0 | ||||||||||||||||||||||||
| 1291 | q->setVisible(true); never executed:  q->setVisible(true); | 0 | ||||||||||||||||||||||||
| 1292 | - | |||||||||||||||||||||||||
| 1293 | // Invalidate the restore size. | - | ||||||||||||||||||||||||
| 1294 | restoreSize.setWidth(-1); | - | ||||||||||||||||||||||||
| 1295 | restoreSize.setHeight(-1); | - | ||||||||||||||||||||||||
| 1296 | - | |||||||||||||||||||||||||
| 1297 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 1298 | setSizeGripVisible(true); | - | ||||||||||||||||||||||||
| 1299 | #endif | - | ||||||||||||||||||||||||
| 1300 | - | |||||||||||||||||||||||||
| 1301 | #ifndef QT_NO_ACTION | - | ||||||||||||||||||||||||
| 1302 | setEnabled(MoveAction, true); | - | ||||||||||||||||||||||||
| 1303 | setEnabled(MaximizeAction, true); | - | ||||||||||||||||||||||||
| 1304 | setEnabled(MinimizeAction, true); | - | ||||||||||||||||||||||||
| 1305 | setEnabled(RestoreAction, false); | - | ||||||||||||||||||||||||
| 1306 | setEnabled(ResizeAction, resizeEnabled); | - | ||||||||||||||||||||||||
| 1307 | #endif // QT_NO_ACTION | - | ||||||||||||||||||||||||
| 1308 | - | |||||||||||||||||||||||||
| 1309 | Q_ASSERT(!(q_func()->windowState() & Qt::WindowMinimized)); | - | ||||||||||||||||||||||||
| 1310 | // This sub-window can be maximized when shown above if not the | - | ||||||||||||||||||||||||
| 1311 | // QMdiArea::DontMaximizeSubWindowOnActionvation is set. Make sure | - | ||||||||||||||||||||||||
| 1312 | // the Qt::WindowMaximized flag is set accordingly. | - | ||||||||||||||||||||||||
| 1313 | Q_ASSERT((isMaximizeMode && q_func()->windowState() & Qt::WindowMaximized) | - | ||||||||||||||||||||||||
| 1314 | || (!isMaximizeMode && !(q_func()->windowState() & Qt::WindowMaximized))); | - | ||||||||||||||||||||||||
| 1315 | Q_ASSERT(!isShadeMode); | - | ||||||||||||||||||||||||
| 1316 | - | |||||||||||||||||||||||||
| 1317 | setActive(true); | - | ||||||||||||||||||||||||
| 1318 | restoreFocus(); | - | ||||||||||||||||||||||||
| 1319 | updateMask(); | - | ||||||||||||||||||||||||
| 1320 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1321 | - | |||||||||||||||||||||||||
| 1322 | inline void QMdiSubWindowPrivate::storeFocusWidget() | - | ||||||||||||||||||||||||
| 1323 | { | - | ||||||||||||||||||||||||
| 1324 | if (QWidget *focus = QApplication::focusWidget()) { 
 | 0 | ||||||||||||||||||||||||
| 1325 | if (!restoreFocusWidget && q_func()->isAncestorOf(focus)) 
 
 | 0 | ||||||||||||||||||||||||
| 1326 | restoreFocusWidget = focus; never executed:  restoreFocusWidget = focus; | 0 | ||||||||||||||||||||||||
| 1327 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1328 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1329 | - | |||||||||||||||||||||||||
| 1330 | /*! | - | ||||||||||||||||||||||||
| 1331 | \internal | - | ||||||||||||||||||||||||
| 1332 | */ | - | ||||||||||||||||||||||||
| 1333 | void QMdiSubWindowPrivate::setMaximizeMode() | - | ||||||||||||||||||||||||
| 1334 | { | - | ||||||||||||||||||||||||
| 1335 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1336 | Q_ASSERT(parent); | - | ||||||||||||||||||||||||
| 1337 | - | |||||||||||||||||||||||||
| 1338 | ensureWindowState(Qt::WindowMaximized); | - | ||||||||||||||||||||||||
| 1339 | isShadeMode = false; | - | ||||||||||||||||||||||||
| 1340 | isMaximizeMode = true; | - | ||||||||||||||||||||||||
| 1341 | - | |||||||||||||||||||||||||
| 1342 | storeFocusWidget(); | - | ||||||||||||||||||||||||
| 1343 | - | |||||||||||||||||||||||||
| 1344 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 1345 | setSizeGripVisible(false); | - | ||||||||||||||||||||||||
| 1346 | #endif | - | ||||||||||||||||||||||||
| 1347 | - | |||||||||||||||||||||||||
| 1348 | // Store old geometry and set restore size if not already set. | - | ||||||||||||||||||||||||
| 1349 | if (!restoreSize.isValid()) { 
 | 0 | ||||||||||||||||||||||||
| 1350 | oldGeometry = q->geometry(); | - | ||||||||||||||||||||||||
| 1351 | restoreSize.setWidth(oldGeometry.width()); | - | ||||||||||||||||||||||||
| 1352 | restoreSize.setHeight(oldGeometry.height()); | - | ||||||||||||||||||||||||
| 1353 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1354 | - | |||||||||||||||||||||||||
| 1355 | // Hide the window before we change the geometry to avoid multiple resize | - | ||||||||||||||||||||||||
| 1356 | // events and wrong window state. | - | ||||||||||||||||||||||||
| 1357 | const bool wasVisible = q->isVisible(); | - | ||||||||||||||||||||||||
| 1358 | if (wasVisible) 
 | 0 | ||||||||||||||||||||||||
| 1359 | q->setVisible(false); never executed:  q->setVisible(false); | 0 | ||||||||||||||||||||||||
| 1360 | - | |||||||||||||||||||||||||
| 1361 | // Show the internal widget if it was hidden by us. | - | ||||||||||||||||||||||||
| 1362 | if (baseWidget && isWidgetHiddenByUs) { 
 
 | 0 | ||||||||||||||||||||||||
| 1363 | baseWidget->show(); | - | ||||||||||||||||||||||||
| 1364 | isWidgetHiddenByUs = false; | - | ||||||||||||||||||||||||
| 1365 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1366 | - | |||||||||||||||||||||||||
| 1367 | updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||
| 1369 | if (wasVisible) { 
 | 0 | ||||||||||||||||||||||||
| 1370 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 1371 | if (QMenuBar *mBar = menuBar()) 
 | 0 | ||||||||||||||||||||||||
| 1372 | showButtonsInMenuBar(mBar); never executed:  showButtonsInMenuBar(mBar); | 0 | ||||||||||||||||||||||||
| 1373 | else | - | ||||||||||||||||||||||||
| 1374 | #endif | - | ||||||||||||||||||||||||
| 1375 | if (!controlContainer) 
 | 0 | ||||||||||||||||||||||||
| 1376 | controlContainer = new ControlContainer(q); never executed:  controlContainer = new ControlContainer(q); | 0 | ||||||||||||||||||||||||
| 1377 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1378 | - | |||||||||||||||||||||||||
| 1379 | QWidget *parent = q->parentWidget(); | - | ||||||||||||||||||||||||
| 1380 | QRect availableRect = parent->contentsRect(); | - | ||||||||||||||||||||||||
| 1381 | - | |||||||||||||||||||||||||
| 1382 | // Adjust geometry if the sub-window is inside a scroll area. | - | ||||||||||||||||||||||||
| 1383 | QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent->parentWidget()); | - | ||||||||||||||||||||||||
| 1384 | if (scrollArea && scrollArea->viewport() == parent) { 
 
 | 0 | ||||||||||||||||||||||||
| 1385 | QScrollBar *hbar = scrollArea->horizontalScrollBar(); | - | ||||||||||||||||||||||||
| 1386 | QScrollBar *vbar = scrollArea->verticalScrollBar(); | - | ||||||||||||||||||||||||
| 1387 | const int xOffset = hbar ? hbar->value() : 0; 
 | 0 | ||||||||||||||||||||||||
| 1388 | const int yOffset = vbar ? vbar->value() : 0; 
 | 0 | ||||||||||||||||||||||||
| 1389 | availableRect.adjust(-xOffset, -yOffset, -xOffset, -yOffset); | - | ||||||||||||||||||||||||
| 1390 | oldGeometry.adjust(xOffset, yOffset, xOffset, yOffset); | - | ||||||||||||||||||||||||
| 1391 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1392 | - | |||||||||||||||||||||||||
| 1393 | setNewGeometry(&availableRect); | - | ||||||||||||||||||||||||
| 1394 | // QWidget::setGeometry will reset Qt::WindowMaximized so we have to update it here. | - | ||||||||||||||||||||||||
| 1395 | ensureWindowState(Qt::WindowMaximized); | - | ||||||||||||||||||||||||
| 1396 | - | |||||||||||||||||||||||||
| 1397 | if (wasVisible) 
 | 0 | ||||||||||||||||||||||||
| 1398 | q->setVisible(true); never executed:  q->setVisible(true); | 0 | ||||||||||||||||||||||||
| 1399 | - | |||||||||||||||||||||||||
| 1400 | resizeEnabled = false; | - | ||||||||||||||||||||||||
| 1401 | moveEnabled = false; | - | ||||||||||||||||||||||||
| 1402 | - | |||||||||||||||||||||||||
| 1403 | #ifndef QT_NO_ACTION | - | ||||||||||||||||||||||||
| 1404 | setEnabled(MoveAction, moveEnabled); | - | ||||||||||||||||||||||||
| 1405 | setEnabled(MaximizeAction, false); | - | ||||||||||||||||||||||||
| 1406 | setEnabled(MinimizeAction, true); | - | ||||||||||||||||||||||||
| 1407 | setEnabled(RestoreAction, true); | - | ||||||||||||||||||||||||
| 1408 | setEnabled(ResizeAction, resizeEnabled); | - | ||||||||||||||||||||||||
| 1409 | #endif // QT_NO_ACTION | - | ||||||||||||||||||||||||
| 1410 | - | |||||||||||||||||||||||||
| 1411 | Q_ASSERT(q->windowState() & Qt::WindowMaximized); | - | ||||||||||||||||||||||||
| 1412 | Q_ASSERT(!(q->windowState() & Qt::WindowMinimized)); | - | ||||||||||||||||||||||||
| 1413 | - | |||||||||||||||||||||||||
| 1414 | restoreFocus(); | - | ||||||||||||||||||||||||
| 1415 | updateMask(); | - | ||||||||||||||||||||||||
| 1416 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1417 | - | |||||||||||||||||||||||||
| 1418 | /*! | - | ||||||||||||||||||||||||
| 1419 | \internal | - | ||||||||||||||||||||||||
| 1420 | */ | - | ||||||||||||||||||||||||
| 1421 | void QMdiSubWindowPrivate::setActive(bool activate, bool changeFocus) | - | ||||||||||||||||||||||||
| 1422 | { | - | ||||||||||||||||||||||||
| 1423 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1424 | if (!parent || !activationEnabled) 
 
 | 0 | ||||||||||||||||||||||||
| 1425 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1426 | - | |||||||||||||||||||||||||
| 1427 | if (activate && !isActive && q->isEnabled()) { 
 
 
 | 0 | ||||||||||||||||||||||||
| 1428 | isActive = true; | - | ||||||||||||||||||||||||
| 1429 | isExplicitlyDeactivated = false; | - | ||||||||||||||||||||||||
| 1430 | Qt::WindowStates oldWindowState = q->windowState(); | - | ||||||||||||||||||||||||
| 1431 | ensureWindowState(Qt::WindowActive); | - | ||||||||||||||||||||||||
| 1432 | emit q->aboutToActivate(); | - | ||||||||||||||||||||||||
| 1433 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 1434 | if (QMenuBar *mBar = menuBar()) 
 | 0 | ||||||||||||||||||||||||
| 1435 | showButtonsInMenuBar(mBar); never executed:  showButtonsInMenuBar(mBar); | 0 | ||||||||||||||||||||||||
| 1436 | #endif | - | ||||||||||||||||||||||||
| 1437 | Q_ASSERT(isActive); | - | ||||||||||||||||||||||||
| 1438 | emit q->windowStateChanged(oldWindowState, q->windowState()); | - | ||||||||||||||||||||||||
| 1439 | } else if (!activate && isActive) { never executed:  end of block
 
 | 0 | ||||||||||||||||||||||||
| 1440 | isActive = false; | - | ||||||||||||||||||||||||
| 1441 | Qt::WindowStates oldWindowState = q->windowState(); | - | ||||||||||||||||||||||||
| 1442 | q->overrideWindowState(q->windowState() & ~Qt::WindowActive); | - | ||||||||||||||||||||||||
| 1443 | if (changeFocus) { 
 | 0 | ||||||||||||||||||||||||
| 1444 | storeFocusWidget(); | - | ||||||||||||||||||||||||
| 1445 | QWidget *focusWidget = QApplication::focusWidget(); | - | ||||||||||||||||||||||||
| 1446 | if (focusWidget && (focusWidget == q || q->isAncestorOf(focusWidget))) 
 
 
 | 0 | ||||||||||||||||||||||||
| 1447 | focusWidget->clearFocus(); never executed:  focusWidget->clearFocus(); | 0 | ||||||||||||||||||||||||
| 1448 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1449 | if (baseWidget) 
 | 0 | ||||||||||||||||||||||||
| 1450 | baseWidget->overrideWindowState(baseWidget->windowState() & ~Qt::WindowActive); never executed:  baseWidget->overrideWindowState(baseWidget->windowState() & ~Qt::WindowActive); | 0 | ||||||||||||||||||||||||
| 1451 | Q_ASSERT(!isActive); | - | ||||||||||||||||||||||||
| 1452 | emit q->windowStateChanged(oldWindowState, q->windowState()); | - | ||||||||||||||||||||||||
| 1453 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1454 | - | |||||||||||||||||||||||||
| 1455 | if (activate && isActive && q->isEnabled() && !q->hasFocus() 
 
 
 
 | 0 | ||||||||||||||||||||||||
| 1456 | && !q->isAncestorOf(QApplication::focusWidget())) { 
 | 0 | ||||||||||||||||||||||||
| 1457 | if (changeFocus) 
 | 0 | ||||||||||||||||||||||||
| 1458 | setFocusWidget(); never executed:  setFocusWidget(); | 0 | ||||||||||||||||||||||||
| 1459 | ensureWindowState(Qt::WindowActive); | - | ||||||||||||||||||||||||
| 1460 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1461 | - | |||||||||||||||||||||||||
| 1462 | int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); | - | ||||||||||||||||||||||||
| 1463 | int titleBarHeight = this->titleBarHeight(); | - | ||||||||||||||||||||||||
| 1464 | QRegion windowDecoration = QRegion(0, 0, q->width(), q->height()); | - | ||||||||||||||||||||||||
| 1465 | windowDecoration -= QRegion(frameWidth, titleBarHeight, q->width() - 2 * frameWidth, | - | ||||||||||||||||||||||||
| 1466 | q->height() - titleBarHeight - frameWidth); | - | ||||||||||||||||||||||||
| 1467 | - | |||||||||||||||||||||||||
| 1468 | // Make sure we don't use cached style options if we get | - | ||||||||||||||||||||||||
| 1469 | // resize events right before activation/deactivation. | - | ||||||||||||||||||||||||
| 1470 | if (resizeTimerId != -1) { 
 | 0 | ||||||||||||||||||||||||
| 1471 | q->killTimer(resizeTimerId); | - | ||||||||||||||||||||||||
| 1472 | resizeTimerId = -1; | - | ||||||||||||||||||||||||
| 1473 | updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 1474 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1475 | - | |||||||||||||||||||||||||
| 1476 | q->update(windowDecoration); | - | ||||||||||||||||||||||||
| 1477 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1478 | - | |||||||||||||||||||||||||
| 1479 | /*! | - | ||||||||||||||||||||||||
| 1480 | \internal | - | ||||||||||||||||||||||||
| 1481 | */ | - | ||||||||||||||||||||||||
| 1482 | void QMdiSubWindowPrivate::processClickedSubControl() | - | ||||||||||||||||||||||||
| 1483 | { | - | ||||||||||||||||||||||||
| 1484 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1485 | switch (activeSubControl) { | - | ||||||||||||||||||||||||
| 1486 | case QStyle::SC_TitleBarContextHelpButton: never executed:  case QStyle::SC_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||
| 1487 | #ifndef QT_NO_WHATSTHIS | - | ||||||||||||||||||||||||
| 1488 | QWhatsThis::enterWhatsThisMode(); | - | ||||||||||||||||||||||||
| 1489 | #endif | - | ||||||||||||||||||||||||
| 1490 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1491 | case QStyle::SC_TitleBarShadeButton: never executed:  case QStyle::SC_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||
| 1492 | q->showShaded(); | - | ||||||||||||||||||||||||
| 1493 | hoveredSubControl = QStyle::SC_TitleBarUnshadeButton; | - | ||||||||||||||||||||||||
| 1494 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1495 | case QStyle::SC_TitleBarUnshadeButton: never executed:  case QStyle::SC_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||
| 1496 | if (q->isShaded()) 
 | 0 | ||||||||||||||||||||||||
| 1497 | hoveredSubControl = QStyle::SC_TitleBarShadeButton; never executed:  hoveredSubControl = QStyle::SC_TitleBarShadeButton; | 0 | ||||||||||||||||||||||||
| 1498 | q->showNormal(); | - | ||||||||||||||||||||||||
| 1499 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1500 | case QStyle::SC_TitleBarMinButton: never executed:  case QStyle::SC_TitleBarMinButton: | 0 | ||||||||||||||||||||||||
| 1501 | #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 1502 | if (qobject_cast<QMacStyle *>(q->style())) { | - | ||||||||||||||||||||||||
| 1503 | if (q->isMinimized()) | - | ||||||||||||||||||||||||
| 1504 | q->showNormal(); | - | ||||||||||||||||||||||||
| 1505 | else | - | ||||||||||||||||||||||||
| 1506 | q->showMinimized(); | - | ||||||||||||||||||||||||
| 1507 | break; | - | ||||||||||||||||||||||||
| 1508 | } | - | ||||||||||||||||||||||||
| 1509 | #endif | - | ||||||||||||||||||||||||
| 1510 | q->showMinimized(); | - | ||||||||||||||||||||||||
| 1511 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1512 | case QStyle::SC_TitleBarNormalButton: never executed:  case QStyle::SC_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||
| 1513 | if (q->isShaded()) 
 | 0 | ||||||||||||||||||||||||
| 1514 | hoveredSubControl = QStyle::SC_TitleBarMinButton; never executed:  hoveredSubControl = QStyle::SC_TitleBarMinButton; | 0 | ||||||||||||||||||||||||
| 1515 | q->showNormal(); | - | ||||||||||||||||||||||||
| 1516 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1517 | case QStyle::SC_TitleBarMaxButton: never executed:  case QStyle::SC_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||
| 1518 | #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 1519 | if (qobject_cast<QMacStyle *>(q->style())) { | - | ||||||||||||||||||||||||
| 1520 | if (q->isMaximized()) | - | ||||||||||||||||||||||||
| 1521 | q->showNormal(); | - | ||||||||||||||||||||||||
| 1522 | else | - | ||||||||||||||||||||||||
| 1523 | q->showMaximized(); | - | ||||||||||||||||||||||||
| 1524 | break; | - | ||||||||||||||||||||||||
| 1525 | } | - | ||||||||||||||||||||||||
| 1526 | #endif | - | ||||||||||||||||||||||||
| 1527 | q->showMaximized(); | - | ||||||||||||||||||||||||
| 1528 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1529 | case QStyle::SC_TitleBarCloseButton: never executed:  case QStyle::SC_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||
| 1530 | q->close(); | - | ||||||||||||||||||||||||
| 1531 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1532 | default: never executed:  default: | 0 | ||||||||||||||||||||||||
| 1533 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1534 | } | - | ||||||||||||||||||||||||
| 1535 | } | - | ||||||||||||||||||||||||
| 1536 | - | |||||||||||||||||||||||||
| 1537 | /*! | - | ||||||||||||||||||||||||
| 1538 | \internal | - | ||||||||||||||||||||||||
| 1539 | */ | - | ||||||||||||||||||||||||
| 1540 | QRegion QMdiSubWindowPrivate::getRegion(Operation operation) const | - | ||||||||||||||||||||||||
| 1541 | { | - | ||||||||||||||||||||||||
| 1542 | Q_Q(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1543 | int width = q->width(); | - | ||||||||||||||||||||||||
| 1544 | int height = q->height(); | - | ||||||||||||||||||||||||
| 1545 | int titleBarHeight = this->titleBarHeight(); | - | ||||||||||||||||||||||||
| 1546 | int frameWidth = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); | - | ||||||||||||||||||||||||
| 1547 | int cornerConst = titleBarHeight - frameWidth; | - | ||||||||||||||||||||||||
| 1548 | int titleBarConst = 2 * titleBarHeight; | - | ||||||||||||||||||||||||
| 1549 | - | |||||||||||||||||||||||||
| 1550 | if (operation == Move) { 
 | 0 | ||||||||||||||||||||||||
| 1551 | QStyleOptionTitleBar titleBarOptions = this->titleBarOptions(); | - | ||||||||||||||||||||||||
| 1552 | QRegion move(frameWidth, frameWidth, width - 2 * frameWidth, cornerConst); | - | ||||||||||||||||||||||||
| 1553 | // Depending on which window flags are set, activated sub controllers will | - | ||||||||||||||||||||||||
| 1554 | // be subtracted from the 'move' region. | - | ||||||||||||||||||||||||
| 1555 | for (int i = 0; i < NumSubControls; ++i) { 
 | 0 | ||||||||||||||||||||||||
| 1556 | if (SubControls[i] == QStyle::SC_TitleBarLabel) 
 | 0 | ||||||||||||||||||||||||
| 1557 | continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 1558 | move -= QRegion(q->style()->subControlRect(QStyle::CC_TitleBar, &titleBarOptions, | - | ||||||||||||||||||||||||
| 1559 | SubControls[i])); | - | ||||||||||||||||||||||||
| 1560 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1561 | return move; never executed:  return move; | 0 | ||||||||||||||||||||||||
| 1562 | } | - | ||||||||||||||||||||||||
| 1563 | - | |||||||||||||||||||||||||
| 1564 | QRegion region; | - | ||||||||||||||||||||||||
| 1565 | #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 1566 | if (qobject_cast<QMacStyle *>(q->style())) | - | ||||||||||||||||||||||||
| 1567 | return region; | - | ||||||||||||||||||||||||
| 1568 | #endif | - | ||||||||||||||||||||||||
| 1569 | - | |||||||||||||||||||||||||
| 1570 | switch (operation) { | - | ||||||||||||||||||||||||
| 1571 | case TopResize: never executed:  case TopResize: | 0 | ||||||||||||||||||||||||
| 1572 | region = QRegion(titleBarHeight, 0, width - titleBarConst, frameWidth); | - | ||||||||||||||||||||||||
| 1573 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1574 | case BottomResize: never executed:  case BottomResize: | 0 | ||||||||||||||||||||||||
| 1575 | region = QRegion(titleBarHeight, height - frameWidth, width - titleBarConst, frameWidth); | - | ||||||||||||||||||||||||
| 1576 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1577 | case LeftResize: never executed:  case LeftResize: | 0 | ||||||||||||||||||||||||
| 1578 | region = QRegion(0, titleBarHeight, frameWidth, height - titleBarConst); | - | ||||||||||||||||||||||||
| 1579 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1580 | case RightResize: never executed:  case RightResize: | 0 | ||||||||||||||||||||||||
| 1581 | region = QRegion(width - frameWidth, titleBarHeight, frameWidth, height - titleBarConst); | - | ||||||||||||||||||||||||
| 1582 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1583 | case TopLeftResize: never executed:  case TopLeftResize: | 0 | ||||||||||||||||||||||||
| 1584 | region = QRegion(0, 0, titleBarHeight, titleBarHeight) | - | ||||||||||||||||||||||||
| 1585 | - QRegion(frameWidth, frameWidth, cornerConst, cornerConst); | - | ||||||||||||||||||||||||
| 1586 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1587 | case TopRightResize: never executed:  case TopRightResize: | 0 | ||||||||||||||||||||||||
| 1588 | region = QRegion(width - titleBarHeight, 0, titleBarHeight, titleBarHeight) | - | ||||||||||||||||||||||||
| 1589 | - QRegion(width - titleBarHeight, frameWidth, cornerConst, cornerConst); | - | ||||||||||||||||||||||||
| 1590 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1591 | case BottomLeftResize: never executed:  case BottomLeftResize: | 0 | ||||||||||||||||||||||||
| 1592 | region = QRegion(0, height - titleBarHeight, titleBarHeight, titleBarHeight) | - | ||||||||||||||||||||||||
| 1593 | - QRegion(frameWidth, height - titleBarHeight, cornerConst, cornerConst); | - | ||||||||||||||||||||||||
| 1594 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1595 | case BottomRightResize: never executed:  case BottomRightResize: | 0 | ||||||||||||||||||||||||
| 1596 | region = QRegion(width - titleBarHeight, height - titleBarHeight, titleBarHeight, titleBarHeight) | - | ||||||||||||||||||||||||
| 1597 | - QRegion(width - titleBarHeight, height - titleBarHeight, cornerConst, cornerConst); | - | ||||||||||||||||||||||||
| 1598 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1599 | default: never executed:  default: | 0 | ||||||||||||||||||||||||
| 1600 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1601 | } | - | ||||||||||||||||||||||||
| 1602 | - | |||||||||||||||||||||||||
| 1603 | return region; never executed:  return region; | 0 | ||||||||||||||||||||||||
| 1604 | } | - | ||||||||||||||||||||||||
| 1605 | - | |||||||||||||||||||||||||
| 1606 | /*! | - | ||||||||||||||||||||||||
| 1607 | \internal | - | ||||||||||||||||||||||||
| 1608 | */ | - | ||||||||||||||||||||||||
| 1609 | QMdiSubWindowPrivate::Operation QMdiSubWindowPrivate::getOperation(const QPoint &pos) const | - | ||||||||||||||||||||||||
| 1610 | { | - | ||||||||||||||||||||||||
| 1611 | OperationInfoMap::const_iterator it; | - | ||||||||||||||||||||||||
| 1612 | for (it = operationMap.constBegin(); it != operationMap.constEnd(); ++it) 
 | 0 | ||||||||||||||||||||||||
| 1613 | if (it.value().region.contains(pos)) 
 | 0 | ||||||||||||||||||||||||
| 1614 | return it.key(); never executed:  return it.key(); | 0 | ||||||||||||||||||||||||
| 1615 | return None; never executed:  return None; | 0 | ||||||||||||||||||||||||
| 1616 | } | - | ||||||||||||||||||||||||
| 1617 | - | |||||||||||||||||||||||||
| 1618 | extern QString qt_setWindowTitle_helperHelper(const QString&, const QWidget*); | - | ||||||||||||||||||||||||
| 1619 | - | |||||||||||||||||||||||||
| 1620 | /*! | - | ||||||||||||||||||||||||
| 1621 | \internal | - | ||||||||||||||||||||||||
| 1622 | */ | - | ||||||||||||||||||||||||
| 1623 | QStyleOptionTitleBar QMdiSubWindowPrivate::titleBarOptions() const | - | ||||||||||||||||||||||||
| 1624 | { | - | ||||||||||||||||||||||||
| 1625 | Q_Q(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1626 | QStyleOptionTitleBar titleBarOptions; | - | ||||||||||||||||||||||||
| 1627 | titleBarOptions.initFrom(q); | - | ||||||||||||||||||||||||
| 1628 | if (activeSubControl != QStyle::SC_None) { 
 | 0 | ||||||||||||||||||||||||
| 1629 | if (hoveredSubControl == activeSubControl) { 
 | 0 | ||||||||||||||||||||||||
| 1630 | titleBarOptions.state |= QStyle::State_Sunken; | - | ||||||||||||||||||||||||
| 1631 | titleBarOptions.activeSubControls = activeSubControl; | - | ||||||||||||||||||||||||
| 1632 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1633 | } else if (autoRaise() && hoveredSubControl != QStyle::SC_None never executed:  end of block
 
 | 0 | ||||||||||||||||||||||||
| 1634 | && hoveredSubControl != QStyle::SC_TitleBarLabel) { 
 | 0 | ||||||||||||||||||||||||
| 1635 | titleBarOptions.state |= QStyle::State_MouseOver; | - | ||||||||||||||||||||||||
| 1636 | titleBarOptions.activeSubControls = hoveredSubControl; | - | ||||||||||||||||||||||||
| 1637 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1638 | titleBarOptions.state &= ~QStyle::State_MouseOver; | - | ||||||||||||||||||||||||
| 1639 | titleBarOptions.activeSubControls = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 1640 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1641 | - | |||||||||||||||||||||||||
| 1642 | titleBarOptions.subControls = QStyle::SC_All; | - | ||||||||||||||||||||||||
| 1643 | titleBarOptions.titleBarFlags = q->windowFlags(); | - | ||||||||||||||||||||||||
| 1644 | titleBarOptions.titleBarState = q->windowState(); | - | ||||||||||||||||||||||||
| 1645 | titleBarOptions.palette = titleBarPalette; | - | ||||||||||||||||||||||||
| 1646 | titleBarOptions.icon = menuIcon; | - | ||||||||||||||||||||||||
| 1647 | - | |||||||||||||||||||||||||
| 1648 | if (isActive) { 
 | 0 | ||||||||||||||||||||||||
| 1649 | titleBarOptions.state |= QStyle::State_Active; | - | ||||||||||||||||||||||||
| 1650 | titleBarOptions.titleBarState |= QStyle::State_Active; | - | ||||||||||||||||||||||||
| 1651 | titleBarOptions.palette.setCurrentColorGroup(QPalette::Active); | - | ||||||||||||||||||||||||
| 1652 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1653 | titleBarOptions.state &= ~QStyle::State_Active; | - | ||||||||||||||||||||||||
| 1654 | titleBarOptions.palette.setCurrentColorGroup(QPalette::Inactive); | - | ||||||||||||||||||||||||
| 1655 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1656 | - | |||||||||||||||||||||||||
| 1657 | int border = hasBorder(titleBarOptions) ? 4 : 0; 
 | 0 | ||||||||||||||||||||||||
| 1658 | int paintHeight = titleBarHeight(titleBarOptions); | - | ||||||||||||||||||||||||
| 1659 | paintHeight -= q->isMinimized() ? 2 * border : border; 
 | 0 | ||||||||||||||||||||||||
| 1660 | titleBarOptions.rect = QRect(border, border, q->width() - 2 * border, paintHeight); | - | ||||||||||||||||||||||||
| 1661 | - | |||||||||||||||||||||||||
| 1662 | if (!windowTitle.isEmpty()) { 
 | 0 | ||||||||||||||||||||||||
| 1663 | // Set the text here before asking for the width of the title bar label | - | ||||||||||||||||||||||||
| 1664 | // in case people uses the actual text to calculate the width. | - | ||||||||||||||||||||||||
| 1665 | titleBarOptions.text = windowTitle; | - | ||||||||||||||||||||||||
| 1666 | titleBarOptions.fontMetrics = QFontMetrics(font); | - | ||||||||||||||||||||||||
| 1667 | int width = q->style()->subControlRect(QStyle::CC_TitleBar, &titleBarOptions, | - | ||||||||||||||||||||||||
| 1668 | QStyle::SC_TitleBarLabel, q).width(); | - | ||||||||||||||||||||||||
| 1669 | // Set elided text if we don't have enough space for the entire title. | - | ||||||||||||||||||||||||
| 1670 | titleBarOptions.text = titleBarOptions.fontMetrics.elidedText(windowTitle, Qt::ElideRight, width); | - | ||||||||||||||||||||||||
| 1671 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1672 | return titleBarOptions; never executed:  return titleBarOptions; | 0 | ||||||||||||||||||||||||
| 1673 | } | - | ||||||||||||||||||||||||
| 1674 | - | |||||||||||||||||||||||||
| 1675 | /*! | - | ||||||||||||||||||||||||
| 1676 | \internal | - | ||||||||||||||||||||||||
| 1677 | */ | - | ||||||||||||||||||||||||
| 1678 | void QMdiSubWindowPrivate::ensureWindowState(Qt::WindowState state) | - | ||||||||||||||||||||||||
| 1679 | { | - | ||||||||||||||||||||||||
| 1680 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1681 | Qt::WindowStates windowStates = q->windowState() | state; | - | ||||||||||||||||||||||||
| 1682 | switch (state) { | - | ||||||||||||||||||||||||
| 1683 | case Qt::WindowMinimized: never executed:  case Qt::WindowMinimized: | 0 | ||||||||||||||||||||||||
| 1684 | windowStates &= ~Qt::WindowMaximized; | - | ||||||||||||||||||||||||
| 1685 | windowStates &= ~Qt::WindowFullScreen; | - | ||||||||||||||||||||||||
| 1686 | windowStates &= ~Qt::WindowNoState; | - | ||||||||||||||||||||||||
| 1687 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1688 | case Qt::WindowMaximized: never executed:  case Qt::WindowMaximized: | 0 | ||||||||||||||||||||||||
| 1689 | windowStates &= ~Qt::WindowMinimized; | - | ||||||||||||||||||||||||
| 1690 | windowStates &= ~Qt::WindowFullScreen; | - | ||||||||||||||||||||||||
| 1691 | windowStates &= ~Qt::WindowNoState; | - | ||||||||||||||||||||||||
| 1692 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1693 | case Qt::WindowNoState: never executed:  case Qt::WindowNoState: | 0 | ||||||||||||||||||||||||
| 1694 | windowStates &= ~Qt::WindowMinimized; | - | ||||||||||||||||||||||||
| 1695 | windowStates &= ~Qt::WindowMaximized; | - | ||||||||||||||||||||||||
| 1696 | windowStates &= ~Qt::WindowFullScreen; | - | ||||||||||||||||||||||||
| 1697 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1698 | default: never executed:  default: | 0 | ||||||||||||||||||||||||
| 1699 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1700 | } | - | ||||||||||||||||||||||||
| 1701 | if (baseWidget) { 
 | 0 | ||||||||||||||||||||||||
| 1702 | if (!(baseWidget->windowState() & Qt::WindowActive) && windowStates & Qt::WindowActive) 
 
 | 0 | ||||||||||||||||||||||||
| 1703 | baseWidget->overrideWindowState(windowStates & ~Qt::WindowActive); never executed:  baseWidget->overrideWindowState(windowStates & ~Qt::WindowActive); | 0 | ||||||||||||||||||||||||
| 1704 | else | - | ||||||||||||||||||||||||
| 1705 | baseWidget->overrideWindowState(windowStates); never executed:  baseWidget->overrideWindowState(windowStates); | 0 | ||||||||||||||||||||||||
| 1706 | } | - | ||||||||||||||||||||||||
| 1707 | q->overrideWindowState(windowStates); | - | ||||||||||||||||||||||||
| 1708 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1709 | - | |||||||||||||||||||||||||
| 1710 | /*! | - | ||||||||||||||||||||||||
| 1711 | \internal | - | ||||||||||||||||||||||||
| 1712 | */ | - | ||||||||||||||||||||||||
| 1713 | int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const | - | ||||||||||||||||||||||||
| 1714 | { | - | ||||||||||||||||||||||||
| 1715 | Q_Q(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1716 | if (!parent || q->windowFlags() & Qt::FramelessWindowHint 
 
 | 0 | ||||||||||||||||||||||||
| 1717 | || (q->isMaximized() && !drawTitleBarWhenMaximized())) { 
 
 | 0 | ||||||||||||||||||||||||
| 1718 | return 0; never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 1719 | } | - | ||||||||||||||||||||||||
| 1720 | - | |||||||||||||||||||||||||
| 1721 | int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q); | - | ||||||||||||||||||||||||
| 1722 | if (hasBorder(options)) 
 | 0 | ||||||||||||||||||||||||
| 1723 | height += q->isMinimized() ? 8 : 4; never executed:  height += q->isMinimized() ? 8 : 4;
 | 0 | ||||||||||||||||||||||||
| 1724 | return height; never executed:  return height; | 0 | ||||||||||||||||||||||||
| 1725 | } | - | ||||||||||||||||||||||||
| 1726 | - | |||||||||||||||||||||||||
| 1727 | /*! | - | ||||||||||||||||||||||||
| 1728 | \internal | - | ||||||||||||||||||||||||
| 1729 | */ | - | ||||||||||||||||||||||||
| 1730 | void QMdiSubWindowPrivate::sizeParameters(int *margin, int *minWidth) const | - | ||||||||||||||||||||||||
| 1731 | { | - | ||||||||||||||||||||||||
| 1732 | Q_Q(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1733 | Qt::WindowFlags flags = q->windowFlags(); | - | ||||||||||||||||||||||||
| 1734 | if (!parent || flags & Qt::FramelessWindowHint) { 
 
 | 0 | ||||||||||||||||||||||||
| 1735 | *margin = 0; | - | ||||||||||||||||||||||||
| 1736 | *minWidth = 0; | - | ||||||||||||||||||||||||
| 1737 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1738 | } | - | ||||||||||||||||||||||||
| 1739 | - | |||||||||||||||||||||||||
| 1740 | if (q->isMaximized() && !drawTitleBarWhenMaximized()) 
 
 | 0 | ||||||||||||||||||||||||
| 1741 | *margin = 0; never executed:  *margin = 0; | 0 | ||||||||||||||||||||||||
| 1742 | else | - | ||||||||||||||||||||||||
| 1743 | *margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); never executed:  *margin = q->style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, q); | 0 | ||||||||||||||||||||||||
| 1744 | - | |||||||||||||||||||||||||
| 1745 | QStyleOptionTitleBar opt = this->titleBarOptions(); | - | ||||||||||||||||||||||||
| 1746 | int tempWidth = 0; | - | ||||||||||||||||||||||||
| 1747 | for (int i = 0; i < NumSubControls; ++i) { 
 | 0 | ||||||||||||||||||||||||
| 1748 | if (SubControls[i] == QStyle::SC_TitleBarLabel) { 
 | 0 | ||||||||||||||||||||||||
| 1749 | tempWidth += 30; | - | ||||||||||||||||||||||||
| 1750 | continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 1751 | } | - | ||||||||||||||||||||||||
| 1752 | QRect rect = q->style()->subControlRect(QStyle::CC_TitleBar, &opt, SubControls[i], q); | - | ||||||||||||||||||||||||
| 1753 | if (!rect.isValid()) 
 | 0 | ||||||||||||||||||||||||
| 1754 | continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 1755 | tempWidth += rect.width(); | - | ||||||||||||||||||||||||
| 1756 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1757 | *minWidth = tempWidth; | - | ||||||||||||||||||||||||
| 1758 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1759 | - | |||||||||||||||||||||||||
| 1760 | /*! | - | ||||||||||||||||||||||||
| 1761 | \internal | - | ||||||||||||||||||||||||
| 1762 | */ | - | ||||||||||||||||||||||||
| 1763 | bool QMdiSubWindowPrivate::drawTitleBarWhenMaximized() const | - | ||||||||||||||||||||||||
| 1764 | { | - | ||||||||||||||||||||||||
| 1765 | Q_Q(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1766 | if (q->window()->testAttribute(Qt::WA_CanHostQMdiSubWindowTitleBar)) 
 | 0 | ||||||||||||||||||||||||
| 1767 | return false; never executed:  return false; | 0 | ||||||||||||||||||||||||
| 1768 | - | |||||||||||||||||||||||||
| 1769 | if (isChildOfTabbedQMdiArea(q)) 
 | 0 | ||||||||||||||||||||||||
| 1770 | return false; never executed:  return false; | 0 | ||||||||||||||||||||||||
| 1771 | - | |||||||||||||||||||||||||
| 1772 | #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) || defined(Q_OS_WINCE_WM) | - | ||||||||||||||||||||||||
| 1773 | Q_UNUSED(isChildOfQMdiSubWindow); | - | ||||||||||||||||||||||||
| 1774 | return true; | - | ||||||||||||||||||||||||
| 1775 | #else | - | ||||||||||||||||||||||||
| 1776 | if (q->style()->styleHint(QStyle::SH_Workspace_FillSpaceOnMaximize, 0, q)) 
 | 0 | ||||||||||||||||||||||||
| 1777 | return true; never executed:  return true; | 0 | ||||||||||||||||||||||||
| 1778 | #if defined(QT_NO_MENUBAR) || defined(QT_NO_MAINWINDOW) | - | ||||||||||||||||||||||||
| 1779 | Q_UNUSED(isChildOfQMdiSubWindow); | - | ||||||||||||||||||||||||
| 1780 | return true; | - | ||||||||||||||||||||||||
| 1781 | #else | - | ||||||||||||||||||||||||
| 1782 | QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window()); | - | ||||||||||||||||||||||||
| 1783 | if (!mainWindow || !qobject_cast<QMenuBar *>(mainWindow->menuWidget()) 
 
 | 0 | ||||||||||||||||||||||||
| 1784 | || mainWindow->menuWidget()->isHidden()) 
 | 0 | ||||||||||||||||||||||||
| 1785 | return true; never executed:  return true; | 0 | ||||||||||||||||||||||||
| 1786 | - | |||||||||||||||||||||||||
| 1787 | return isChildOfQMdiSubWindow(q); never executed:  return isChildOfQMdiSubWindow(q); | 0 | ||||||||||||||||||||||||
| 1788 | #endif | - | ||||||||||||||||||||||||
| 1789 | #endif | - | ||||||||||||||||||||||||
| 1790 | } | - | ||||||||||||||||||||||||
| 1791 | - | |||||||||||||||||||||||||
| 1792 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 1793 | - | |||||||||||||||||||||||||
| 1794 | /*! | - | ||||||||||||||||||||||||
| 1795 | \internal | - | ||||||||||||||||||||||||
| 1796 | */ | - | ||||||||||||||||||||||||
| 1797 | void QMdiSubWindowPrivate::showButtonsInMenuBar(QMenuBar *menuBar) | - | ||||||||||||||||||||||||
| 1798 | { | - | ||||||||||||||||||||||||
| 1799 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1800 | Q_ASSERT(q->isMaximized() && !drawTitleBarWhenMaximized()); | - | ||||||||||||||||||||||||
| 1801 | - | |||||||||||||||||||||||||
| 1802 | if (isChildOfTabbedQMdiArea(q)) 
 | 0 | ||||||||||||||||||||||||
| 1803 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1804 | - | |||||||||||||||||||||||||
| 1805 | removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 1806 | if (!controlContainer) 
 | 0 | ||||||||||||||||||||||||
| 1807 | controlContainer = new ControlContainer(q); never executed:  controlContainer = new ControlContainer(q); | 0 | ||||||||||||||||||||||||
| 1808 | - | |||||||||||||||||||||||||
| 1809 | ignoreWindowTitleChange = true; | - | ||||||||||||||||||||||||
| 1810 | controlContainer->showButtonsInMenuBar(menuBar); | - | ||||||||||||||||||||||||
| 1811 | ignoreWindowTitleChange = false; | - | ||||||||||||||||||||||||
| 1812 | - | |||||||||||||||||||||||||
| 1813 | QWidget *topLevelWindow = q->window(); | - | ||||||||||||||||||||||||
| 1814 | topLevelWindow->setWindowModified(q->isWindowModified()); | - | ||||||||||||||||||||||||
| 1815 | topLevelWindow->installEventFilter(q); | - | ||||||||||||||||||||||||
| 1816 | - | |||||||||||||||||||||||||
| 1817 | int buttonHeight = 0; | - | ||||||||||||||||||||||||
| 1818 | if (controlContainer->controllerWidget()) 
 | 0 | ||||||||||||||||||||||||
| 1819 | buttonHeight = controlContainer->controllerWidget()->height(); never executed:  buttonHeight = controlContainer->controllerWidget()->height(); | 0 | ||||||||||||||||||||||||
| 1820 | else if (controlContainer->systemMenuLabel()) 
 | 0 | ||||||||||||||||||||||||
| 1821 | buttonHeight = controlContainer->systemMenuLabel()->height(); never executed:  buttonHeight = controlContainer->systemMenuLabel()->height(); | 0 | ||||||||||||||||||||||||
| 1822 | - | |||||||||||||||||||||||||
| 1823 | // This will rarely happen. | - | ||||||||||||||||||||||||
| 1824 | if (menuBar && menuBar->height() < buttonHeight 
 
 | 0 | ||||||||||||||||||||||||
| 1825 | && topLevelWindow->layout()) { 
 | 0 | ||||||||||||||||||||||||
| 1826 | // Make sure topLevelWindow->contentsRect returns correct geometry. | - | ||||||||||||||||||||||||
| 1827 | // topLevelWidget->updateGeoemtry will not do the trick here since it will post the event. | - | ||||||||||||||||||||||||
| 1828 | QEvent event(QEvent::LayoutRequest); | - | ||||||||||||||||||||||||
| 1829 | QApplication::sendEvent(topLevelWindow, &event); | - | ||||||||||||||||||||||||
| 1830 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1831 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1832 | - | |||||||||||||||||||||||||
| 1833 | /*! | - | ||||||||||||||||||||||||
| 1834 | \internal | - | ||||||||||||||||||||||||
| 1835 | */ | - | ||||||||||||||||||||||||
| 1836 | void QMdiSubWindowPrivate::removeButtonsFromMenuBar() | - | ||||||||||||||||||||||||
| 1837 | { | - | ||||||||||||||||||||||||
| 1838 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1839 | - | |||||||||||||||||||||||||
| 1840 | if (!controlContainer || isChildOfTabbedQMdiArea(q)) 
 
 | 0 | ||||||||||||||||||||||||
| 1841 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1842 | - | |||||||||||||||||||||||||
| 1843 | QMenuBar *currentMenuBar = 0; | - | ||||||||||||||||||||||||
| 1844 | #ifndef QT_NO_MAINWINDOW | - | ||||||||||||||||||||||||
| 1845 | if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q->window())) { 
 | 0 | ||||||||||||||||||||||||
| 1846 | // NB! We can't use menuBar() here because that one will actually create | - | ||||||||||||||||||||||||
| 1847 | // a menubar for us if not set. That's not what we want :-) | - | ||||||||||||||||||||||||
| 1848 | currentMenuBar = qobject_cast<QMenuBar *>(mainWindow->menuWidget()); | - | ||||||||||||||||||||||||
| 1849 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1850 | #endif | - | ||||||||||||||||||||||||
| 1851 | - | |||||||||||||||||||||||||
| 1852 | ignoreWindowTitleChange = true; | - | ||||||||||||||||||||||||
| 1853 | controlContainer->removeButtonsFromMenuBar(currentMenuBar); | - | ||||||||||||||||||||||||
| 1854 | ignoreWindowTitleChange = false; | - | ||||||||||||||||||||||||
| 1855 | - | |||||||||||||||||||||||||
| 1856 | QWidget *topLevelWindow = q->window(); | - | ||||||||||||||||||||||||
| 1857 | topLevelWindow->removeEventFilter(q); | - | ||||||||||||||||||||||||
| 1858 | if (baseWidget && !drawTitleBarWhenMaximized()) 
 
 | 0 | ||||||||||||||||||||||||
| 1859 | topLevelWindow->setWindowModified(false); never executed:  topLevelWindow->setWindowModified(false); | 0 | ||||||||||||||||||||||||
| 1860 | originalTitle = QString::null; | - | ||||||||||||||||||||||||
| 1861 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1862 | - | |||||||||||||||||||||||||
| 1863 | #endif // QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 1864 | - | |||||||||||||||||||||||||
| 1865 | void QMdiSubWindowPrivate::updateWindowTitle(bool isRequestFromChild) | - | ||||||||||||||||||||||||
| 1866 | { | - | ||||||||||||||||||||||||
| 1867 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1868 | if (isRequestFromChild && !q->windowTitle().isEmpty() && !lastChildWindowTitle.isEmpty() 
 
 
 | 0 | ||||||||||||||||||||||||
| 1869 | && lastChildWindowTitle != q->windowTitle()) { 
 | 0 | ||||||||||||||||||||||||
| 1870 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1871 | } | - | ||||||||||||||||||||||||
| 1872 | - | |||||||||||||||||||||||||
| 1873 | QWidget *titleWidget = 0; | - | ||||||||||||||||||||||||
| 1874 | if (isRequestFromChild) 
 | 0 | ||||||||||||||||||||||||
| 1875 | titleWidget = baseWidget; never executed:  titleWidget = baseWidget; | 0 | ||||||||||||||||||||||||
| 1876 | else | - | ||||||||||||||||||||||||
| 1877 | titleWidget = q; never executed:  titleWidget = q; | 0 | ||||||||||||||||||||||||
| 1878 | if (!titleWidget || titleWidget->windowTitle().isEmpty()) 
 
 | 0 | ||||||||||||||||||||||||
| 1879 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1880 | - | |||||||||||||||||||||||||
| 1881 | ignoreWindowTitleChange = true; | - | ||||||||||||||||||||||||
| 1882 | q->setWindowTitle(titleWidget->windowTitle()); | - | ||||||||||||||||||||||||
| 1883 | if (q->maximizedButtonsWidget()) 
 | 0 | ||||||||||||||||||||||||
| 1884 | setNewWindowTitle(); never executed:  setNewWindowTitle(); | 0 | ||||||||||||||||||||||||
| 1885 | ignoreWindowTitleChange = false; | - | ||||||||||||||||||||||||
| 1886 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1887 | - | |||||||||||||||||||||||||
| 1888 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 1889 | void QMdiSubWindowPrivate::enterRubberBandMode() | - | ||||||||||||||||||||||||
| 1890 | { | - | ||||||||||||||||||||||||
| 1891 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1892 | if (q->isMaximized()) 
 | 0 | ||||||||||||||||||||||||
| 1893 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1894 | Q_ASSERT(oldGeometry.isValid()); | - | ||||||||||||||||||||||||
| 1895 | Q_ASSERT(parent); | - | ||||||||||||||||||||||||
| 1896 | if (!rubberBand) { 
 | 0 | ||||||||||||||||||||||||
| 1897 | rubberBand = new QRubberBand(QRubberBand::Rectangle, q->parentWidget()); | - | ||||||||||||||||||||||||
| 1898 | // For accessibility to identify this special widget. | - | ||||||||||||||||||||||||
| 1899 | rubberBand->setObjectName(QLatin1String("qt_rubberband")); | - | ||||||||||||||||||||||||
| 1900 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1901 | QPoint rubberBandPos = q->mapToParent(QPoint(0, 0)); | - | ||||||||||||||||||||||||
| 1902 | rubberBand->setGeometry(rubberBandPos.x(), rubberBandPos.y(), | - | ||||||||||||||||||||||||
| 1903 | oldGeometry.width(), oldGeometry.height()); | - | ||||||||||||||||||||||||
| 1904 | rubberBand->show(); | - | ||||||||||||||||||||||||
| 1905 | isInRubberBandMode = true; | - | ||||||||||||||||||||||||
| 1906 | q->grabMouse(); | - | ||||||||||||||||||||||||
| 1907 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1908 | - | |||||||||||||||||||||||||
| 1909 | void QMdiSubWindowPrivate::leaveRubberBandMode() | - | ||||||||||||||||||||||||
| 1910 | { | - | ||||||||||||||||||||||||
| 1911 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1912 | Q_ASSERT(rubberBand); | - | ||||||||||||||||||||||||
| 1913 | Q_ASSERT(isInRubberBandMode); | - | ||||||||||||||||||||||||
| 1914 | q->releaseMouse(); | - | ||||||||||||||||||||||||
| 1915 | isInRubberBandMode = false; | - | ||||||||||||||||||||||||
| 1916 | q->setGeometry(rubberBand->geometry()); | - | ||||||||||||||||||||||||
| 1917 | rubberBand->hide(); | - | ||||||||||||||||||||||||
| 1918 | currentOperation = None; | - | ||||||||||||||||||||||||
| 1919 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1920 | #endif // QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 1921 | - | |||||||||||||||||||||||||
| 1922 | // Taken from the old QWorkspace (::readColors()) | - | ||||||||||||||||||||||||
| 1923 | QPalette QMdiSubWindowPrivate::desktopPalette() const | - | ||||||||||||||||||||||||
| 1924 | { | - | ||||||||||||||||||||||||
| 1925 | Q_Q(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 1926 | QPalette newPalette = q->palette(); | - | ||||||||||||||||||||||||
| 1927 | - | |||||||||||||||||||||||||
| 1928 | bool colorsInitialized = false; | - | ||||||||||||||||||||||||
| 1929 | #ifdef Q_DEAD_CODE_FROM_QT4_WIN // ask system properties on windows | - | ||||||||||||||||||||||||
| 1930 | #ifndef SPI_GETGRADIENTCAPTIONS | - | ||||||||||||||||||||||||
| 1931 | #define SPI_GETGRADIENTCAPTIONS 0x1008 | - | ||||||||||||||||||||||||
| 1932 | #endif | - | ||||||||||||||||||||||||
| 1933 | #ifndef COLOR_GRADIENTACTIVECAPTION | - | ||||||||||||||||||||||||
| 1934 | #define COLOR_GRADIENTACTIVECAPTION 27 | - | ||||||||||||||||||||||||
| 1935 | #endif | - | ||||||||||||||||||||||||
| 1936 | #ifndef COLOR_GRADIENTINACTIVECAPTION | - | ||||||||||||||||||||||||
| 1937 | #define COLOR_GRADIENTINACTIVECAPTION 28 | - | ||||||||||||||||||||||||
| 1938 | #endif | - | ||||||||||||||||||||||||
| 1939 | if (QApplication::desktopSettingsAware()) { | - | ||||||||||||||||||||||||
| 1940 | newPalette.setColor(QPalette::Active, QPalette::Highlight, | - | ||||||||||||||||||||||||
| 1941 | colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION))); | - | ||||||||||||||||||||||||
| 1942 | newPalette.setColor(QPalette::Inactive, QPalette::Highlight, | - | ||||||||||||||||||||||||
| 1943 | colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION))); | - | ||||||||||||||||||||||||
| 1944 | newPalette.setColor(QPalette::Active, QPalette::HighlightedText, | - | ||||||||||||||||||||||||
| 1945 | colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT))); | - | ||||||||||||||||||||||||
| 1946 | newPalette.setColor(QPalette::Inactive, QPalette::HighlightedText, | - | ||||||||||||||||||||||||
| 1947 | colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT))); | - | ||||||||||||||||||||||||
| 1948 | - | |||||||||||||||||||||||||
| 1949 | colorsInitialized = true; | - | ||||||||||||||||||||||||
| 1950 | BOOL hasGradient = false; | - | ||||||||||||||||||||||||
| 1951 | SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &hasGradient, 0); | - | ||||||||||||||||||||||||
| 1952 | - | |||||||||||||||||||||||||
| 1953 | if (hasGradient) { | - | ||||||||||||||||||||||||
| 1954 | newPalette.setColor(QPalette::Active, QPalette::Base, | - | ||||||||||||||||||||||||
| 1955 | colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION))); | - | ||||||||||||||||||||||||
| 1956 | newPalette.setColor(QPalette::Inactive, QPalette::Base, | - | ||||||||||||||||||||||||
| 1957 | colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION))); | - | ||||||||||||||||||||||||
| 1958 | } else { | - | ||||||||||||||||||||||||
| 1959 | newPalette.setColor(QPalette::Active, QPalette::Base, | - | ||||||||||||||||||||||||
| 1960 | newPalette.color(QPalette::Active, QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 1961 | newPalette.setColor(QPalette::Inactive, QPalette::Base, | - | ||||||||||||||||||||||||
| 1962 | newPalette.color(QPalette::Inactive, QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 1963 | } | - | ||||||||||||||||||||||||
| 1964 | } | - | ||||||||||||||||||||||||
| 1965 | #endif // Q_DEAD_CODE_FROM_QT4_WIN | - | ||||||||||||||||||||||||
| 1966 | if (!colorsInitialized) { 
 | 0 | ||||||||||||||||||||||||
| 1967 | newPalette.setColor(QPalette::Active, QPalette::Highlight, | - | ||||||||||||||||||||||||
| 1968 | newPalette.color(QPalette::Active, QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 1969 | newPalette.setColor(QPalette::Active, QPalette::Base, | - | ||||||||||||||||||||||||
| 1970 | newPalette.color(QPalette::Active, QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 1971 | newPalette.setColor(QPalette::Inactive, QPalette::Highlight, | - | ||||||||||||||||||||||||
| 1972 | newPalette.color(QPalette::Inactive, QPalette::Dark)); | - | ||||||||||||||||||||||||
| 1973 | newPalette.setColor(QPalette::Inactive, QPalette::Base, | - | ||||||||||||||||||||||||
| 1974 | newPalette.color(QPalette::Inactive, QPalette::Dark)); | - | ||||||||||||||||||||||||
| 1975 | newPalette.setColor(QPalette::Inactive, QPalette::HighlightedText, | - | ||||||||||||||||||||||||
| 1976 | newPalette.color(QPalette::Inactive, QPalette::Window)); | - | ||||||||||||||||||||||||
| 1977 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1978 | - | |||||||||||||||||||||||||
| 1979 | return newPalette; never executed:  return newPalette; | 0 | ||||||||||||||||||||||||
| 1980 | } | - | ||||||||||||||||||||||||
| 1981 | - | |||||||||||||||||||||||||
| 1982 | void QMdiSubWindowPrivate::updateActions() | - | ||||||||||||||||||||||||
| 1983 | { | - | ||||||||||||||||||||||||
| 1984 | Qt::WindowFlags windowFlags = q_func()->windowFlags(); | - | ||||||||||||||||||||||||
| 1985 | // Hide all | - | ||||||||||||||||||||||||
| 1986 | for (int i = 0; i < NumWindowStateActions; ++i) 
 | 0 | ||||||||||||||||||||||||
| 1987 | setVisible(WindowStateAction(i), false); never executed:  setVisible(WindowStateAction(i), false); | 0 | ||||||||||||||||||||||||
| 1988 | - | |||||||||||||||||||||||||
| 1989 | if (windowFlags & Qt::FramelessWindowHint) 
 | 0 | ||||||||||||||||||||||||
| 1990 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1991 | - | |||||||||||||||||||||||||
| 1992 | setVisible(StayOnTopAction, true); | - | ||||||||||||||||||||||||
| 1993 | setVisible(MoveAction, moveEnabled); | - | ||||||||||||||||||||||||
| 1994 | setVisible(ResizeAction, resizeEnabled); | - | ||||||||||||||||||||||||
| 1995 | - | |||||||||||||||||||||||||
| 1996 | // CloseAction | - | ||||||||||||||||||||||||
| 1997 | if (windowFlags & Qt::WindowSystemMenuHint) 
 | 0 | ||||||||||||||||||||||||
| 1998 | setVisible(CloseAction, true); never executed:  setVisible(CloseAction, true); | 0 | ||||||||||||||||||||||||
| 1999 | - | |||||||||||||||||||||||||
| 2000 | // RestoreAction | - | ||||||||||||||||||||||||
| 2001 | if (windowFlags & (Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint)) 
 | 0 | ||||||||||||||||||||||||
| 2002 | setVisible(RestoreAction, true); never executed:  setVisible(RestoreAction, true); | 0 | ||||||||||||||||||||||||
| 2003 | - | |||||||||||||||||||||||||
| 2004 | // MinimizeAction | - | ||||||||||||||||||||||||
| 2005 | if (windowFlags & Qt::WindowMinimizeButtonHint) 
 | 0 | ||||||||||||||||||||||||
| 2006 | setVisible(MinimizeAction, true); never executed:  setVisible(MinimizeAction, true); | 0 | ||||||||||||||||||||||||
| 2007 | - | |||||||||||||||||||||||||
| 2008 | // MaximizeAction | - | ||||||||||||||||||||||||
| 2009 | if (windowFlags & Qt::WindowMaximizeButtonHint) 
 | 0 | ||||||||||||||||||||||||
| 2010 | setVisible(MaximizeAction, true); never executed:  setVisible(MaximizeAction, true); | 0 | ||||||||||||||||||||||||
| 2011 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2012 | - | |||||||||||||||||||||||||
| 2013 | void QMdiSubWindowPrivate::setFocusWidget() | - | ||||||||||||||||||||||||
| 2014 | { | - | ||||||||||||||||||||||||
| 2015 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2016 | if (!baseWidget) { 
 | 0 | ||||||||||||||||||||||||
| 2017 | q->setFocus(); | - | ||||||||||||||||||||||||
| 2018 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2019 | } | - | ||||||||||||||||||||||||
| 2020 | - | |||||||||||||||||||||||||
| 2021 | // This will give focus to the next child if possible, otherwise | - | ||||||||||||||||||||||||
| 2022 | // do nothing, hence it's not possible to tab between windows with | - | ||||||||||||||||||||||||
| 2023 | // just hitting tab (unless Qt::TabFocus is removed from the focus policy). | - | ||||||||||||||||||||||||
| 2024 | if (focusInReason == Qt::TabFocusReason) { 
 | 0 | ||||||||||||||||||||||||
| 2025 | q->focusNextChild(); | - | ||||||||||||||||||||||||
| 2026 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2027 | } | - | ||||||||||||||||||||||||
| 2028 | - | |||||||||||||||||||||||||
| 2029 | // Same as above, but gives focus to the previous child. | - | ||||||||||||||||||||||||
| 2030 | if (focusInReason == Qt::BacktabFocusReason) { 
 | 0 | ||||||||||||||||||||||||
| 2031 | q->focusPreviousChild(); | - | ||||||||||||||||||||||||
| 2032 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2033 | } | - | ||||||||||||||||||||||||
| 2034 | - | |||||||||||||||||||||||||
| 2035 | if (!(q->windowState() & Qt::WindowMinimized) && restoreFocus()) 
 
 | 0 | ||||||||||||||||||||||||
| 2036 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2037 | - | |||||||||||||||||||||||||
| 2038 | if (QWidget *focusWidget = baseWidget->focusWidget()) { 
 | 0 | ||||||||||||||||||||||||
| 2039 | if (!focusWidget->hasFocus() && q->isAncestorOf(focusWidget) 
 
 | 0 | ||||||||||||||||||||||||
| 2040 | && focusWidget->isVisible() && !q->isMinimized() 
 
 | 0 | ||||||||||||||||||||||||
| 2041 | && focusWidget->focusPolicy() != Qt::NoFocus) { 
 | 0 | ||||||||||||||||||||||||
| 2042 | focusWidget->setFocus(); | - | ||||||||||||||||||||||||
| 2043 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2044 | q->setFocus(); | - | ||||||||||||||||||||||||
| 2045 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2046 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2047 | } | - | ||||||||||||||||||||||||
| 2048 | - | |||||||||||||||||||||||||
| 2049 | QWidget *focusWidget = q->nextInFocusChain(); | - | ||||||||||||||||||||||||
| 2050 | while (focusWidget && focusWidget != q && focusWidget->focusPolicy() == Qt::NoFocus) 
 
 
 | 0 | ||||||||||||||||||||||||
| 2051 | focusWidget = focusWidget->nextInFocusChain(); never executed:  focusWidget = focusWidget->nextInFocusChain(); | 0 | ||||||||||||||||||||||||
| 2052 | if (focusWidget && q->isAncestorOf(focusWidget)) 
 
 | 0 | ||||||||||||||||||||||||
| 2053 | focusWidget->setFocus(); never executed:  focusWidget->setFocus(); | 0 | ||||||||||||||||||||||||
| 2054 | else if (baseWidget->focusPolicy() != Qt::NoFocus) 
 | 0 | ||||||||||||||||||||||||
| 2055 | baseWidget->setFocus(); never executed:  baseWidget->setFocus(); | 0 | ||||||||||||||||||||||||
| 2056 | else if (!q->hasFocus()) 
 | 0 | ||||||||||||||||||||||||
| 2057 | q->setFocus(); never executed:  q->setFocus(); | 0 | ||||||||||||||||||||||||
| 2058 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2059 | - | |||||||||||||||||||||||||
| 2060 | bool QMdiSubWindowPrivate::restoreFocus() | - | ||||||||||||||||||||||||
| 2061 | { | - | ||||||||||||||||||||||||
| 2062 | if (restoreFocusWidget.isNull()) 
 | 0 | ||||||||||||||||||||||||
| 2063 | return false; never executed:  return false; | 0 | ||||||||||||||||||||||||
| 2064 | QWidget *candidate = restoreFocusWidget; | - | ||||||||||||||||||||||||
| 2065 | restoreFocusWidget.clear(); | - | ||||||||||||||||||||||||
| 2066 | if (!candidate->hasFocus() && q_func()->isAncestorOf(candidate) 
 
 | 0 | ||||||||||||||||||||||||
| 2067 | && candidate->isVisible() 
 | 0 | ||||||||||||||||||||||||
| 2068 | && candidate->focusPolicy() != Qt::NoFocus) { 
 | 0 | ||||||||||||||||||||||||
| 2069 | candidate->setFocus(); | - | ||||||||||||||||||||||||
| 2070 | return true; never executed:  return true; | 0 | ||||||||||||||||||||||||
| 2071 | } | - | ||||||||||||||||||||||||
| 2072 | return candidate->hasFocus(); never executed:  return candidate->hasFocus(); | 0 | ||||||||||||||||||||||||
| 2073 | } | - | ||||||||||||||||||||||||
| 2074 | - | |||||||||||||||||||||||||
| 2075 | /*! | - | ||||||||||||||||||||||||
| 2076 | \internal | - | ||||||||||||||||||||||||
| 2077 | */ | - | ||||||||||||||||||||||||
| 2078 | void QMdiSubWindowPrivate::setWindowFlags(Qt::WindowFlags windowFlags) | - | ||||||||||||||||||||||||
| 2079 | { | - | ||||||||||||||||||||||||
| 2080 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2081 | - | |||||||||||||||||||||||||
| 2082 | if (!parent) { 
 | 0 | ||||||||||||||||||||||||
| 2083 | QWidgetPrivate::setWindowFlags(windowFlags); | - | ||||||||||||||||||||||||
| 2084 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2085 | } | - | ||||||||||||||||||||||||
| 2086 | - | |||||||||||||||||||||||||
| 2087 | Qt::WindowFlags windowType = windowFlags & Qt::WindowType_Mask; | - | ||||||||||||||||||||||||
| 2088 | if (windowType == Qt::Dialog || windowFlags & Qt::MSWindowsFixedSizeDialogHint) 
 
 | 0 | ||||||||||||||||||||||||
| 2089 | windowFlags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint; never executed:  windowFlags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint; | 0 | ||||||||||||||||||||||||
| 2090 | - | |||||||||||||||||||||||||
| 2091 | // Set standard flags if none of the customize flags are set | - | ||||||||||||||||||||||||
| 2092 | if (!(windowFlags & CustomizeWindowFlags)) 
 | 0 | ||||||||||||||||||||||||
| 2093 | windowFlags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint; never executed:  windowFlags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint; | 0 | ||||||||||||||||||||||||
| 2094 | else if (windowFlags & Qt::FramelessWindowHint && windowFlags & Qt::WindowStaysOnTopHint) 
 
 | 0 | ||||||||||||||||||||||||
| 2095 | windowFlags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint; never executed:  windowFlags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint; | 0 | ||||||||||||||||||||||||
| 2096 | else if (windowFlags & Qt::FramelessWindowHint) 
 | 0 | ||||||||||||||||||||||||
| 2097 | windowFlags = Qt::FramelessWindowHint; never executed:  windowFlags = Qt::FramelessWindowHint; | 0 | ||||||||||||||||||||||||
| 2098 | - | |||||||||||||||||||||||||
| 2099 | windowFlags &= ~windowType; | - | ||||||||||||||||||||||||
| 2100 | windowFlags &= ~Qt::WindowFullscreenButtonHint; | - | ||||||||||||||||||||||||
| 2101 | windowFlags |= Qt::SubWindow; | - | ||||||||||||||||||||||||
| 2102 | - | |||||||||||||||||||||||||
| 2103 | #ifndef QT_NO_ACTION | - | ||||||||||||||||||||||||
| 2104 | if (QAction *stayOnTopAction = actions[QMdiSubWindowPrivate::StayOnTopAction]) { 
 | 0 | ||||||||||||||||||||||||
| 2105 | if (windowFlags & Qt::WindowStaysOnTopHint) 
 | 0 | ||||||||||||||||||||||||
| 2106 | stayOnTopAction->setChecked(true); never executed:  stayOnTopAction->setChecked(true); | 0 | ||||||||||||||||||||||||
| 2107 | else | - | ||||||||||||||||||||||||
| 2108 | stayOnTopAction->setChecked(false); never executed:  stayOnTopAction->setChecked(false); | 0 | ||||||||||||||||||||||||
| 2109 | } | - | ||||||||||||||||||||||||
| 2110 | #endif | - | ||||||||||||||||||||||||
| 2111 | - | |||||||||||||||||||||||||
| 2112 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 2113 | if ((windowFlags & Qt::FramelessWindowHint) && sizeGrip) 
 
 | 0 | ||||||||||||||||||||||||
| 2114 | delete sizeGrip; never executed:  delete sizeGrip; | 0 | ||||||||||||||||||||||||
| 2115 | #endif | - | ||||||||||||||||||||||||
| 2116 | - | |||||||||||||||||||||||||
| 2117 | QWidgetPrivate::setWindowFlags(windowFlags); | - | ||||||||||||||||||||||||
| 2118 | updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2119 | updateActions(); | - | ||||||||||||||||||||||||
| 2120 | QSize currentSize = q->size(); | - | ||||||||||||||||||||||||
| 2121 | if (q->isVisible() && (currentSize.width() < internalMinimumSize.width() 
 
 | 0 | ||||||||||||||||||||||||
| 2122 | || currentSize.height() < internalMinimumSize.height())) { 
 | 0 | ||||||||||||||||||||||||
| 2123 | q->resize(currentSize.expandedTo(internalMinimumSize)); | - | ||||||||||||||||||||||||
| 2124 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2125 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2126 | - | |||||||||||||||||||||||||
| 2127 | void QMdiSubWindowPrivate::setVisible(WindowStateAction action, bool visible) | - | ||||||||||||||||||||||||
| 2128 | { | - | ||||||||||||||||||||||||
| 2129 | #ifndef QT_NO_ACTION | - | ||||||||||||||||||||||||
| 2130 | if (actions[action]) 
 | 0 | ||||||||||||||||||||||||
| 2131 | actions[action]->setVisible(visible); never executed:  actions[action]->setVisible(visible); | 0 | ||||||||||||||||||||||||
| 2132 | #endif | - | ||||||||||||||||||||||||
| 2133 | - | |||||||||||||||||||||||||
| 2134 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2135 | if (!controlContainer) 
 | 0 | ||||||||||||||||||||||||
| 2136 | controlContainer = new ControlContainer(q); never executed:  controlContainer = new ControlContainer(q); | 0 | ||||||||||||||||||||||||
| 2137 | - | |||||||||||||||||||||||||
| 2138 | if (ControllerWidget *ctrlWidget = qobject_cast<ControllerWidget *> 
 | 0 | ||||||||||||||||||||||||
| 2139 | (controlContainer->controllerWidget())) { 
 | 0 | ||||||||||||||||||||||||
| 2140 | ctrlWidget->setControlVisible(action, visible); | - | ||||||||||||||||||||||||
| 2141 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2142 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2143 | - | |||||||||||||||||||||||||
| 2144 | #ifndef QT_NO_ACTION | - | ||||||||||||||||||||||||
| 2145 | void QMdiSubWindowPrivate::setEnabled(WindowStateAction action, bool enable) | - | ||||||||||||||||||||||||
| 2146 | { | - | ||||||||||||||||||||||||
| 2147 | if (actions[action]) 
 | 0 | ||||||||||||||||||||||||
| 2148 | actions[action]->setEnabled(enable); never executed:  actions[action]->setEnabled(enable); | 0 | ||||||||||||||||||||||||
| 2149 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2150 | - | |||||||||||||||||||||||||
| 2151 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 2152 | void QMdiSubWindowPrivate::addToSystemMenu(WindowStateAction action, const QString &text, | - | ||||||||||||||||||||||||
| 2153 | const char *slot) | - | ||||||||||||||||||||||||
| 2154 | { | - | ||||||||||||||||||||||||
| 2155 | if (!systemMenu) 
 | 0 | ||||||||||||||||||||||||
| 2156 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2157 | actions[action] = systemMenu->addAction(text, q_func(), slot); | - | ||||||||||||||||||||||||
| 2158 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2159 | #endif | - | ||||||||||||||||||||||||
| 2160 | #endif // QT_NO_ACTION | - | ||||||||||||||||||||||||
| 2161 | - | |||||||||||||||||||||||||
| 2162 | /*! | - | ||||||||||||||||||||||||
| 2163 | \internal | - | ||||||||||||||||||||||||
| 2164 | */ | - | ||||||||||||||||||||||||
| 2165 | QSize QMdiSubWindowPrivate::iconSize() const | - | ||||||||||||||||||||||||
| 2166 | { | - | ||||||||||||||||||||||||
| 2167 | Q_Q(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2168 | if (!parent || q->windowFlags() & Qt::FramelessWindowHint) 
 
 | 0 | ||||||||||||||||||||||||
| 2169 | return QSize(-1, -1); never executed:  return QSize(-1, -1); | 0 | ||||||||||||||||||||||||
| 2170 | 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 | ||||||||||||||||||||||||
| 2171 | } | - | ||||||||||||||||||||||||
| 2172 | - | |||||||||||||||||||||||||
| 2173 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 2174 | - | |||||||||||||||||||||||||
| 2175 | /*! | - | ||||||||||||||||||||||||
| 2176 | \internal | - | ||||||||||||||||||||||||
| 2177 | */ | - | ||||||||||||||||||||||||
| 2178 | void QMdiSubWindowPrivate::setSizeGrip(QSizeGrip *newSizeGrip) | - | ||||||||||||||||||||||||
| 2179 | { | - | ||||||||||||||||||||||||
| 2180 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2181 | if (!newSizeGrip || sizeGrip || q->windowFlags() & Qt::FramelessWindowHint) 
 
 
 | 0 | ||||||||||||||||||||||||
| 2182 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2183 | - | |||||||||||||||||||||||||
| 2184 | if (layout && layout->indexOf(newSizeGrip) != -1) 
 
 | 0 | ||||||||||||||||||||||||
| 2185 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2186 | newSizeGrip->setFixedSize(newSizeGrip->sizeHint()); | - | ||||||||||||||||||||||||
| 2187 | bool putSizeGripInLayout = layout ? true : false; 
 | 0 | ||||||||||||||||||||||||
| 2188 | #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 2189 | if (qobject_cast<QMacStyle *>(q->style())) | - | ||||||||||||||||||||||||
| 2190 | putSizeGripInLayout = false; | - | ||||||||||||||||||||||||
| 2191 | #endif | - | ||||||||||||||||||||||||
| 2192 | if (putSizeGripInLayout) { 
 | 0 | ||||||||||||||||||||||||
| 2193 | layout->addWidget(newSizeGrip); | - | ||||||||||||||||||||||||
| 2194 | layout->setAlignment(newSizeGrip, Qt::AlignBottom | Qt::AlignRight); | - | ||||||||||||||||||||||||
| 2195 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2196 | newSizeGrip->setParent(q); | - | ||||||||||||||||||||||||
| 2197 | newSizeGrip->move(q->isLeftToRight() ? q->width() - newSizeGrip->width() : 0, | - | ||||||||||||||||||||||||
| 2198 | q->height() - newSizeGrip->height()); | - | ||||||||||||||||||||||||
| 2199 | sizeGrip = newSizeGrip; | - | ||||||||||||||||||||||||
| 2200 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2201 | newSizeGrip->raise(); | - | ||||||||||||||||||||||||
| 2202 | updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2203 | newSizeGrip->installEventFilter(q); | - | ||||||||||||||||||||||||
| 2204 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2205 | - | |||||||||||||||||||||||||
| 2206 | /*! | - | ||||||||||||||||||||||||
| 2207 | \internal | - | ||||||||||||||||||||||||
| 2208 | */ | - | ||||||||||||||||||||||||
| 2209 | void QMdiSubWindowPrivate::setSizeGripVisible(bool visible) const | - | ||||||||||||||||||||||||
| 2210 | { | - | ||||||||||||||||||||||||
| 2211 | // See if we can find any size grips | - | ||||||||||||||||||||||||
| 2212 | const QList<QSizeGrip *> sizeGrips = q_func()->findChildren<QSizeGrip *>(); | - | ||||||||||||||||||||||||
| 2213 | for (QSizeGrip *grip : sizeGrips) | - | ||||||||||||||||||||||||
| 2214 | grip->setVisible(visible); never executed:  grip->setVisible(visible); | 0 | ||||||||||||||||||||||||
| 2215 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2216 | - | |||||||||||||||||||||||||
| 2217 | #endif // QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 2218 | - | |||||||||||||||||||||||||
| 2219 | /*! | - | ||||||||||||||||||||||||
| 2220 | \internal | - | ||||||||||||||||||||||||
| 2221 | */ | - | ||||||||||||||||||||||||
| 2222 | void QMdiSubWindowPrivate::updateInternalWindowTitle() | - | ||||||||||||||||||||||||
| 2223 | { | - | ||||||||||||||||||||||||
| 2224 | Q_Q(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2225 | if (q->isWindowModified()) { 
 | 0 | ||||||||||||||||||||||||
| 2226 | windowTitle = q->windowTitle(); | - | ||||||||||||||||||||||||
| 2227 | windowTitle.replace(QLatin1String("[*]"), QLatin1String("*")); | - | ||||||||||||||||||||||||
| 2228 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2229 | windowTitle = qt_setWindowTitle_helperHelper(q->windowTitle(), q); | - | ||||||||||||||||||||||||
| 2230 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2231 | q->update(0, 0, q->width(), titleBarHeight()); | - | ||||||||||||||||||||||||
| 2232 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2233 | - | |||||||||||||||||||||||||
| 2234 | /*! | - | ||||||||||||||||||||||||
| 2235 | Constructs a new QMdiSubWindow widget. The \a parent and \a | - | ||||||||||||||||||||||||
| 2236 | flags arguments are passed to QWidget's constructor. | - | ||||||||||||||||||||||||
| 2237 | - | |||||||||||||||||||||||||
| 2238 | Instead of using addSubWindow(), it is also simply possible to | - | ||||||||||||||||||||||||
| 2239 | use setParent() when you add the subwindow to a QMdiArea. | - | ||||||||||||||||||||||||
| 2240 | - | |||||||||||||||||||||||||
| 2241 | Note that only \l{QMdiSubWindow}s can be set as children of | - | ||||||||||||||||||||||||
| 2242 | QMdiArea; you cannot, for instance, write: | - | ||||||||||||||||||||||||
| 2243 | - | |||||||||||||||||||||||||
| 2244 | \code | - | ||||||||||||||||||||||||
| 2245 | //bad code | - | ||||||||||||||||||||||||
| 2246 | QMdiArea mdiArea; | - | ||||||||||||||||||||||||
| 2247 | QTextEdit editor(&mdiArea); // invalid child widget | - | ||||||||||||||||||||||||
| 2248 | \endcode | - | ||||||||||||||||||||||||
| 2249 | - | |||||||||||||||||||||||||
| 2250 | \sa QMdiArea::addSubWindow() | - | ||||||||||||||||||||||||
| 2251 | */ | - | ||||||||||||||||||||||||
| 2252 | QMdiSubWindow::QMdiSubWindow(QWidget *parent, Qt::WindowFlags flags) | - | ||||||||||||||||||||||||
| 2253 | : QWidget(*new QMdiSubWindowPrivate, parent, 0) | - | ||||||||||||||||||||||||
| 2254 | { | - | ||||||||||||||||||||||||
| 2255 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2256 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 2257 | d->createSystemMenu(); | - | ||||||||||||||||||||||||
| 2258 | addActions(d->systemMenu->actions()); | - | ||||||||||||||||||||||||
| 2259 | #endif | - | ||||||||||||||||||||||||
| 2260 | d->setWindowFlags(flags); | - | ||||||||||||||||||||||||
| 2261 | setBackgroundRole(QPalette::Window); | - | ||||||||||||||||||||||||
| 2262 | setAutoFillBackground(true); | - | ||||||||||||||||||||||||
| 2263 | setMouseTracking(true); | - | ||||||||||||||||||||||||
| 2264 | setLayout(new QVBoxLayout); | - | ||||||||||||||||||||||||
| 2265 | setFocusPolicy(Qt::StrongFocus); | - | ||||||||||||||||||||||||
| 2266 | layout()->setMargin(0); | - | ||||||||||||||||||||||||
| 2267 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2268 | setAttribute(Qt::WA_Resized, false); | - | ||||||||||||||||||||||||
| 2269 | d->titleBarPalette = d->desktopPalette(); | - | ||||||||||||||||||||||||
| 2270 | d->font = QApplication::font("QMdiSubWindowTitleBar"); | - | ||||||||||||||||||||||||
| 2271 | // We don't want the menu icon by default on mac. | - | ||||||||||||||||||||||||
| 2272 | #ifndef Q_OS_MAC | - | ||||||||||||||||||||||||
| 2273 | if (windowIcon().isNull()) 
 | 0 | ||||||||||||||||||||||||
| 2274 | d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); never executed:  d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); | 0 | ||||||||||||||||||||||||
| 2275 | else | - | ||||||||||||||||||||||||
| 2276 | d->menuIcon = windowIcon(); never executed:  d->menuIcon = windowIcon(); | 0 | ||||||||||||||||||||||||
| 2277 | #endif | - | ||||||||||||||||||||||||
| 2278 | connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), | - | ||||||||||||||||||||||||
| 2279 | this, SLOT(_q_processFocusChanged(QWidget*,QWidget*))); | - | ||||||||||||||||||||||||
| 2280 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2281 | - | |||||||||||||||||||||||||
| 2282 | /*! | - | ||||||||||||||||||||||||
| 2283 | Destroys the subwindow. | - | ||||||||||||||||||||||||
| 2284 | - | |||||||||||||||||||||||||
| 2285 | \sa QMdiArea::removeSubWindow() | - | ||||||||||||||||||||||||
| 2286 | */ | - | ||||||||||||||||||||||||
| 2287 | QMdiSubWindow::~QMdiSubWindow() | - | ||||||||||||||||||||||||
| 2288 | { | - | ||||||||||||||||||||||||
| 2289 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2290 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 2291 | d->removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 2292 | #endif | - | ||||||||||||||||||||||||
| 2293 | d->setActive(false); | - | ||||||||||||||||||||||||
| 2294 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2295 | - | |||||||||||||||||||||||||
| 2296 | /*! | - | ||||||||||||||||||||||||
| 2297 | Sets \a widget as the internal widget of this subwindow. The | - | ||||||||||||||||||||||||
| 2298 | internal widget is displayed in the center of the subwindow | - | ||||||||||||||||||||||||
| 2299 | beneath the title bar. | - | ||||||||||||||||||||||||
| 2300 | - | |||||||||||||||||||||||||
| 2301 | QMdiSubWindow takes temporary ownership of \a widget; you do | - | ||||||||||||||||||||||||
| 2302 | not have to delete it. Any existing internal widget will be | - | ||||||||||||||||||||||||
| 2303 | removed and reparented to the root window. | - | ||||||||||||||||||||||||
| 2304 | - | |||||||||||||||||||||||||
| 2305 | \sa widget() | - | ||||||||||||||||||||||||
| 2306 | */ | - | ||||||||||||||||||||||||
| 2307 | void QMdiSubWindow::setWidget(QWidget *widget) | - | ||||||||||||||||||||||||
| 2308 | { | - | ||||||||||||||||||||||||
| 2309 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2310 | if (!widget) { 
 | 0 | ||||||||||||||||||||||||
| 2311 | d->removeBaseWidget(); | - | ||||||||||||||||||||||||
| 2312 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2313 | } | - | ||||||||||||||||||||||||
| 2314 | - | |||||||||||||||||||||||||
| 2315 | if (Q_UNLIKELY(widget == d->baseWidget)) { 
 | 0 | ||||||||||||||||||||||||
| 2316 | qWarning("QMdiSubWindow::setWidget: widget is already set"); | - | ||||||||||||||||||||||||
| 2317 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2318 | } | - | ||||||||||||||||||||||||
| 2319 | - | |||||||||||||||||||||||||
| 2320 | bool wasResized = testAttribute(Qt::WA_Resized); | - | ||||||||||||||||||||||||
| 2321 | d->removeBaseWidget(); | - | ||||||||||||||||||||||||
| 2322 | - | |||||||||||||||||||||||||
| 2323 | if (QLayout *layout = this->layout()) 
 | 0 | ||||||||||||||||||||||||
| 2324 | layout->addWidget(widget); never executed:  layout->addWidget(widget); | 0 | ||||||||||||||||||||||||
| 2325 | else | - | ||||||||||||||||||||||||
| 2326 | widget->setParent(this); never executed:  widget->setParent(this); | 0 | ||||||||||||||||||||||||
| 2327 | - | |||||||||||||||||||||||||
| 2328 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 2329 | QSizeGrip *sizeGrip = widget->findChild<QSizeGrip *>(); | - | ||||||||||||||||||||||||
| 2330 | if (sizeGrip) 
 | 0 | ||||||||||||||||||||||||
| 2331 | sizeGrip->installEventFilter(this); never executed:  sizeGrip->installEventFilter(this); | 0 | ||||||||||||||||||||||||
| 2332 | if (d->sizeGrip) 
 | 0 | ||||||||||||||||||||||||
| 2333 | d->sizeGrip->raise(); never executed:  d->sizeGrip->raise(); | 0 | ||||||||||||||||||||||||
| 2334 | #endif | - | ||||||||||||||||||||||||
| 2335 | - | |||||||||||||||||||||||||
| 2336 | d->baseWidget = widget; | - | ||||||||||||||||||||||||
| 2337 | d->baseWidget->installEventFilter(this); | - | ||||||||||||||||||||||||
| 2338 | - | |||||||||||||||||||||||||
| 2339 | d->ignoreWindowTitleChange = true; | - | ||||||||||||||||||||||||
| 2340 | bool isWindowModified = this->isWindowModified(); | - | ||||||||||||||||||||||||
| 2341 | if (windowTitle().isEmpty()) { 
 | 0 | ||||||||||||||||||||||||
| 2342 | d->updateWindowTitle(true); | - | ||||||||||||||||||||||||
| 2343 | isWindowModified = d->baseWidget->isWindowModified(); | - | ||||||||||||||||||||||||
| 2344 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2345 | if (!this->isWindowModified() && isWindowModified 
 
 | 0 | ||||||||||||||||||||||||
| 2346 | && windowTitle().contains(QLatin1String("[*]"))) { 
 | 0 | ||||||||||||||||||||||||
| 2347 | setWindowModified(isWindowModified); | - | ||||||||||||||||||||||||
| 2348 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2349 | d->lastChildWindowTitle = d->baseWidget->windowTitle(); | - | ||||||||||||||||||||||||
| 2350 | d->ignoreWindowTitleChange = false; | - | ||||||||||||||||||||||||
| 2351 | - | |||||||||||||||||||||||||
| 2352 | if (windowIcon().isNull() && !d->baseWidget->windowIcon().isNull()) 
 
 | 0 | ||||||||||||||||||||||||
| 2353 | setWindowIcon(d->baseWidget->windowIcon()); never executed:  setWindowIcon(d->baseWidget->windowIcon()); | 0 | ||||||||||||||||||||||||
| 2354 | - | |||||||||||||||||||||||||
| 2355 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2356 | if (!wasResized && testAttribute(Qt::WA_Resized)) 
 
 | 0 | ||||||||||||||||||||||||
| 2357 | setAttribute(Qt::WA_Resized, false); never executed:  setAttribute(Qt::WA_Resized, false); | 0 | ||||||||||||||||||||||||
| 2358 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2359 | - | |||||||||||||||||||||||||
| 2360 | /*! | - | ||||||||||||||||||||||||
| 2361 | Returns the current internal widget. | - | ||||||||||||||||||||||||
| 2362 | - | |||||||||||||||||||||||||
| 2363 | \sa setWidget() | - | ||||||||||||||||||||||||
| 2364 | */ | - | ||||||||||||||||||||||||
| 2365 | QWidget *QMdiSubWindow::widget() const | - | ||||||||||||||||||||||||
| 2366 | { | - | ||||||||||||||||||||||||
| 2367 | return d_func()->baseWidget; never executed:  return d_func()->baseWidget; | 0 | ||||||||||||||||||||||||
| 2368 | } | - | ||||||||||||||||||||||||
| 2369 | - | |||||||||||||||||||||||||
| 2370 | - | |||||||||||||||||||||||||
| 2371 | /*! | - | ||||||||||||||||||||||||
| 2372 | \internal | - | ||||||||||||||||||||||||
| 2373 | */ | - | ||||||||||||||||||||||||
| 2374 | QWidget *QMdiSubWindow::maximizedButtonsWidget() const | - | ||||||||||||||||||||||||
| 2375 | { | - | ||||||||||||||||||||||||
| 2376 | Q_D(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2377 | if (isVisible() && d->controlContainer && isMaximized() && !d->drawTitleBarWhenMaximized() 
 
 
 
 | 0 | ||||||||||||||||||||||||
| 2378 | && !isChildOfTabbedQMdiArea(this)) { 
 | 0 | ||||||||||||||||||||||||
| 2379 | return d->controlContainer->controllerWidget(); never executed:  return d->controlContainer->controllerWidget(); | 0 | ||||||||||||||||||||||||
| 2380 | } | - | ||||||||||||||||||||||||
| 2381 | return 0; never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 2382 | } | - | ||||||||||||||||||||||||
| 2383 | - | |||||||||||||||||||||||||
| 2384 | /*! | - | ||||||||||||||||||||||||
| 2385 | \internal | - | ||||||||||||||||||||||||
| 2386 | */ | - | ||||||||||||||||||||||||
| 2387 | QWidget *QMdiSubWindow::maximizedSystemMenuIconWidget() const | - | ||||||||||||||||||||||||
| 2388 | { | - | ||||||||||||||||||||||||
| 2389 | Q_D(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2390 | if (isVisible() && d->controlContainer && isMaximized() && !d->drawTitleBarWhenMaximized() 
 
 
 
 | 0 | ||||||||||||||||||||||||
| 2391 | && !isChildOfTabbedQMdiArea(this)) { 
 | 0 | ||||||||||||||||||||||||
| 2392 | return d->controlContainer->systemMenuLabel(); never executed:  return d->controlContainer->systemMenuLabel(); | 0 | ||||||||||||||||||||||||
| 2393 | } | - | ||||||||||||||||||||||||
| 2394 | return 0; never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 2395 | } | - | ||||||||||||||||||||||||
| 2396 | - | |||||||||||||||||||||||||
| 2397 | /*! | - | ||||||||||||||||||||||||
| 2398 | Returns \c true if this window is shaded; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2399 | - | |||||||||||||||||||||||||
| 2400 | A window is shaded if it is collapsed so that only the title bar is | - | ||||||||||||||||||||||||
| 2401 | visible. | - | ||||||||||||||||||||||||
| 2402 | */ | - | ||||||||||||||||||||||||
| 2403 | bool QMdiSubWindow::isShaded() const | - | ||||||||||||||||||||||||
| 2404 | { | - | ||||||||||||||||||||||||
| 2405 | return d_func()->isShadeMode; never executed:  return d_func()->isShadeMode; | 0 | ||||||||||||||||||||||||
| 2406 | } | - | ||||||||||||||||||||||||
| 2407 | - | |||||||||||||||||||||||||
| 2408 | /*! | - | ||||||||||||||||||||||||
| 2409 | If \a on is true, \a option is enabled on the subwindow; otherwise it is | - | ||||||||||||||||||||||||
| 2410 | disabled. See SubWindowOption for the effect of each option. | - | ||||||||||||||||||||||||
| 2411 | - | |||||||||||||||||||||||||
| 2412 | \sa SubWindowOption, testOption() | - | ||||||||||||||||||||||||
| 2413 | */ | - | ||||||||||||||||||||||||
| 2414 | void QMdiSubWindow::setOption(SubWindowOption option, bool on) | - | ||||||||||||||||||||||||
| 2415 | { | - | ||||||||||||||||||||||||
| 2416 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2417 | d->options.setFlag(option, on); | - | ||||||||||||||||||||||||
| 2418 | - | |||||||||||||||||||||||||
| 2419 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 2420 | if ((option & (RubberBandResize | RubberBandMove)) && !on && d->isInRubberBandMode) 
 
 
 | 0 | ||||||||||||||||||||||||
| 2421 | d->leaveRubberBandMode(); never executed:  d->leaveRubberBandMode(); | 0 | ||||||||||||||||||||||||
| 2422 | #endif | - | ||||||||||||||||||||||||
| 2423 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2424 | - | |||||||||||||||||||||||||
| 2425 | /*! | - | ||||||||||||||||||||||||
| 2426 | Returns \c true if \a option is enabled; otherwise returns \c false. | - | ||||||||||||||||||||||||
| 2427 | - | |||||||||||||||||||||||||
| 2428 | \sa SubWindowOption, setOption() | - | ||||||||||||||||||||||||
| 2429 | */ | - | ||||||||||||||||||||||||
| 2430 | bool QMdiSubWindow::testOption(SubWindowOption option) const | - | ||||||||||||||||||||||||
| 2431 | { | - | ||||||||||||||||||||||||
| 2432 | return d_func()->options & option; never executed:  return d_func()->options & option; | 0 | ||||||||||||||||||||||||
| 2433 | } | - | ||||||||||||||||||||||||
| 2434 | - | |||||||||||||||||||||||||
| 2435 | /*! | - | ||||||||||||||||||||||||
| 2436 | \property QMdiSubWindow::keyboardSingleStep | - | ||||||||||||||||||||||||
| 2437 | \brief sets how far a widget should move or resize when using the | - | ||||||||||||||||||||||||
| 2438 | keyboard arrow keys. | - | ||||||||||||||||||||||||
| 2439 | - | |||||||||||||||||||||||||
| 2440 | When in keyboard-interactive mode, you can use the arrow and page keys to | - | ||||||||||||||||||||||||
| 2441 | either move or resize the window. This property controls the arrow keys. | - | ||||||||||||||||||||||||
| 2442 | The common way to enter keyboard interactive mode is to enter the | - | ||||||||||||||||||||||||
| 2443 | subwindow menu, and select either "resize" or "move". | - | ||||||||||||||||||||||||
| 2444 | - | |||||||||||||||||||||||||
| 2445 | The default keyboard single step value is 5 pixels. | - | ||||||||||||||||||||||||
| 2446 | - | |||||||||||||||||||||||||
| 2447 | \sa keyboardPageStep | - | ||||||||||||||||||||||||
| 2448 | */ | - | ||||||||||||||||||||||||
| 2449 | int QMdiSubWindow::keyboardSingleStep() const | - | ||||||||||||||||||||||||
| 2450 | { | - | ||||||||||||||||||||||||
| 2451 | return d_func()->keyboardSingleStep; never executed:  return d_func()->keyboardSingleStep; | 0 | ||||||||||||||||||||||||
| 2452 | } | - | ||||||||||||||||||||||||
| 2453 | - | |||||||||||||||||||||||||
| 2454 | void QMdiSubWindow::setKeyboardSingleStep(int step) | - | ||||||||||||||||||||||||
| 2455 | { | - | ||||||||||||||||||||||||
| 2456 | // Haven't done any boundary check here since negative step only | - | ||||||||||||||||||||||||
| 2457 | // means inverted behavior, which is OK if the user want it. | - | ||||||||||||||||||||||||
| 2458 | // A step equal to zero means "do nothing". | - | ||||||||||||||||||||||||
| 2459 | d_func()->keyboardSingleStep = step; | - | ||||||||||||||||||||||||
| 2460 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2461 | - | |||||||||||||||||||||||||
| 2462 | /*! | - | ||||||||||||||||||||||||
| 2463 | \property QMdiSubWindow::keyboardPageStep | - | ||||||||||||||||||||||||
| 2464 | \brief sets how far a widget should move or resize when using the | - | ||||||||||||||||||||||||
| 2465 | keyboard page keys. | - | ||||||||||||||||||||||||
| 2466 | - | |||||||||||||||||||||||||
| 2467 | When in keyboard-interactive mode, you can use the arrow and page keys to | - | ||||||||||||||||||||||||
| 2468 | either move or resize the window. This property controls the page | - | ||||||||||||||||||||||||
| 2469 | keys. The common way to enter keyboard interactive mode is to enter the | - | ||||||||||||||||||||||||
| 2470 | subwindow menu, and select either "resize" or "move". | - | ||||||||||||||||||||||||
| 2471 | - | |||||||||||||||||||||||||
| 2472 | The default keyboard page step value is 20 pixels. | - | ||||||||||||||||||||||||
| 2473 | - | |||||||||||||||||||||||||
| 2474 | \sa keyboardSingleStep | - | ||||||||||||||||||||||||
| 2475 | */ | - | ||||||||||||||||||||||||
| 2476 | int QMdiSubWindow::keyboardPageStep() const | - | ||||||||||||||||||||||||
| 2477 | { | - | ||||||||||||||||||||||||
| 2478 | return d_func()->keyboardPageStep; never executed:  return d_func()->keyboardPageStep; | 0 | ||||||||||||||||||||||||
| 2479 | } | - | ||||||||||||||||||||||||
| 2480 | - | |||||||||||||||||||||||||
| 2481 | void QMdiSubWindow::setKeyboardPageStep(int step) | - | ||||||||||||||||||||||||
| 2482 | { | - | ||||||||||||||||||||||||
| 2483 | // Haven't done any boundary check here since negative step only | - | ||||||||||||||||||||||||
| 2484 | // means inverted behavior, which is OK if the user want it. | - | ||||||||||||||||||||||||
| 2485 | // A step equal to zero means "do nothing". | - | ||||||||||||||||||||||||
| 2486 | d_func()->keyboardPageStep = step; | - | ||||||||||||||||||||||||
| 2487 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2488 | - | |||||||||||||||||||||||||
| 2489 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 2490 | /*! | - | ||||||||||||||||||||||||
| 2491 | Sets \a systemMenu as the current system menu for this subwindow. | - | ||||||||||||||||||||||||
| 2492 | - | |||||||||||||||||||||||||
| 2493 | By default, each QMdiSubWindow has a standard system menu. | - | ||||||||||||||||||||||||
| 2494 | - | |||||||||||||||||||||||||
| 2495 | QActions for the system menu created by QMdiSubWindow will | - | ||||||||||||||||||||||||
| 2496 | automatically be updated depending on the current window state; | - | ||||||||||||||||||||||||
| 2497 | e.g., the minimize action will be disabled after the window is | - | ||||||||||||||||||||||||
| 2498 | minimized. | - | ||||||||||||||||||||||||
| 2499 | - | |||||||||||||||||||||||||
| 2500 | QActions added by the user are not updated by QMdiSubWindow. | - | ||||||||||||||||||||||||
| 2501 | - | |||||||||||||||||||||||||
| 2502 | QMdiSubWindow takes ownership of \a systemMenu; you do not have to | - | ||||||||||||||||||||||||
| 2503 | delete it. Any existing menus will be deleted. | - | ||||||||||||||||||||||||
| 2504 | - | |||||||||||||||||||||||||
| 2505 | \sa systemMenu(), showSystemMenu() | - | ||||||||||||||||||||||||
| 2506 | */ | - | ||||||||||||||||||||||||
| 2507 | void QMdiSubWindow::setSystemMenu(QMenu *systemMenu) | - | ||||||||||||||||||||||||
| 2508 | { | - | ||||||||||||||||||||||||
| 2509 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2510 | if (Q_UNLIKELY(systemMenu && systemMenu == d->systemMenu)) { 
 | 0 | ||||||||||||||||||||||||
| 2511 | qWarning("QMdiSubWindow::setSystemMenu: system menu is already set"); | - | ||||||||||||||||||||||||
| 2512 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2513 | } | - | ||||||||||||||||||||||||
| 2514 | - | |||||||||||||||||||||||||
| 2515 | if (d->systemMenu) { 
 | 0 | ||||||||||||||||||||||||
| 2516 | delete d->systemMenu; | - | ||||||||||||||||||||||||
| 2517 | d->systemMenu = 0; | - | ||||||||||||||||||||||||
| 2518 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2519 | - | |||||||||||||||||||||||||
| 2520 | if (!systemMenu) 
 | 0 | ||||||||||||||||||||||||
| 2521 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2522 | - | |||||||||||||||||||||||||
| 2523 | if (systemMenu->parent() != this) 
 | 0 | ||||||||||||||||||||||||
| 2524 | systemMenu->setParent(this); never executed:  systemMenu->setParent(this); | 0 | ||||||||||||||||||||||||
| 2525 | d->systemMenu = systemMenu; | - | ||||||||||||||||||||||||
| 2526 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2527 | - | |||||||||||||||||||||||||
| 2528 | /*! | - | ||||||||||||||||||||||||
| 2529 | Returns a pointer to the current system menu, or zero if no system | - | ||||||||||||||||||||||||
| 2530 | menu is set. QMdiSubWindow provides a default system menu, but you can | - | ||||||||||||||||||||||||
| 2531 | also set the menu with setSystemMenu(). | - | ||||||||||||||||||||||||
| 2532 | - | |||||||||||||||||||||||||
| 2533 | \sa setSystemMenu(), showSystemMenu() | - | ||||||||||||||||||||||||
| 2534 | */ | - | ||||||||||||||||||||||||
| 2535 | QMenu *QMdiSubWindow::systemMenu() const | - | ||||||||||||||||||||||||
| 2536 | { | - | ||||||||||||||||||||||||
| 2537 | return d_func()->systemMenu; never executed:  return d_func()->systemMenu; | 0 | ||||||||||||||||||||||||
| 2538 | } | - | ||||||||||||||||||||||||
| 2539 | - | |||||||||||||||||||||||||
| 2540 | /*! | - | ||||||||||||||||||||||||
| 2541 | Shows the system menu below the system menu icon in the title bar. | - | ||||||||||||||||||||||||
| 2542 | - | |||||||||||||||||||||||||
| 2543 | \sa setSystemMenu(), systemMenu() | - | ||||||||||||||||||||||||
| 2544 | */ | - | ||||||||||||||||||||||||
| 2545 | void QMdiSubWindow::showSystemMenu() | - | ||||||||||||||||||||||||
| 2546 | { | - | ||||||||||||||||||||||||
| 2547 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2548 | if (!d->systemMenu) 
 | 0 | ||||||||||||||||||||||||
| 2549 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2550 | - | |||||||||||||||||||||||||
| 2551 | QPoint globalPopupPos; | - | ||||||||||||||||||||||||
| 2552 | if (QWidget *icon = maximizedSystemMenuIconWidget()) { 
 | 0 | ||||||||||||||||||||||||
| 2553 | if (isLeftToRight()) 
 | 0 | ||||||||||||||||||||||||
| 2554 | globalPopupPos = icon->mapToGlobal(QPoint(0, icon->y() + icon->height())); never executed:  globalPopupPos = icon->mapToGlobal(QPoint(0, icon->y() + icon->height())); | 0 | ||||||||||||||||||||||||
| 2555 | else | - | ||||||||||||||||||||||||
| 2556 | globalPopupPos = icon->mapToGlobal(QPoint(icon->width(), icon->y() + icon->height())); never executed:  globalPopupPos = icon->mapToGlobal(QPoint(icon->width(), icon->y() + icon->height())); | 0 | ||||||||||||||||||||||||
| 2557 | } else { | - | ||||||||||||||||||||||||
| 2558 | if (isLeftToRight()) 
 | 0 | ||||||||||||||||||||||||
| 2559 | globalPopupPos = mapToGlobal(contentsRect().topLeft()); never executed:  globalPopupPos = mapToGlobal(contentsRect().topLeft()); | 0 | ||||||||||||||||||||||||
| 2560 | else // + QPoint(1, 0) because topRight() == QPoint(left() + width() -1, top()) | - | ||||||||||||||||||||||||
| 2561 | globalPopupPos = mapToGlobal(contentsRect().topRight()) + QPoint(1, 0); never executed:  globalPopupPos = mapToGlobal(contentsRect().topRight()) + QPoint(1, 0); | 0 | ||||||||||||||||||||||||
| 2562 | } | - | ||||||||||||||||||||||||
| 2563 | - | |||||||||||||||||||||||||
| 2564 | // Adjust x() with -menuwidth in reverse mode. | - | ||||||||||||||||||||||||
| 2565 | if (isRightToLeft()) 
 | 0 | ||||||||||||||||||||||||
| 2566 | globalPopupPos -= QPoint(d->systemMenu->sizeHint().width(), 0); never executed:  globalPopupPos -= QPoint(d->systemMenu->sizeHint().width(), 0); | 0 | ||||||||||||||||||||||||
| 2567 | d->systemMenu->popup(globalPopupPos); | - | ||||||||||||||||||||||||
| 2568 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2569 | #endif // QT_NO_MENU | - | ||||||||||||||||||||||||
| 2570 | - | |||||||||||||||||||||||||
| 2571 | /*! | - | ||||||||||||||||||||||||
| 2572 | \since 4.4 | - | ||||||||||||||||||||||||
| 2573 | - | |||||||||||||||||||||||||
| 2574 | Returns the area containing this sub-window, or 0 if there is none. | - | ||||||||||||||||||||||||
| 2575 | - | |||||||||||||||||||||||||
| 2576 | \sa QMdiArea::addSubWindow() | - | ||||||||||||||||||||||||
| 2577 | */ | - | ||||||||||||||||||||||||
| 2578 | QMdiArea *QMdiSubWindow::mdiArea() const | - | ||||||||||||||||||||||||
| 2579 | { | - | ||||||||||||||||||||||||
| 2580 | QWidget *parent = parentWidget(); | - | ||||||||||||||||||||||||
| 2581 | while (parent) { 
 | 0 | ||||||||||||||||||||||||
| 2582 | if (QMdiArea *area = qobject_cast<QMdiArea *>(parent)) { 
 | 0 | ||||||||||||||||||||||||
| 2583 | if (area->viewport() == parentWidget()) 
 | 0 | ||||||||||||||||||||||||
| 2584 | return area; never executed:  return area; | 0 | ||||||||||||||||||||||||
| 2585 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2586 | parent = parent->parentWidget(); | - | ||||||||||||||||||||||||
| 2587 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2588 | return 0; never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 2589 | } | - | ||||||||||||||||||||||||
| 2590 | - | |||||||||||||||||||||||||
| 2591 | /*! | - | ||||||||||||||||||||||||
| 2592 | Calling this function makes the subwindow enter the shaded mode. | - | ||||||||||||||||||||||||
| 2593 | When the subwindow is shaded, only the title bar is visible. | - | ||||||||||||||||||||||||
| 2594 | - | |||||||||||||||||||||||||
| 2595 | Although shading is not supported by all styles, this function will | - | ||||||||||||||||||||||||
| 2596 | still show the subwindow as shaded, regardless of whether support | - | ||||||||||||||||||||||||
| 2597 | for shading is available. However, when used with styles without | - | ||||||||||||||||||||||||
| 2598 | shading support, the user will be unable to return from shaded mode | - | ||||||||||||||||||||||||
| 2599 | through the user interface (e.g., through a shade button in the title | - | ||||||||||||||||||||||||
| 2600 | bar). | - | ||||||||||||||||||||||||
| 2601 | - | |||||||||||||||||||||||||
| 2602 | \sa isShaded() | - | ||||||||||||||||||||||||
| 2603 | */ | - | ||||||||||||||||||||||||
| 2604 | void QMdiSubWindow::showShaded() | - | ||||||||||||||||||||||||
| 2605 | { | - | ||||||||||||||||||||||||
| 2606 | if (!parent()) 
 | 0 | ||||||||||||||||||||||||
| 2607 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2608 | - | |||||||||||||||||||||||||
| 2609 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2610 | // setMinimizeMode uses this function. | - | ||||||||||||||||||||||||
| 2611 | if (!d->isShadeRequestFromMinimizeMode && isShaded()) 
 
 | 0 | ||||||||||||||||||||||||
| 2612 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2613 | - | |||||||||||||||||||||||||
| 2614 | d->isMaximizeMode = false; | - | ||||||||||||||||||||||||
| 2615 | - | |||||||||||||||||||||||||
| 2616 | d->storeFocusWidget(); | - | ||||||||||||||||||||||||
| 2617 | - | |||||||||||||||||||||||||
| 2618 | if (!d->isShadeRequestFromMinimizeMode) { 
 | 0 | ||||||||||||||||||||||||
| 2619 | d->isShadeMode = true; | - | ||||||||||||||||||||||||
| 2620 | d->ensureWindowState(Qt::WindowMinimized); | - | ||||||||||||||||||||||||
| 2621 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2622 | - | |||||||||||||||||||||||||
| 2623 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 2624 | d->removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 2625 | #endif | - | ||||||||||||||||||||||||
| 2626 | - | |||||||||||||||||||||||||
| 2627 | // showMinimized() will reset Qt::WindowActive, which makes sense | - | ||||||||||||||||||||||||
| 2628 | // for top level widgets, but in MDI it makes sense to have an | - | ||||||||||||||||||||||||
| 2629 | // active window which is minimized. | - | ||||||||||||||||||||||||
| 2630 | if (hasFocus() || isAncestorOf(QApplication::focusWidget())) 
 
 | 0 | ||||||||||||||||||||||||
| 2631 | d->ensureWindowState(Qt::WindowActive); never executed:  d->ensureWindowState(Qt::WindowActive); | 0 | ||||||||||||||||||||||||
| 2632 | - | |||||||||||||||||||||||||
| 2633 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 2634 | d->setSizeGripVisible(false); | - | ||||||||||||||||||||||||
| 2635 | #endif | - | ||||||||||||||||||||||||
| 2636 | - | |||||||||||||||||||||||||
| 2637 | if (!d->restoreSize.isValid() || d->isShadeMode) { 
 
 | 0 | ||||||||||||||||||||||||
| 2638 | d->oldGeometry = geometry(); | - | ||||||||||||||||||||||||
| 2639 | d->restoreSize.setWidth(d->oldGeometry.width()); | - | ||||||||||||||||||||||||
| 2640 | d->restoreSize.setHeight(d->oldGeometry.height()); | - | ||||||||||||||||||||||||
| 2641 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2642 | - | |||||||||||||||||||||||||
| 2643 | // Hide the window before we change the geometry to avoid multiple resize | - | ||||||||||||||||||||||||
| 2644 | // events and wrong window state. | - | ||||||||||||||||||||||||
| 2645 | const bool wasVisible = isVisible(); | - | ||||||||||||||||||||||||
| 2646 | if (wasVisible) 
 | 0 | ||||||||||||||||||||||||
| 2647 | setVisible(false); never executed:  setVisible(false); | 0 | ||||||||||||||||||||||||
| 2648 | - | |||||||||||||||||||||||||
| 2649 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2650 | // Update minimum size to internalMinimumSize if set by user. | - | ||||||||||||||||||||||||
| 2651 | if (!minimumSize().isNull()) { 
 | 0 | ||||||||||||||||||||||||
| 2652 | d->userMinimumSize = minimumSize(); | - | ||||||||||||||||||||||||
| 2653 | setMinimumSize(d->internalMinimumSize); | - | ||||||||||||||||||||||||
| 2654 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2655 | resize(d->internalMinimumSize); | - | ||||||||||||||||||||||||
| 2656 | - | |||||||||||||||||||||||||
| 2657 | // Hide the internal widget if not already hidden by the user. | - | ||||||||||||||||||||||||
| 2658 | if (d->baseWidget && !d->baseWidget->isHidden() && !(windowFlags() & Qt::FramelessWindowHint)) { 
 
 
 | 0 | ||||||||||||||||||||||||
| 2659 | d->baseWidget->hide(); | - | ||||||||||||||||||||||||
| 2660 | d->isWidgetHiddenByUs = true; | - | ||||||||||||||||||||||||
| 2661 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2662 | - | |||||||||||||||||||||||||
| 2663 | if (wasVisible) 
 | 0 | ||||||||||||||||||||||||
| 2664 | setVisible(true); never executed:  setVisible(true); | 0 | ||||||||||||||||||||||||
| 2665 | - | |||||||||||||||||||||||||
| 2666 | d->setFocusWidget(); | - | ||||||||||||||||||||||||
| 2667 | d->resizeEnabled = false; | - | ||||||||||||||||||||||||
| 2668 | d->moveEnabled = true; | - | ||||||||||||||||||||||||
| 2669 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2670 | d->updateMask(); | - | ||||||||||||||||||||||||
| 2671 | - | |||||||||||||||||||||||||
| 2672 | #ifndef QT_NO_ACTION | - | ||||||||||||||||||||||||
| 2673 | d->setEnabled(QMdiSubWindowPrivate::MinimizeAction, false); | - | ||||||||||||||||||||||||
| 2674 | d->setEnabled(QMdiSubWindowPrivate::ResizeAction, d->resizeEnabled); | - | ||||||||||||||||||||||||
| 2675 | d->setEnabled(QMdiSubWindowPrivate::MaximizeAction, true); | - | ||||||||||||||||||||||||
| 2676 | d->setEnabled(QMdiSubWindowPrivate::RestoreAction, true); | - | ||||||||||||||||||||||||
| 2677 | d->setEnabled(QMdiSubWindowPrivate::MoveAction, d->moveEnabled); | - | ||||||||||||||||||||||||
| 2678 | #endif | - | ||||||||||||||||||||||||
| 2679 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2680 | - | |||||||||||||||||||||||||
| 2681 | /*! | - | ||||||||||||||||||||||||
| 2682 | \reimp | - | ||||||||||||||||||||||||
| 2683 | */ | - | ||||||||||||||||||||||||
| 2684 | bool QMdiSubWindow::eventFilter(QObject *object, QEvent *event) | - | ||||||||||||||||||||||||
| 2685 | { | - | ||||||||||||||||||||||||
| 2686 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2687 | if (!object) 
 | 0 | ||||||||||||||||||||||||
| 2688 | return QWidget::eventFilter(object, event); never executed:  return QWidget::eventFilter(object, event); | 0 | ||||||||||||||||||||||||
| 2689 | - | |||||||||||||||||||||||||
| 2690 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 2691 | // System menu events. | - | ||||||||||||||||||||||||
| 2692 | if (d->systemMenu && d->systemMenu == object) { 
 
 | 0 | ||||||||||||||||||||||||
| 2693 | if (event->type() == QEvent::MouseButtonDblClick) { 
 | 0 | ||||||||||||||||||||||||
| 2694 | const QMouseEvent *mouseEvent = static_cast<const QMouseEvent *>(event); | - | ||||||||||||||||||||||||
| 2695 | const QAction *action = d->systemMenu->actionAt(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 2696 | if (!action || action->isEnabled()) 
 
 | 0 | ||||||||||||||||||||||||
| 2697 | close(); never executed:  close(); | 0 | ||||||||||||||||||||||||
| 2698 | } else if (event->type() == QEvent::MouseMove) { never executed:  end of block
 | 0 | ||||||||||||||||||||||||
| 2699 | QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); | - | ||||||||||||||||||||||||
| 2700 | d->hoveredSubControl = d->getSubControl(mapFromGlobal(mouseEvent->globalPos())); | - | ||||||||||||||||||||||||
| 2701 | } else if (event->type() == QEvent::Hide) { never executed:  end of block
 | 0 | ||||||||||||||||||||||||
| 2702 | d->activeSubControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 2703 | update(QRegion(0, 0, width(), d->titleBarHeight())); | - | ||||||||||||||||||||||||
| 2704 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2705 | return QWidget::eventFilter(object, event); never executed:  return QWidget::eventFilter(object, event); | 0 | ||||||||||||||||||||||||
| 2706 | } | - | ||||||||||||||||||||||||
| 2707 | #endif | - | ||||||||||||||||||||||||
| 2708 | - | |||||||||||||||||||||||||
| 2709 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 2710 | if (object != d->baseWidget && parent() && qobject_cast<QSizeGrip *>(object)) { 
 
 
 | 0 | ||||||||||||||||||||||||
| 2711 | if (event->type() != QEvent::MouseButtonPress || !testOption(QMdiSubWindow::RubberBandResize)) 
 
 | 0 | ||||||||||||||||||||||||
| 2712 | return QWidget::eventFilter(object, event); never executed:  return QWidget::eventFilter(object, event); | 0 | ||||||||||||||||||||||||
| 2713 | const QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event); | - | ||||||||||||||||||||||||
| 2714 | d->mousePressPosition = parentWidget()->mapFromGlobal(mouseEvent->globalPos()); | - | ||||||||||||||||||||||||
| 2715 | d->oldGeometry = geometry(); | - | ||||||||||||||||||||||||
| 2716 | d->currentOperation = isLeftToRight() ? QMdiSubWindowPrivate::BottomRightResize 
 | 0 | ||||||||||||||||||||||||
| 2717 | : QMdiSubWindowPrivate::BottomLeftResize; | - | ||||||||||||||||||||||||
| 2718 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 2719 | d->enterRubberBandMode(); | - | ||||||||||||||||||||||||
| 2720 | #endif | - | ||||||||||||||||||||||||
| 2721 | return true; never executed:  return true; | 0 | ||||||||||||||||||||||||
| 2722 | } | - | ||||||||||||||||||||||||
| 2723 | #endif | - | ||||||||||||||||||||||||
| 2724 | - | |||||||||||||||||||||||||
| 2725 | if (object != d->baseWidget && event->type() != QEvent::WindowTitleChange) 
 
 | 0 | ||||||||||||||||||||||||
| 2726 | return QWidget::eventFilter(object, event); never executed:  return QWidget::eventFilter(object, event); | 0 | ||||||||||||||||||||||||
| 2727 | - | |||||||||||||||||||||||||
| 2728 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 2729 | case QEvent::Show: never executed:  case QEvent::Show: | 0 | ||||||||||||||||||||||||
| 2730 | d->setActive(true); | - | ||||||||||||||||||||||||
| 2731 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2732 | case QEvent::ShowToParent: never executed:  case QEvent::ShowToParent: | 0 | ||||||||||||||||||||||||
| 2733 | if (!d->isWidgetHiddenByUs) 
 | 0 | ||||||||||||||||||||||||
| 2734 | show(); never executed:  show(); | 0 | ||||||||||||||||||||||||
| 2735 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2736 | case QEvent::WindowStateChange: { never executed:  case QEvent::WindowStateChange: | 0 | ||||||||||||||||||||||||
| 2737 | QWindowStateChangeEvent *changeEvent = static_cast<QWindowStateChangeEvent*>(event); | - | ||||||||||||||||||||||||
| 2738 | if (changeEvent->isOverride()) 
 | 0 | ||||||||||||||||||||||||
| 2739 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2740 | Qt::WindowStates oldState = changeEvent->oldState(); | - | ||||||||||||||||||||||||
| 2741 | Qt::WindowStates newState = d->baseWidget->windowState(); | - | ||||||||||||||||||||||||
| 2742 | if (!(oldState & Qt::WindowMinimized) && (newState & Qt::WindowMinimized)) 
 
 | 0 | ||||||||||||||||||||||||
| 2743 | showMinimized(); never executed:  showMinimized(); | 0 | ||||||||||||||||||||||||
| 2744 | else if (!(oldState & Qt::WindowMaximized) && (newState & Qt::WindowMaximized)) 
 
 | 0 | ||||||||||||||||||||||||
| 2745 | showMaximized(); never executed:  showMaximized(); | 0 | ||||||||||||||||||||||||
| 2746 | else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen))) 
 | 0 | ||||||||||||||||||||||||
| 2747 | showNormal(); never executed:  showNormal(); | 0 | ||||||||||||||||||||||||
| 2748 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2749 | } | - | ||||||||||||||||||||||||
| 2750 | case QEvent::Enter: never executed:  case QEvent::Enter: | 0 | ||||||||||||||||||||||||
| 2751 | d->currentOperation = QMdiSubWindowPrivate::None; | - | ||||||||||||||||||||||||
| 2752 | d->updateCursor(); | - | ||||||||||||||||||||||||
| 2753 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2754 | case QEvent::LayoutRequest: never executed:  case QEvent::LayoutRequest: | 0 | ||||||||||||||||||||||||
| 2755 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2756 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2757 | case QEvent::WindowTitleChange: never executed:  case QEvent::WindowTitleChange: | 0 | ||||||||||||||||||||||||
| 2758 | if (d->ignoreWindowTitleChange) 
 | 0 | ||||||||||||||||||||||||
| 2759 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2760 | if (object == d->baseWidget) { 
 | 0 | ||||||||||||||||||||||||
| 2761 | d->updateWindowTitle(true); | - | ||||||||||||||||||||||||
| 2762 | d->lastChildWindowTitle = d->baseWidget->windowTitle(); | - | ||||||||||||||||||||||||
| 2763 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 2764 | } else if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar() never executed:  end of block
 
 
 | 0 | ||||||||||||||||||||||||
| 2765 | ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) { 
 | 0 | ||||||||||||||||||||||||
| 2766 | d->originalTitle = QString::null; | - | ||||||||||||||||||||||||
| 2767 | if (d->baseWidget && d->baseWidget->windowTitle() == windowTitle()) 
 
 | 0 | ||||||||||||||||||||||||
| 2768 | d->updateWindowTitle(true); never executed:  d->updateWindowTitle(true); | 0 | ||||||||||||||||||||||||
| 2769 | else | - | ||||||||||||||||||||||||
| 2770 | d->updateWindowTitle(false); never executed:  d->updateWindowTitle(false); | 0 | ||||||||||||||||||||||||
| 2771 | #endif | - | ||||||||||||||||||||||||
| 2772 | } | - | ||||||||||||||||||||||||
| 2773 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2774 | case QEvent::ModifiedChange: { never executed:  case QEvent::ModifiedChange: | 0 | ||||||||||||||||||||||||
| 2775 | if (object != d->baseWidget) 
 | 0 | ||||||||||||||||||||||||
| 2776 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2777 | bool windowModified = d->baseWidget->isWindowModified(); | - | ||||||||||||||||||||||||
| 2778 | if (!windowModified && d->baseWidget->windowTitle() != windowTitle()) 
 
 | 0 | ||||||||||||||||||||||||
| 2779 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2780 | if (windowTitle().contains(QLatin1String("[*]"))) 
 | 0 | ||||||||||||||||||||||||
| 2781 | setWindowModified(windowModified); never executed:  setWindowModified(windowModified); | 0 | ||||||||||||||||||||||||
| 2782 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2783 | } | - | ||||||||||||||||||||||||
| 2784 | default: never executed:  default: | 0 | ||||||||||||||||||||||||
| 2785 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2786 | } | - | ||||||||||||||||||||||||
| 2787 | return QWidget::eventFilter(object, event); never executed:  return QWidget::eventFilter(object, event); | 0 | ||||||||||||||||||||||||
| 2788 | } | - | ||||||||||||||||||||||||
| 2789 | - | |||||||||||||||||||||||||
| 2790 | /*! | - | ||||||||||||||||||||||||
| 2791 | \reimp | - | ||||||||||||||||||||||||
| 2792 | */ | - | ||||||||||||||||||||||||
| 2793 | bool QMdiSubWindow::event(QEvent *event) | - | ||||||||||||||||||||||||
| 2794 | { | - | ||||||||||||||||||||||||
| 2795 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2796 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 2797 | case QEvent::StyleChange: { never executed:  case QEvent::StyleChange: | 0 | ||||||||||||||||||||||||
| 2798 | bool wasShaded = isShaded(); | - | ||||||||||||||||||||||||
| 2799 | bool wasMinimized = isMinimized(); | - | ||||||||||||||||||||||||
| 2800 | bool wasMaximized = isMaximized(); | - | ||||||||||||||||||||||||
| 2801 | // Don't emit subWindowActivated, the app doesn't have to know about our hacks | - | ||||||||||||||||||||||||
| 2802 | const QScopedValueRollback<bool> activationEnabledSaver(d->activationEnabled); | - | ||||||||||||||||||||||||
| 2803 | d->activationEnabled = false; | - | ||||||||||||||||||||||||
| 2804 | - | |||||||||||||||||||||||||
| 2805 | ensurePolished(); | - | ||||||||||||||||||||||||
| 2806 | setContentsMargins(0, 0, 0, 0); | - | ||||||||||||||||||||||||
| 2807 | if (wasMinimized || wasMaximized || wasShaded) 
 
 
 | 0 | ||||||||||||||||||||||||
| 2808 | showNormal(); never executed:  showNormal(); | 0 | ||||||||||||||||||||||||
| 2809 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2810 | resize(d->internalMinimumSize.expandedTo(size())); | - | ||||||||||||||||||||||||
| 2811 | d->updateMask(); | - | ||||||||||||||||||||||||
| 2812 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2813 | if (wasShaded) 
 | 0 | ||||||||||||||||||||||||
| 2814 | showShaded(); never executed:  showShaded(); | 0 | ||||||||||||||||||||||||
| 2815 | else if (wasMinimized) 
 | 0 | ||||||||||||||||||||||||
| 2816 | showMinimized(); never executed:  showMinimized(); | 0 | ||||||||||||||||||||||||
| 2817 | else if (wasMaximized) 
 | 0 | ||||||||||||||||||||||||
| 2818 | showMaximized(); never executed:  showMaximized(); | 0 | ||||||||||||||||||||||||
| 2819 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2820 | } | - | ||||||||||||||||||||||||
| 2821 | case QEvent::ParentAboutToChange: never executed:  case QEvent::ParentAboutToChange: | 0 | ||||||||||||||||||||||||
| 2822 | d->setActive(false); | - | ||||||||||||||||||||||||
| 2823 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2824 | case QEvent::ParentChange: { never executed:  case QEvent::ParentChange: | 0 | ||||||||||||||||||||||||
| 2825 | bool wasResized = testAttribute(Qt::WA_Resized); | - | ||||||||||||||||||||||||
| 2826 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 2827 | d->removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 2828 | #endif | - | ||||||||||||||||||||||||
| 2829 | d->currentOperation = QMdiSubWindowPrivate::None; | - | ||||||||||||||||||||||||
| 2830 | d->activeSubControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 2831 | d->hoveredSubControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 2832 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 2833 | if (d->isInRubberBandMode) 
 | 0 | ||||||||||||||||||||||||
| 2834 | d->leaveRubberBandMode(); never executed:  d->leaveRubberBandMode(); | 0 | ||||||||||||||||||||||||
| 2835 | #endif | - | ||||||||||||||||||||||||
| 2836 | d->isShadeMode = false; | - | ||||||||||||||||||||||||
| 2837 | d->isMaximizeMode = false; | - | ||||||||||||||||||||||||
| 2838 | d->isWidgetHiddenByUs = false; | - | ||||||||||||||||||||||||
| 2839 | if (!parent()) { 
 | 0 | ||||||||||||||||||||||||
| 2840 | #if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 2841 | if (qobject_cast<QMacStyle *>(style())) | - | ||||||||||||||||||||||||
| 2842 | delete d->sizeGrip; | - | ||||||||||||||||||||||||
| 2843 | #endif | - | ||||||||||||||||||||||||
| 2844 | setOption(RubberBandResize, false); | - | ||||||||||||||||||||||||
| 2845 | setOption(RubberBandMove, false); | - | ||||||||||||||||||||||||
| 2846 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2847 | d->setWindowFlags(windowFlags()); | - | ||||||||||||||||||||||||
| 2848 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2849 | setContentsMargins(0, 0, 0, 0); | - | ||||||||||||||||||||||||
| 2850 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2851 | d->updateCursor(); | - | ||||||||||||||||||||||||
| 2852 | d->updateMask(); | - | ||||||||||||||||||||||||
| 2853 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2854 | d->updateActions(); | - | ||||||||||||||||||||||||
| 2855 | if (!wasResized && testAttribute(Qt::WA_Resized)) 
 
 | 0 | ||||||||||||||||||||||||
| 2856 | setAttribute(Qt::WA_Resized, false); never executed:  setAttribute(Qt::WA_Resized, false); | 0 | ||||||||||||||||||||||||
| 2857 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2858 | } | - | ||||||||||||||||||||||||
| 2859 | case QEvent::WindowActivate: never executed:  case QEvent::WindowActivate: | 0 | ||||||||||||||||||||||||
| 2860 | if (d->ignoreNextActivationEvent) { 
 | 0 | ||||||||||||||||||||||||
| 2861 | d->ignoreNextActivationEvent = false; | - | ||||||||||||||||||||||||
| 2862 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2863 | } | - | ||||||||||||||||||||||||
| 2864 | d->isExplicitlyDeactivated = false; | - | ||||||||||||||||||||||||
| 2865 | d->setActive(true); | - | ||||||||||||||||||||||||
| 2866 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2867 | case QEvent::WindowDeactivate: never executed:  case QEvent::WindowDeactivate: | 0 | ||||||||||||||||||||||||
| 2868 | if (d->ignoreNextActivationEvent) { 
 | 0 | ||||||||||||||||||||||||
| 2869 | d->ignoreNextActivationEvent = false; | - | ||||||||||||||||||||||||
| 2870 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2871 | } | - | ||||||||||||||||||||||||
| 2872 | d->isExplicitlyDeactivated = true; | - | ||||||||||||||||||||||||
| 2873 | d->setActive(false); | - | ||||||||||||||||||||||||
| 2874 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2875 | case QEvent::WindowTitleChange: never executed:  case QEvent::WindowTitleChange: | 0 | ||||||||||||||||||||||||
| 2876 | if (!d->ignoreWindowTitleChange) 
 | 0 | ||||||||||||||||||||||||
| 2877 | d->updateWindowTitle(false); never executed:  d->updateWindowTitle(false); | 0 | ||||||||||||||||||||||||
| 2878 | d->updateInternalWindowTitle(); | - | ||||||||||||||||||||||||
| 2879 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2880 | case QEvent::ModifiedChange: never executed:  case QEvent::ModifiedChange: | 0 | ||||||||||||||||||||||||
| 2881 | if (!windowTitle().contains(QLatin1String("[*]"))) 
 | 0 | ||||||||||||||||||||||||
| 2882 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2883 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 2884 | if (maximizedButtonsWidget() && d->controlContainer->menuBar() && d->controlContainer->menuBar() 
 
 
 | 0 | ||||||||||||||||||||||||
| 2885 | ->cornerWidget(Qt::TopRightCorner) == maximizedButtonsWidget()) { 
 | 0 | ||||||||||||||||||||||||
| 2886 | window()->setWindowModified(isWindowModified()); | - | ||||||||||||||||||||||||
| 2887 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2888 | #endif // QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 2889 | d->updateInternalWindowTitle(); | - | ||||||||||||||||||||||||
| 2890 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2891 | case QEvent::LayoutDirectionChange: never executed:  case QEvent::LayoutDirectionChange: | 0 | ||||||||||||||||||||||||
| 2892 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2893 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2894 | case QEvent::LayoutRequest: never executed:  case QEvent::LayoutRequest: | 0 | ||||||||||||||||||||||||
| 2895 | d->updateGeometryConstraints(); | - | ||||||||||||||||||||||||
| 2896 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2897 | case QEvent::WindowIconChange: never executed:  case QEvent::WindowIconChange: | 0 | ||||||||||||||||||||||||
| 2898 | d->menuIcon = windowIcon(); | - | ||||||||||||||||||||||||
| 2899 | if (d->menuIcon.isNull()) 
 | 0 | ||||||||||||||||||||||||
| 2900 | d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); never executed:  d->menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, this); | 0 | ||||||||||||||||||||||||
| 2901 | if (d->controlContainer) 
 | 0 | ||||||||||||||||||||||||
| 2902 | d->controlContainer->updateWindowIcon(d->menuIcon); never executed:  d->controlContainer->updateWindowIcon(d->menuIcon); | 0 | ||||||||||||||||||||||||
| 2903 | if (!maximizedSystemMenuIconWidget()) 
 | 0 | ||||||||||||||||||||||||
| 2904 | update(0, 0, width(), d->titleBarHeight()); never executed:  update(0, 0, width(), d->titleBarHeight()); | 0 | ||||||||||||||||||||||||
| 2905 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2906 | case QEvent::PaletteChange: never executed:  case QEvent::PaletteChange: | 0 | ||||||||||||||||||||||||
| 2907 | d->titleBarPalette = d->desktopPalette(); | - | ||||||||||||||||||||||||
| 2908 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2909 | case QEvent::FontChange: never executed:  case QEvent::FontChange: | 0 | ||||||||||||||||||||||||
| 2910 | d->font = font(); | - | ||||||||||||||||||||||||
| 2911 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2912 | #ifndef QT_NO_TOOLTIP | - | ||||||||||||||||||||||||
| 2913 | case QEvent::ToolTip: never executed:  case QEvent::ToolTip: | 0 | ||||||||||||||||||||||||
| 2914 | showToolTip(static_cast<QHelpEvent *>(event), this, d->titleBarOptions(), | - | ||||||||||||||||||||||||
| 2915 | QStyle::CC_TitleBar, d->hoveredSubControl); | - | ||||||||||||||||||||||||
| 2916 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2917 | #endif | - | ||||||||||||||||||||||||
| 2918 | default: never executed:  default: | 0 | ||||||||||||||||||||||||
| 2919 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2920 | } | - | ||||||||||||||||||||||||
| 2921 | return QWidget::event(event); never executed:  return QWidget::event(event); | 0 | ||||||||||||||||||||||||
| 2922 | } | - | ||||||||||||||||||||||||
| 2923 | - | |||||||||||||||||||||||||
| 2924 | /*! | - | ||||||||||||||||||||||||
| 2925 | \reimp | - | ||||||||||||||||||||||||
| 2926 | */ | - | ||||||||||||||||||||||||
| 2927 | void QMdiSubWindow::showEvent(QShowEvent *showEvent) | - | ||||||||||||||||||||||||
| 2928 | { | - | ||||||||||||||||||||||||
| 2929 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 2930 | if (!parent()) { 
 | 0 | ||||||||||||||||||||||||
| 2931 | QWidget::showEvent(showEvent); | - | ||||||||||||||||||||||||
| 2932 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2933 | } | - | ||||||||||||||||||||||||
| 2934 | - | |||||||||||||||||||||||||
| 2935 | #if !defined(QT_NO_SIZEGRIP) && defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 2936 | if (qobject_cast<QMacStyle *>(style()) && !d->sizeGrip | - | ||||||||||||||||||||||||
| 2937 | && !(windowFlags() & Qt::FramelessWindowHint)) { | - | ||||||||||||||||||||||||
| 2938 | d->setSizeGrip(new QSizeGrip(this)); | - | ||||||||||||||||||||||||
| 2939 | Q_ASSERT(d->sizeGrip); | - | ||||||||||||||||||||||||
| 2940 | if (isMinimized()) | - | ||||||||||||||||||||||||
| 2941 | d->setSizeGripVisible(false); | - | ||||||||||||||||||||||||
| 2942 | else | - | ||||||||||||||||||||||||
| 2943 | d->setSizeGripVisible(true); | - | ||||||||||||||||||||||||
| 2944 | resize(size().expandedTo(d->internalMinimumSize)); | - | ||||||||||||||||||||||||
| 2945 | } | - | ||||||||||||||||||||||||
| 2946 | #endif | - | ||||||||||||||||||||||||
| 2947 | - | |||||||||||||||||||||||||
| 2948 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 2949 | // Show buttons in the menu bar if they're already not there. | - | ||||||||||||||||||||||||
| 2950 | // We want to do this when QMdiSubWindow becomes visible after being hidden. | - | ||||||||||||||||||||||||
| 2951 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 2952 | if (d->controlContainer) { 
 | 0 | ||||||||||||||||||||||||
| 2953 | if (QMenuBar *menuBar = d->menuBar()) { 
 | 0 | ||||||||||||||||||||||||
| 2954 | if (menuBar->cornerWidget(Qt::TopRightCorner) != maximizedButtonsWidget()) 
 | 0 | ||||||||||||||||||||||||
| 2955 | d->showButtonsInMenuBar(menuBar); never executed:  d->showButtonsInMenuBar(menuBar); | 0 | ||||||||||||||||||||||||
| 2956 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2957 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2958 | #endif | - | ||||||||||||||||||||||||
| 2959 | d->setActive(true); | - | ||||||||||||||||||||||||
| 2960 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2961 | - | |||||||||||||||||||||||||
| 2962 | /*! | - | ||||||||||||||||||||||||
| 2963 | \reimp | - | ||||||||||||||||||||||||
| 2964 | */ | - | ||||||||||||||||||||||||
| 2965 | void QMdiSubWindow::hideEvent(QHideEvent * /*hideEvent*/) | - | ||||||||||||||||||||||||
| 2966 | { | - | ||||||||||||||||||||||||
| 2967 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 2968 | d_func()->removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 2969 | #endif | - | ||||||||||||||||||||||||
| 2970 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2971 | - | |||||||||||||||||||||||||
| 2972 | /*! | - | ||||||||||||||||||||||||
| 2973 | \reimp | - | ||||||||||||||||||||||||
| 2974 | */ | - | ||||||||||||||||||||||||
| 2975 | void QMdiSubWindow::changeEvent(QEvent *changeEvent) | - | ||||||||||||||||||||||||
| 2976 | { | - | ||||||||||||||||||||||||
| 2977 | if (!parent()) { 
 | 0 | ||||||||||||||||||||||||
| 2978 | QWidget::changeEvent(changeEvent); | - | ||||||||||||||||||||||||
| 2979 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2980 | } | - | ||||||||||||||||||||||||
| 2981 | - | |||||||||||||||||||||||||
| 2982 | if (changeEvent->type() != QEvent::WindowStateChange) { 
 | 0 | ||||||||||||||||||||||||
| 2983 | QWidget::changeEvent(changeEvent); | - | ||||||||||||||||||||||||
| 2984 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2985 | } | - | ||||||||||||||||||||||||
| 2986 | - | |||||||||||||||||||||||||
| 2987 | QWindowStateChangeEvent *event = static_cast<QWindowStateChangeEvent *>(changeEvent); | - | ||||||||||||||||||||||||
| 2988 | if (event->isOverride()) { 
 | 0 | ||||||||||||||||||||||||
| 2989 | event->ignore(); | - | ||||||||||||||||||||||||
| 2990 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2991 | } | - | ||||||||||||||||||||||||
| 2992 | - | |||||||||||||||||||||||||
| 2993 | Qt::WindowStates oldState = event->oldState(); | - | ||||||||||||||||||||||||
| 2994 | Qt::WindowStates newState = windowState(); | - | ||||||||||||||||||||||||
| 2995 | if (oldState == newState) { 
 | 0 | ||||||||||||||||||||||||
| 2996 | changeEvent->ignore(); | - | ||||||||||||||||||||||||
| 2997 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2998 | } | - | ||||||||||||||||||||||||
| 2999 | - | |||||||||||||||||||||||||
| 3000 | // QWidget ensures that the widget is visible _after_ setWindowState(), | - | ||||||||||||||||||||||||
| 3001 | // but we need to ensure that the widget is visible _before_ | - | ||||||||||||||||||||||||
| 3002 | // setWindowState() returns. | - | ||||||||||||||||||||||||
| 3003 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3004 | if (!isVisible()) { 
 | 0 | ||||||||||||||||||||||||
| 3005 | d->ensureWindowState(Qt::WindowNoState); | - | ||||||||||||||||||||||||
| 3006 | setVisible(true); | - | ||||||||||||||||||||||||
| 3007 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3008 | - | |||||||||||||||||||||||||
| 3009 | if (!d->oldGeometry.isValid()) 
 | 0 | ||||||||||||||||||||||||
| 3010 | d->oldGeometry = geometry(); never executed:  d->oldGeometry = geometry(); | 0 | ||||||||||||||||||||||||
| 3011 | - | |||||||||||||||||||||||||
| 3012 | if ((oldState & Qt::WindowActive) && (newState & Qt::WindowActive)) 
 
 | 0 | ||||||||||||||||||||||||
| 3013 | d->currentOperation = QMdiSubWindowPrivate::None; never executed:  d->currentOperation = QMdiSubWindowPrivate::None; | 0 | ||||||||||||||||||||||||
| 3014 | - | |||||||||||||||||||||||||
| 3015 | if (!(oldState & Qt::WindowMinimized) && (newState & Qt::WindowMinimized)) 
 
 | 0 | ||||||||||||||||||||||||
| 3016 | d->setMinimizeMode(); never executed:  d->setMinimizeMode(); | 0 | ||||||||||||||||||||||||
| 3017 | else if (!(oldState & Qt::WindowMaximized) && (newState & Qt::WindowMaximized)) 
 
 | 0 | ||||||||||||||||||||||||
| 3018 | d->setMaximizeMode(); never executed:  d->setMaximizeMode(); | 0 | ||||||||||||||||||||||||
| 3019 | else if (!(newState & (Qt::WindowMaximized | Qt::WindowMinimized | Qt::WindowFullScreen))) 
 | 0 | ||||||||||||||||||||||||
| 3020 | d->setNormalMode(); never executed:  d->setNormalMode(); | 0 | ||||||||||||||||||||||||
| 3021 | - | |||||||||||||||||||||||||
| 3022 | if (d->isActive) 
 | 0 | ||||||||||||||||||||||||
| 3023 | d->ensureWindowState(Qt::WindowActive); never executed:  d->ensureWindowState(Qt::WindowActive); | 0 | ||||||||||||||||||||||||
| 3024 | if (d->activationEnabled) 
 | 0 | ||||||||||||||||||||||||
| 3025 | emit windowStateChanged(oldState, windowState()); never executed:  windowStateChanged(oldState, windowState()); | 0 | ||||||||||||||||||||||||
| 3026 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3027 | - | |||||||||||||||||||||||||
| 3028 | /*! | - | ||||||||||||||||||||||||
| 3029 | \reimp | - | ||||||||||||||||||||||||
| 3030 | */ | - | ||||||||||||||||||||||||
| 3031 | void QMdiSubWindow::closeEvent(QCloseEvent *closeEvent) | - | ||||||||||||||||||||||||
| 3032 | { | - | ||||||||||||||||||||||||
| 3033 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3034 | bool acceptClose = true; | - | ||||||||||||||||||||||||
| 3035 | if (d->baseWidget) 
 | 0 | ||||||||||||||||||||||||
| 3036 | acceptClose = d->baseWidget->close(); never executed:  acceptClose = d->baseWidget->close(); | 0 | ||||||||||||||||||||||||
| 3037 | if (!acceptClose) { 
 | 0 | ||||||||||||||||||||||||
| 3038 | closeEvent->ignore(); | - | ||||||||||||||||||||||||
| 3039 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3040 | } | - | ||||||||||||||||||||||||
| 3041 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 3042 | d->removeButtonsFromMenuBar(); | - | ||||||||||||||||||||||||
| 3043 | #endif | - | ||||||||||||||||||||||||
| 3044 | d->setActive(false); | - | ||||||||||||||||||||||||
| 3045 | if (parentWidget() && testAttribute(Qt::WA_DeleteOnClose)) { 
 
 | 0 | ||||||||||||||||||||||||
| 3046 | QChildEvent childRemoved(QEvent::ChildRemoved, this); | - | ||||||||||||||||||||||||
| 3047 | QApplication::sendEvent(parentWidget(), &childRemoved); | - | ||||||||||||||||||||||||
| 3048 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3049 | closeEvent->accept(); | - | ||||||||||||||||||||||||
| 3050 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3051 | - | |||||||||||||||||||||||||
| 3052 | /*! | - | ||||||||||||||||||||||||
| 3053 | \reimp | - | ||||||||||||||||||||||||
| 3054 | */ | - | ||||||||||||||||||||||||
| 3055 | void QMdiSubWindow::leaveEvent(QEvent * /*leaveEvent*/) | - | ||||||||||||||||||||||||
| 3056 | { | - | ||||||||||||||||||||||||
| 3057 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3058 | if (d->hoveredSubControl != QStyle::SC_None) { 
 | 0 | ||||||||||||||||||||||||
| 3059 | d->hoveredSubControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 3060 | update(QRegion(0, 0, width(), d->titleBarHeight())); | - | ||||||||||||||||||||||||
| 3061 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3062 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3063 | - | |||||||||||||||||||||||||
| 3064 | /*! | - | ||||||||||||||||||||||||
| 3065 | \reimp | - | ||||||||||||||||||||||||
| 3066 | - | |||||||||||||||||||||||||
| 3067 | \warning When maximizing or restoring a subwindow, the resulting call to this function | - | ||||||||||||||||||||||||
| 3068 | may have an invalid QResizeEvent::oldSize(). | - | ||||||||||||||||||||||||
| 3069 | */ | - | ||||||||||||||||||||||||
| 3070 | void QMdiSubWindow::resizeEvent(QResizeEvent *resizeEvent) | - | ||||||||||||||||||||||||
| 3071 | { | - | ||||||||||||||||||||||||
| 3072 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3073 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 3074 | if (d->sizeGrip) { 
 | 0 | ||||||||||||||||||||||||
| 3075 | d->sizeGrip->move(isLeftToRight() ? width() - d->sizeGrip->width() : 0, | - | ||||||||||||||||||||||||
| 3076 | height() - d->sizeGrip->height()); | - | ||||||||||||||||||||||||
| 3077 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3078 | #endif | - | ||||||||||||||||||||||||
| 3079 | - | |||||||||||||||||||||||||
| 3080 | if (!parent()) { 
 | 0 | ||||||||||||||||||||||||
| 3081 | QWidget::resizeEvent(resizeEvent); | - | ||||||||||||||||||||||||
| 3082 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3083 | } | - | ||||||||||||||||||||||||
| 3084 | - | |||||||||||||||||||||||||
| 3085 | if (d->isMaximizeMode) 
 | 0 | ||||||||||||||||||||||||
| 3086 | d->ensureWindowState(Qt::WindowMaximized); never executed:  d->ensureWindowState(Qt::WindowMaximized); | 0 | ||||||||||||||||||||||||
| 3087 | - | |||||||||||||||||||||||||
| 3088 | d->updateMask(); | - | ||||||||||||||||||||||||
| 3089 | if (!isVisible()) 
 | 0 | ||||||||||||||||||||||||
| 3090 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3091 | - | |||||||||||||||||||||||||
| 3092 | if (d->resizeTimerId <= 0) 
 | 0 | ||||||||||||||||||||||||
| 3093 | d->cachedStyleOptions = d->titleBarOptions(); never executed:  d->cachedStyleOptions = d->titleBarOptions(); | 0 | ||||||||||||||||||||||||
| 3094 | else | - | ||||||||||||||||||||||||
| 3095 | killTimer(d->resizeTimerId); never executed:  killTimer(d->resizeTimerId); | 0 | ||||||||||||||||||||||||
| 3096 | d->resizeTimerId = startTimer(200); | - | ||||||||||||||||||||||||
| 3097 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3098 | - | |||||||||||||||||||||||||
| 3099 | /*! | - | ||||||||||||||||||||||||
| 3100 | \reimp | - | ||||||||||||||||||||||||
| 3101 | */ | - | ||||||||||||||||||||||||
| 3102 | void QMdiSubWindow::timerEvent(QTimerEvent *timerEvent) | - | ||||||||||||||||||||||||
| 3103 | { | - | ||||||||||||||||||||||||
| 3104 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3105 | if (timerEvent->timerId() == d->resizeTimerId) { 
 | 0 | ||||||||||||||||||||||||
| 3106 | killTimer(d->resizeTimerId); | - | ||||||||||||||||||||||||
| 3107 | d->resizeTimerId = -1; | - | ||||||||||||||||||||||||
| 3108 | d->updateDirtyRegions(); | - | ||||||||||||||||||||||||
| 3109 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3110 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3111 | - | |||||||||||||||||||||||||
| 3112 | /*! | - | ||||||||||||||||||||||||
| 3113 | \reimp | - | ||||||||||||||||||||||||
| 3114 | */ | - | ||||||||||||||||||||||||
| 3115 | void QMdiSubWindow::moveEvent(QMoveEvent *moveEvent) | - | ||||||||||||||||||||||||
| 3116 | { | - | ||||||||||||||||||||||||
| 3117 | if (!parent()) { 
 | 0 | ||||||||||||||||||||||||
| 3118 | QWidget::moveEvent(moveEvent); | - | ||||||||||||||||||||||||
| 3119 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3120 | } | - | ||||||||||||||||||||||||
| 3121 | - | |||||||||||||||||||||||||
| 3122 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3123 | if (d->isMaximizeMode) 
 | 0 | ||||||||||||||||||||||||
| 3124 | d->ensureWindowState(Qt::WindowMaximized); never executed:  d->ensureWindowState(Qt::WindowMaximized); | 0 | ||||||||||||||||||||||||
| 3125 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3126 | - | |||||||||||||||||||||||||
| 3127 | /*! | - | ||||||||||||||||||||||||
| 3128 | \reimp | - | ||||||||||||||||||||||||
| 3129 | */ | - | ||||||||||||||||||||||||
| 3130 | void QMdiSubWindow::paintEvent(QPaintEvent *paintEvent) | - | ||||||||||||||||||||||||
| 3131 | { | - | ||||||||||||||||||||||||
| 3132 | if (!parent() || (windowFlags() & Qt::FramelessWindowHint)) { 
 
 | 0 | ||||||||||||||||||||||||
| 3133 | QWidget::paintEvent(paintEvent); | - | ||||||||||||||||||||||||
| 3134 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3135 | } | - | ||||||||||||||||||||||||
| 3136 | - | |||||||||||||||||||||||||
| 3137 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3138 | if (isMaximized() && !d->drawTitleBarWhenMaximized()) 
 
 | 0 | ||||||||||||||||||||||||
| 3139 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3140 | - | |||||||||||||||||||||||||
| 3141 | if (d->resizeTimerId != -1) { 
 | 0 | ||||||||||||||||||||||||
| 3142 | // Only update the style option rect and the window title. | - | ||||||||||||||||||||||||
| 3143 | int border = d->hasBorder(d->cachedStyleOptions) ? 4 : 0; 
 | 0 | ||||||||||||||||||||||||
| 3144 | int titleBarHeight = d->titleBarHeight(d->cachedStyleOptions); | - | ||||||||||||||||||||||||
| 3145 | titleBarHeight -= isMinimized() ? 2 * border : border; 
 | 0 | ||||||||||||||||||||||||
| 3146 | d->cachedStyleOptions.rect = QRect(border, border, width() - 2 * border, titleBarHeight); | - | ||||||||||||||||||||||||
| 3147 | if (!d->windowTitle.isEmpty()) { 
 | 0 | ||||||||||||||||||||||||
| 3148 | int width = style()->subControlRect(QStyle::CC_TitleBar, &d->cachedStyleOptions, | - | ||||||||||||||||||||||||
| 3149 | QStyle::SC_TitleBarLabel, this).width(); | - | ||||||||||||||||||||||||
| 3150 | d->cachedStyleOptions.text = d->cachedStyleOptions.fontMetrics | - | ||||||||||||||||||||||||
| 3151 | .elidedText(d->windowTitle, Qt::ElideRight, width); | - | ||||||||||||||||||||||||
| 3152 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3153 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3154 | // Force full update. | - | ||||||||||||||||||||||||
| 3155 | d->cachedStyleOptions = d->titleBarOptions(); | - | ||||||||||||||||||||||||
| 3156 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3157 | - | |||||||||||||||||||||||||
| 3158 | QStylePainter painter(this); | - | ||||||||||||||||||||||||
| 3159 | if (!d->windowTitle.isEmpty()) 
 | 0 | ||||||||||||||||||||||||
| 3160 | painter.setFont(d->font); never executed:  painter.setFont(d->font); | 0 | ||||||||||||||||||||||||
| 3161 | painter.drawComplexControl(QStyle::CC_TitleBar, d->cachedStyleOptions); | - | ||||||||||||||||||||||||
| 3162 | - | |||||||||||||||||||||||||
| 3163 | if (isMinimized() && !d->hasBorder(d->cachedStyleOptions)) 
 
 | 0 | ||||||||||||||||||||||||
| 3164 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3165 | - | |||||||||||||||||||||||||
| 3166 | QStyleOptionFrame frameOptions; | - | ||||||||||||||||||||||||
| 3167 | frameOptions.initFrom(this); | - | ||||||||||||||||||||||||
| 3168 | frameOptions.lineWidth = style()->pixelMetric(QStyle::PM_MdiSubWindowFrameWidth, 0, this); | - | ||||||||||||||||||||||||
| 3169 | frameOptions.state.setFlag(QStyle::State_Active, d->isActive); | - | ||||||||||||||||||||||||
| 3170 | - | |||||||||||||||||||||||||
| 3171 | // ### Ensure that we do not require setting the cliprect for 4.4 | - | ||||||||||||||||||||||||
| 3172 | if (!isMinimized() && !d->hasBorder(d->cachedStyleOptions)) 
 
 | 0 | ||||||||||||||||||||||||
| 3173 | 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 | ||||||||||||||||||||||||
| 3174 | if (!isMinimized() || d->hasBorder(d->cachedStyleOptions)) 
 
 | 0 | ||||||||||||||||||||||||
| 3175 | painter.drawPrimitive(QStyle::PE_FrameWindow, frameOptions); never executed:  painter.drawPrimitive(QStyle::PE_FrameWindow, frameOptions); | 0 | ||||||||||||||||||||||||
| 3176 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3177 | - | |||||||||||||||||||||||||
| 3178 | /*! | - | ||||||||||||||||||||||||
| 3179 | \reimp | - | ||||||||||||||||||||||||
| 3180 | */ | - | ||||||||||||||||||||||||
| 3181 | void QMdiSubWindow::mousePressEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 3182 | { | - | ||||||||||||||||||||||||
| 3183 | if (!parent()) { 
 | 0 | ||||||||||||||||||||||||
| 3184 | QWidget::mousePressEvent(mouseEvent); | - | ||||||||||||||||||||||||
| 3185 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3186 | } | - | ||||||||||||||||||||||||
| 3187 | - | |||||||||||||||||||||||||
| 3188 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3189 | if (d->isInInteractiveMode) 
 | 0 | ||||||||||||||||||||||||
| 3190 | d->leaveInteractiveMode(); never executed:  d->leaveInteractiveMode(); | 0 | ||||||||||||||||||||||||
| 3191 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 3192 | if (d->isInRubberBandMode) 
 | 0 | ||||||||||||||||||||||||
| 3193 | d->leaveRubberBandMode(); never executed:  d->leaveRubberBandMode(); | 0 | ||||||||||||||||||||||||
| 3194 | #endif | - | ||||||||||||||||||||||||
| 3195 | - | |||||||||||||||||||||||||
| 3196 | if (mouseEvent->button() != Qt::LeftButton) { 
 | 0 | ||||||||||||||||||||||||
| 3197 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
| 3198 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3199 | } | - | ||||||||||||||||||||||||
| 3200 | - | |||||||||||||||||||||||||
| 3201 | if (d->currentOperation != QMdiSubWindowPrivate::None) { 
 | 0 | ||||||||||||||||||||||||
| 3202 | d->updateCursor(); | - | ||||||||||||||||||||||||
| 3203 | d->mousePressPosition = mapToParent(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 3204 | if (d->resizeEnabled || d->moveEnabled) 
 
 | 0 | ||||||||||||||||||||||||
| 3205 | d->oldGeometry = geometry(); never executed:  d->oldGeometry = geometry(); | 0 | ||||||||||||||||||||||||
| 3206 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 3207 | if ((testOption(QMdiSubWindow::RubberBandResize) && d->isResizeOperation()) 
 
 | 0 | ||||||||||||||||||||||||
| 3208 | || (testOption(QMdiSubWindow::RubberBandMove) && d->isMoveOperation())) { 
 
 | 0 | ||||||||||||||||||||||||
| 3209 | d->enterRubberBandMode(); | - | ||||||||||||||||||||||||
| 3210 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3211 | #endif | - | ||||||||||||||||||||||||
| 3212 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3213 | } | - | ||||||||||||||||||||||||
| 3214 | - | |||||||||||||||||||||||||
| 3215 | d->activeSubControl = d->hoveredSubControl; | - | ||||||||||||||||||||||||
| 3216 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 3217 | if (d->activeSubControl == QStyle::SC_TitleBarSysMenu) 
 | 0 | ||||||||||||||||||||||||
| 3218 | showSystemMenu(); never executed:  showSystemMenu(); | 0 | ||||||||||||||||||||||||
| 3219 | else | - | ||||||||||||||||||||||||
| 3220 | #endif | - | ||||||||||||||||||||||||
| 3221 | update(QRegion(0, 0, width(), d->titleBarHeight())); never executed:  update(QRegion(0, 0, width(), d->titleBarHeight())); | 0 | ||||||||||||||||||||||||
| 3222 | } | - | ||||||||||||||||||||||||
| 3223 | - | |||||||||||||||||||||||||
| 3224 | /*! | - | ||||||||||||||||||||||||
| 3225 | \reimp | - | ||||||||||||||||||||||||
| 3226 | */ | - | ||||||||||||||||||||||||
| 3227 | void QMdiSubWindow::mouseDoubleClickEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 3228 | { | - | ||||||||||||||||||||||||
| 3229 | if (!parent()) { 
 | 0 | ||||||||||||||||||||||||
| 3230 | QWidget::mouseDoubleClickEvent(mouseEvent); | - | ||||||||||||||||||||||||
| 3231 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3232 | } | - | ||||||||||||||||||||||||
| 3233 | - | |||||||||||||||||||||||||
| 3234 | if (mouseEvent->button() != Qt::LeftButton) { 
 | 0 | ||||||||||||||||||||||||
| 3235 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
| 3236 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3237 | } | - | ||||||||||||||||||||||||
| 3238 | - | |||||||||||||||||||||||||
| 3239 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3240 | if (!d->isMoveOperation()) { 
 | 0 | ||||||||||||||||||||||||
| 3241 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 3242 | if (d->hoveredSubControl == QStyle::SC_TitleBarSysMenu) 
 | 0 | ||||||||||||||||||||||||
| 3243 | close(); never executed:  close(); | 0 | ||||||||||||||||||||||||
| 3244 | #endif | - | ||||||||||||||||||||||||
| 3245 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3246 | } | - | ||||||||||||||||||||||||
| 3247 | - | |||||||||||||||||||||||||
| 3248 | Qt::WindowFlags flags = windowFlags(); | - | ||||||||||||||||||||||||
| 3249 | if (isMinimized()) { 
 | 0 | ||||||||||||||||||||||||
| 3250 | if ((isShaded() && (flags & Qt::WindowShadeButtonHint)) 
 
 | 0 | ||||||||||||||||||||||||
| 3251 | || (flags & Qt::WindowMinimizeButtonHint)) { 
 | 0 | ||||||||||||||||||||||||
| 3252 | showNormal(); | - | ||||||||||||||||||||||||
| 3253 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3254 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3255 | } | - | ||||||||||||||||||||||||
| 3256 | - | |||||||||||||||||||||||||
| 3257 | if (isMaximized()) { 
 | 0 | ||||||||||||||||||||||||
| 3258 | if (flags & Qt::WindowMaximizeButtonHint) 
 | 0 | ||||||||||||||||||||||||
| 3259 | showNormal(); never executed:  showNormal(); | 0 | ||||||||||||||||||||||||
| 3260 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3261 | } | - | ||||||||||||||||||||||||
| 3262 | - | |||||||||||||||||||||||||
| 3263 | if (flags & Qt::WindowShadeButtonHint) 
 | 0 | ||||||||||||||||||||||||
| 3264 | showShaded(); never executed:  showShaded(); | 0 | ||||||||||||||||||||||||
| 3265 | else if (flags & Qt::WindowMaximizeButtonHint) 
 | 0 | ||||||||||||||||||||||||
| 3266 | showMaximized(); never executed:  showMaximized(); | 0 | ||||||||||||||||||||||||
| 3267 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3268 | - | |||||||||||||||||||||||||
| 3269 | /*! | - | ||||||||||||||||||||||||
| 3270 | \reimp | - | ||||||||||||||||||||||||
| 3271 | */ | - | ||||||||||||||||||||||||
| 3272 | void QMdiSubWindow::mouseReleaseEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 3273 | { | - | ||||||||||||||||||||||||
| 3274 | if (!parent()) { 
 | 0 | ||||||||||||||||||||||||
| 3275 | QWidget::mouseReleaseEvent(mouseEvent); | - | ||||||||||||||||||||||||
| 3276 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3277 | } | - | ||||||||||||||||||||||||
| 3278 | - | |||||||||||||||||||||||||
| 3279 | if (mouseEvent->button() != Qt::LeftButton) { 
 | 0 | ||||||||||||||||||||||||
| 3280 | mouseEvent->ignore(); | - | ||||||||||||||||||||||||
| 3281 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3282 | } | - | ||||||||||||||||||||||||
| 3283 | - | |||||||||||||||||||||||||
| 3284 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3285 | if (d->currentOperation != QMdiSubWindowPrivate::None) { 
 | 0 | ||||||||||||||||||||||||
| 3286 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 3287 | if (d->isInRubberBandMode && !d->isInInteractiveMode) 
 
 | 0 | ||||||||||||||||||||||||
| 3288 | d->leaveRubberBandMode(); never executed:  d->leaveRubberBandMode(); | 0 | ||||||||||||||||||||||||
| 3289 | #endif | - | ||||||||||||||||||||||||
| 3290 | if (d->resizeEnabled || d->moveEnabled) 
 
 | 0 | ||||||||||||||||||||||||
| 3291 | d->oldGeometry = geometry(); never executed:  d->oldGeometry = geometry(); | 0 | ||||||||||||||||||||||||
| 3292 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3293 | - | |||||||||||||||||||||||||
| 3294 | d->currentOperation = d->getOperation(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 3295 | d->updateCursor(); | - | ||||||||||||||||||||||||
| 3296 | - | |||||||||||||||||||||||||
| 3297 | d->hoveredSubControl = d->getSubControl(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 3298 | if (d->activeSubControl != QStyle::SC_None 
 | 0 | ||||||||||||||||||||||||
| 3299 | && d->activeSubControl == d->hoveredSubControl) { 
 | 0 | ||||||||||||||||||||||||
| 3300 | d->processClickedSubControl(); | - | ||||||||||||||||||||||||
| 3301 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3302 | d->activeSubControl = QStyle::SC_None; | - | ||||||||||||||||||||||||
| 3303 | update(QRegion(0, 0, width(), d->titleBarHeight())); | - | ||||||||||||||||||||||||
| 3304 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3305 | - | |||||||||||||||||||||||||
| 3306 | /*! | - | ||||||||||||||||||||||||
| 3307 | \reimp | - | ||||||||||||||||||||||||
| 3308 | */ | - | ||||||||||||||||||||||||
| 3309 | void QMdiSubWindow::mouseMoveEvent(QMouseEvent *mouseEvent) | - | ||||||||||||||||||||||||
| 3310 | { | - | ||||||||||||||||||||||||
| 3311 | if (!parent()) { 
 | 0 | ||||||||||||||||||||||||
| 3312 | QWidget::mouseMoveEvent(mouseEvent); | - | ||||||||||||||||||||||||
| 3313 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3314 | } | - | ||||||||||||||||||||||||
| 3315 | - | |||||||||||||||||||||||||
| 3316 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3317 | // No update needed if we're in a move/resize operation. | - | ||||||||||||||||||||||||
| 3318 | if (!d->isMoveOperation() && !d->isResizeOperation()) { 
 
 | 0 | ||||||||||||||||||||||||
| 3319 | // Find previous and current hover region. | - | ||||||||||||||||||||||||
| 3320 | const QStyleOptionTitleBar options = d->titleBarOptions(); | - | ||||||||||||||||||||||||
| 3321 | QStyle::SubControl oldHover = d->hoveredSubControl; | - | ||||||||||||||||||||||||
| 3322 | d->hoveredSubControl = d->getSubControl(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 3323 | QRegion hoverRegion; | - | ||||||||||||||||||||||||
| 3324 | if (isHoverControl(oldHover) && oldHover != d->hoveredSubControl) 
 
 | 0 | ||||||||||||||||||||||||
| 3325 | hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, oldHover, this); never executed:  hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, oldHover, this); | 0 | ||||||||||||||||||||||||
| 3326 | if (isHoverControl(d->hoveredSubControl) && d->hoveredSubControl != oldHover) { 
 
 | 0 | ||||||||||||||||||||||||
| 3327 | hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options, | - | ||||||||||||||||||||||||
| 3328 | d->hoveredSubControl, this); | - | ||||||||||||||||||||||||
| 3329 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3330 | #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 3331 | if (qobject_cast<QMacStyle *>(style()) && !hoverRegion.isEmpty()) | - | ||||||||||||||||||||||||
| 3332 | hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options)); | - | ||||||||||||||||||||||||
| 3333 | #endif | - | ||||||||||||||||||||||||
| 3334 | if (!hoverRegion.isEmpty()) 
 | 0 | ||||||||||||||||||||||||
| 3335 | update(hoverRegion); never executed:  update(hoverRegion); | 0 | ||||||||||||||||||||||||
| 3336 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3337 | - | |||||||||||||||||||||||||
| 3338 | if ((mouseEvent->buttons() & Qt::LeftButton) || d->isInInteractiveMode) { 
 
 | 0 | ||||||||||||||||||||||||
| 3339 | if ((d->isResizeOperation() && d->resizeEnabled) || (d->isMoveOperation() && d->moveEnabled)) 
 
 
 
 | 0 | ||||||||||||||||||||||||
| 3340 | d->setNewGeometry(mapToParent(mouseEvent->pos())); never executed:  d->setNewGeometry(mapToParent(mouseEvent->pos())); | 0 | ||||||||||||||||||||||||
| 3341 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3342 | } | - | ||||||||||||||||||||||||
| 3343 | - | |||||||||||||||||||||||||
| 3344 | // Do not resize/move if not allowed. | - | ||||||||||||||||||||||||
| 3345 | d->currentOperation = d->getOperation(mouseEvent->pos()); | - | ||||||||||||||||||||||||
| 3346 | if ((d->isResizeOperation() && !d->resizeEnabled) || (d->isMoveOperation() && !d->moveEnabled)) 
 
 
 
 | 0 | ||||||||||||||||||||||||
| 3347 | d->currentOperation = QMdiSubWindowPrivate::None; never executed:  d->currentOperation = QMdiSubWindowPrivate::None; | 0 | ||||||||||||||||||||||||
| 3348 | d->updateCursor(); | - | ||||||||||||||||||||||||
| 3349 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3350 | - | |||||||||||||||||||||||||
| 3351 | /*! | - | ||||||||||||||||||||||||
| 3352 | \reimp | - | ||||||||||||||||||||||||
| 3353 | */ | - | ||||||||||||||||||||||||
| 3354 | void QMdiSubWindow::keyPressEvent(QKeyEvent *keyEvent) | - | ||||||||||||||||||||||||
| 3355 | { | - | ||||||||||||||||||||||||
| 3356 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3357 | if (!d->isInInteractiveMode || !parent()) { 
 
 | 0 | ||||||||||||||||||||||||
| 3358 | keyEvent->ignore(); | - | ||||||||||||||||||||||||
| 3359 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3360 | } | - | ||||||||||||||||||||||||
| 3361 | - | |||||||||||||||||||||||||
| 3362 | QPoint delta; | - | ||||||||||||||||||||||||
| 3363 | switch (keyEvent->key()) { | - | ||||||||||||||||||||||||
| 3364 | case Qt::Key_Right: never executed:  case Qt::Key_Right: | 0 | ||||||||||||||||||||||||
| 3365 | if (keyEvent->modifiers() & Qt::ShiftModifier) 
 | 0 | ||||||||||||||||||||||||
| 3366 | delta = QPoint(d->keyboardPageStep, 0); never executed:  delta = QPoint(d->keyboardPageStep, 0); | 0 | ||||||||||||||||||||||||
| 3367 | else | - | ||||||||||||||||||||||||
| 3368 | delta = QPoint(d->keyboardSingleStep, 0); never executed:  delta = QPoint(d->keyboardSingleStep, 0); | 0 | ||||||||||||||||||||||||
| 3369 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 3370 | case Qt::Key_Up: never executed:  case Qt::Key_Up: | 0 | ||||||||||||||||||||||||
| 3371 | if (keyEvent->modifiers() & Qt::ShiftModifier) 
 | 0 | ||||||||||||||||||||||||
| 3372 | delta = QPoint(0, -d->keyboardPageStep); never executed:  delta = QPoint(0, -d->keyboardPageStep); | 0 | ||||||||||||||||||||||||
| 3373 | else | - | ||||||||||||||||||||||||
| 3374 | delta = QPoint(0, -d->keyboardSingleStep); never executed:  delta = QPoint(0, -d->keyboardSingleStep); | 0 | ||||||||||||||||||||||||
| 3375 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 3376 | case Qt::Key_Left: never executed:  case Qt::Key_Left: | 0 | ||||||||||||||||||||||||
| 3377 | if (keyEvent->modifiers() & Qt::ShiftModifier) 
 | 0 | ||||||||||||||||||||||||
| 3378 | delta = QPoint(-d->keyboardPageStep, 0); never executed:  delta = QPoint(-d->keyboardPageStep, 0); | 0 | ||||||||||||||||||||||||
| 3379 | else | - | ||||||||||||||||||||||||
| 3380 | delta = QPoint(-d->keyboardSingleStep, 0); never executed:  delta = QPoint(-d->keyboardSingleStep, 0); | 0 | ||||||||||||||||||||||||
| 3381 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 3382 | case Qt::Key_Down: never executed:  case Qt::Key_Down: | 0 | ||||||||||||||||||||||||
| 3383 | if (keyEvent->modifiers() & Qt::ShiftModifier) 
 | 0 | ||||||||||||||||||||||||
| 3384 | delta = QPoint(0, d->keyboardPageStep); never executed:  delta = QPoint(0, d->keyboardPageStep); | 0 | ||||||||||||||||||||||||
| 3385 | else | - | ||||||||||||||||||||||||
| 3386 | delta = QPoint(0, d->keyboardSingleStep); never executed:  delta = QPoint(0, d->keyboardSingleStep); | 0 | ||||||||||||||||||||||||
| 3387 | break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 3388 | case Qt::Key_Escape: never executed:  case Qt::Key_Escape: | 0 | ||||||||||||||||||||||||
| 3389 | case Qt::Key_Return: never executed:  case Qt::Key_Return: | 0 | ||||||||||||||||||||||||
| 3390 | case Qt::Key_Enter: never executed:  case Qt::Key_Enter: | 0 | ||||||||||||||||||||||||
| 3391 | d->leaveInteractiveMode(); | - | ||||||||||||||||||||||||
| 3392 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3393 | default: never executed:  default: | 0 | ||||||||||||||||||||||||
| 3394 | keyEvent->ignore(); | - | ||||||||||||||||||||||||
| 3395 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3396 | } | - | ||||||||||||||||||||||||
| 3397 | - | |||||||||||||||||||||||||
| 3398 | #ifndef QT_NO_CURSOR | - | ||||||||||||||||||||||||
| 3399 | QPoint newPosition = parentWidget()->mapFromGlobal(cursor().pos() + delta); | - | ||||||||||||||||||||||||
| 3400 | QRect oldGeometry = | - | ||||||||||||||||||||||||
| 3401 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 3402 | d->isInRubberBandMode ? d->rubberBand->geometry() : 
 | 0 | ||||||||||||||||||||||||
| 3403 | #endif | - | ||||||||||||||||||||||||
| 3404 | geometry(); | - | ||||||||||||||||||||||||
| 3405 | d->setNewGeometry(newPosition); | - | ||||||||||||||||||||||||
| 3406 | QRect currentGeometry = | - | ||||||||||||||||||||||||
| 3407 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 3408 | d->isInRubberBandMode ? d->rubberBand->geometry() : 
 | 0 | ||||||||||||||||||||||||
| 3409 | #endif | - | ||||||||||||||||||||||||
| 3410 | geometry(); | - | ||||||||||||||||||||||||
| 3411 | if (currentGeometry == oldGeometry) 
 | 0 | ||||||||||||||||||||||||
| 3412 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3413 | - | |||||||||||||||||||||||||
| 3414 | // Update cursor position | - | ||||||||||||||||||||||||
| 3415 | - | |||||||||||||||||||||||||
| 3416 | QPoint actualDelta; | - | ||||||||||||||||||||||||
| 3417 | if (d->isMoveOperation()) { 
 | 0 | ||||||||||||||||||||||||
| 3418 | actualDelta = QPoint(currentGeometry.x() - oldGeometry.x(), | - | ||||||||||||||||||||||||
| 3419 | currentGeometry.y() - oldGeometry.y()); | - | ||||||||||||||||||||||||
| 3420 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3421 | int dx = isLeftToRight() ? currentGeometry.width() - oldGeometry.width() 
 | 0 | ||||||||||||||||||||||||
| 3422 | : currentGeometry.x() - oldGeometry.x(); | - | ||||||||||||||||||||||||
| 3423 | actualDelta = QPoint(dx, currentGeometry.height() - oldGeometry.height()); | - | ||||||||||||||||||||||||
| 3424 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3425 | - | |||||||||||||||||||||||||
| 3426 | // Adjust in case we weren't able to move as long as wanted. | - | ||||||||||||||||||||||||
| 3427 | if (actualDelta != delta) 
 | 0 | ||||||||||||||||||||||||
| 3428 | newPosition += (actualDelta - delta); never executed:  newPosition += (actualDelta - delta); | 0 | ||||||||||||||||||||||||
| 3429 | cursor().setPos(parentWidget()->mapToGlobal(newPosition)); | - | ||||||||||||||||||||||||
| 3430 | #endif | - | ||||||||||||||||||||||||
| 3431 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3432 | - | |||||||||||||||||||||||||
| 3433 | #ifndef QT_NO_CONTEXTMENU | - | ||||||||||||||||||||||||
| 3434 | /*! | - | ||||||||||||||||||||||||
| 3435 | \reimp | - | ||||||||||||||||||||||||
| 3436 | */ | - | ||||||||||||||||||||||||
| 3437 | void QMdiSubWindow::contextMenuEvent(QContextMenuEvent *contextMenuEvent) | - | ||||||||||||||||||||||||
| 3438 | { | - | ||||||||||||||||||||||||
| 3439 | Q_D(QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3440 | if (!d->systemMenu) { 
 | 0 | ||||||||||||||||||||||||
| 3441 | contextMenuEvent->ignore(); | - | ||||||||||||||||||||||||
| 3442 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3443 | } | - | ||||||||||||||||||||||||
| 3444 | - | |||||||||||||||||||||||||
| 3445 | if (d->hoveredSubControl == QStyle::SC_TitleBarSysMenu 
 | 0 | ||||||||||||||||||||||||
| 3446 | || d->getRegion(QMdiSubWindowPrivate::Move).contains(contextMenuEvent->pos())) { 
 | 0 | ||||||||||||||||||||||||
| 3447 | d->systemMenu->exec(contextMenuEvent->globalPos()); | - | ||||||||||||||||||||||||
| 3448 | } else { never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3449 | contextMenuEvent->ignore(); | - | ||||||||||||||||||||||||
| 3450 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3451 | } | - | ||||||||||||||||||||||||
| 3452 | #endif // QT_NO_CONTEXTMENU | - | ||||||||||||||||||||||||
| 3453 | - | |||||||||||||||||||||||||
| 3454 | /*! | - | ||||||||||||||||||||||||
| 3455 | \reimp | - | ||||||||||||||||||||||||
| 3456 | */ | - | ||||||||||||||||||||||||
| 3457 | void QMdiSubWindow::focusInEvent(QFocusEvent *focusInEvent) | - | ||||||||||||||||||||||||
| 3458 | { | - | ||||||||||||||||||||||||
| 3459 | d_func()->focusInReason = focusInEvent->reason(); | - | ||||||||||||||||||||||||
| 3460 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3461 | - | |||||||||||||||||||||||||
| 3462 | /*! | - | ||||||||||||||||||||||||
| 3463 | \reimp | - | ||||||||||||||||||||||||
| 3464 | */ | - | ||||||||||||||||||||||||
| 3465 | void QMdiSubWindow::focusOutEvent(QFocusEvent * /*focusOutEvent*/) | - | ||||||||||||||||||||||||
| 3466 | { | - | ||||||||||||||||||||||||
| 3467 | // To avoid update() in QWidget::focusOutEvent. | - | ||||||||||||||||||||||||
| 3468 | } | - | ||||||||||||||||||||||||
| 3469 | - | |||||||||||||||||||||||||
| 3470 | /*! | - | ||||||||||||||||||||||||
| 3471 | \reimp | - | ||||||||||||||||||||||||
| 3472 | */ | - | ||||||||||||||||||||||||
| 3473 | void QMdiSubWindow::childEvent(QChildEvent *childEvent) | - | ||||||||||||||||||||||||
| 3474 | { | - | ||||||||||||||||||||||||
| 3475 | if (childEvent->type() != QEvent::ChildPolished) 
 | 0 | ||||||||||||||||||||||||
| 3476 | return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 3477 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 3478 | if (QSizeGrip *sizeGrip = qobject_cast<QSizeGrip *>(childEvent->child())) 
 | 0 | ||||||||||||||||||||||||
| 3479 | d_func()->setSizeGrip(sizeGrip); never executed:  d_func()->setSizeGrip(sizeGrip); | 0 | ||||||||||||||||||||||||
| 3480 | #endif | - | ||||||||||||||||||||||||
| 3481 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3482 | - | |||||||||||||||||||||||||
| 3483 | /*! | - | ||||||||||||||||||||||||
| 3484 | \reimp | - | ||||||||||||||||||||||||
| 3485 | */ | - | ||||||||||||||||||||||||
| 3486 | QSize QMdiSubWindow::sizeHint() const | - | ||||||||||||||||||||||||
| 3487 | { | - | ||||||||||||||||||||||||
| 3488 | Q_D(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3489 | int margin, minWidth; | - | ||||||||||||||||||||||||
| 3490 | d->sizeParameters(&margin, &minWidth); | - | ||||||||||||||||||||||||
| 3491 | QSize size(2 * margin, d->titleBarHeight() + margin); | - | ||||||||||||||||||||||||
| 3492 | if (d->baseWidget && d->baseWidget->sizeHint().isValid()) 
 
 | 0 | ||||||||||||||||||||||||
| 3493 | size += d->baseWidget->sizeHint(); never executed:  size += d->baseWidget->sizeHint(); | 0 | ||||||||||||||||||||||||
| 3494 | return size.expandedTo(minimumSizeHint()); never executed:  return size.expandedTo(minimumSizeHint()); | 0 | ||||||||||||||||||||||||
| 3495 | } | - | ||||||||||||||||||||||||
| 3496 | - | |||||||||||||||||||||||||
| 3497 | /*! | - | ||||||||||||||||||||||||
| 3498 | \reimp | - | ||||||||||||||||||||||||
| 3499 | */ | - | ||||||||||||||||||||||||
| 3500 | QSize QMdiSubWindow::minimumSizeHint() const | - | ||||||||||||||||||||||||
| 3501 | { | - | ||||||||||||||||||||||||
| 3502 | Q_D(const QMdiSubWindow); | - | ||||||||||||||||||||||||
| 3503 | if (isVisible()) 
 | 0 | ||||||||||||||||||||||||
| 3504 | ensurePolished(); never executed:  ensurePolished(); | 0 | ||||||||||||||||||||||||
| 3505 | - | |||||||||||||||||||||||||
| 3506 | // Minimized window. | - | ||||||||||||||||||||||||
| 3507 | if (parent() && isMinimized() && !isShaded()) 
 
 
 | 0 | ||||||||||||||||||||||||
| 3508 | return d->iconSize(); never executed:  return d->iconSize(); | 0 | ||||||||||||||||||||||||
| 3509 | - | |||||||||||||||||||||||||
| 3510 | // Calculate window decoration. | - | ||||||||||||||||||||||||
| 3511 | int margin, minWidth; | - | ||||||||||||||||||||||||
| 3512 | d->sizeParameters(&margin, &minWidth); | - | ||||||||||||||||||||||||
| 3513 | int decorationHeight = margin + d->titleBarHeight(); | - | ||||||||||||||||||||||||
| 3514 | int minHeight = decorationHeight; | - | ||||||||||||||||||||||||
| 3515 | - | |||||||||||||||||||||||||
| 3516 | // Shaded window. | - | ||||||||||||||||||||||||
| 3517 | if (parent() && isShaded()) 
 
 | 0 | ||||||||||||||||||||||||
| 3518 | return QSize(qMax(minWidth, width()), d->titleBarHeight()); never executed:  return QSize(qMax(minWidth, width()), d->titleBarHeight()); | 0 | ||||||||||||||||||||||||
| 3519 | - | |||||||||||||||||||||||||
| 3520 | // Content | - | ||||||||||||||||||||||||
| 3521 | if (layout()) { 
 | 0 | ||||||||||||||||||||||||
| 3522 | QSize minLayoutSize = layout()->minimumSize(); | - | ||||||||||||||||||||||||
| 3523 | if (minLayoutSize.isValid()) { 
 | 0 | ||||||||||||||||||||||||
| 3524 | minWidth = qMax(minWidth, minLayoutSize.width() + 2 * margin); | - | ||||||||||||||||||||||||
| 3525 | minHeight += minLayoutSize.height(); | - | ||||||||||||||||||||||||
| 3526 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3527 | } else if (d->baseWidget && d->baseWidget->isVisible()) { never executed:  end of block
 
 | 0 | ||||||||||||||||||||||||
| 3528 | QSize minBaseWidgetSize = d->baseWidget->minimumSizeHint(); | - | ||||||||||||||||||||||||
| 3529 | if (minBaseWidgetSize.isValid()) { 
 | 0 | ||||||||||||||||||||||||
| 3530 | minWidth = qMax(minWidth, minBaseWidgetSize.width() + 2 * margin); | - | ||||||||||||||||||||||||
| 3531 | minHeight += minBaseWidgetSize.height(); | - | ||||||||||||||||||||||||
| 3532 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3533 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 3534 | - | |||||||||||||||||||||||||
| 3535 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 3536 | // SizeGrip | - | ||||||||||||||||||||||||
| 3537 | int sizeGripHeight = 0; | - | ||||||||||||||||||||||||
| 3538 | if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this))) 
 
 | 0 | ||||||||||||||||||||||||
| 3539 | sizeGripHeight = d->sizeGrip->height(); never executed:  sizeGripHeight = d->sizeGrip->height(); | 0 | ||||||||||||||||||||||||
| 3540 | #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) | - | ||||||||||||||||||||||||
| 3541 | else if (parent() && qobject_cast<QMacStyle *>(style()) && !d->sizeGrip) | - | ||||||||||||||||||||||||
| 3542 | sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this); | - | ||||||||||||||||||||||||
| 3543 | #endif | - | ||||||||||||||||||||||||
| 3544 | minHeight = qMax(minHeight, decorationHeight + sizeGripHeight); | - | ||||||||||||||||||||||||
| 3545 | #endif | - | ||||||||||||||||||||||||
| 3546 | - | |||||||||||||||||||||||||
| 3547 | return QSize(minWidth, minHeight).expandedTo(QApplication::globalStrut()); never executed:  return QSize(minWidth, minHeight).expandedTo(QApplication::globalStrut()); | 0 | ||||||||||||||||||||||||
| 3548 | } | - | ||||||||||||||||||||||||
| 3549 | - | |||||||||||||||||||||||||
| 3550 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| 3551 | - | |||||||||||||||||||||||||
| 3552 | #include "moc_qmdisubwindow.cpp" | - | ||||||||||||||||||||||||
| 3553 | #include "qmdisubwindow.moc" | - | ||||||||||||||||||||||||
| 3554 | - | |||||||||||||||||||||||||
| 3555 | #endif //QT_NO_MDIAREA | - | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |