| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtGui 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 Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | | - |
| 42 | #include "qabstractscrollarea.h" | - |
| 43 | | - |
| 44 | #ifndef QT_NO_SCROLLAREA | - |
| 45 | | - |
| 46 | #include "qscrollbar.h" | - |
| 47 | #include "qapplication.h" | - |
| 48 | #include "qstyle.h" | - |
| 49 | #include "qstyleoption.h" | - |
| 50 | #include "qevent.h" | - |
| 51 | #include "qdebug.h" | - |
| 52 | #include "qboxlayout.h" | - |
| 53 | #include "qpainter.h" | - |
| 54 | #include "qmargins.h" | - |
| 55 | #include "qheaderview.h" | - |
| 56 | | - |
| 57 | #include <QDebug> | - |
| 58 | | - |
| 59 | #include "qabstractscrollarea_p.h" | - |
| 60 | #include "qscrollbar_p.h" | - |
| 61 | #include <qwidget.h> | - |
| 62 | | - |
| 63 | #include <private/qapplication_p.h> | - |
| 64 | | - |
| 65 | #ifdef Q_WS_MAC | - |
| 66 | #include <private/qt_mac_p.h> | - |
| 67 | #include <private/qt_cocoa_helpers_mac_p.h> | - |
| 68 | #endif | - |
| 69 | #ifdef Q_OS_WIN | - |
| 70 | # include <qlibrary.h> | - |
| 71 | # include <qt_windows.h> | - |
| 72 | #endif | - |
| 73 | | - |
| 74 | QT_BEGIN_NAMESPACE | - |
| 75 | | - |
| 76 | /*! | - |
| 77 | \class QAbstractScrollArea | - |
| 78 | \brief The QAbstractScrollArea widget provides a scrolling area with | - |
| 79 | on-demand scroll bars. | - |
| 80 | | - |
| 81 | \ingroup abstractwidgets | - |
| 82 | \inmodule QtWidgets | - |
| 83 | | - |
| 84 | QAbstractScrollArea is a low-level abstraction of a scrolling | - |
| 85 | area. The area provides a central widget called the viewport, in | - |
| 86 | which the contents of the area is to be scrolled (i.e, the | - |
| 87 | visible parts of the contents are rendered in the viewport). | - |
| 88 | | - |
| 89 | Next to the viewport is a vertical scroll bar, and below is a | - |
| 90 | horizontal scroll bar. When all of the area contents fits in the | - |
| 91 | viewport, each scroll bar can be either visible or hidden | - |
| 92 | depending on the scroll bar's Qt::ScrollBarPolicy. When a scroll | - |
| 93 | bar is hidden, the viewport expands in order to cover all | - |
| 94 | available space. When a scroll bar becomes visible again, the | - |
| 95 | viewport shrinks in order to make room for the scroll bar. | - |
| 96 | | - |
| 97 | It is possible to reserve a margin area around the viewport, see | - |
| 98 | setViewportMargins(). The feature is mostly used to place a | - |
| 99 | QHeaderView widget above or beside the scrolling area. Subclasses | - |
| 100 | of QAbstractScrollArea should implement margins. | - |
| 101 | | - |
| 102 | When inheriting QAbstractScrollArea, you need to do the | - |
| 103 | following: | - |
| 104 | | - |
| 105 | \list | - |
| 106 | \li Control the scroll bars by setting their | - |
| 107 | range, value, page step, and tracking their | - |
| 108 | movements. | - |
| 109 | \li Draw the contents of the area in the viewport according | - |
| 110 | to the values of the scroll bars. | - |
| 111 | \li Handle events received by the viewport in | - |
| 112 | viewportEvent() - notably resize events. | - |
| 113 | \li Use \c{viewport->update()} to update the contents of the | - |
| 114 | viewport instead of \l{QWidget::update()}{update()} | - |
| 115 | as all painting operations take place on the viewport. | - |
| 116 | \endlist | - |
| 117 | | - |
| 118 | With a scroll bar policy of Qt::ScrollBarAsNeeded (the default), | - |
| 119 | QAbstractScrollArea shows scroll bars when they provide a non-zero | - |
| 120 | scrolling range, and hides them otherwise. | - |
| 121 | | - |
| 122 | The scroll bars and viewport should be updated whenever the viewport | - |
| 123 | receives a resize event or the size of the contents changes. | - |
| 124 | The viewport also needs to be updated when the scroll bars | - |
| 125 | values change. The initial values of the scroll bars are often | - |
| 126 | set when the area receives new contents. | - |
| 127 | | - |
| 128 | We give a simple example, in which we have implemented a scroll area | - |
| 129 | that can scroll any QWidget. We make the widget a child of the | - |
| 130 | viewport; this way, we do not have to calculate which part of | - |
| 131 | the widget to draw but can simply move the widget with | - |
| 132 | QWidget::move(). When the area contents or the viewport size | - |
| 133 | changes, we do the following: | - |
| 134 | | - |
| 135 | \snippet myscrollarea.cpp 1 | - |
| 136 | | - |
| 137 | When the scroll bars change value, we need to update the widget | - |
| 138 | position, i.e., find the part of the widget that is to be drawn in | - |
| 139 | the viewport: | - |
| 140 | | - |
| 141 | \snippet myscrollarea.cpp 0 | - |
| 142 | | - |
| 143 | In order to track scroll bar movements, reimplement the virtual | - |
| 144 | function scrollContentsBy(). In order to fine-tune scrolling | - |
| 145 | behavior, connect to a scroll bar's | - |
| 146 | QAbstractSlider::actionTriggered() signal and adjust the \l | - |
| 147 | QAbstractSlider::sliderPosition as you wish. | - |
| 148 | | - |
| 149 | For convenience, QAbstractScrollArea makes all viewport events | - |
| 150 | available in the virtual viewportEvent() handler. QWidget's | - |
| 151 | specialized handlers are remapped to viewport events in the cases | - |
| 152 | where this makes sense. The remapped specialized handlers are: | - |
| 153 | paintEvent(), mousePressEvent(), mouseReleaseEvent(), | - |
| 154 | mouseDoubleClickEvent(), mouseMoveEvent(), wheelEvent(), | - |
| 155 | dragEnterEvent(), dragMoveEvent(), dragLeaveEvent(), dropEvent(), | - |
| 156 | contextMenuEvent(), and resizeEvent(). | - |
| 157 | | - |
| 158 | QScrollArea, which inherits QAbstractScrollArea, provides smooth | - |
| 159 | scrolling for any QWidget (i.e., the widget is scrolled pixel by | - |
| 160 | pixel). You only need to subclass QAbstractScrollArea if you need | - |
| 161 | more specialized behavior. This is, for instance, true if the | - |
| 162 | entire contents of the area is not suitable for being drawn on a | - |
| 163 | QWidget or if you do not want smooth scrolling. | - |
| 164 | | - |
| 165 | \sa QScrollArea | - |
| 166 | */ | - |
| 167 | | - |
| 168 | QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate() | - |
| 169 | :hbar(0), vbar(0), vbarpolicy(Qt::ScrollBarAsNeeded), hbarpolicy(Qt::ScrollBarAsNeeded), | - |
| 170 | viewport(0), cornerWidget(0), left(0), top(0), right(0), bottom(0), | - |
| 171 | xoffset(0), yoffset(0), viewportFilter(0) | - |
| 172 | #ifdef Q_WS_WIN | - |
| 173 | , singleFingerPanEnabled(false) | - |
| 174 | #endif | - |
| 175 | { | - |
| 176 | } executed: }Execution Count:5100 | 5100 |
| 177 | | - |
| 178 | QAbstractScrollAreaScrollBarContainer::QAbstractScrollAreaScrollBarContainer(Qt::Orientation orientation, QWidget *parent) | - |
| 179 | :QWidget(parent), scrollBar(new QScrollBar(orientation, this)), | - |
| 180 | layout(new QBoxLayout(orientation == Qt::Horizontal ? QBoxLayout::LeftToRight : QBoxLayout::TopToBottom)), | - |
| 181 | orientation(orientation) | - |
| 182 | { | - |
| 183 | setLayout(layout); executed (the execution status of this line is deduced): setLayout(layout); | - |
| 184 | layout->setMargin(0); executed (the execution status of this line is deduced): layout->setMargin(0); | - |
| 185 | layout->setSpacing(0); executed (the execution status of this line is deduced): layout->setSpacing(0); | - |
| 186 | layout->addWidget(scrollBar); executed (the execution status of this line is deduced): layout->addWidget(scrollBar); | - |
| 187 | layout->setSizeConstraint(QLayout::SetMaximumSize); executed (the execution status of this line is deduced): layout->setSizeConstraint(QLayout::SetMaximumSize); | - |
| 188 | } executed: }Execution Count:10200 | 10200 |
| 189 | | - |
| 190 | /*! \internal | - |
| 191 | Adds a widget to the scroll bar container. | - |
| 192 | */ | - |
| 193 | void QAbstractScrollAreaScrollBarContainer::addWidget(QWidget *widget, LogicalPosition position) | - |
| 194 | { | - |
| 195 | QSizePolicy policy = widget->sizePolicy(); executed (the execution status of this line is deduced): QSizePolicy policy = widget->sizePolicy(); | - |
| 196 | if (orientation == Qt::Vertical) evaluated: orientation == Qt::Vertical| yes Evaluation Count:8 | yes Evaluation Count:5 |
| 5-8 |
| 197 | policy.setHorizontalPolicy(QSizePolicy::Ignored); executed: policy.setHorizontalPolicy(QSizePolicy::Ignored);Execution Count:8 | 8 |
| 198 | else | - |
| 199 | policy.setVerticalPolicy(QSizePolicy::Ignored); executed: policy.setVerticalPolicy(QSizePolicy::Ignored);Execution Count:5 | 5 |
| 200 | widget->setSizePolicy(policy); executed (the execution status of this line is deduced): widget->setSizePolicy(policy); | - |
| 201 | widget->setParent(this); executed (the execution status of this line is deduced): widget->setParent(this); | - |
| 202 | | - |
| 203 | const int insertIndex = (position & LogicalLeft) ? 0 : scrollBarLayoutIndex() + 1; evaluated: (position & LogicalLeft)| yes Evaluation Count:5 | yes Evaluation Count:8 |
| 5-8 |
| 204 | layout->insertWidget(insertIndex, widget); executed (the execution status of this line is deduced): layout->insertWidget(insertIndex, widget); | - |
| 205 | } executed: }Execution Count:13 | 13 |
| 206 | | - |
| 207 | /*! \internal | - |
| 208 | Retuns a list of scroll bar widgets for the given position. The scroll bar | - |
| 209 | itself is not returned. | - |
| 210 | */ | - |
| 211 | QWidgetList QAbstractScrollAreaScrollBarContainer::widgets(LogicalPosition position) | - |
| 212 | { | - |
| 213 | QWidgetList list; executed (the execution status of this line is deduced): QWidgetList list; | - |
| 214 | const int scrollBarIndex = scrollBarLayoutIndex(); executed (the execution status of this line is deduced): const int scrollBarIndex = scrollBarLayoutIndex(); | - |
| 215 | if (position == LogicalLeft) { evaluated: position == LogicalLeft| yes Evaluation Count:30 | yes Evaluation Count:30 |
| 30 |
| 216 | for (int i = 0; i < scrollBarIndex; ++i) evaluated: i < scrollBarIndex| yes Evaluation Count:12 | yes Evaluation Count:30 |
| 12-30 |
| 217 | list.append(layout->itemAt(i)->widget()); executed: list.append(layout->itemAt(i)->widget());Execution Count:12 | 12 |
| 218 | } else if (position == LogicalRight) { executed: }Execution Count:30 partially evaluated: position == LogicalRight| yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-30 |
| 219 | const int layoutItemCount = layout->count(); executed (the execution status of this line is deduced): const int layoutItemCount = layout->count(); | - |
| 220 | for (int i = scrollBarIndex + 1; i < layoutItemCount; ++i) evaluated: i < layoutItemCount| yes Evaluation Count:10 | yes Evaluation Count:30 |
| 10-30 |
| 221 | list.append(layout->itemAt(i)->widget()); executed: list.append(layout->itemAt(i)->widget());Execution Count:10 | 10 |
| 222 | } executed: }Execution Count:30 | 30 |
| 223 | return list; executed: return list;Execution Count:60 | 60 |
| 224 | } | - |
| 225 | | - |
| 226 | /*! \internal | - |
| 227 | Returns the layout index for the scroll bar. This needs to be | - |
| 228 | recalculated by a linear search for each use, since items in | - |
| 229 | the layout can be removed at any time (i.e. when a widget is | - |
| 230 | deleted or re-parented). | - |
| 231 | */ | - |
| 232 | int QAbstractScrollAreaScrollBarContainer::scrollBarLayoutIndex() const | - |
| 233 | { | - |
| 234 | const int layoutItemCount = layout->count(); executed (the execution status of this line is deduced): const int layoutItemCount = layout->count(); | - |
| 235 | for (int i = 0; i < layoutItemCount; ++i) { partially evaluated: i < layoutItemCount| yes Evaluation Count:100 | no Evaluation Count:0 |
| 0-100 |
| 236 | if (qobject_cast<QScrollBar *>(layout->itemAt(i)->widget())) evaluated: qobject_cast<QScrollBar *>(layout->itemAt(i)->widget())| yes Evaluation Count:68 | yes Evaluation Count:32 |
| 32-68 |
| 237 | return i; executed: return i;Execution Count:68 | 68 |
| 238 | } executed: }Execution Count:32 | 32 |
| 239 | return -1; never executed: return -1; | 0 |
| 240 | } | - |
| 241 | | - |
| 242 | /*! \internal | - |
| 243 | */ | - |
| 244 | void QAbstractScrollAreaPrivate::replaceScrollBar(QScrollBar *scrollBar, | - |
| 245 | Qt::Orientation orientation) | - |
| 246 | { | - |
| 247 | Q_Q(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollArea * const q = q_func(); | - |
| 248 | | - |
| 249 | QAbstractScrollAreaScrollBarContainer *container = scrollBarContainers[orientation]; executed (the execution status of this line is deduced): QAbstractScrollAreaScrollBarContainer *container = scrollBarContainers[orientation]; | - |
| 250 | bool horizontal = (orientation == Qt::Horizontal); executed (the execution status of this line is deduced): bool horizontal = (orientation == Qt::Horizontal); | - |
| 251 | QScrollBar *oldBar = horizontal ? hbar : vbar; evaluated: horizontal| yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
| 252 | if (horizontal) evaluated: horizontal| yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
| 253 | hbar = scrollBar; executed: hbar = scrollBar;Execution Count:4 | 4 |
| 254 | else | - |
| 255 | vbar = scrollBar; executed: vbar = scrollBar;Execution Count:4 | 4 |
| 256 | scrollBar->setParent(container); executed (the execution status of this line is deduced): scrollBar->setParent(container); | - |
| 257 | container->scrollBar = scrollBar; executed (the execution status of this line is deduced): container->scrollBar = scrollBar; | - |
| 258 | container->layout->removeWidget(oldBar); executed (the execution status of this line is deduced): container->layout->removeWidget(oldBar); | - |
| 259 | container->layout->insertWidget(0, scrollBar); executed (the execution status of this line is deduced): container->layout->insertWidget(0, scrollBar); | - |
| 260 | scrollBar->setVisible(oldBar->isVisibleTo(container)); executed (the execution status of this line is deduced): scrollBar->setVisible(oldBar->isVisibleTo(container)); | - |
| 261 | scrollBar->setInvertedAppearance(oldBar->invertedAppearance()); executed (the execution status of this line is deduced): scrollBar->setInvertedAppearance(oldBar->invertedAppearance()); | - |
| 262 | scrollBar->setInvertedControls(oldBar->invertedControls()); executed (the execution status of this line is deduced): scrollBar->setInvertedControls(oldBar->invertedControls()); | - |
| 263 | scrollBar->setRange(oldBar->minimum(), oldBar->maximum()); executed (the execution status of this line is deduced): scrollBar->setRange(oldBar->minimum(), oldBar->maximum()); | - |
| 264 | scrollBar->setOrientation(oldBar->orientation()); executed (the execution status of this line is deduced): scrollBar->setOrientation(oldBar->orientation()); | - |
| 265 | scrollBar->setPageStep(oldBar->pageStep()); executed (the execution status of this line is deduced): scrollBar->setPageStep(oldBar->pageStep()); | - |
| 266 | scrollBar->setSingleStep(oldBar->singleStep()); executed (the execution status of this line is deduced): scrollBar->setSingleStep(oldBar->singleStep()); | - |
| 267 | scrollBar->setSliderDown(oldBar->isSliderDown()); executed (the execution status of this line is deduced): scrollBar->setSliderDown(oldBar->isSliderDown()); | - |
| 268 | scrollBar->setSliderPosition(oldBar->sliderPosition()); executed (the execution status of this line is deduced): scrollBar->setSliderPosition(oldBar->sliderPosition()); | - |
| 269 | scrollBar->setTracking(oldBar->hasTracking()); executed (the execution status of this line is deduced): scrollBar->setTracking(oldBar->hasTracking()); | - |
| 270 | scrollBar->setValue(oldBar->value()); executed (the execution status of this line is deduced): scrollBar->setValue(oldBar->value()); | - |
| 271 | scrollBar->installEventFilter(q); executed (the execution status of this line is deduced): scrollBar->installEventFilter(q); | - |
| 272 | oldBar->removeEventFilter(q); executed (the execution status of this line is deduced): oldBar->removeEventFilter(q); | - |
| 273 | delete oldBar; executed (the execution status of this line is deduced): delete oldBar; | - |
| 274 | | - |
| 275 | QObject::connect(scrollBar, SIGNAL(valueChanged(int)), executed (the execution status of this line is deduced): QObject::connect(scrollBar, "2""valueChanged(int)", | - |
| 276 | q, horizontal ? SLOT(_q_hslide(int)) : SLOT(_q_vslide(int))); executed (the execution status of this line is deduced): q, horizontal ? "1""_q_hslide(int)" : "1""_q_vslide(int)"); | - |
| 277 | QObject::connect(scrollBar, SIGNAL(rangeChanged(int,int)), executed (the execution status of this line is deduced): QObject::connect(scrollBar, "2""rangeChanged(int,int)", | - |
| 278 | q, SLOT(_q_showOrHideScrollBars()), Qt::QueuedConnection); executed (the execution status of this line is deduced): q, "1""_q_showOrHideScrollBars()", Qt::QueuedConnection); | - |
| 279 | } executed: }Execution Count:8 | 8 |
| 280 | | - |
| 281 | void QAbstractScrollAreaPrivate::init() | - |
| 282 | { | - |
| 283 | Q_Q(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollArea * const q = q_func(); | - |
| 284 | viewport = new QWidget(q); executed (the execution status of this line is deduced): viewport = new QWidget(q); | - |
| 285 | viewport->setObjectName(QLatin1String("qt_scrollarea_viewport")); executed (the execution status of this line is deduced): viewport->setObjectName(QLatin1String("qt_scrollarea_viewport")); | - |
| 286 | viewport->setBackgroundRole(QPalette::Base); executed (the execution status of this line is deduced): viewport->setBackgroundRole(QPalette::Base); | - |
| 287 | viewport->setAutoFillBackground(true); executed (the execution status of this line is deduced): viewport->setAutoFillBackground(true); | - |
| 288 | scrollBarContainers[Qt::Horizontal] = new QAbstractScrollAreaScrollBarContainer(Qt::Horizontal, q); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Horizontal] = new QAbstractScrollAreaScrollBarContainer(Qt::Horizontal, q); | - |
| 289 | scrollBarContainers[Qt::Horizontal]->setObjectName(QLatin1String("qt_scrollarea_hcontainer")); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Horizontal]->setObjectName(QLatin1String("qt_scrollarea_hcontainer")); | - |
| 290 | hbar = scrollBarContainers[Qt::Horizontal]->scrollBar; executed (the execution status of this line is deduced): hbar = scrollBarContainers[Qt::Horizontal]->scrollBar; | - |
| 291 | hbar->setRange(0,0); executed (the execution status of this line is deduced): hbar->setRange(0,0); | - |
| 292 | scrollBarContainers[Qt::Horizontal]->setVisible(false); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Horizontal]->setVisible(false); | - |
| 293 | hbar->installEventFilter(q); executed (the execution status of this line is deduced): hbar->installEventFilter(q); | - |
| 294 | QObject::connect(hbar, SIGNAL(valueChanged(int)), q, SLOT(_q_hslide(int))); executed (the execution status of this line is deduced): QObject::connect(hbar, "2""valueChanged(int)", q, "1""_q_hslide(int)"); | - |
| 295 | QObject::connect(hbar, SIGNAL(rangeChanged(int,int)), q, SLOT(_q_showOrHideScrollBars()), Qt::QueuedConnection); executed (the execution status of this line is deduced): QObject::connect(hbar, "2""rangeChanged(int,int)", q, "1""_q_showOrHideScrollBars()", Qt::QueuedConnection); | - |
| 296 | scrollBarContainers[Qt::Vertical] = new QAbstractScrollAreaScrollBarContainer(Qt::Vertical, q); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Vertical] = new QAbstractScrollAreaScrollBarContainer(Qt::Vertical, q); | - |
| 297 | scrollBarContainers[Qt::Vertical]->setObjectName(QLatin1String("qt_scrollarea_vcontainer")); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Vertical]->setObjectName(QLatin1String("qt_scrollarea_vcontainer")); | - |
| 298 | vbar = scrollBarContainers[Qt::Vertical]->scrollBar; executed (the execution status of this line is deduced): vbar = scrollBarContainers[Qt::Vertical]->scrollBar; | - |
| 299 | vbar->setRange(0,0); executed (the execution status of this line is deduced): vbar->setRange(0,0); | - |
| 300 | scrollBarContainers[Qt::Vertical]->setVisible(false); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Vertical]->setVisible(false); | - |
| 301 | vbar->installEventFilter(q); executed (the execution status of this line is deduced): vbar->installEventFilter(q); | - |
| 302 | QObject::connect(vbar, SIGNAL(valueChanged(int)), q, SLOT(_q_vslide(int))); executed (the execution status of this line is deduced): QObject::connect(vbar, "2""valueChanged(int)", q, "1""_q_vslide(int)"); | - |
| 303 | QObject::connect(vbar, SIGNAL(rangeChanged(int,int)), q, SLOT(_q_showOrHideScrollBars()), Qt::QueuedConnection); executed (the execution status of this line is deduced): QObject::connect(vbar, "2""rangeChanged(int,int)", q, "1""_q_showOrHideScrollBars()", Qt::QueuedConnection); | - |
| 304 | viewportFilter.reset(new QAbstractScrollAreaFilter(this)); executed (the execution status of this line is deduced): viewportFilter.reset(new QAbstractScrollAreaFilter(this)); | - |
| 305 | viewport->installEventFilter(viewportFilter.data()); executed (the execution status of this line is deduced): viewport->installEventFilter(viewportFilter.data()); | - |
| 306 | viewport->setFocusProxy(q); executed (the execution status of this line is deduced): viewport->setFocusProxy(q); | - |
| 307 | q->setFocusPolicy(Qt::WheelFocus); executed (the execution status of this line is deduced): q->setFocusPolicy(Qt::WheelFocus); | - |
| 308 | q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); executed (the execution status of this line is deduced): q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); | - |
| 309 | q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); executed (the execution status of this line is deduced): q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | - |
| 310 | layoutChildren(); executed (the execution status of this line is deduced): layoutChildren(); | - |
| 311 | #ifndef Q_WS_MAC | - |
| 312 | # ifndef QT_NO_GESTURES | - |
| 313 | viewport->grabGesture(Qt::PanGesture); executed (the execution status of this line is deduced): viewport->grabGesture(Qt::PanGesture); | - |
| 314 | # endif | - |
| 315 | #endif | - |
| 316 | } executed: }Execution Count:5100 | 5100 |
| 317 | | - |
| 318 | #ifdef Q_WS_WIN | - |
| 319 | void QAbstractScrollAreaPrivate::setSingleFingerPanEnabled(bool on) | - |
| 320 | { | - |
| 321 | singleFingerPanEnabled = on; | - |
| 322 | QWidgetPrivate *dd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(viewport)); | - |
| 323 | if (dd) | - |
| 324 | dd->winSetupGestures(); | - |
| 325 | } | - |
| 326 | #endif // Q_WS_WIN | - |
| 327 | | - |
| 328 | void QAbstractScrollAreaPrivate::layoutChildren() | - |
| 329 | { | - |
| 330 | Q_Q(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollArea * const q = q_func(); | - |
| 331 | bool transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar ? vbar : hbar); executed (the execution status of this line is deduced): bool transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar ? vbar : hbar); | - |
| 332 | bool needh = (hbarpolicy != Qt::ScrollBarAlwaysOff) && ((hbarpolicy == Qt::ScrollBarAlwaysOn && !transient) evaluated: (hbarpolicy != Qt::ScrollBarAlwaysOff)| yes Evaluation Count:15161 | yes Evaluation Count:13037 |
evaluated: hbarpolicy == Qt::ScrollBarAlwaysOn| yes Evaluation Count:225 | yes Evaluation Count:14936 |
partially evaluated: !transient| yes Evaluation Count:225 | no Evaluation Count:0 |
| 0-15161 |
| 333 | || ((hbarpolicy == Qt::ScrollBarAsNeeded || transient) partially evaluated: hbarpolicy == Qt::ScrollBarAsNeeded| yes Evaluation Count:14936 | no Evaluation Count:0 |
never evaluated: transient | 0-14936 |
| 334 | && hbar->minimum() < hbar->maximum() && !hbar->sizeHint().isEmpty())); evaluated: hbar->minimum() < hbar->maximum()| yes Evaluation Count:2334 | yes Evaluation Count:12602 |
partially evaluated: !hbar->sizeHint().isEmpty()| yes Evaluation Count:2334 | no Evaluation Count:0 |
| 0-12602 |
| 335 | | - |
| 336 | bool needv = (vbarpolicy != Qt::ScrollBarAlwaysOff) && ((vbarpolicy == Qt::ScrollBarAlwaysOn && !transient) evaluated: (vbarpolicy != Qt::ScrollBarAlwaysOff)| yes Evaluation Count:15463 | yes Evaluation Count:12735 |
evaluated: vbarpolicy == Qt::ScrollBarAlwaysOn| yes Evaluation Count:411 | yes Evaluation Count:15052 |
partially evaluated: !transient| yes Evaluation Count:411 | no Evaluation Count:0 |
| 0-15463 |
| 337 | || ((vbarpolicy == Qt::ScrollBarAsNeeded || transient) partially evaluated: vbarpolicy == Qt::ScrollBarAsNeeded| yes Evaluation Count:15052 | no Evaluation Count:0 |
never evaluated: transient | 0-15052 |
| 338 | && vbar->minimum() < vbar->maximum() && !vbar->sizeHint().isEmpty())); evaluated: vbar->minimum() < vbar->maximum()| yes Evaluation Count:3031 | yes Evaluation Count:12021 |
partially evaluated: !vbar->sizeHint().isEmpty()| yes Evaluation Count:3031 | no Evaluation Count:0 |
| 0-12021 |
| 339 | | - |
| 340 | QStyleOption opt(0); executed (the execution status of this line is deduced): QStyleOption opt(0); | - |
| 341 | opt.init(q); executed (the execution status of this line is deduced): opt.init(q); | - |
| 342 | const int scrollOverlap = q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarOverlap, executed (the execution status of this line is deduced): const int scrollOverlap = q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarOverlap, | - |
| 343 | &opt, q); executed (the execution status of this line is deduced): &opt, q); | - |
| 344 | | - |
| 345 | #ifdef Q_WS_MAC | - |
| 346 | QWidget * const window = q->window(); | - |
| 347 | | - |
| 348 | // Use small scroll bars for tool windows, to match the native size grip. | - |
| 349 | bool hbarIsSmall = hbar->testAttribute(Qt::WA_MacSmallSize); | - |
| 350 | bool vbarIsSmall = vbar->testAttribute(Qt::WA_MacSmallSize); | - |
| 351 | const Qt::WindowType windowType = window->windowType(); | - |
| 352 | if (windowType == Qt::Tool) { | - |
| 353 | if (!hbarIsSmall) { | - |
| 354 | hbar->setAttribute(Qt::WA_MacMiniSize, false); | - |
| 355 | hbar->setAttribute(Qt::WA_MacNormalSize, false); | - |
| 356 | hbar->setAttribute(Qt::WA_MacSmallSize, true); | - |
| 357 | } | - |
| 358 | if (!vbarIsSmall) { | - |
| 359 | vbar->setAttribute(Qt::WA_MacMiniSize, false); | - |
| 360 | vbar->setAttribute(Qt::WA_MacNormalSize, false); | - |
| 361 | vbar->setAttribute(Qt::WA_MacSmallSize, true); | - |
| 362 | } | - |
| 363 | } else { | - |
| 364 | if (hbarIsSmall) { | - |
| 365 | hbar->setAttribute(Qt::WA_MacMiniSize, false); | - |
| 366 | hbar->setAttribute(Qt::WA_MacNormalSize, false); | - |
| 367 | hbar->setAttribute(Qt::WA_MacSmallSize, false); | - |
| 368 | } | - |
| 369 | if (vbarIsSmall) { | - |
| 370 | vbar->setAttribute(Qt::WA_MacMiniSize, false); | - |
| 371 | vbar->setAttribute(Qt::WA_MacNormalSize, false); | - |
| 372 | vbar->setAttribute(Qt::WA_MacSmallSize, false); | - |
| 373 | } | - |
| 374 | } | - |
| 375 | #endif | - |
| 376 | | - |
| 377 | const int hsbExt = hbar->sizeHint().height(); executed (the execution status of this line is deduced): const int hsbExt = hbar->sizeHint().height(); | - |
| 378 | const int vsbExt = vbar->sizeHint().width(); executed (the execution status of this line is deduced): const int vsbExt = vbar->sizeHint().width(); | - |
| 379 | const QPoint extPoint(vsbExt, hsbExt); executed (the execution status of this line is deduced): const QPoint extPoint(vsbExt, hsbExt); | - |
| 380 | const QSize extSize(vsbExt, hsbExt); executed (the execution status of this line is deduced): const QSize extSize(vsbExt, hsbExt); | - |
| 381 | | - |
| 382 | const QRect widgetRect = q->rect(); executed (the execution status of this line is deduced): const QRect widgetRect = q->rect(); | - |
| 383 | | - |
| 384 | const bool hasCornerWidget = (cornerWidget != 0); executed (the execution status of this line is deduced): const bool hasCornerWidget = (cornerWidget != 0); | - |
| 385 | | - |
| 386 | // If the scroll bars are at the very right and bottom of the window we | - |
| 387 | // move their positions to be aligned with the size grip. | - |
| 388 | #ifdef Q_WS_MAC | - |
| 389 | // Check if a native sizegrip is present. | - |
| 390 | bool hasMacReverseSizeGrip = false; | - |
| 391 | bool hasMacSizeGrip = false; | - |
| 392 | bool nativeGripPresent = false; | - |
| 393 | if (q->testAttribute(Qt::WA_WState_Created)) | - |
| 394 | nativeGripPresent = qt_mac_checkForNativeSizeGrip(q); | - |
| 395 | | - |
| 396 | if (nativeGripPresent) { | - |
| 397 | // Look for a native size grip at the visual window bottom right and at the | - |
| 398 | // absolute window bottom right. In reverse mode, the native size grip does not | - |
| 399 | // swich side, so we need to check if it is on the "wrong side". | - |
| 400 | const QPoint scrollAreaBottomRight = q->mapTo(window, widgetRect.bottomRight() - QPoint(frameWidth, frameWidth)); | - |
| 401 | const QPoint windowBottomRight = window->rect().bottomRight(); | - |
| 402 | const QPoint visualWindowBottomRight = QStyle::visualPos(opt.direction, opt.rect, windowBottomRight); | - |
| 403 | const QPoint offset = windowBottomRight - scrollAreaBottomRight; | - |
| 404 | const QPoint visualOffset = visualWindowBottomRight - scrollAreaBottomRight; | - |
| 405 | hasMacSizeGrip = (visualOffset.manhattanLength() < vsbExt); | - |
| 406 | hasMacReverseSizeGrip = (hasMacSizeGrip == false && (offset.manhattanLength() < hsbExt)); | - |
| 407 | } | - |
| 408 | #endif | - |
| 409 | | - |
| 410 | QPoint cornerOffset((needv && scrollOverlap == 0) ? vsbExt : 0, (needh && scrollOverlap == 0) ? hsbExt : 0); executed (the execution status of this line is deduced): QPoint cornerOffset((needv && scrollOverlap == 0) ? vsbExt : 0, (needh && scrollOverlap == 0) ? hsbExt : 0); | - |
| 411 | QRect controlsRect; executed (the execution status of this line is deduced): QRect controlsRect; | - |
| 412 | QRect viewportRect; executed (the execution status of this line is deduced): QRect viewportRect; | - |
| 413 | | - |
| 414 | // In FrameOnlyAroundContents mode the frame is drawn between the controls and | - |
| 415 | // the viewport, else the frame rect is equal to the widget rect. | - |
| 416 | if ((frameStyle != QFrame::NoFrame) && evaluated: (frameStyle != QFrame::NoFrame)| yes Evaluation Count:14796 | yes Evaluation Count:13402 |
| 13402-14796 |
| 417 | q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, q)) { evaluated: q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, q)| yes Evaluation Count:2 | yes Evaluation Count:14794 |
| 2-14794 |
| 418 | controlsRect = widgetRect; executed (the execution status of this line is deduced): controlsRect = widgetRect; | - |
| 419 | const int extra = scrollOverlap + q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &opt, q); executed (the execution status of this line is deduced): const int extra = scrollOverlap + q->style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &opt, q); | - |
| 420 | const QPoint cornerExtra(needv ? extra : 0, needh ? extra : 0); executed (the execution status of this line is deduced): const QPoint cornerExtra(needv ? extra : 0, needh ? extra : 0); | - |
| 421 | QRect frameRect = widgetRect; executed (the execution status of this line is deduced): QRect frameRect = widgetRect; | - |
| 422 | frameRect.adjust(0, 0, -cornerOffset.x() - cornerExtra.x(), -cornerOffset.y() - cornerExtra.y()); executed (the execution status of this line is deduced): frameRect.adjust(0, 0, -cornerOffset.x() - cornerExtra.x(), -cornerOffset.y() - cornerExtra.y()); | - |
| 423 | q->setFrameRect(QStyle::visualRect(opt.direction, opt.rect, frameRect)); executed (the execution status of this line is deduced): q->setFrameRect(QStyle::visualRect(opt.direction, opt.rect, frameRect)); | - |
| 424 | // The frame rect needs to be in logical coords, however we need to flip | - |
| 425 | // the contentsRect back before passing it on to the viewportRect | - |
| 426 | // since the viewportRect has its logical coords calculated later. | - |
| 427 | viewportRect = QStyle::visualRect(opt.direction, opt.rect, q->contentsRect()); executed (the execution status of this line is deduced): viewportRect = QStyle::visualRect(opt.direction, opt.rect, q->contentsRect()); | - |
| 428 | } else { executed: }Execution Count:2 | 2 |
| 429 | q->setFrameRect(QStyle::visualRect(opt.direction, opt.rect, widgetRect)); executed (the execution status of this line is deduced): q->setFrameRect(QStyle::visualRect(opt.direction, opt.rect, widgetRect)); | - |
| 430 | controlsRect = q->contentsRect(); executed (the execution status of this line is deduced): controlsRect = q->contentsRect(); | - |
| 431 | viewportRect = QRect(controlsRect.topLeft(), controlsRect.bottomRight() - cornerOffset); executed (the execution status of this line is deduced): viewportRect = QRect(controlsRect.topLeft(), controlsRect.bottomRight() - cornerOffset); | - |
| 432 | } executed: }Execution Count:28196 | 28196 |
| 433 | | - |
| 434 | cornerOffset = QPoint(needv ? vsbExt : 0, needh ? hsbExt : 0); executed (the execution status of this line is deduced): cornerOffset = QPoint(needv ? vsbExt : 0, needh ? hsbExt : 0); | - |
| 435 | | - |
| 436 | // If we have a corner widget and are only showing one scroll bar, we need to move it | - |
| 437 | // to make room for the corner widget. | - |
| 438 | if (hasCornerWidget && (needv || needh) && scrollOverlap == 0) evaluated: hasCornerWidget| yes Evaluation Count:2 | yes Evaluation Count:28196 |
evaluated: needv| yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: needh| no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: scrollOverlap == 0| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-28196 |
| 439 | cornerOffset = extPoint; executed: cornerOffset = extPoint;Execution Count:1 | 1 |
| 440 | | - |
| 441 | #ifdef Q_WS_MAC | - |
| 442 | // Also move the scroll bars if they are covered by the native Mac size grip. | - |
| 443 | if (hasMacSizeGrip) | - |
| 444 | cornerOffset = extPoint; | - |
| 445 | #endif | - |
| 446 | | - |
| 447 | // The corner point is where the scroll bar rects, the corner widget rect and the | - |
| 448 | // viewport rect meets. | - |
| 449 | const QPoint cornerPoint(controlsRect.bottomRight() + QPoint(1, 1) - cornerOffset); executed (the execution status of this line is deduced): const QPoint cornerPoint(controlsRect.bottomRight() + QPoint(1, 1) - cornerOffset); | - |
| 450 | | - |
| 451 | // Some styles paints the corner if both scorllbars are showing and there is | - |
| 452 | // no corner widget. Also, on the Mac we paint if there is a native | - |
| 453 | // (transparent) sizegrip in the area where a corner widget would be. | - |
| 454 | if ((needv && needh && hasCornerWidget == false && scrollOverlap == 0) evaluated: needv| yes Evaluation Count:3442 | yes Evaluation Count:24756 |
evaluated: needh| yes Evaluation Count:1733 | yes Evaluation Count:1709 |
evaluated: hasCornerWidget == false| yes Evaluation Count:1732 | yes Evaluation Count:1 |
partially evaluated: scrollOverlap == 0| yes Evaluation Count:1732 | no Evaluation Count:0 |
| 0-24756 |
| 455 | || ((needv || needh) evaluated: needv| yes Evaluation Count:1710 | yes Evaluation Count:24756 |
evaluated: needh| yes Evaluation Count:826 | yes Evaluation Count:23930 |
| 826-24756 |
| 456 | #ifdef Q_WS_MAC executed (the execution status of this line is deduced): | - |
| 457 | && hasMacSizeGrip executed (the execution status of this line is deduced): | - |
| 458 | #endif executed (the execution status of this line is deduced): | - |
| 459 | ) executed (the execution status of this line is deduced): ) | - |
| 460 | ) { | - |
| 461 | cornerPaintingRect = QStyle::visualRect(opt.direction, opt.rect, QRect(cornerPoint, extSize)); executed (the execution status of this line is deduced): cornerPaintingRect = QStyle::visualRect(opt.direction, opt.rect, QRect(cornerPoint, extSize)); | - |
| 462 | } else { executed: }Execution Count:4268 | 4268 |
| 463 | cornerPaintingRect = QRect(); executed (the execution status of this line is deduced): cornerPaintingRect = QRect(); | - |
| 464 | } executed: }Execution Count:23930 | 23930 |
| 465 | | - |
| 466 | #ifdef Q_WS_MAC | - |
| 467 | if (hasMacReverseSizeGrip) | - |
| 468 | reverseCornerPaintingRect = QRect(controlsRect.bottomRight() + QPoint(1, 1) - extPoint, extSize); | - |
| 469 | else | - |
| 470 | reverseCornerPaintingRect = QRect(); | - |
| 471 | #endif | - |
| 472 | | - |
| 473 | // move the scrollbars away from top/left headers | - |
| 474 | int vHeaderRight = 0; executed (the execution status of this line is deduced): int vHeaderRight = 0; | - |
| 475 | int hHeaderBottom = 0; executed (the execution status of this line is deduced): int hHeaderBottom = 0; | - |
| 476 | if (scrollOverlap > 0 && (needv || needh)) { partially evaluated: scrollOverlap > 0| no Evaluation Count:0 | yes Evaluation Count:28198 |
never evaluated: needv never evaluated: needh | 0-28198 |
| 477 | const QList<QHeaderView *> headers = q->findChildren<QHeaderView*>(); never executed (the execution status of this line is deduced): const QList<QHeaderView *> headers = q->findChildren<QHeaderView*>(); | - |
| 478 | if (headers.count() <= 2) { never evaluated: headers.count() <= 2 | 0 |
| 479 | Q_FOREACH (const QHeaderView *header, headers) { never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(headers)> _container_(headers); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QHeaderView *header = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
| 480 | const QRect geo = header->geometry(); never executed (the execution status of this line is deduced): const QRect geo = header->geometry(); | - |
| 481 | if (header->orientation() == Qt::Vertical && header->isVisible() && QStyle::visualRect(opt.direction, opt.rect, geo).left() <= opt.rect.width() / 2) never evaluated: header->orientation() == Qt::Vertical never evaluated: header->isVisible() never evaluated: QStyle::visualRect(opt.direction, opt.rect, geo).left() <= opt.rect.width() / 2 | 0 |
| 482 | vHeaderRight = QStyle::visualRect(opt.direction, opt.rect, geo).right(); never executed: vHeaderRight = QStyle::visualRect(opt.direction, opt.rect, geo).right(); | 0 |
| 483 | else if (header->orientation() == Qt::Horizontal && header->isVisible() && geo.top() <= q->frameWidth()) never evaluated: header->orientation() == Qt::Horizontal never evaluated: header->isVisible() never evaluated: geo.top() <= q->frameWidth() | 0 |
| 484 | hHeaderBottom = geo.bottom(); never executed: hHeaderBottom = geo.bottom(); | 0 |
| 485 | } | - |
| 486 | } | 0 |
| 487 | } | 0 |
| 488 | | - |
| 489 | if (needh) { evaluated: needh| yes Evaluation Count:2559 | yes Evaluation Count:25639 |
| 2559-25639 |
| 490 | QRect horizontalScrollBarRect(QPoint(controlsRect.left() + vHeaderRight, cornerPoint.y()), QPoint(cornerPoint.x() - 1, controlsRect.bottom())); executed (the execution status of this line is deduced): QRect horizontalScrollBarRect(QPoint(controlsRect.left() + vHeaderRight, cornerPoint.y()), QPoint(cornerPoint.x() - 1, controlsRect.bottom())); | - |
| 491 | #ifdef Q_WS_MAC | - |
| 492 | if (hasMacReverseSizeGrip) | - |
| 493 | horizontalScrollBarRect.adjust(vsbExt, 0, 0, 0); | - |
| 494 | #endif | - |
| 495 | #ifdef Q_OS_MAC | - |
| 496 | if (!hasCornerWidget && QSysInfo::macVersion() >= QSysInfo::MV_10_8 && transient) | - |
| 497 | horizontalScrollBarRect.adjust(0, 0, cornerOffset.x(), 0); | - |
| 498 | #endif | - |
| 499 | scrollBarContainers[Qt::Horizontal]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, horizontalScrollBarRect)); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Horizontal]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, horizontalScrollBarRect)); | - |
| 500 | scrollBarContainers[Qt::Horizontal]->raise(); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Horizontal]->raise(); | - |
| 501 | } executed: }Execution Count:2559 | 2559 |
| 502 | | - |
| 503 | if (needv) { evaluated: needv| yes Evaluation Count:3442 | yes Evaluation Count:24756 |
| 3442-24756 |
| 504 | QRect verticalScrollBarRect (QPoint(cornerPoint.x(), controlsRect.top() + hHeaderBottom), QPoint(controlsRect.right(), cornerPoint.y() - 1)); executed (the execution status of this line is deduced): QRect verticalScrollBarRect (QPoint(cornerPoint.x(), controlsRect.top() + hHeaderBottom), QPoint(controlsRect.right(), cornerPoint.y() - 1)); | - |
| 505 | #ifdef Q_OS_MAC | - |
| 506 | if (!hasCornerWidget && QSysInfo::macVersion() >= QSysInfo::MV_10_8 && transient) | - |
| 507 | verticalScrollBarRect.adjust(0, 0, 0, cornerOffset.y()); | - |
| 508 | #endif | - |
| 509 | scrollBarContainers[Qt::Vertical]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, verticalScrollBarRect)); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Vertical]->setGeometry(QStyle::visualRect(opt.direction, opt.rect, verticalScrollBarRect)); | - |
| 510 | scrollBarContainers[Qt::Vertical]->raise(); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Vertical]->raise(); | - |
| 511 | } executed: }Execution Count:3442 | 3442 |
| 512 | | - |
| 513 | if (cornerWidget) { evaluated: cornerWidget| yes Evaluation Count:2 | yes Evaluation Count:28196 |
| 2-28196 |
| 514 | const QRect cornerWidgetRect(cornerPoint, controlsRect.bottomRight()); executed (the execution status of this line is deduced): const QRect cornerWidgetRect(cornerPoint, controlsRect.bottomRight()); | - |
| 515 | cornerWidget->setGeometry(QStyle::visualRect(opt.direction, opt.rect, cornerWidgetRect)); executed (the execution status of this line is deduced): cornerWidget->setGeometry(QStyle::visualRect(opt.direction, opt.rect, cornerWidgetRect)); | - |
| 516 | } executed: }Execution Count:2 | 2 |
| 517 | | - |
| 518 | scrollBarContainers[Qt::Horizontal]->setVisible(needh); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Horizontal]->setVisible(needh); | - |
| 519 | scrollBarContainers[Qt::Vertical]->setVisible(needv); executed (the execution status of this line is deduced): scrollBarContainers[Qt::Vertical]->setVisible(needv); | - |
| 520 | | - |
| 521 | if (q->isRightToLeft()) evaluated: q->isRightToLeft()| yes Evaluation Count:96 | yes Evaluation Count:28102 |
| 96-28102 |
| 522 | viewportRect.adjust(right, top, -left, -bottom); executed: viewportRect.adjust(right, top, -left, -bottom);Execution Count:96 | 96 |
| 523 | else | - |
| 524 | viewportRect.adjust(left, top, -right, -bottom); executed: viewportRect.adjust(left, top, -right, -bottom);Execution Count:28102 | 28102 |
| 525 | | - |
| 526 | viewport->setGeometry(QStyle::visualRect(opt.direction, opt.rect, viewportRect)); // resize the viewport last executed (the execution status of this line is deduced): viewport->setGeometry(QStyle::visualRect(opt.direction, opt.rect, viewportRect)); | - |
| 527 | } executed: }Execution Count:28198 | 28198 |
| 528 | | - |
| 529 | /*! | - |
| 530 | \internal | - |
| 531 | | - |
| 532 | Creates a new QAbstractScrollAreaPrivate, \a dd with the given \a parent. | - |
| 533 | */ | - |
| 534 | QAbstractScrollArea::QAbstractScrollArea(QAbstractScrollAreaPrivate &dd, QWidget *parent) | - |
| 535 | :QFrame(dd, parent) | - |
| 536 | { | - |
| 537 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 538 | QT_TRY { partially evaluated: true| yes Evaluation Count:5097 | no Evaluation Count:0 |
| 0-5097 |
| 539 | d->init(); executed (the execution status of this line is deduced): d->init(); | - |
| 540 | } QT_CATCH(...) { executed: }Execution Count:5097 | 5097 |
| 541 | d->viewportFilter.reset(); never executed (the execution status of this line is deduced): d->viewportFilter.reset(); | - |
| 542 | QT_RETHROW; never executed (the execution status of this line is deduced): qt_noop(); | - |
| 543 | } | 0 |
| 544 | } | - |
| 545 | | - |
| 546 | /*! | - |
| 547 | Constructs a viewport. | - |
| 548 | | - |
| 549 | The \a parent argument is sent to the QWidget constructor. | - |
| 550 | */ | - |
| 551 | QAbstractScrollArea::QAbstractScrollArea(QWidget *parent) | - |
| 552 | :QFrame(*new QAbstractScrollAreaPrivate, parent) | - |
| 553 | { | - |
| 554 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 555 | QT_TRY { partially evaluated: true| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 556 | d->init(); executed (the execution status of this line is deduced): d->init(); | - |
| 557 | } QT_CATCH(...) { executed: }Execution Count:3 | 3 |
| 558 | d->viewportFilter.reset(); never executed (the execution status of this line is deduced): d->viewportFilter.reset(); | - |
| 559 | QT_RETHROW; never executed (the execution status of this line is deduced): qt_noop(); | - |
| 560 | } | 0 |
| 561 | } | - |
| 562 | | - |
| 563 | | - |
| 564 | /*! | - |
| 565 | Destroys the viewport. | - |
| 566 | */ | - |
| 567 | QAbstractScrollArea::~QAbstractScrollArea() | - |
| 568 | { | - |
| 569 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 570 | // reset it here, otherwise we'll have a dangling pointer in ~QWidget | - |
| 571 | d->viewportFilter.reset(); executed (the execution status of this line is deduced): d->viewportFilter.reset(); | - |
| 572 | } executed: }Execution Count:4457 | 4457 |
| 573 | | - |
| 574 | | - |
| 575 | /*! | - |
| 576 | \since 4.2 | - |
| 577 | Sets the viewport to be the given \a widget. | - |
| 578 | The QAbstractScrollArea will take ownership of the given \a widget. | - |
| 579 | | - |
| 580 | If \a widget is 0, QAbstractScrollArea will assign a new QWidget instance | - |
| 581 | for the viewport. | - |
| 582 | | - |
| 583 | \sa viewport() | - |
| 584 | */ | - |
| 585 | void QAbstractScrollArea::setViewport(QWidget *widget) | - |
| 586 | { | - |
| 587 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 588 | if (widget != d->viewport) { partially evaluated: widget != d->viewport| yes Evaluation Count:889 | no Evaluation Count:0 |
| 0-889 |
| 589 | QWidget *oldViewport = d->viewport; executed (the execution status of this line is deduced): QWidget *oldViewport = d->viewport; | - |
| 590 | if (!widget) evaluated: !widget| yes Evaluation Count:880 | yes Evaluation Count:9 |
| 9-880 |
| 591 | widget = new QWidget; executed: widget = new QWidget;Execution Count:880 | 880 |
| 592 | d->viewport = widget; executed (the execution status of this line is deduced): d->viewport = widget; | - |
| 593 | d->viewport->setParent(this); executed (the execution status of this line is deduced): d->viewport->setParent(this); | - |
| 594 | d->viewport->setFocusProxy(this); executed (the execution status of this line is deduced): d->viewport->setFocusProxy(this); | - |
| 595 | d->viewport->installEventFilter(d->viewportFilter.data()); executed (the execution status of this line is deduced): d->viewport->installEventFilter(d->viewportFilter.data()); | - |
| 596 | #ifndef Q_WS_MAC | - |
| 597 | #ifndef QT_NO_GESTURES | - |
| 598 | d->viewport->grabGesture(Qt::PanGesture); executed (the execution status of this line is deduced): d->viewport->grabGesture(Qt::PanGesture); | - |
| 599 | #endif | - |
| 600 | #endif | - |
| 601 | d->layoutChildren(); executed (the execution status of this line is deduced): d->layoutChildren(); | - |
| 602 | if (isVisible()) evaluated: isVisible()| yes Evaluation Count:3 | yes Evaluation Count:886 |
| 3-886 |
| 603 | d->viewport->show(); executed: d->viewport->show();Execution Count:3 | 3 |
| 604 | setupViewport(widget); executed (the execution status of this line is deduced): setupViewport(widget); | - |
| 605 | delete oldViewport; executed (the execution status of this line is deduced): delete oldViewport; | - |
| 606 | } executed: }Execution Count:889 | 889 |
| 607 | } executed: }Execution Count:889 | 889 |
| 608 | | - |
| 609 | /*! | - |
| 610 | Returns the viewport widget. | - |
| 611 | | - |
| 612 | Use the QScrollArea::widget() function to retrieve the contents of | - |
| 613 | the viewport widget. | - |
| 614 | | - |
| 615 | \sa QScrollArea::widget() | - |
| 616 | */ | - |
| 617 | QWidget *QAbstractScrollArea::viewport() const | - |
| 618 | { | - |
| 619 | Q_D(const QAbstractScrollArea); executed (the execution status of this line is deduced): const QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 620 | return d->viewport; executed: return d->viewport;Execution Count:63310 | 63310 |
| 621 | } | - |
| 622 | | - |
| 623 | | - |
| 624 | /*! | - |
| 625 | Returns the size of the viewport as if the scroll bars had no valid | - |
| 626 | scrolling range. | - |
| 627 | */ | - |
| 628 | // ### still thinking about the name | - |
| 629 | QSize QAbstractScrollArea::maximumViewportSize() const | - |
| 630 | { | - |
| 631 | Q_D(const QAbstractScrollArea); executed (the execution status of this line is deduced): const QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 632 | int hsbExt = d->hbar->sizeHint().height(); executed (the execution status of this line is deduced): int hsbExt = d->hbar->sizeHint().height(); | - |
| 633 | int vsbExt = d->vbar->sizeHint().width(); executed (the execution status of this line is deduced): int vsbExt = d->vbar->sizeHint().width(); | - |
| 634 | | - |
| 635 | int f = 2 * d->frameWidth; executed (the execution status of this line is deduced): int f = 2 * d->frameWidth; | - |
| 636 | QSize max = size() - QSize(f + d->left + d->right, f + d->top + d->bottom); executed (the execution status of this line is deduced): QSize max = size() - QSize(f + d->left + d->right, f + d->top + d->bottom); | - |
| 637 | if (d->vbarpolicy == Qt::ScrollBarAlwaysOn) evaluated: d->vbarpolicy == Qt::ScrollBarAlwaysOn| yes Evaluation Count:596 | yes Evaluation Count:12609 |
| 596-12609 |
| 638 | max.rwidth() -= vsbExt; executed: max.rwidth() -= vsbExt;Execution Count:596 | 596 |
| 639 | if (d->hbarpolicy == Qt::ScrollBarAlwaysOn) evaluated: d->hbarpolicy == Qt::ScrollBarAlwaysOn| yes Evaluation Count:308 | yes Evaluation Count:12897 |
| 308-12897 |
| 640 | max.rheight() -= hsbExt; executed: max.rheight() -= hsbExt;Execution Count:308 | 308 |
| 641 | return max; executed: return max;Execution Count:13205 | 13205 |
| 642 | } | - |
| 643 | | - |
| 644 | /*! | - |
| 645 | \property QAbstractScrollArea::verticalScrollBarPolicy | - |
| 646 | \brief the policy for the vertical scroll bar | - |
| 647 | | - |
| 648 | The default policy is Qt::ScrollBarAsNeeded. | - |
| 649 | | - |
| 650 | \sa horizontalScrollBarPolicy | - |
| 651 | */ | - |
| 652 | | - |
| 653 | Qt::ScrollBarPolicy QAbstractScrollArea::verticalScrollBarPolicy() const | - |
| 654 | { | - |
| 655 | Q_D(const QAbstractScrollArea); executed (the execution status of this line is deduced): const QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 656 | return d->vbarpolicy; executed: return d->vbarpolicy;Execution Count:47 | 47 |
| 657 | } | - |
| 658 | | - |
| 659 | void QAbstractScrollArea::setVerticalScrollBarPolicy(Qt::ScrollBarPolicy policy) | - |
| 660 | { | - |
| 661 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 662 | const Qt::ScrollBarPolicy oldPolicy = d->vbarpolicy; executed (the execution status of this line is deduced): const Qt::ScrollBarPolicy oldPolicy = d->vbarpolicy; | - |
| 663 | d->vbarpolicy = policy; executed (the execution status of this line is deduced): d->vbarpolicy = policy; | - |
| 664 | if (isVisible()) evaluated: isVisible()| yes Evaluation Count:2 | yes Evaluation Count:2374 |
| 2-2374 |
| 665 | d->layoutChildren(); executed: d->layoutChildren();Execution Count:2 | 2 |
| 666 | if (oldPolicy != d->vbarpolicy) evaluated: oldPolicy != d->vbarpolicy| yes Evaluation Count:2273 | yes Evaluation Count:103 |
| 103-2273 |
| 667 | d->scrollBarPolicyChanged(Qt::Vertical, d->vbarpolicy); executed: d->scrollBarPolicyChanged(Qt::Vertical, d->vbarpolicy);Execution Count:2273 | 2273 |
| 668 | } executed: }Execution Count:2376 | 2376 |
| 669 | | - |
| 670 | | - |
| 671 | /*! | - |
| 672 | Returns the vertical scroll bar. | - |
| 673 | | - |
| 674 | \sa verticalScrollBarPolicy, horizontalScrollBar() | - |
| 675 | */ | - |
| 676 | QScrollBar *QAbstractScrollArea::verticalScrollBar() const | - |
| 677 | { | - |
| 678 | Q_D(const QAbstractScrollArea); executed (the execution status of this line is deduced): const QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 679 | return d->vbar; executed: return d->vbar;Execution Count:61137 | 61137 |
| 680 | } | - |
| 681 | | - |
| 682 | /*! | - |
| 683 | \since 4.2 | - |
| 684 | Replaces the existing vertical scroll bar with \a scrollBar, and sets all | - |
| 685 | the former scroll bar's slider properties on the new scroll bar. The former | - |
| 686 | scroll bar is then deleted. | - |
| 687 | | - |
| 688 | QAbstractScrollArea already provides vertical and horizontal scroll bars by | - |
| 689 | default. You can call this function to replace the default vertical | - |
| 690 | scroll bar with your own custom scroll bar. | - |
| 691 | | - |
| 692 | \sa verticalScrollBar(), setHorizontalScrollBar() | - |
| 693 | */ | - |
| 694 | void QAbstractScrollArea::setVerticalScrollBar(QScrollBar *scrollBar) | - |
| 695 | { | - |
| 696 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 697 | if (!scrollBar) { partially evaluated: !scrollBar| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 698 | qWarning("QAbstractScrollArea::setVerticalScrollBar: Cannot set a null scroll bar"); never executed (the execution status of this line is deduced): QMessageLogger("widgets/qabstractscrollarea.cpp", 698, __PRETTY_FUNCTION__).warning("QAbstractScrollArea::setVerticalScrollBar: Cannot set a null scroll bar"); | - |
| 699 | return; | 0 |
| 700 | } | - |
| 701 | | - |
| 702 | d->replaceScrollBar(scrollBar, Qt::Vertical); executed (the execution status of this line is deduced): d->replaceScrollBar(scrollBar, Qt::Vertical); | - |
| 703 | } executed: }Execution Count:4 | 4 |
| 704 | | - |
| 705 | /*! | - |
| 706 | \property QAbstractScrollArea::horizontalScrollBarPolicy | - |
| 707 | \brief the policy for the horizontal scroll bar | - |
| 708 | | - |
| 709 | The default policy is Qt::ScrollBarAsNeeded. | - |
| 710 | | - |
| 711 | \sa verticalScrollBarPolicy | - |
| 712 | */ | - |
| 713 | | - |
| 714 | Qt::ScrollBarPolicy QAbstractScrollArea::horizontalScrollBarPolicy() const | - |
| 715 | { | - |
| 716 | Q_D(const QAbstractScrollArea); executed (the execution status of this line is deduced): const QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 717 | return d->hbarpolicy; executed: return d->hbarpolicy;Execution Count:1216 | 1216 |
| 718 | } | - |
| 719 | | - |
| 720 | void QAbstractScrollArea::setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy policy) | - |
| 721 | { | - |
| 722 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 723 | const Qt::ScrollBarPolicy oldPolicy = d->hbarpolicy; executed (the execution status of this line is deduced): const Qt::ScrollBarPolicy oldPolicy = d->hbarpolicy; | - |
| 724 | d->hbarpolicy = policy; executed (the execution status of this line is deduced): d->hbarpolicy = policy; | - |
| 725 | if (isVisible()) evaluated: isVisible()| yes Evaluation Count:2 | yes Evaluation Count:2736 |
| 2-2736 |
| 726 | d->layoutChildren(); executed: d->layoutChildren();Execution Count:2 | 2 |
| 727 | if (oldPolicy != d->hbarpolicy) evaluated: oldPolicy != d->hbarpolicy| yes Evaluation Count:2635 | yes Evaluation Count:103 |
| 103-2635 |
| 728 | d->scrollBarPolicyChanged(Qt::Horizontal, d->hbarpolicy); executed: d->scrollBarPolicyChanged(Qt::Horizontal, d->hbarpolicy);Execution Count:2635 | 2635 |
| 729 | } executed: }Execution Count:2738 | 2738 |
| 730 | | - |
| 731 | /*! | - |
| 732 | Returns the horizontal scroll bar. | - |
| 733 | | - |
| 734 | \sa horizontalScrollBarPolicy, verticalScrollBar() | - |
| 735 | */ | - |
| 736 | QScrollBar *QAbstractScrollArea::horizontalScrollBar() const | - |
| 737 | { | - |
| 738 | Q_D(const QAbstractScrollArea); executed (the execution status of this line is deduced): const QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 739 | return d->hbar; executed: return d->hbar;Execution Count:77669 | 77669 |
| 740 | } | - |
| 741 | | - |
| 742 | /*! | - |
| 743 | \since 4.2 | - |
| 744 | | - |
| 745 | Replaces the existing horizontal scroll bar with \a scrollBar, and sets all | - |
| 746 | the former scroll bar's slider properties on the new scroll bar. The former | - |
| 747 | scroll bar is then deleted. | - |
| 748 | | - |
| 749 | QAbstractScrollArea already provides horizontal and vertical scroll bars by | - |
| 750 | default. You can call this function to replace the default horizontal | - |
| 751 | scroll bar with your own custom scroll bar. | - |
| 752 | | - |
| 753 | \sa horizontalScrollBar(), setVerticalScrollBar() | - |
| 754 | */ | - |
| 755 | void QAbstractScrollArea::setHorizontalScrollBar(QScrollBar *scrollBar) | - |
| 756 | { | - |
| 757 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 758 | if (!scrollBar) { partially evaluated: !scrollBar| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 759 | qWarning("QAbstractScrollArea::setHorizontalScrollBar: Cannot set a null scroll bar"); never executed (the execution status of this line is deduced): QMessageLogger("widgets/qabstractscrollarea.cpp", 759, __PRETTY_FUNCTION__).warning("QAbstractScrollArea::setHorizontalScrollBar: Cannot set a null scroll bar"); | - |
| 760 | return; | 0 |
| 761 | } | - |
| 762 | | - |
| 763 | d->replaceScrollBar(scrollBar, Qt::Horizontal); executed (the execution status of this line is deduced): d->replaceScrollBar(scrollBar, Qt::Horizontal); | - |
| 764 | } executed: }Execution Count:4 | 4 |
| 765 | | - |
| 766 | /*! | - |
| 767 | \since 4.2 | - |
| 768 | | - |
| 769 | Returns the widget in the corner between the two scroll bars. | - |
| 770 | | - |
| 771 | By default, no corner widget is present. | - |
| 772 | */ | - |
| 773 | QWidget *QAbstractScrollArea::cornerWidget() const | - |
| 774 | { | - |
| 775 | Q_D(const QAbstractScrollArea); executed (the execution status of this line is deduced): const QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 776 | return d->cornerWidget; executed: return d->cornerWidget;Execution Count:70 | 70 |
| 777 | } | - |
| 778 | | - |
| 779 | /*! | - |
| 780 | \since 4.2 | - |
| 781 | | - |
| 782 | Sets the widget in the corner between the two scroll bars to be | - |
| 783 | \a widget. | - |
| 784 | | - |
| 785 | You will probably also want to set at least one of the scroll bar | - |
| 786 | modes to \c AlwaysOn. | - |
| 787 | | - |
| 788 | Passing 0 shows no widget in the corner. | - |
| 789 | | - |
| 790 | Any previous corner widget is hidden. | - |
| 791 | | - |
| 792 | You may call setCornerWidget() with the same widget at different | - |
| 793 | times. | - |
| 794 | | - |
| 795 | All widgets set here will be deleted by the scroll area when it is | - |
| 796 | destroyed unless you separately reparent the widget after setting | - |
| 797 | some other corner widget (or 0). | - |
| 798 | | - |
| 799 | Any \e newly set widget should have no current parent. | - |
| 800 | | - |
| 801 | By default, no corner widget is present. | - |
| 802 | | - |
| 803 | \sa horizontalScrollBarPolicy, horizontalScrollBarPolicy | - |
| 804 | */ | - |
| 805 | void QAbstractScrollArea::setCornerWidget(QWidget *widget) | - |
| 806 | { | - |
| 807 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 808 | QWidget* oldWidget = d->cornerWidget; executed (the execution status of this line is deduced): QWidget* oldWidget = d->cornerWidget; | - |
| 809 | if (oldWidget != widget) { partially evaluated: oldWidget != widget| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 810 | if (oldWidget) partially evaluated: oldWidget| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 811 | oldWidget->hide(); never executed: oldWidget->hide(); | 0 |
| 812 | d->cornerWidget = widget; executed (the execution status of this line is deduced): d->cornerWidget = widget; | - |
| 813 | | - |
| 814 | if (widget && widget->parentWidget() != this) partially evaluated: widget| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: widget->parentWidget() != this| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 815 | widget->setParent(this); executed: widget->setParent(this);Execution Count:2 | 2 |
| 816 | | - |
| 817 | d->layoutChildren(); executed (the execution status of this line is deduced): d->layoutChildren(); | - |
| 818 | if (widget) partially evaluated: widget| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 819 | widget->show(); executed: widget->show();Execution Count:2 | 2 |
| 820 | } else { executed: }Execution Count:2 | 2 |
| 821 | d->cornerWidget = widget; never executed (the execution status of this line is deduced): d->cornerWidget = widget; | - |
| 822 | d->layoutChildren(); never executed (the execution status of this line is deduced): d->layoutChildren(); | - |
| 823 | } | 0 |
| 824 | } | - |
| 825 | | - |
| 826 | /*! | - |
| 827 | \since 4.2 | - |
| 828 | Adds \a widget as a scroll bar widget in the location specified | - |
| 829 | by \a alignment. | - |
| 830 | | - |
| 831 | Scroll bar widgets are shown next to the horizontal or vertical | - |
| 832 | scroll bar, and can be placed on either side of it. If you want | - |
| 833 | the scroll bar widgets to be always visible, set the | - |
| 834 | scrollBarPolicy for the corresponding scroll bar to \c AlwaysOn. | - |
| 835 | | - |
| 836 | \a alignment must be one of Qt::Alignleft and Qt::AlignRight, | - |
| 837 | which maps to the horizontal scroll bar, or Qt::AlignTop and | - |
| 838 | Qt::AlignBottom, which maps to the vertical scroll bar. | - |
| 839 | | - |
| 840 | A scroll bar widget can be removed by either re-parenting the | - |
| 841 | widget or deleting it. It's also possible to hide a widget with | - |
| 842 | QWidget::hide() | - |
| 843 | | - |
| 844 | The scroll bar widget will be resized to fit the scroll bar | - |
| 845 | geometry for the current style. The following describes the case | - |
| 846 | for scroll bar widgets on the horizontal scroll bar: | - |
| 847 | | - |
| 848 | The height of the widget will be set to match the height of the | - |
| 849 | scroll bar. To control the width of the widget, use | - |
| 850 | QWidget::setMinimumWidth and QWidget::setMaximumWidth, or | - |
| 851 | implement QWidget::sizeHint() and set a horizontal size policy. | - |
| 852 | If you want a square widget, call | - |
| 853 | QStyle::pixelMetric(QStyle::PM_ScrollBarExtent) and set the | - |
| 854 | width to this value. | - |
| 855 | | - |
| 856 | \sa scrollBarWidgets() | - |
| 857 | */ | - |
| 858 | void QAbstractScrollArea::addScrollBarWidget(QWidget *widget, Qt::Alignment alignment) | - |
| 859 | { | - |
| 860 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 861 | | - |
| 862 | if (widget == 0) partially evaluated: widget == 0| no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
| 863 | return; | 0 |
| 864 | | - |
| 865 | const Qt::Orientation scrollBarOrientation executed (the execution status of this line is deduced): const Qt::Orientation scrollBarOrientation | - |
| 866 | = ((alignment & Qt::AlignLeft) || (alignment & Qt::AlignRight)) ? Qt::Horizontal : Qt::Vertical; evaluated: (alignment & Qt::AlignLeft)| yes Evaluation Count:3 | yes Evaluation Count:10 |
evaluated: (alignment & Qt::AlignRight)| yes Evaluation Count:2 | yes Evaluation Count:8 |
| 2-10 |
| 867 | const QAbstractScrollAreaScrollBarContainer::LogicalPosition position executed (the execution status of this line is deduced): const QAbstractScrollAreaScrollBarContainer::LogicalPosition position | - |
| 868 | = ((alignment & Qt::AlignRight) || (alignment & Qt::AlignBottom)) evaluated: (alignment & Qt::AlignRight)| yes Evaluation Count:2 | yes Evaluation Count:11 |
evaluated: (alignment & Qt::AlignBottom)| yes Evaluation Count:6 | yes Evaluation Count:5 |
| 2-11 |
| 869 | ? QAbstractScrollAreaScrollBarContainer::LogicalRight : QAbstractScrollAreaScrollBarContainer::LogicalLeft; executed (the execution status of this line is deduced): ? QAbstractScrollAreaScrollBarContainer::LogicalRight : QAbstractScrollAreaScrollBarContainer::LogicalLeft; | - |
| 870 | d->scrollBarContainers[scrollBarOrientation]->addWidget(widget, position); executed (the execution status of this line is deduced): d->scrollBarContainers[scrollBarOrientation]->addWidget(widget, position); | - |
| 871 | d->layoutChildren(); executed (the execution status of this line is deduced): d->layoutChildren(); | - |
| 872 | if (isHidden() == false) partially evaluated: isHidden() == false| yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
| 873 | widget->show(); executed: widget->show();Execution Count:13 | 13 |
| 874 | } executed: }Execution Count:13 | 13 |
| 875 | | - |
| 876 | /*! | - |
| 877 | \since 4.2 | - |
| 878 | Returns a list of the currently set scroll bar widgets. \a alignment | - |
| 879 | can be any combination of the four location flags. | - |
| 880 | | - |
| 881 | \sa addScrollBarWidget() | - |
| 882 | */ | - |
| 883 | QWidgetList QAbstractScrollArea::scrollBarWidgets(Qt::Alignment alignment) | - |
| 884 | { | - |
| 885 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 886 | | - |
| 887 | QWidgetList list; executed (the execution status of this line is deduced): QWidgetList list; | - |
| 888 | | - |
| 889 | if (alignment & Qt::AlignLeft) evaluated: alignment & Qt::AlignLeft| yes Evaluation Count:15 | yes Evaluation Count:21 |
| 15-21 |
| 890 | list += d->scrollBarContainers[Qt::Horizontal]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalLeft); executed: list += d->scrollBarContainers[Qt::Horizontal]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalLeft);Execution Count:15 | 15 |
| 891 | if (alignment & Qt::AlignRight) evaluated: alignment & Qt::AlignRight| yes Evaluation Count:15 | yes Evaluation Count:21 |
| 15-21 |
| 892 | list += d->scrollBarContainers[Qt::Horizontal]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalRight); executed: list += d->scrollBarContainers[Qt::Horizontal]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalRight);Execution Count:15 | 15 |
| 893 | if (alignment & Qt::AlignTop) evaluated: alignment & Qt::AlignTop| yes Evaluation Count:15 | yes Evaluation Count:21 |
| 15-21 |
| 894 | list += d->scrollBarContainers[Qt::Vertical]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalLeft); executed: list += d->scrollBarContainers[Qt::Vertical]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalLeft);Execution Count:15 | 15 |
| 895 | if (alignment & Qt::AlignBottom) evaluated: alignment & Qt::AlignBottom| yes Evaluation Count:15 | yes Evaluation Count:21 |
| 15-21 |
| 896 | list += d->scrollBarContainers[Qt::Vertical]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalRight); executed: list += d->scrollBarContainers[Qt::Vertical]->widgets(QAbstractScrollAreaScrollBarContainer::LogicalRight);Execution Count:15 | 15 |
| 897 | | - |
| 898 | return list; executed: return list;Execution Count:36 | 36 |
| 899 | } | - |
| 900 | | - |
| 901 | /*! | - |
| 902 | Sets the margins around the scrolling area to \a left, \a top, \a | - |
| 903 | right and \a bottom. This is useful for applications such as | - |
| 904 | spreadsheets with "locked" rows and columns. The marginal space is | - |
| 905 | is left blank; put widgets in the unused area. | - |
| 906 | | - |
| 907 | Note that this function is frequently called by QTreeView and | - |
| 908 | QTableView, so margins must be implemented by QAbstractScrollArea | - |
| 909 | subclasses. Also, if the subclasses are to be used in item views, | - |
| 910 | they should not call this function. | - |
| 911 | | - |
| 912 | By default all margins are zero. | - |
| 913 | | - |
| 914 | */ | - |
| 915 | void QAbstractScrollArea::setViewportMargins(int left, int top, int right, int bottom) | - |
| 916 | { | - |
| 917 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 918 | d->left = left; executed (the execution status of this line is deduced): d->left = left; | - |
| 919 | d->top = top; executed (the execution status of this line is deduced): d->top = top; | - |
| 920 | d->right = right; executed (the execution status of this line is deduced): d->right = right; | - |
| 921 | d->bottom = bottom; executed (the execution status of this line is deduced): d->bottom = bottom; | - |
| 922 | d->layoutChildren(); executed (the execution status of this line is deduced): d->layoutChildren(); | - |
| 923 | } executed: }Execution Count:4077 | 4077 |
| 924 | | - |
| 925 | /*! | - |
| 926 | \since 4.6 | - |
| 927 | Sets \a margins around the scrolling area. This is useful for | - |
| 928 | applications such as spreadsheets with "locked" rows and columns. | - |
| 929 | The marginal space is is left blank; put widgets in the unused | - |
| 930 | area. | - |
| 931 | | - |
| 932 | By default all margins are zero. | - |
| 933 | | - |
| 934 | */ | - |
| 935 | void QAbstractScrollArea::setViewportMargins(const QMargins &margins) | - |
| 936 | { | - |
| 937 | setViewportMargins(margins.left(), margins.top(), never executed (the execution status of this line is deduced): setViewportMargins(margins.left(), margins.top(), | - |
| 938 | margins.right(), margins.bottom()); never executed (the execution status of this line is deduced): margins.right(), margins.bottom()); | - |
| 939 | } | 0 |
| 940 | | - |
| 941 | /*! \internal */ | - |
| 942 | bool QAbstractScrollArea::eventFilter(QObject *o, QEvent *e) | - |
| 943 | { | - |
| 944 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 945 | if ((o == d->hbar || o == d->vbar) && (e->type() == QEvent::HoverEnter || e->type() == QEvent::HoverLeave)) { evaluated: o == d->hbar| yes Evaluation Count:11647 | yes Evaluation Count:83419 |
evaluated: o == d->vbar| yes Evaluation Count:12636 | yes Evaluation Count:70783 |
partially evaluated: e->type() == QEvent::HoverEnter| no Evaluation Count:0 | yes Evaluation Count:24283 |
partially evaluated: e->type() == QEvent::HoverLeave| no Evaluation Count:0 | yes Evaluation Count:24283 |
| 0-83419 |
| 946 | Qt::ScrollBarPolicy policy = o == d->hbar ? d->vbarpolicy : d->hbarpolicy; never evaluated: o == d->hbar | 0 |
| 947 | if (policy == Qt::ScrollBarAsNeeded || style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, d->vbar ? d->vbar : d->hbar)) { never evaluated: policy == Qt::ScrollBarAsNeeded never evaluated: style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, d->vbar ? d->vbar : d->hbar) | 0 |
| 948 | QScrollBar *sibling = o == d->hbar ? d->vbar : d->hbar; never evaluated: o == d->hbar | 0 |
| 949 | d->setScrollBarTransient(sibling, e->type() == QEvent::HoverLeave); never executed (the execution status of this line is deduced): d->setScrollBarTransient(sibling, e->type() == QEvent::HoverLeave); | - |
| 950 | } | 0 |
| 951 | } | 0 |
| 952 | return QFrame::eventFilter(o, e); executed: return QFrame::eventFilter(o, e);Execution Count:95066 | 95066 |
| 953 | } | - |
| 954 | | - |
| 955 | /*! | - |
| 956 | \fn bool QAbstractScrollArea::event(QEvent *event) | - |
| 957 | | - |
| 958 | \reimp | - |
| 959 | | - |
| 960 | This is the main event handler for the QAbstractScrollArea widget (\e not | - |
| 961 | the scrolling area viewport()). The specified \a event is a general event | - |
| 962 | object that may need to be cast to the appropriate class depending on its | - |
| 963 | type. | - |
| 964 | | - |
| 965 | \sa QEvent::type() | - |
| 966 | */ | - |
| 967 | bool QAbstractScrollArea::event(QEvent *e) | - |
| 968 | { | - |
| 969 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 970 | switch (e->type()) { | - |
| 971 | case QEvent::AcceptDropsChange: | - |
| 972 | // There was a chance that with accessibility client we get an | - |
| 973 | // event before the viewport was created. | - |
| 974 | // Also, in some cases we might get here from QWidget::event() virtual function which is (indirectly) called | - |
| 975 | // from the viewport constructor at the time when the d->viewport is not yet initialized even without any | - |
| 976 | // accessibility client. See qabstractscrollarea autotest for a test case. | - |
| 977 | if (d->viewport) partially evaluated: d->viewport| yes Evaluation Count:1576 | no Evaluation Count:0 |
| 0-1576 |
| 978 | d->viewport->setAcceptDrops(acceptDrops()); executed: d->viewport->setAcceptDrops(acceptDrops());Execution Count:1576 | 1576 |
| 979 | break; executed: break;Execution Count:1576 | 1576 |
| 980 | case QEvent::MouseTrackingChange: | - |
| 981 | d->viewport->setMouseTracking(hasMouseTracking()); executed (the execution status of this line is deduced): d->viewport->setMouseTracking(hasMouseTracking()); | - |
| 982 | break; executed: break;Execution Count:342 | 342 |
| 983 | case QEvent::Resize: | - |
| 984 | d->layoutChildren(); executed (the execution status of this line is deduced): d->layoutChildren(); | - |
| 985 | break; executed: break;Execution Count:4071 | 4071 |
| 986 | case QEvent::Paint: { | - |
| 987 | QStyleOption option; executed (the execution status of this line is deduced): QStyleOption option; | - |
| 988 | option.initFrom(this); executed (the execution status of this line is deduced): option.initFrom(this); | - |
| 989 | if (d->cornerPaintingRect.isValid()) { evaluated: d->cornerPaintingRect.isValid()| yes Evaluation Count:846 | yes Evaluation Count:851 |
| 846-851 |
| 990 | option.rect = d->cornerPaintingRect; executed (the execution status of this line is deduced): option.rect = d->cornerPaintingRect; | - |
| 991 | QPainter p(this); executed (the execution status of this line is deduced): QPainter p(this); | - |
| 992 | style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); executed (the execution status of this line is deduced): style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); | - |
| 993 | } executed: }Execution Count:846 | 846 |
| 994 | #ifdef Q_WS_MAC | - |
| 995 | if (d->reverseCornerPaintingRect.isValid()) { | - |
| 996 | option.rect = d->reverseCornerPaintingRect; | - |
| 997 | QPainter p(this); | - |
| 998 | style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, &option, &p, this); | - |
| 999 | } | - |
| 1000 | #endif | - |
| 1001 | } | - |
| 1002 | QFrame::paintEvent((QPaintEvent*)e); executed (the execution status of this line is deduced): QFrame::paintEvent((QPaintEvent*)e); | - |
| 1003 | break; executed: break;Execution Count:1697 | 1697 |
| 1004 | #ifndef QT_NO_CONTEXTMENU | - |
| 1005 | case QEvent::ContextMenu: | - |
| 1006 | if (static_cast<QContextMenuEvent *>(e)->reason() == QContextMenuEvent::Keyboard) partially evaluated: static_cast<QContextMenuEvent *>(e)->reason() == QContextMenuEvent::Keyboard| no Evaluation Count:0 | yes Evaluation Count:100 |
| 0-100 |
| 1007 | return QFrame::event(e); never executed: return QFrame::event(e); | 0 |
| 1008 | e->ignore(); executed (the execution status of this line is deduced): e->ignore(); | - |
| 1009 | break; executed: break;Execution Count:100 | 100 |
| 1010 | #endif // QT_NO_CONTEXTMENU | - |
| 1011 | case QEvent::MouseButtonPress: | - |
| 1012 | case QEvent::MouseButtonRelease: | - |
| 1013 | case QEvent::MouseButtonDblClick: | - |
| 1014 | case QEvent::MouseMove: | - |
| 1015 | case QEvent::Wheel: | - |
| 1016 | #ifndef QT_NO_DRAGANDDROP | - |
| 1017 | case QEvent::Drop: | - |
| 1018 | case QEvent::DragEnter: | - |
| 1019 | case QEvent::DragMove: | - |
| 1020 | case QEvent::DragLeave: | - |
| 1021 | #endif | - |
| 1022 | // ignore touch events in case they have been propagated from the viewport | - |
| 1023 | case QEvent::TouchBegin: | - |
| 1024 | case QEvent::TouchUpdate: | - |
| 1025 | case QEvent::TouchEnd: | - |
| 1026 | return false; executed: return false;Execution Count:10 | 10 |
| 1027 | #ifndef QT_NO_GESTURES | - |
| 1028 | case QEvent::Gesture: | - |
| 1029 | { | - |
| 1030 | QGestureEvent *ge = static_cast<QGestureEvent *>(e); never executed (the execution status of this line is deduced): QGestureEvent *ge = static_cast<QGestureEvent *>(e); | - |
| 1031 | QPanGesture *g = static_cast<QPanGesture *>(ge->gesture(Qt::PanGesture)); never executed (the execution status of this line is deduced): QPanGesture *g = static_cast<QPanGesture *>(ge->gesture(Qt::PanGesture)); | - |
| 1032 | if (g) { | 0 |
| 1033 | QScrollBar *hBar = horizontalScrollBar(); never executed (the execution status of this line is deduced): QScrollBar *hBar = horizontalScrollBar(); | - |
| 1034 | QScrollBar *vBar = verticalScrollBar(); never executed (the execution status of this line is deduced): QScrollBar *vBar = verticalScrollBar(); | - |
| 1035 | QPointF delta = g->delta(); never executed (the execution status of this line is deduced): QPointF delta = g->delta(); | - |
| 1036 | if (!delta.isNull()) { never evaluated: !delta.isNull() | 0 |
| 1037 | if (QApplication::isRightToLeft()) never evaluated: QApplication::isRightToLeft() | 0 |
| 1038 | delta.rx() *= -1; never executed: delta.rx() *= -1; | 0 |
| 1039 | int newX = hBar->value() - delta.x(); never executed (the execution status of this line is deduced): int newX = hBar->value() - delta.x(); | - |
| 1040 | int newY = vBar->value() - delta.y(); never executed (the execution status of this line is deduced): int newY = vBar->value() - delta.y(); | - |
| 1041 | hBar->setValue(newX); never executed (the execution status of this line is deduced): hBar->setValue(newX); | - |
| 1042 | vBar->setValue(newY); never executed (the execution status of this line is deduced): vBar->setValue(newY); | - |
| 1043 | } | 0 |
| 1044 | return true; never executed: return true; | 0 |
| 1045 | } | - |
| 1046 | return false; never executed: return false; | 0 |
| 1047 | } | - |
| 1048 | #endif // QT_NO_GESTURES | - |
| 1049 | case QEvent::ScrollPrepare: | - |
| 1050 | { | - |
| 1051 | QScrollPrepareEvent *se = static_cast<QScrollPrepareEvent *>(e); never executed (the execution status of this line is deduced): QScrollPrepareEvent *se = static_cast<QScrollPrepareEvent *>(e); | - |
| 1052 | if (d->canStartScrollingAt(se->startPos().toPoint())) { never evaluated: d->canStartScrollingAt(se->startPos().toPoint()) | 0 |
| 1053 | QScrollBar *hBar = horizontalScrollBar(); never executed (the execution status of this line is deduced): QScrollBar *hBar = horizontalScrollBar(); | - |
| 1054 | QScrollBar *vBar = verticalScrollBar(); never executed (the execution status of this line is deduced): QScrollBar *vBar = verticalScrollBar(); | - |
| 1055 | | - |
| 1056 | se->setViewportSize(QSizeF(viewport()->size())); never executed (the execution status of this line is deduced): se->setViewportSize(QSizeF(viewport()->size())); | - |
| 1057 | se->setContentPosRange(QRectF(0, 0, hBar->maximum(), vBar->maximum())); never executed (the execution status of this line is deduced): se->setContentPosRange(QRectF(0, 0, hBar->maximum(), vBar->maximum())); | - |
| 1058 | se->setContentPos(QPointF(hBar->value(), vBar->value())); never executed (the execution status of this line is deduced): se->setContentPos(QPointF(hBar->value(), vBar->value())); | - |
| 1059 | se->accept(); never executed (the execution status of this line is deduced): se->accept(); | - |
| 1060 | return true; never executed: return true; | 0 |
| 1061 | } | - |
| 1062 | return false; never executed: return false; | 0 |
| 1063 | } | - |
| 1064 | case QEvent::Scroll: | - |
| 1065 | { | - |
| 1066 | QScrollEvent *se = static_cast<QScrollEvent *>(e); never executed (the execution status of this line is deduced): QScrollEvent *se = static_cast<QScrollEvent *>(e); | - |
| 1067 | | - |
| 1068 | QScrollBar *hBar = horizontalScrollBar(); never executed (the execution status of this line is deduced): QScrollBar *hBar = horizontalScrollBar(); | - |
| 1069 | QScrollBar *vBar = verticalScrollBar(); never executed (the execution status of this line is deduced): QScrollBar *vBar = verticalScrollBar(); | - |
| 1070 | hBar->setValue(se->contentPos().x()); never executed (the execution status of this line is deduced): hBar->setValue(se->contentPos().x()); | - |
| 1071 | vBar->setValue(se->contentPos().y()); never executed (the execution status of this line is deduced): vBar->setValue(se->contentPos().y()); | - |
| 1072 | | - |
| 1073 | #ifdef Q_WS_WIN | - |
| 1074 | typedef BOOL (*PtrBeginPanningFeedback)(HWND); | - |
| 1075 | typedef BOOL (*PtrUpdatePanningFeedback)(HWND, LONG, LONG, BOOL); | - |
| 1076 | typedef BOOL (*PtrEndPanningFeedback)(HWND, BOOL); | - |
| 1077 | | - |
| 1078 | static PtrBeginPanningFeedback ptrBeginPanningFeedback = 0; | - |
| 1079 | static PtrUpdatePanningFeedback ptrUpdatePanningFeedback = 0; | - |
| 1080 | static PtrEndPanningFeedback ptrEndPanningFeedback = 0; | - |
| 1081 | | - |
| 1082 | if (!ptrBeginPanningFeedback) | - |
| 1083 | ptrBeginPanningFeedback = (PtrBeginPanningFeedback) QLibrary::resolve(QLatin1String("UxTheme"), "BeginPanningFeedback"); | - |
| 1084 | if (!ptrUpdatePanningFeedback) | - |
| 1085 | ptrUpdatePanningFeedback = (PtrUpdatePanningFeedback) QLibrary::resolve(QLatin1String("UxTheme"), "UpdatePanningFeedback"); | - |
| 1086 | if (!ptrEndPanningFeedback) | - |
| 1087 | ptrEndPanningFeedback = (PtrEndPanningFeedback) QLibrary::resolve(QLatin1String("UxTheme"), "EndPanningFeedback"); | - |
| 1088 | | - |
| 1089 | if (ptrBeginPanningFeedback && ptrUpdatePanningFeedback && ptrEndPanningFeedback) { | - |
| 1090 | WId wid = window()->winId(); | - |
| 1091 | | - |
| 1092 | if (!se->overshootDistance().isNull() && d->overshoot.isNull()) | - |
| 1093 | ptrBeginPanningFeedback(wid); | - |
| 1094 | if (!se->overshootDistance().isNull()) | - |
| 1095 | ptrUpdatePanningFeedback(wid, -se->overshootDistance().x(), -se->overshootDistance().y(), false); | - |
| 1096 | if (se->overshootDistance().isNull() && !d->overshoot.isNull()) | - |
| 1097 | ptrEndPanningFeedback(wid, true); | - |
| 1098 | } else | - |
| 1099 | #endif | - |
| 1100 | { | - |
| 1101 | QPoint delta = d->overshoot - se->overshootDistance().toPoint(); never executed (the execution status of this line is deduced): QPoint delta = d->overshoot - se->overshootDistance().toPoint(); | - |
| 1102 | if (!delta.isNull()) never evaluated: !delta.isNull() | 0 |
| 1103 | viewport()->move(viewport()->pos() + delta); never executed: viewport()->move(viewport()->pos() + delta); | 0 |
| 1104 | } | - |
| 1105 | d->overshoot = se->overshootDistance().toPoint(); never executed (the execution status of this line is deduced): d->overshoot = se->overshootDistance().toPoint(); | - |
| 1106 | | - |
| 1107 | return true; never executed: return true; | 0 |
| 1108 | } | - |
| 1109 | case QEvent::StyleChange: | - |
| 1110 | case QEvent::LayoutDirectionChange: | - |
| 1111 | case QEvent::ApplicationLayoutDirectionChange: | - |
| 1112 | case QEvent::LayoutRequest: | - |
| 1113 | d->layoutChildren(); executed (the execution status of this line is deduced): d->layoutChildren(); | - |
| 1114 | // fall through | - |
| 1115 | default: | - |
| 1116 | return QFrame::event(e); executed: return QFrame::event(e);Execution Count:94627 | 94627 |
| 1117 | } | - |
| 1118 | return true; executed: return true;Execution Count:7786 | 7786 |
| 1119 | } | - |
| 1120 | | - |
| 1121 | /*! | - |
| 1122 | \fn bool QAbstractScrollArea::viewportEvent(QEvent *event) | - |
| 1123 | | - |
| 1124 | The main event handler for the scrolling area (the viewport() widget). | - |
| 1125 | It handles the \a event specified, and can be called by subclasses to | - |
| 1126 | provide reasonable default behavior. | - |
| 1127 | | - |
| 1128 | Returns true to indicate to the event system that the event has been | - |
| 1129 | handled, and needs no further processing; otherwise returns false to | - |
| 1130 | indicate that the event should be propagated further. | - |
| 1131 | | - |
| 1132 | You can reimplement this function in a subclass, but we recommend | - |
| 1133 | using one of the specialized event handlers instead. | - |
| 1134 | | - |
| 1135 | Specialized handlers for viewport events are: paintEvent(), | - |
| 1136 | mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), | - |
| 1137 | mouseMoveEvent(), wheelEvent(), dragEnterEvent(), dragMoveEvent(), | - |
| 1138 | dragLeaveEvent(), dropEvent(), contextMenuEvent(), and | - |
| 1139 | resizeEvent(). | - |
| 1140 | */ | - |
| 1141 | bool QAbstractScrollArea::viewportEvent(QEvent *e) | - |
| 1142 | { | - |
| 1143 | switch (e->type()) { | - |
| 1144 | case QEvent::Resize: | - |
| 1145 | case QEvent::Paint: | - |
| 1146 | case QEvent::MouseButtonPress: | - |
| 1147 | case QEvent::MouseButtonRelease: | - |
| 1148 | case QEvent::MouseButtonDblClick: | - |
| 1149 | case QEvent::TouchBegin: | - |
| 1150 | case QEvent::TouchUpdate: | - |
| 1151 | case QEvent::TouchEnd: | - |
| 1152 | case QEvent::MouseMove: | - |
| 1153 | case QEvent::ContextMenu: | - |
| 1154 | #ifndef QT_NO_WHEELEVENT | - |
| 1155 | case QEvent::Wheel: | - |
| 1156 | #endif | - |
| 1157 | #ifndef QT_NO_DRAGANDDROP | - |
| 1158 | case QEvent::Drop: | - |
| 1159 | case QEvent::DragEnter: | - |
| 1160 | case QEvent::DragMove: | - |
| 1161 | case QEvent::DragLeave: | - |
| 1162 | #endif | - |
| 1163 | return QFrame::event(e); executed: return QFrame::event(e);Execution Count:20260 | 20260 |
| 1164 | case QEvent::LayoutRequest: | - |
| 1165 | #ifndef QT_NO_GESTURES | - |
| 1166 | case QEvent::Gesture: | - |
| 1167 | case QEvent::GestureOverride: | - |
| 1168 | return event(e); executed: return event(e);Execution Count:204 | 204 |
| 1169 | #endif | - |
| 1170 | case QEvent::ScrollPrepare: | - |
| 1171 | case QEvent::Scroll: | - |
| 1172 | return event(e); never executed: return event(e); | 0 |
| 1173 | default: | - |
| 1174 | break; executed: break;Execution Count:29816 | 29816 |
| 1175 | } | - |
| 1176 | return false; // let the viewport widget handle the event executed: return false;Execution Count:29816 | 29816 |
| 1177 | } | - |
| 1178 | | - |
| 1179 | /*! | - |
| 1180 | \fn void QAbstractScrollArea::resizeEvent(QResizeEvent *event) | - |
| 1181 | | - |
| 1182 | This event handler can be reimplemented in a subclass to receive | - |
| 1183 | resize events (passed in \a event), for the viewport() widget. | - |
| 1184 | | - |
| 1185 | When resizeEvent() is called, the viewport already has its new | - |
| 1186 | geometry: Its new size is accessible through the | - |
| 1187 | QResizeEvent::size() function, and the old size through | - |
| 1188 | QResizeEvent::oldSize(). | - |
| 1189 | | - |
| 1190 | \sa QWidget::resizeEvent() | - |
| 1191 | */ | - |
| 1192 | void QAbstractScrollArea::resizeEvent(QResizeEvent *) | - |
| 1193 | { | - |
| 1194 | } | - |
| 1195 | | - |
| 1196 | /*! | - |
| 1197 | \fn void QAbstractScrollArea::paintEvent(QPaintEvent *event) | - |
| 1198 | | - |
| 1199 | This event handler can be reimplemented in a subclass to receive | - |
| 1200 | paint events (passed in \a event), for the viewport() widget. | - |
| 1201 | | - |
| 1202 | \note If you open a painter, make sure to open it on the viewport(). | - |
| 1203 | | - |
| 1204 | \sa QWidget::paintEvent() | - |
| 1205 | */ | - |
| 1206 | void QAbstractScrollArea::paintEvent(QPaintEvent*) | - |
| 1207 | { | - |
| 1208 | } | - |
| 1209 | | - |
| 1210 | /*! | - |
| 1211 | This event handler can be reimplemented in a subclass to receive | - |
| 1212 | mouse press events for the viewport() widget. The event is passed | - |
| 1213 | in \a e. | - |
| 1214 | | - |
| 1215 | \sa QWidget::mousePressEvent() | - |
| 1216 | */ | - |
| 1217 | void QAbstractScrollArea::mousePressEvent(QMouseEvent *e) | - |
| 1218 | { | - |
| 1219 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
| 1220 | } | 0 |
| 1221 | | - |
| 1222 | /*! | - |
| 1223 | This event handler can be reimplemented in a subclass to receive | - |
| 1224 | mouse release events for the viewport() widget. The event is | - |
| 1225 | passed in \a e. | - |
| 1226 | | - |
| 1227 | \sa QWidget::mouseReleaseEvent() | - |
| 1228 | */ | - |
| 1229 | void QAbstractScrollArea::mouseReleaseEvent(QMouseEvent *e) | - |
| 1230 | { | - |
| 1231 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
| 1232 | } | 0 |
| 1233 | | - |
| 1234 | /*! | - |
| 1235 | This event handler can be reimplemented in a subclass to receive | - |
| 1236 | mouse double click events for the viewport() widget. The event is | - |
| 1237 | passed in \a e. | - |
| 1238 | | - |
| 1239 | \sa QWidget::mouseDoubleClickEvent() | - |
| 1240 | */ | - |
| 1241 | void QAbstractScrollArea::mouseDoubleClickEvent(QMouseEvent *e) | - |
| 1242 | { | - |
| 1243 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
| 1244 | } | 0 |
| 1245 | | - |
| 1246 | /*! | - |
| 1247 | This event handler can be reimplemented in a subclass to receive | - |
| 1248 | mouse move events for the viewport() widget. The event is passed | - |
| 1249 | in \a e. | - |
| 1250 | | - |
| 1251 | \sa QWidget::mouseMoveEvent() | - |
| 1252 | */ | - |
| 1253 | void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e) | - |
| 1254 | { | - |
| 1255 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
| 1256 | } | 0 |
| 1257 | | - |
| 1258 | /*! | - |
| 1259 | This event handler can be reimplemented in a subclass to receive | - |
| 1260 | wheel events for the viewport() widget. The event is passed in \a | - |
| 1261 | e. | - |
| 1262 | | - |
| 1263 | \sa QWidget::wheelEvent() | - |
| 1264 | */ | - |
| 1265 | #ifndef QT_NO_WHEELEVENT | - |
| 1266 | void QAbstractScrollArea::wheelEvent(QWheelEvent *e) | - |
| 1267 | { | - |
| 1268 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 1269 | if (static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal) evaluated: static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal| yes Evaluation Count:4 | yes Evaluation Count:5 |
| 4-5 |
| 1270 | QApplication::sendEvent(d->hbar, e); executed: QApplication::sendEvent(d->hbar, e);Execution Count:4 | 4 |
| 1271 | else | - |
| 1272 | QApplication::sendEvent(d->vbar, e); executed: QApplication::sendEvent(d->vbar, e);Execution Count:5 | 5 |
| 1273 | } | - |
| 1274 | #endif | - |
| 1275 | | - |
| 1276 | #ifndef QT_NO_CONTEXTMENU | - |
| 1277 | /*! | - |
| 1278 | This event handler can be reimplemented in a subclass to receive | - |
| 1279 | context menu events for the viewport() widget. The event is passed | - |
| 1280 | in \a e. | - |
| 1281 | | - |
| 1282 | \sa QWidget::contextMenuEvent() | - |
| 1283 | */ | - |
| 1284 | void QAbstractScrollArea::contextMenuEvent(QContextMenuEvent *e) | - |
| 1285 | { | - |
| 1286 | e->ignore(); never executed (the execution status of this line is deduced): e->ignore(); | - |
| 1287 | } | 0 |
| 1288 | #endif // QT_NO_CONTEXTMENU | - |
| 1289 | | - |
| 1290 | /*! | - |
| 1291 | This function is called with key event \a e when key presses | - |
| 1292 | occur. It handles PageUp, PageDown, Up, Down, Left, and Right, and | - |
| 1293 | ignores all other key presses. | - |
| 1294 | */ | - |
| 1295 | void QAbstractScrollArea::keyPressEvent(QKeyEvent * e) | - |
| 1296 | { | - |
| 1297 | Q_D(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 1298 | if (false){ partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1299 | #ifndef QT_NO_SHORTCUT | - |
| 1300 | } else if (e == QKeySequence::MoveToPreviousPage) { never executed: } partially evaluated: e == QKeySequence::MoveToPreviousPage| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1301 | d->vbar->triggerAction(QScrollBar::SliderPageStepSub); never executed (the execution status of this line is deduced): d->vbar->triggerAction(QScrollBar::SliderPageStepSub); | - |
| 1302 | } else if (e == QKeySequence::MoveToNextPage) { never executed: } partially evaluated: e == QKeySequence::MoveToNextPage| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1303 | d->vbar->triggerAction(QScrollBar::SliderPageStepAdd); never executed (the execution status of this line is deduced): d->vbar->triggerAction(QScrollBar::SliderPageStepAdd); | - |
| 1304 | #endif | - |
| 1305 | } else { | 0 |
| 1306 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 1307 | if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { | - |
| 1308 | e->ignore(); | - |
| 1309 | return; | - |
| 1310 | } | - |
| 1311 | #endif | - |
| 1312 | switch (e->key()) { | - |
| 1313 | case Qt::Key_Up: | - |
| 1314 | d->vbar->triggerAction(QScrollBar::SliderSingleStepSub); never executed (the execution status of this line is deduced): d->vbar->triggerAction(QScrollBar::SliderSingleStepSub); | - |
| 1315 | break; | 0 |
| 1316 | case Qt::Key_Down: | - |
| 1317 | d->vbar->triggerAction(QScrollBar::SliderSingleStepAdd); never executed (the execution status of this line is deduced): d->vbar->triggerAction(QScrollBar::SliderSingleStepAdd); | - |
| 1318 | break; | 0 |
| 1319 | case Qt::Key_Left: | - |
| 1320 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 1321 | if (QApplication::keypadNavigationEnabled() && hasEditFocus() | - |
| 1322 | && (!d->hbar->isVisible() || d->hbar->value() == d->hbar->minimum())) { | - |
| 1323 | //if we aren't using the hbar or we are already at the leftmost point ignore | - |
| 1324 | e->ignore(); | - |
| 1325 | return; | - |
| 1326 | } | - |
| 1327 | #endif | - |
| 1328 | d->hbar->triggerAction( executed (the execution status of this line is deduced): d->hbar->triggerAction( | - |
| 1329 | layoutDirection() == Qt::LeftToRight executed (the execution status of this line is deduced): layoutDirection() == Qt::LeftToRight | - |
| 1330 | ? QScrollBar::SliderSingleStepSub : QScrollBar::SliderSingleStepAdd); executed (the execution status of this line is deduced): ? QScrollBar::SliderSingleStepSub : QScrollBar::SliderSingleStepAdd); | - |
| 1331 | break; executed: break;Execution Count:2 | 2 |
| 1332 | case Qt::Key_Right: | - |
| 1333 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 1334 | if (QApplication::keypadNavigationEnabled() && hasEditFocus() | - |
| 1335 | && (!d->hbar->isVisible() || d->hbar->value() == d->hbar->maximum())) { | - |
| 1336 | //if we aren't using the hbar or we are already at the rightmost point ignore | - |
| 1337 | e->ignore(); | - |
| 1338 | return; | - |
| 1339 | } | - |
| 1340 | #endif | - |
| 1341 | d->hbar->triggerAction( executed (the execution status of this line is deduced): d->hbar->triggerAction( | - |
| 1342 | layoutDirection() == Qt::LeftToRight executed (the execution status of this line is deduced): layoutDirection() == Qt::LeftToRight | - |
| 1343 | ? QScrollBar::SliderSingleStepAdd : QScrollBar::SliderSingleStepSub); executed (the execution status of this line is deduced): ? QScrollBar::SliderSingleStepAdd : QScrollBar::SliderSingleStepSub); | - |
| 1344 | break; executed: break;Execution Count:2 | 2 |
| 1345 | default: | - |
| 1346 | e->ignore(); executed (the execution status of this line is deduced): e->ignore(); | - |
| 1347 | return; executed: return;Execution Count:4 | 4 |
| 1348 | } | - |
| 1349 | } executed: }Execution Count:4 | 4 |
| 1350 | e->accept(); executed (the execution status of this line is deduced): e->accept(); | - |
| 1351 | } executed: }Execution Count:4 | 4 |
| 1352 | | - |
| 1353 | | - |
| 1354 | #ifndef QT_NO_DRAGANDDROP | - |
| 1355 | /*! | - |
| 1356 | \fn void QAbstractScrollArea::dragEnterEvent(QDragEnterEvent *event) | - |
| 1357 | | - |
| 1358 | This event handler can be reimplemented in a subclass to receive | - |
| 1359 | drag enter events (passed in \a event), for the viewport() widget. | - |
| 1360 | | - |
| 1361 | \sa QWidget::dragEnterEvent() | - |
| 1362 | */ | - |
| 1363 | void QAbstractScrollArea::dragEnterEvent(QDragEnterEvent *) | - |
| 1364 | { | - |
| 1365 | } | - |
| 1366 | | - |
| 1367 | /*! | - |
| 1368 | \fn void QAbstractScrollArea::dragMoveEvent(QDragMoveEvent *event) | - |
| 1369 | | - |
| 1370 | This event handler can be reimplemented in a subclass to receive | - |
| 1371 | drag move events (passed in \a event), for the viewport() widget. | - |
| 1372 | | - |
| 1373 | \sa QWidget::dragMoveEvent() | - |
| 1374 | */ | - |
| 1375 | void QAbstractScrollArea::dragMoveEvent(QDragMoveEvent *) | - |
| 1376 | { | - |
| 1377 | } | - |
| 1378 | | - |
| 1379 | /*! | - |
| 1380 | \fn void QAbstractScrollArea::dragLeaveEvent(QDragLeaveEvent *event) | - |
| 1381 | | - |
| 1382 | This event handler can be reimplemented in a subclass to receive | - |
| 1383 | drag leave events (passed in \a event), for the viewport() widget. | - |
| 1384 | | - |
| 1385 | \sa QWidget::dragLeaveEvent() | - |
| 1386 | */ | - |
| 1387 | void QAbstractScrollArea::dragLeaveEvent(QDragLeaveEvent *) | - |
| 1388 | { | - |
| 1389 | } | - |
| 1390 | | - |
| 1391 | /*! | - |
| 1392 | \fn void QAbstractScrollArea::dropEvent(QDropEvent *event) | - |
| 1393 | | - |
| 1394 | This event handler can be reimplemented in a subclass to receive | - |
| 1395 | drop events (passed in \a event), for the viewport() widget. | - |
| 1396 | | - |
| 1397 | \sa QWidget::dropEvent() | - |
| 1398 | */ | - |
| 1399 | void QAbstractScrollArea::dropEvent(QDropEvent *) | - |
| 1400 | { | - |
| 1401 | } | - |
| 1402 | | - |
| 1403 | | - |
| 1404 | #endif | - |
| 1405 | | - |
| 1406 | /*! | - |
| 1407 | This virtual handler is called when the scroll bars are moved by | - |
| 1408 | \a dx, \a dy, and consequently the viewport's contents should be | - |
| 1409 | scrolled accordingly. | - |
| 1410 | | - |
| 1411 | The default implementation simply calls update() on the entire | - |
| 1412 | viewport(), subclasses can reimplement this handler for | - |
| 1413 | optimization purposes, or - like QScrollArea - to move a contents | - |
| 1414 | widget. The parameters \a dx and \a dy are there for convenience, | - |
| 1415 | so that the class knows how much should be scrolled (useful | - |
| 1416 | e.g. when doing pixel-shifts). You may just as well ignore these | - |
| 1417 | values and scroll directly to the position the scroll bars | - |
| 1418 | indicate. | - |
| 1419 | | - |
| 1420 | Calling this function in order to scroll programmatically is an | - |
| 1421 | error, use the scroll bars instead (e.g. by calling | - |
| 1422 | QScrollBar::setValue() directly). | - |
| 1423 | */ | - |
| 1424 | void QAbstractScrollArea::scrollContentsBy(int, int) | - |
| 1425 | { | - |
| 1426 | viewport()->update(); never executed (the execution status of this line is deduced): viewport()->update(); | - |
| 1427 | } | 0 |
| 1428 | | - |
| 1429 | bool QAbstractScrollAreaPrivate::canStartScrollingAt( const QPoint &startPos ) | - |
| 1430 | { | - |
| 1431 | Q_Q(QAbstractScrollArea); never executed (the execution status of this line is deduced): QAbstractScrollArea * const q = q_func(); | - |
| 1432 | | - |
| 1433 | #ifndef QT_NO_GRAPHICSVIEW | - |
| 1434 | // don't start scrolling when a drag mode has been set. | - |
| 1435 | // don't start scrolling on a movable item. | - |
| 1436 | if (QGraphicsView *view = qobject_cast<QGraphicsView *>(q)) { never evaluated: QGraphicsView *view = qobject_cast<QGraphicsView *>(q) | 0 |
| 1437 | if (view->dragMode() != QGraphicsView::NoDrag) never evaluated: view->dragMode() != QGraphicsView::NoDrag | 0 |
| 1438 | return false; never executed: return false; | 0 |
| 1439 | | - |
| 1440 | QGraphicsItem *childItem = view->itemAt(startPos); never executed (the execution status of this line is deduced): QGraphicsItem *childItem = view->itemAt(startPos); | - |
| 1441 | | - |
| 1442 | if (childItem && (childItem->flags() & QGraphicsItem::ItemIsMovable)) never evaluated: childItem never evaluated: (childItem->flags() & QGraphicsItem::ItemIsMovable) | 0 |
| 1443 | return false; never executed: return false; | 0 |
| 1444 | } | 0 |
| 1445 | #endif | - |
| 1446 | | - |
| 1447 | // don't start scrolling on a QAbstractSlider | - |
| 1448 | if (qobject_cast<QAbstractSlider *>(q->viewport()->childAt(startPos))) { never evaluated: qobject_cast<QAbstractSlider *>(q->viewport()->childAt(startPos)) | 0 |
| 1449 | return false; never executed: return false; | 0 |
| 1450 | } | - |
| 1451 | | - |
| 1452 | return true; never executed: return true; | 0 |
| 1453 | } | - |
| 1454 | | - |
| 1455 | void QAbstractScrollAreaPrivate::flashScrollBars() | - |
| 1456 | { | - |
| 1457 | Q_Q(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollArea * const q = q_func(); | - |
| 1458 | bool transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar ? vbar : hbar); executed (the execution status of this line is deduced): bool transient = q->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, vbar ? vbar : hbar); | - |
| 1459 | if ((hbarpolicy != Qt::ScrollBarAlwaysOff) && (hbarpolicy == Qt::ScrollBarAsNeeded || transient)) evaluated: (hbarpolicy != Qt::ScrollBarAlwaysOff)| yes Evaluation Count:9080 | yes Evaluation Count:122 |
evaluated: hbarpolicy == Qt::ScrollBarAsNeeded| yes Evaluation Count:9012 | yes Evaluation Count:68 |
partially evaluated: transient| no Evaluation Count:0 | yes Evaluation Count:68 |
| 0-9080 |
| 1460 | hbar->d_func()->flash(); executed: hbar->d_func()->flash();Execution Count:9012 | 9012 |
| 1461 | if ((vbarpolicy != Qt::ScrollBarAlwaysOff) && (vbarpolicy == Qt::ScrollBarAsNeeded || transient)) evaluated: (vbarpolicy != Qt::ScrollBarAlwaysOff)| yes Evaluation Count:9142 | yes Evaluation Count:60 |
evaluated: vbarpolicy == Qt::ScrollBarAsNeeded| yes Evaluation Count:9014 | yes Evaluation Count:128 |
partially evaluated: transient| no Evaluation Count:0 | yes Evaluation Count:128 |
| 0-9142 |
| 1462 | vbar->d_func()->flash(); executed: vbar->d_func()->flash();Execution Count:9014 | 9014 |
| 1463 | } executed: }Execution Count:9202 | 9202 |
| 1464 | | - |
| 1465 | void QAbstractScrollAreaPrivate::setScrollBarTransient(QScrollBar *scrollBar, bool transient) | - |
| 1466 | { | - |
| 1467 | scrollBar->d_func()->setTransient(transient); never executed (the execution status of this line is deduced): scrollBar->d_func()->setTransient(transient); | - |
| 1468 | } | 0 |
| 1469 | | - |
| 1470 | void QAbstractScrollAreaPrivate::_q_hslide(int x) | - |
| 1471 | { | - |
| 1472 | Q_Q(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollArea * const q = q_func(); | - |
| 1473 | int dx = xoffset - x; executed (the execution status of this line is deduced): int dx = xoffset - x; | - |
| 1474 | xoffset = x; executed (the execution status of this line is deduced): xoffset = x; | - |
| 1475 | q->scrollContentsBy(dx, 0); executed (the execution status of this line is deduced): q->scrollContentsBy(dx, 0); | - |
| 1476 | flashScrollBars(); executed (the execution status of this line is deduced): flashScrollBars(); | - |
| 1477 | } executed: }Execution Count:7058 | 7058 |
| 1478 | | - |
| 1479 | void QAbstractScrollAreaPrivate::_q_vslide(int y) | - |
| 1480 | { | - |
| 1481 | Q_Q(QAbstractScrollArea); executed (the execution status of this line is deduced): QAbstractScrollArea * const q = q_func(); | - |
| 1482 | int dy = yoffset - y; executed (the execution status of this line is deduced): int dy = yoffset - y; | - |
| 1483 | yoffset = y; executed (the execution status of this line is deduced): yoffset = y; | - |
| 1484 | q->scrollContentsBy(0, dy); executed (the execution status of this line is deduced): q->scrollContentsBy(0, dy); | - |
| 1485 | flashScrollBars(); executed (the execution status of this line is deduced): flashScrollBars(); | - |
| 1486 | } executed: }Execution Count:2144 | 2144 |
| 1487 | | - |
| 1488 | void QAbstractScrollAreaPrivate::_q_showOrHideScrollBars() | - |
| 1489 | { | - |
| 1490 | layoutChildren(); executed (the execution status of this line is deduced): layoutChildren(); | - |
| 1491 | #ifdef Q_WS_WIN | - |
| 1492 | // Need to re-subscribe to gestures as the content changes to make sure we | - |
| 1493 | // enable/disable panning when needed. | - |
| 1494 | QWidgetPrivate *dd = static_cast<QWidgetPrivate *>(QObjectPrivate::get(viewport)); | - |
| 1495 | if (dd) | - |
| 1496 | dd->winSetupGestures(); | - |
| 1497 | #endif // Q_WS_WIN | - |
| 1498 | } executed: }Execution Count:1506 | 1506 |
| 1499 | | - |
| 1500 | QPoint QAbstractScrollAreaPrivate::contentsOffset() const | - |
| 1501 | { | - |
| 1502 | Q_Q(const QAbstractScrollArea); executed (the execution status of this line is deduced): const QAbstractScrollArea * const q = q_func(); | - |
| 1503 | QPoint offset; executed (the execution status of this line is deduced): QPoint offset; | - |
| 1504 | if (vbar->isVisible()) evaluated: vbar->isVisible()| yes Evaluation Count:1412 | yes Evaluation Count:758 |
| 758-1412 |
| 1505 | offset.setY(vbar->value()); executed: offset.setY(vbar->value());Execution Count:1412 | 1412 |
| 1506 | if (hbar->isVisible()) { evaluated: hbar->isVisible()| yes Evaluation Count:1237 | yes Evaluation Count:933 |
| 933-1237 |
| 1507 | if (q->isRightToLeft()) evaluated: q->isRightToLeft()| yes Evaluation Count:1 | yes Evaluation Count:1236 |
| 1-1236 |
| 1508 | offset.setX(hbar->maximum() - hbar->value()); executed: offset.setX(hbar->maximum() - hbar->value());Execution Count:1 | 1 |
| 1509 | else | - |
| 1510 | offset.setX(hbar->value()); executed: offset.setX(hbar->value());Execution Count:1236 | 1236 |
| 1511 | } | - |
| 1512 | return offset; executed: return offset;Execution Count:2170 | 2170 |
| 1513 | } | - |
| 1514 | | - |
| 1515 | /*! | - |
| 1516 | \reimp | - |
| 1517 | | - |
| 1518 | */ | - |
| 1519 | QSize QAbstractScrollArea::minimumSizeHint() const | - |
| 1520 | { | - |
| 1521 | Q_D(const QAbstractScrollArea); executed (the execution status of this line is deduced): const QAbstractScrollAreaPrivate * const d = d_func(); | - |
| 1522 | int hsbExt = d->hbar->sizeHint().height(); executed (the execution status of this line is deduced): int hsbExt = d->hbar->sizeHint().height(); | - |
| 1523 | int vsbExt = d->vbar->sizeHint().width(); executed (the execution status of this line is deduced): int vsbExt = d->vbar->sizeHint().width(); | - |
| 1524 | int extra = 2 * d->frameWidth; executed (the execution status of this line is deduced): int extra = 2 * d->frameWidth; | - |
| 1525 | QStyleOption opt; executed (the execution status of this line is deduced): QStyleOption opt; | - |
| 1526 | opt.initFrom(this); executed (the execution status of this line is deduced): opt.initFrom(this); | - |
| 1527 | if ((d->frameStyle != QFrame::NoFrame) evaluated: (d->frameStyle != QFrame::NoFrame)| yes Evaluation Count:2554 | yes Evaluation Count:75 |
| 75-2554 |
| 1528 | && style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, this)) { partially evaluated: style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, &opt, this)| no Evaluation Count:0 | yes Evaluation Count:2554 |
| 0-2554 |
| 1529 | extra += style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &opt, this); never executed (the execution status of this line is deduced): extra += style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, &opt, this); | - |
| 1530 | } | 0 |
| 1531 | return QSize(d->scrollBarContainers[Qt::Horizontal]->sizeHint().width() + vsbExt + extra, executed: return QSize(d->scrollBarContainers[Qt::Horizontal]->sizeHint().width() + vsbExt + extra, d->scrollBarContainers[Qt::Vertical]->sizeHint().height() + hsbExt + extra);Execution Count:2629 | 2629 |
| 1532 | d->scrollBarContainers[Qt::Vertical]->sizeHint().height() + hsbExt + extra); executed: return QSize(d->scrollBarContainers[Qt::Horizontal]->sizeHint().width() + vsbExt + extra, d->scrollBarContainers[Qt::Vertical]->sizeHint().height() + hsbExt + extra);Execution Count:2629 | 2629 |
| 1533 | } | - |
| 1534 | | - |
| 1535 | /*! | - |
| 1536 | \reimp | - |
| 1537 | */ | - |
| 1538 | QSize QAbstractScrollArea::sizeHint() const | - |
| 1539 | { | - |
| 1540 | return QSize(256, 192); executed: return QSize(256, 192);Execution Count:1649 | 1649 |
| 1541 | #if 0 | - |
| 1542 | Q_D(const QAbstractScrollArea); | - |
| 1543 | int h = qMax(10, fontMetrics().height()); | - |
| 1544 | int f = 2 * d->frameWidth; | - |
| 1545 | return QSize((6 * h) + f, (4 * h) + f); | - |
| 1546 | #endif | - |
| 1547 | } | - |
| 1548 | | - |
| 1549 | /*! | - |
| 1550 | This slot is called by QAbstractScrollArea after setViewport(\a | - |
| 1551 | viewport) has been called. Reimplement this function in a | - |
| 1552 | subclass of QAbstractScrollArea to initialize the new \a viewport | - |
| 1553 | before it is used. | - |
| 1554 | | - |
| 1555 | \sa setViewport() | - |
| 1556 | */ | - |
| 1557 | void QAbstractScrollArea::setupViewport(QWidget *viewport) | - |
| 1558 | { | - |
| 1559 | Q_UNUSED(viewport); executed (the execution status of this line is deduced): (void)viewport;; | - |
| 1560 | } executed: }Execution Count:1 | 1 |
| 1561 | | - |
| 1562 | /*! | - |
| 1563 | \internal | - |
| 1564 | | - |
| 1565 | This method is reserved for future use. | - |
| 1566 | */ | - |
| 1567 | QSize QAbstractScrollArea::viewportSizeHint() const | - |
| 1568 | { | - |
| 1569 | return QSize(); never executed: return QSize(); | 0 |
| 1570 | } | - |
| 1571 | | - |
| 1572 | QT_END_NAMESPACE | - |
| 1573 | | - |
| 1574 | #include "moc_qabstractscrollarea.cpp" | - |
| 1575 | #include "moc_qabstractscrollarea_p.cpp" | - |
| 1576 | | - |
| 1577 | #endif // QT_NO_SCROLLAREA | - |
| 1578 | | - |
| | |