| 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 "private/qlayoutengine_p.h" | - |
| 43 | #include "qabstractitemdelegate.h" | - |
| 44 | #include "qapplication.h" | - |
| 45 | #include "qbitmap.h" | - |
| 46 | #include "qcursor.h" | - |
| 47 | #include "qevent.h" | - |
| 48 | #include "qpainter.h" | - |
| 49 | #include "qstyle.h" | - |
| 50 | #include "qstyleoption.h" | - |
| 51 | #include "qstylepainter.h" | - |
| 52 | #include "qtabwidget.h" | - |
| 53 | #include "qtooltip.h" | - |
| 54 | #include "qwhatsthis.h" | - |
| 55 | #include "private/qtextengine_p.h" | - |
| 56 | #ifndef QT_NO_ACCESSIBILITY | - |
| 57 | #include "qaccessible.h" | - |
| 58 | #endif | - |
| 59 | | - |
| 60 | #include "qdebug.h" | - |
| 61 | #include "private/qtabbar_p.h" | - |
| 62 | | - |
| 63 | #ifndef QT_NO_TABBAR | - |
| 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 | | - |
| 70 | QT_BEGIN_NAMESPACE | - |
| 71 | | - |
| 72 | | - |
| 73 | inline static bool verticalTabs(QTabBar::Shape shape) | - |
| 74 | { | - |
| 75 | return shape == QTabBar::RoundedWest executed: return shape == QTabBar::RoundedWest || shape == QTabBar::RoundedEast || shape == QTabBar::TriangularWest || shape == QTabBar::TriangularEast;Execution Count:3654 | 3654 |
| 76 | || shape == QTabBar::RoundedEast executed: return shape == QTabBar::RoundedWest || shape == QTabBar::RoundedEast || shape == QTabBar::TriangularWest || shape == QTabBar::TriangularEast;Execution Count:3654 | 3654 |
| 77 | || shape == QTabBar::TriangularWest executed: return shape == QTabBar::RoundedWest || shape == QTabBar::RoundedEast || shape == QTabBar::TriangularWest || shape == QTabBar::TriangularEast;Execution Count:3654 | 3654 |
| 78 | || shape == QTabBar::TriangularEast; executed: return shape == QTabBar::RoundedWest || shape == QTabBar::RoundedEast || shape == QTabBar::TriangularWest || shape == QTabBar::TriangularEast;Execution Count:3654 | 3654 |
| 79 | } | - |
| 80 | | - |
| 81 | void QTabBarPrivate::updateMacBorderMetrics() | - |
| 82 | { | - |
| 83 | #if (defined Q_WS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) | - |
| 84 | if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { | - |
| 85 | Q_Q(QTabBar); | - |
| 86 | ::HIContentBorderMetrics metrics; | - |
| 87 | | - |
| 88 | // TODO: get metrics to preserve the bottom value | - |
| 89 | // TODO: test tab bar position | - |
| 90 | | - |
| 91 | OSWindowRef window = qt_mac_window_for(q); | - |
| 92 | | - |
| 93 | // push base line separator down to the client are so we can paint over it (Carbon) | - |
| 94 | metrics.top = (documentMode && q->isVisible()) ? 1 : 0; | - |
| 95 | metrics.bottom = 0; | - |
| 96 | metrics.left = 0; | - |
| 97 | metrics.right = 0; | - |
| 98 | qt_mac_updateContentBorderMetricts(window, metrics); | - |
| 99 | // In Cocoa we need to keep track of the drawRect method. | - |
| 100 | // If documentMode is enabled we need to change it, unless | - |
| 101 | // a toolbar is present. | - |
| 102 | // Notice that all the information is kept in the window, | - |
| 103 | // that's why we get the private widget for it instead of | - |
| 104 | // the private widget for this widget. | - |
| 105 | QWidgetPrivate *privateWidget = qt_widget_private(q->window()); | - |
| 106 | if(privateWidget) | - |
| 107 | privateWidget->changeMethods = documentMode; | - |
| 108 | // Since in Cocoa there is no simple way to remove the baseline, so we just ask the | - |
| 109 | // top level to do the magic for us. | - |
| 110 | privateWidget->syncUnifiedMode(); | - |
| 111 | } | - |
| 112 | #endif | - |
| 113 | } | - |
| 114 | | - |
| 115 | /*! | - |
| 116 | Initialize \a option with the values from the tab at \a tabIndex. This method | - |
| 117 | is useful for subclasses when they need a QStyleOptionTab, QStyleOptionTabV2, | - |
| 118 | or QStyleOptionTabV3 but don't want to fill in all the information themselves. | - |
| 119 | This function will check the version of the QStyleOptionTab and fill in the | - |
| 120 | additional values for a QStyleOptionTabV2 and QStyleOptionTabV3. | - |
| 121 | | - |
| 122 | \sa QStyleOption::initFrom(), QTabWidget::initStyleOption() | - |
| 123 | */ | - |
| 124 | void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const | - |
| 125 | { | - |
| 126 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 127 | int totalTabs = d->tabList.size(); executed (the execution status of this line is deduced): int totalTabs = d->tabList.size(); | - |
| 128 | | - |
| 129 | if (!option || (tabIndex < 0 || tabIndex >= totalTabs)) partially evaluated: !option| no Evaluation Count:0 | yes Evaluation Count:686 |
partially evaluated: tabIndex < 0| no Evaluation Count:0 | yes Evaluation Count:686 |
partially evaluated: tabIndex >= totalTabs| no Evaluation Count:0 | yes Evaluation Count:686 |
| 0-686 |
| 130 | return; | 0 |
| 131 | | - |
| 132 | const QTabBarPrivate::Tab &tab = d->tabList.at(tabIndex); executed (the execution status of this line is deduced): const QTabBarPrivate::Tab &tab = d->tabList.at(tabIndex); | - |
| 133 | option->initFrom(this); executed (the execution status of this line is deduced): option->initFrom(this); | - |
| 134 | option->state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver); executed (the execution status of this line is deduced): option->state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver); | - |
| 135 | option->rect = tabRect(tabIndex); executed (the execution status of this line is deduced): option->rect = tabRect(tabIndex); | - |
| 136 | bool isCurrent = tabIndex == d->currentIndex; executed (the execution status of this line is deduced): bool isCurrent = tabIndex == d->currentIndex; | - |
| 137 | option->row = 0; executed (the execution status of this line is deduced): option->row = 0; | - |
| 138 | if (tabIndex == d->pressedIndex) partially evaluated: tabIndex == d->pressedIndex| no Evaluation Count:0 | yes Evaluation Count:686 |
| 0-686 |
| 139 | option->state |= QStyle::State_Sunken; never executed: option->state |= QStyle::State_Sunken; | 0 |
| 140 | if (isCurrent) evaluated: isCurrent| yes Evaluation Count:354 | yes Evaluation Count:332 |
| 332-354 |
| 141 | option->state |= QStyle::State_Selected; executed: option->state |= QStyle::State_Selected;Execution Count:354 | 354 |
| 142 | if (isCurrent && hasFocus()) evaluated: isCurrent| yes Evaluation Count:354 | yes Evaluation Count:332 |
evaluated: hasFocus()| yes Evaluation Count:37 | yes Evaluation Count:317 |
| 37-354 |
| 143 | option->state |= QStyle::State_HasFocus; executed: option->state |= QStyle::State_HasFocus;Execution Count:37 | 37 |
| 144 | if (!tab.enabled) partially evaluated: !tab.enabled| no Evaluation Count:0 | yes Evaluation Count:686 |
| 0-686 |
| 145 | option->state &= ~QStyle::State_Enabled; never executed: option->state &= ~QStyle::State_Enabled; | 0 |
| 146 | if (isActiveWindow()) evaluated: isActiveWindow()| yes Evaluation Count:55 | yes Evaluation Count:631 |
| 55-631 |
| 147 | option->state |= QStyle::State_Active; executed: option->state |= QStyle::State_Active;Execution Count:55 | 55 |
| 148 | if (!d->dragInProgress && option->rect == d->hoverRect) partially evaluated: !d->dragInProgress| yes Evaluation Count:686 | no Evaluation Count:0 |
evaluated: option->rect == d->hoverRect| yes Evaluation Count:162 | yes Evaluation Count:524 |
| 0-686 |
| 149 | option->state |= QStyle::State_MouseOver; executed: option->state |= QStyle::State_MouseOver;Execution Count:162 | 162 |
| 150 | option->shape = d->shape; executed (the execution status of this line is deduced): option->shape = d->shape; | - |
| 151 | option->text = tab.text; executed (the execution status of this line is deduced): option->text = tab.text; | - |
| 152 | | - |
| 153 | if (tab.textColor.isValid()) partially evaluated: tab.textColor.isValid()| no Evaluation Count:0 | yes Evaluation Count:686 |
| 0-686 |
| 154 | option->palette.setColor(foregroundRole(), tab.textColor); never executed: option->palette.setColor(foregroundRole(), tab.textColor); | 0 |
| 155 | | - |
| 156 | option->icon = tab.icon; executed (the execution status of this line is deduced): option->icon = tab.icon; | - |
| 157 | if (QStyleOptionTabV2 *optionV2 = qstyleoption_cast<QStyleOptionTabV2 *>(option)) partially evaluated: QStyleOptionTabV2 *optionV2 = qstyleoption_cast<QStyleOptionTabV2 *>(option)| yes Evaluation Count:686 | no Evaluation Count:0 |
| 0-686 |
| 158 | optionV2->iconSize = iconSize(); // Will get the default value then. executed: optionV2->iconSize = iconSize();Execution Count:686 | 686 |
| 159 | | - |
| 160 | if (QStyleOptionTabV3 *optionV3 = qstyleoption_cast<QStyleOptionTabV3 *>(option)) { partially evaluated: QStyleOptionTabV3 *optionV3 = qstyleoption_cast<QStyleOptionTabV3 *>(option)| yes Evaluation Count:686 | no Evaluation Count:0 |
| 0-686 |
| 161 | optionV3->leftButtonSize = tab.leftWidget ? tab.leftWidget->size() : QSize(); evaluated: tab.leftWidget| yes Evaluation Count:12 | yes Evaluation Count:674 |
| 12-674 |
| 162 | optionV3->rightButtonSize = tab.rightWidget ? tab.rightWidget->size() : QSize(); evaluated: tab.rightWidget| yes Evaluation Count:50 | yes Evaluation Count:636 |
| 50-636 |
| 163 | optionV3->documentMode = d->documentMode; executed (the execution status of this line is deduced): optionV3->documentMode = d->documentMode; | - |
| 164 | } executed: }Execution Count:686 | 686 |
| 165 | | - |
| 166 | if (tabIndex > 0 && tabIndex - 1 == d->currentIndex) evaluated: tabIndex > 0| yes Evaluation Count:325 | yes Evaluation Count:361 |
evaluated: tabIndex - 1 == d->currentIndex| yes Evaluation Count:142 | yes Evaluation Count:183 |
| 142-361 |
| 167 | option->selectedPosition = QStyleOptionTab::PreviousIsSelected; executed: option->selectedPosition = QStyleOptionTab::PreviousIsSelected;Execution Count:142 | 142 |
| 168 | else if (tabIndex + 1 < totalTabs && tabIndex + 1 == d->currentIndex) evaluated: tabIndex + 1 < totalTabs| yes Evaluation Count:292 | yes Evaluation Count:252 |
evaluated: tabIndex + 1 == d->currentIndex| yes Evaluation Count:28 | yes Evaluation Count:264 |
| 28-292 |
| 169 | option->selectedPosition = QStyleOptionTab::NextIsSelected; executed: option->selectedPosition = QStyleOptionTab::NextIsSelected;Execution Count:28 | 28 |
| 170 | else | - |
| 171 | option->selectedPosition = QStyleOptionTab::NotAdjacent; executed: option->selectedPosition = QStyleOptionTab::NotAdjacent;Execution Count:516 | 516 |
| 172 | | - |
| 173 | bool paintBeginning = (tabIndex == 0) || (d->dragInProgress && tabIndex == d->pressedIndex + 1); evaluated: (tabIndex == 0)| yes Evaluation Count:361 | yes Evaluation Count:325 |
partially evaluated: d->dragInProgress| no Evaluation Count:0 | yes Evaluation Count:325 |
never evaluated: tabIndex == d->pressedIndex + 1 | 0-361 |
| 174 | bool paintEnd = (tabIndex == totalTabs - 1) || (d->dragInProgress && tabIndex == d->pressedIndex - 1); evaluated: (tabIndex == totalTabs - 1)| yes Evaluation Count:348 | yes Evaluation Count:338 |
partially evaluated: d->dragInProgress| no Evaluation Count:0 | yes Evaluation Count:338 |
never evaluated: tabIndex == d->pressedIndex - 1 | 0-348 |
| 175 | if (paintBeginning) { evaluated: paintBeginning| yes Evaluation Count:361 | yes Evaluation Count:325 |
| 325-361 |
| 176 | if (paintEnd) evaluated: paintEnd| yes Evaluation Count:179 | yes Evaluation Count:182 |
| 179-182 |
| 177 | option->position = QStyleOptionTab::OnlyOneTab; executed: option->position = QStyleOptionTab::OnlyOneTab;Execution Count:179 | 179 |
| 178 | else | - |
| 179 | option->position = QStyleOptionTab::Beginning; executed: option->position = QStyleOptionTab::Beginning;Execution Count:182 | 182 |
| 180 | } else if (paintEnd) { evaluated: paintEnd| yes Evaluation Count:169 | yes Evaluation Count:156 |
| 156-169 |
| 181 | option->position = QStyleOptionTab::End; executed (the execution status of this line is deduced): option->position = QStyleOptionTab::End; | - |
| 182 | } else { executed: }Execution Count:169 | 169 |
| 183 | option->position = QStyleOptionTab::Middle; executed (the execution status of this line is deduced): option->position = QStyleOptionTab::Middle; | - |
| 184 | } executed: }Execution Count:156 | 156 |
| 185 | | - |
| 186 | #ifndef QT_NO_TABWIDGET | - |
| 187 | if (const QTabWidget *tw = qobject_cast<const QTabWidget *>(parentWidget())) { evaluated: const QTabWidget *tw = qobject_cast<const QTabWidget *>(parentWidget())| yes Evaluation Count:451 | yes Evaluation Count:235 |
| 235-451 |
| 188 | option->features |= QStyleOptionTab::HasFrame; executed (the execution status of this line is deduced): option->features |= QStyleOptionTab::HasFrame; | - |
| 189 | if (tw->cornerWidget(Qt::TopLeftCorner) || tw->cornerWidget(Qt::BottomLeftCorner)) partially evaluated: tw->cornerWidget(Qt::TopLeftCorner)| no Evaluation Count:0 | yes Evaluation Count:451 |
partially evaluated: tw->cornerWidget(Qt::BottomLeftCorner)| no Evaluation Count:0 | yes Evaluation Count:451 |
| 0-451 |
| 190 | option->cornerWidgets |= QStyleOptionTab::LeftCornerWidget; never executed: option->cornerWidgets |= QStyleOptionTab::LeftCornerWidget; | 0 |
| 191 | if (tw->cornerWidget(Qt::TopRightCorner) || tw->cornerWidget(Qt::BottomRightCorner)) partially evaluated: tw->cornerWidget(Qt::TopRightCorner)| no Evaluation Count:0 | yes Evaluation Count:451 |
partially evaluated: tw->cornerWidget(Qt::BottomRightCorner)| no Evaluation Count:0 | yes Evaluation Count:451 |
| 0-451 |
| 192 | option->cornerWidgets |= QStyleOptionTab::RightCornerWidget; never executed: option->cornerWidgets |= QStyleOptionTab::RightCornerWidget; | 0 |
| 193 | } executed: }Execution Count:451 | 451 |
| 194 | #endif | - |
| 195 | | - |
| 196 | QRect textRect = style()->subElementRect(QStyle::SE_TabBarTabText, option, this); executed (the execution status of this line is deduced): QRect textRect = style()->subElementRect(QStyle::SE_TabBarTabText, option, this); | - |
| 197 | option->text = fontMetrics().elidedText(option->text, d->elideMode, textRect.width(), executed (the execution status of this line is deduced): option->text = fontMetrics().elidedText(option->text, d->elideMode, textRect.width(), | - |
| 198 | Qt::TextShowMnemonic); executed (the execution status of this line is deduced): Qt::TextShowMnemonic); | - |
| 199 | } executed: }Execution Count:686 | 686 |
| 200 | | - |
| 201 | /*! | - |
| 202 | \class QTabBar | - |
| 203 | \brief The QTabBar class provides a tab bar, e.g. for use in tabbed dialogs. | - |
| 204 | | - |
| 205 | \ingroup basicwidgets | - |
| 206 | \inmodule QtWidgets | - |
| 207 | | - |
| 208 | QTabBar is straightforward to use; it draws the tabs using one of | - |
| 209 | the predefined \l{QTabBar::Shape}{shapes}, and emits a | - |
| 210 | signal when a tab is selected. It can be subclassed to tailor the | - |
| 211 | look and feel. Qt also provides a ready-made \l{QTabWidget}. | - |
| 212 | | - |
| 213 | Each tab has a tabText(), an optional tabIcon(), an optional | - |
| 214 | tabToolTip(), optional tabWhatsThis() and optional tabData(). | - |
| 215 | The tabs's attributes can be changed with setTabText(), setTabIcon(), | - |
| 216 | setTabToolTip(), setTabWhatsThis and setTabData(). Each tabs can be | - |
| 217 | enabled or disabled individually with setTabEnabled(). | - |
| 218 | | - |
| 219 | Each tab can display text in a distinct color. The current text color | - |
| 220 | for a tab can be found with the tabTextColor() function. Set the text | - |
| 221 | color for a particular tab with setTabTextColor(). | - |
| 222 | | - |
| 223 | Tabs are added using addTab(), or inserted at particular positions | - |
| 224 | using insertTab(). The total number of tabs is given by | - |
| 225 | count(). Tabs can be removed from the tab bar with | - |
| 226 | removeTab(). Combining removeTab() and insertTab() allows you to | - |
| 227 | move tabs to different positions. | - |
| 228 | | - |
| 229 | The \l shape property defines the tabs' appearance. The choice of | - |
| 230 | shape is a matter of taste, although tab dialogs (for preferences | - |
| 231 | and similar) invariably use \l RoundedNorth. | - |
| 232 | Tab controls in windows other than dialogs almost | - |
| 233 | always use either \l RoundedSouth or \l TriangularSouth. Many | - |
| 234 | spreadsheets and other tab controls in which all the pages are | - |
| 235 | essentially similar use \l TriangularSouth, whereas \l | - |
| 236 | RoundedSouth is used mostly when the pages are different (e.g. a | - |
| 237 | multi-page tool palette). The default in QTabBar is \l | - |
| 238 | RoundedNorth. | - |
| 239 | | - |
| 240 | The most important part of QTabBar's API is the currentChanged() | - |
| 241 | signal. This is emitted whenever the current tab changes (even at | - |
| 242 | startup, when the current tab changes from 'none'). There is also | - |
| 243 | a slot, setCurrentIndex(), which can be used to select a tab | - |
| 244 | programmatically. The function currentIndex() returns the index of | - |
| 245 | the current tab, \l count holds the number of tabs. | - |
| 246 | | - |
| 247 | QTabBar creates automatic mnemonic keys in the manner of QAbstractButton; | - |
| 248 | e.g. if a tab's label is "\&Graphics", Alt+G becomes a shortcut | - |
| 249 | key for switching to that tab. | - |
| 250 | | - |
| 251 | The following virtual functions may need to be reimplemented in | - |
| 252 | order to tailor the look and feel or store extra data with each | - |
| 253 | tab: | - |
| 254 | | - |
| 255 | \list | - |
| 256 | \li tabSizeHint() calcuates the size of a tab. | - |
| 257 | \li tabInserted() notifies that a new tab was added. | - |
| 258 | \li tabRemoved() notifies that a tab was removed. | - |
| 259 | \li tabLayoutChange() notifies that the tabs have been re-laid out. | - |
| 260 | \li paintEvent() paints all tabs. | - |
| 261 | \endlist | - |
| 262 | | - |
| 263 | For subclasses, you might also need the tabRect() functions which | - |
| 264 | returns the visual geometry of a single tab. | - |
| 265 | | - |
| 266 | \table 100% | - |
| 267 | \row \li \inlineimage fusion-tabbar.png Screenshot of a Fusion style tab bar | - |
| 268 | \li A tab bar shown in the Fusion widget style. | - |
| 269 | \row \li \inlineimage fusion-tabbar-truncated.png Screenshot of a truncated Fusion tab bar | - |
| 270 | \li A truncated tab bar shown in the Fusion widget style. | - |
| 271 | \endtable | - |
| 272 | | - |
| 273 | \sa QTabWidget | - |
| 274 | */ | - |
| 275 | | - |
| 276 | /*! | - |
| 277 | \enum QTabBar::Shape | - |
| 278 | | - |
| 279 | This enum type lists the built-in shapes supported by QTabBar. Treat these | - |
| 280 | as hints as some styles may not render some of the shapes. However, | - |
| 281 | position should be honored. | - |
| 282 | | - |
| 283 | \value RoundedNorth The normal rounded look above the pages | - |
| 284 | | - |
| 285 | \value RoundedSouth The normal rounded look below the pages | - |
| 286 | | - |
| 287 | \value RoundedWest The normal rounded look on the left side of the pages | - |
| 288 | | - |
| 289 | \value RoundedEast The normal rounded look on the right side the pages | - |
| 290 | | - |
| 291 | \value TriangularNorth Triangular tabs above the pages. | - |
| 292 | | - |
| 293 | \value TriangularSouth Triangular tabs similar to those used in | - |
| 294 | the Excel spreadsheet, for example | - |
| 295 | | - |
| 296 | \value TriangularWest Triangular tabs on the left of the pages. | - |
| 297 | | - |
| 298 | \value TriangularEast Triangular tabs on the right of the pages. | - |
| 299 | */ | - |
| 300 | | - |
| 301 | /*! | - |
| 302 | \fn void QTabBar::currentChanged(int index) | - |
| 303 | | - |
| 304 | This signal is emitted when the tab bar's current tab changes. The | - |
| 305 | new current has the given \a index, or -1 if there isn't a new one | - |
| 306 | (for example, if there are no tab in the QTabBar) | - |
| 307 | */ | - |
| 308 | | - |
| 309 | /*! | - |
| 310 | \fn void QTabBar::tabCloseRequested(int index) | - |
| 311 | \since 4.5 | - |
| 312 | | - |
| 313 | This signal is emitted when the close button on a tab is clicked. | - |
| 314 | The \a index is the index that should be removed. | - |
| 315 | | - |
| 316 | \sa setTabsClosable() | - |
| 317 | */ | - |
| 318 | | - |
| 319 | /*! | - |
| 320 | \fn void QTabBar::tabMoved(int from, int to) | - |
| 321 | \since 4.5 | - |
| 322 | | - |
| 323 | This signal is emitted when the tab has moved the tab | - |
| 324 | at index position \a from to index position \a to. | - |
| 325 | | - |
| 326 | note: QTabWidget will automatically move the page when | - |
| 327 | this signal is emitted from its tab bar. | - |
| 328 | | - |
| 329 | \sa moveTab() | - |
| 330 | */ | - |
| 331 | | - |
| 332 | int QTabBarPrivate::extraWidth() const | - |
| 333 | { | - |
| 334 | Q_Q(const QTabBar); executed (the execution status of this line is deduced): const QTabBar * const q = q_func(); | - |
| 335 | return 2 * qMax(q->style()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, q), executed: return 2 * qMax(q->style()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, q), QApplication::globalStrut().width());Execution Count:66 | 66 |
| 336 | QApplication::globalStrut().width()); executed: return 2 * qMax(q->style()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, q), QApplication::globalStrut().width());Execution Count:66 | 66 |
| 337 | } | - |
| 338 | | - |
| 339 | void QTabBarPrivate::init() | - |
| 340 | { | - |
| 341 | Q_Q(QTabBar); executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 342 | leftB = new QToolButton(q); executed (the execution status of this line is deduced): leftB = new QToolButton(q); | - |
| 343 | leftB->setAutoRepeat(true); executed (the execution status of this line is deduced): leftB->setAutoRepeat(true); | - |
| 344 | QObject::connect(leftB, SIGNAL(clicked()), q, SLOT(_q_scrollTabs())); executed (the execution status of this line is deduced): QObject::connect(leftB, "2""clicked()", q, "1""_q_scrollTabs()"); | - |
| 345 | leftB->hide(); executed (the execution status of this line is deduced): leftB->hide(); | - |
| 346 | rightB = new QToolButton(q); executed (the execution status of this line is deduced): rightB = new QToolButton(q); | - |
| 347 | rightB->setAutoRepeat(true); executed (the execution status of this line is deduced): rightB->setAutoRepeat(true); | - |
| 348 | QObject::connect(rightB, SIGNAL(clicked()), q, SLOT(_q_scrollTabs())); executed (the execution status of this line is deduced): QObject::connect(rightB, "2""clicked()", q, "1""_q_scrollTabs()"); | - |
| 349 | rightB->hide(); executed (the execution status of this line is deduced): rightB->hide(); | - |
| 350 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 351 | if (QApplication::keypadNavigationEnabled()) { | - |
| 352 | leftB->setFocusPolicy(Qt::NoFocus); | - |
| 353 | rightB->setFocusPolicy(Qt::NoFocus); | - |
| 354 | q->setFocusPolicy(Qt::NoFocus); | - |
| 355 | } else | - |
| 356 | #endif | - |
| 357 | q->setFocusPolicy(Qt::TabFocus); executed (the execution status of this line is deduced): q->setFocusPolicy(Qt::TabFocus); | - |
| 358 | | - |
| 359 | #ifndef QT_NO_ACCESSIBILITY | - |
| 360 | leftB->setAccessibleName(QTabBar::tr("Scroll Left")); executed (the execution status of this line is deduced): leftB->setAccessibleName(QTabBar::tr("Scroll Left")); | - |
| 361 | rightB->setAccessibleName(QTabBar::tr("Scroll Right")); executed (the execution status of this line is deduced): rightB->setAccessibleName(QTabBar::tr("Scroll Right")); | - |
| 362 | #endif | - |
| 363 | q->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); executed (the execution status of this line is deduced): q->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); | - |
| 364 | elideMode = Qt::TextElideMode(q->style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, q)); executed (the execution status of this line is deduced): elideMode = Qt::TextElideMode(q->style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, q)); | - |
| 365 | useScrollButtons = !q->style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, q); executed (the execution status of this line is deduced): useScrollButtons = !q->style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, q); | - |
| 366 | } executed: }Execution Count:115 | 115 |
| 367 | | - |
| 368 | QTabBarPrivate::Tab *QTabBarPrivate::at(int index) | - |
| 369 | { | - |
| 370 | return validIndex(index)?&tabList[index]:0; executed: return validIndex(index)?&tabList[index]:0;Execution Count:41 | 41 |
| 371 | } | - |
| 372 | | - |
| 373 | const QTabBarPrivate::Tab *QTabBarPrivate::at(int index) const | - |
| 374 | { | - |
| 375 | return validIndex(index)?&tabList[index]:0; executed: return validIndex(index)?&tabList[index]:0;Execution Count:2306 | 2306 |
| 376 | } | - |
| 377 | | - |
| 378 | int QTabBarPrivate::indexAtPos(const QPoint &p) const | - |
| 379 | { | - |
| 380 | Q_Q(const QTabBar); never executed (the execution status of this line is deduced): const QTabBar * const q = q_func(); | - |
| 381 | if (q->tabRect(currentIndex).contains(p)) never evaluated: q->tabRect(currentIndex).contains(p) | 0 |
| 382 | return currentIndex; never executed: return currentIndex; | 0 |
| 383 | for (int i = 0; i < tabList.count(); ++i) never evaluated: i < tabList.count() | 0 |
| 384 | if (tabList.at(i).enabled && q->tabRect(i).contains(p)) never evaluated: tabList.at(i).enabled never evaluated: q->tabRect(i).contains(p) | 0 |
| 385 | return i; never executed: return i; | 0 |
| 386 | return -1; never executed: return -1; | 0 |
| 387 | } | - |
| 388 | | - |
| 389 | void QTabBarPrivate::layoutTabs() | - |
| 390 | { | - |
| 391 | Q_Q(QTabBar); executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 392 | scrollOffset = 0; executed (the execution status of this line is deduced): scrollOffset = 0; | - |
| 393 | layoutDirty = false; executed (the execution status of this line is deduced): layoutDirty = false; | - |
| 394 | QSize size = q->size(); executed (the execution status of this line is deduced): QSize size = q->size(); | - |
| 395 | int last, available; executed (the execution status of this line is deduced): int last, available; | - |
| 396 | int maxExtent; executed (the execution status of this line is deduced): int maxExtent; | - |
| 397 | int i; executed (the execution status of this line is deduced): int i; | - |
| 398 | bool vertTabs = verticalTabs(shape); executed (the execution status of this line is deduced): bool vertTabs = verticalTabs(shape); | - |
| 399 | int tabChainIndex = 0; executed (the execution status of this line is deduced): int tabChainIndex = 0; | - |
| 400 | | - |
| 401 | Qt::Alignment tabAlignment = Qt::Alignment(q->style()->styleHint(QStyle::SH_TabBar_Alignment, 0, q)); executed (the execution status of this line is deduced): Qt::Alignment tabAlignment = Qt::Alignment(q->style()->styleHint(QStyle::SH_TabBar_Alignment, 0, q)); | - |
| 402 | QVector<QLayoutStruct> tabChain(tabList.count() + 2); executed (the execution status of this line is deduced): QVector<QLayoutStruct> tabChain(tabList.count() + 2); | - |
| 403 | | - |
| 404 | // We put an empty item at the front and back and set its expansive attribute | - |
| 405 | // depending on tabAlignment. | - |
| 406 | tabChain[tabChainIndex].init(); executed (the execution status of this line is deduced): tabChain[tabChainIndex].init(); | - |
| 407 | tabChain[tabChainIndex].expansive = (tabAlignment != Qt::AlignLeft) partially evaluated: (tabAlignment != Qt::AlignLeft)| no Evaluation Count:0 | yes Evaluation Count:170 |
| 0-170 |
| 408 | && (tabAlignment != Qt::AlignJustify); never evaluated: (tabAlignment != Qt::AlignJustify) | 0 |
| 409 | tabChain[tabChainIndex].empty = true; executed (the execution status of this line is deduced): tabChain[tabChainIndex].empty = true; | - |
| 410 | ++tabChainIndex; executed (the execution status of this line is deduced): ++tabChainIndex; | - |
| 411 | | - |
| 412 | // We now go through our list of tabs and set the minimum size and the size hint | - |
| 413 | // This will allow us to elide text if necessary. Since we don't set | - |
| 414 | // a maximum size, tabs will EXPAND to fill up the empty space. | - |
| 415 | // Since tab widget is rather *ahem* strict about keeping the geometry of the | - |
| 416 | // tab bar to its absolute minimum, this won't bleed through, but will show up | - |
| 417 | // if you use tab bar on its own (a.k.a. not a bug, but a feature). | - |
| 418 | // Update: if expanding is false, we DO set a maximum size to prevent the tabs | - |
| 419 | // being wider than necessary. | - |
| 420 | if (!vertTabs) { evaluated: !vertTabs| yes Evaluation Count:164 | yes Evaluation Count:6 |
| 6-164 |
| 421 | int minx = 0; executed (the execution status of this line is deduced): int minx = 0; | - |
| 422 | int x = 0; executed (the execution status of this line is deduced): int x = 0; | - |
| 423 | int maxHeight = 0; executed (the execution status of this line is deduced): int maxHeight = 0; | - |
| 424 | for (i = 0; i < tabList.count(); ++i, ++tabChainIndex) { evaluated: i < tabList.count()| yes Evaluation Count:287 | yes Evaluation Count:164 |
| 164-287 |
| 425 | QSize sz = q->tabSizeHint(i); executed (the execution status of this line is deduced): QSize sz = q->tabSizeHint(i); | - |
| 426 | tabList[i].maxRect = QRect(x, 0, sz.width(), sz.height()); executed (the execution status of this line is deduced): tabList[i].maxRect = QRect(x, 0, sz.width(), sz.height()); | - |
| 427 | x += sz.width(); executed (the execution status of this line is deduced): x += sz.width(); | - |
| 428 | maxHeight = qMax(maxHeight, sz.height()); executed (the execution status of this line is deduced): maxHeight = qMax(maxHeight, sz.height()); | - |
| 429 | sz = q->minimumTabSizeHint(i); executed (the execution status of this line is deduced): sz = q->minimumTabSizeHint(i); | - |
| 430 | tabList[i].minRect = QRect(minx, 0, sz.width(), sz.height()); executed (the execution status of this line is deduced): tabList[i].minRect = QRect(minx, 0, sz.width(), sz.height()); | - |
| 431 | minx += sz.width(); executed (the execution status of this line is deduced): minx += sz.width(); | - |
| 432 | tabChain[tabChainIndex].init(); executed (the execution status of this line is deduced): tabChain[tabChainIndex].init(); | - |
| 433 | tabChain[tabChainIndex].sizeHint = tabList.at(i).maxRect.width(); executed (the execution status of this line is deduced): tabChain[tabChainIndex].sizeHint = tabList.at(i).maxRect.width(); | - |
| 434 | tabChain[tabChainIndex].minimumSize = sz.width(); executed (the execution status of this line is deduced): tabChain[tabChainIndex].minimumSize = sz.width(); | - |
| 435 | tabChain[tabChainIndex].empty = false; executed (the execution status of this line is deduced): tabChain[tabChainIndex].empty = false; | - |
| 436 | tabChain[tabChainIndex].expansive = true; executed (the execution status of this line is deduced): tabChain[tabChainIndex].expansive = true; | - |
| 437 | | - |
| 438 | if (!expanding) evaluated: !expanding| yes Evaluation Count:13 | yes Evaluation Count:274 |
| 13-274 |
| 439 | tabChain[tabChainIndex].maximumSize = tabChain[tabChainIndex].sizeHint; executed: tabChain[tabChainIndex].maximumSize = tabChain[tabChainIndex].sizeHint;Execution Count:13 | 13 |
| 440 | } executed: }Execution Count:287 | 287 |
| 441 | | - |
| 442 | last = minx; executed (the execution status of this line is deduced): last = minx; | - |
| 443 | available = size.width(); executed (the execution status of this line is deduced): available = size.width(); | - |
| 444 | maxExtent = maxHeight; executed (the execution status of this line is deduced): maxExtent = maxHeight; | - |
| 445 | } else { executed: }Execution Count:164 | 164 |
| 446 | int miny = 0; executed (the execution status of this line is deduced): int miny = 0; | - |
| 447 | int y = 0; executed (the execution status of this line is deduced): int y = 0; | - |
| 448 | int maxWidth = 0; executed (the execution status of this line is deduced): int maxWidth = 0; | - |
| 449 | for (i = 0; i < tabList.count(); ++i, ++tabChainIndex) { evaluated: i < tabList.count()| yes Evaluation Count:4 | yes Evaluation Count:6 |
| 4-6 |
| 450 | QSize sz = q->tabSizeHint(i); executed (the execution status of this line is deduced): QSize sz = q->tabSizeHint(i); | - |
| 451 | tabList[i].maxRect = QRect(0, y, sz.width(), sz.height()); executed (the execution status of this line is deduced): tabList[i].maxRect = QRect(0, y, sz.width(), sz.height()); | - |
| 452 | y += sz.height(); executed (the execution status of this line is deduced): y += sz.height(); | - |
| 453 | maxWidth = qMax(maxWidth, sz.width()); executed (the execution status of this line is deduced): maxWidth = qMax(maxWidth, sz.width()); | - |
| 454 | sz = q->minimumTabSizeHint(i); executed (the execution status of this line is deduced): sz = q->minimumTabSizeHint(i); | - |
| 455 | tabList[i].minRect = QRect(0, miny, sz.width(), sz.height()); executed (the execution status of this line is deduced): tabList[i].minRect = QRect(0, miny, sz.width(), sz.height()); | - |
| 456 | miny += sz.height(); executed (the execution status of this line is deduced): miny += sz.height(); | - |
| 457 | tabChain[tabChainIndex].init(); executed (the execution status of this line is deduced): tabChain[tabChainIndex].init(); | - |
| 458 | tabChain[tabChainIndex].sizeHint = tabList.at(i).maxRect.height(); executed (the execution status of this line is deduced): tabChain[tabChainIndex].sizeHint = tabList.at(i).maxRect.height(); | - |
| 459 | tabChain[tabChainIndex].minimumSize = sz.height(); executed (the execution status of this line is deduced): tabChain[tabChainIndex].minimumSize = sz.height(); | - |
| 460 | tabChain[tabChainIndex].empty = false; executed (the execution status of this line is deduced): tabChain[tabChainIndex].empty = false; | - |
| 461 | tabChain[tabChainIndex].expansive = true; executed (the execution status of this line is deduced): tabChain[tabChainIndex].expansive = true; | - |
| 462 | | - |
| 463 | if (!expanding) partially evaluated: !expanding| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 464 | tabChain[tabChainIndex].maximumSize = tabChain[tabChainIndex].sizeHint; never executed: tabChain[tabChainIndex].maximumSize = tabChain[tabChainIndex].sizeHint; | 0 |
| 465 | } executed: }Execution Count:4 | 4 |
| 466 | | - |
| 467 | last = miny; executed (the execution status of this line is deduced): last = miny; | - |
| 468 | available = size.height(); executed (the execution status of this line is deduced): available = size.height(); | - |
| 469 | maxExtent = maxWidth; executed (the execution status of this line is deduced): maxExtent = maxWidth; | - |
| 470 | } executed: }Execution Count:6 | 6 |
| 471 | | - |
| 472 | Q_ASSERT(tabChainIndex == tabChain.count() - 1); // add an assert just to make sure. executed (the execution status of this line is deduced): qt_noop(); | - |
| 473 | // Mirror our front item. | - |
| 474 | tabChain[tabChainIndex].init(); executed (the execution status of this line is deduced): tabChain[tabChainIndex].init(); | - |
| 475 | tabChain[tabChainIndex].expansive = (tabAlignment != Qt::AlignRight) partially evaluated: (tabAlignment != Qt::AlignRight)| yes Evaluation Count:170 | no Evaluation Count:0 |
| 0-170 |
| 476 | && (tabAlignment != Qt::AlignJustify); partially evaluated: (tabAlignment != Qt::AlignJustify)| yes Evaluation Count:170 | no Evaluation Count:0 |
| 0-170 |
| 477 | tabChain[tabChainIndex].empty = true; executed (the execution status of this line is deduced): tabChain[tabChainIndex].empty = true; | - |
| 478 | | - |
| 479 | // Do the calculation | - |
| 480 | qGeomCalc(tabChain, 0, tabChain.count(), 0, qMax(available, last), 0); executed (the execution status of this line is deduced): qGeomCalc(tabChain, 0, tabChain.count(), 0, qMax(available, last), 0); | - |
| 481 | | - |
| 482 | // Use the results | - |
| 483 | for (i = 0; i < tabList.count(); ++i) { evaluated: i < tabList.count()| yes Evaluation Count:291 | yes Evaluation Count:170 |
| 170-291 |
| 484 | const QLayoutStruct &lstruct = tabChain.at(i + 1); executed (the execution status of this line is deduced): const QLayoutStruct &lstruct = tabChain.at(i + 1); | - |
| 485 | if (!vertTabs) evaluated: !vertTabs| yes Evaluation Count:287 | yes Evaluation Count:4 |
| 4-287 |
| 486 | tabList[i].rect.setRect(lstruct.pos, 0, lstruct.size, maxExtent); executed: tabList[i].rect.setRect(lstruct.pos, 0, lstruct.size, maxExtent);Execution Count:287 | 287 |
| 487 | else | - |
| 488 | tabList[i].rect.setRect(0, lstruct.pos, maxExtent, lstruct.size); executed: tabList[i].rect.setRect(0, lstruct.pos, maxExtent, lstruct.size);Execution Count:4 | 4 |
| 489 | } | - |
| 490 | | - |
| 491 | if (useScrollButtons && tabList.count() && last > available) { evaluated: useScrollButtons| yes Evaluation Count:167 | yes Evaluation Count:3 |
evaluated: tabList.count()| yes Evaluation Count:139 | yes Evaluation Count:28 |
evaluated: last > available| yes Evaluation Count:32 | yes Evaluation Count:107 |
| 3-167 |
| 492 | int extra = extraWidth(); executed (the execution status of this line is deduced): int extra = extraWidth(); | - |
| 493 | if (!vertTabs) { evaluated: !vertTabs| yes Evaluation Count:30 | yes Evaluation Count:2 |
| 2-30 |
| 494 | Qt::LayoutDirection ld = q->layoutDirection(); executed (the execution status of this line is deduced): Qt::LayoutDirection ld = q->layoutDirection(); | - |
| 495 | QRect arrows = QStyle::visualRect(ld, q->rect(), executed (the execution status of this line is deduced): QRect arrows = QStyle::visualRect(ld, q->rect(), | - |
| 496 | QRect(available - extra, 0, extra, size.height())); executed (the execution status of this line is deduced): QRect(available - extra, 0, extra, size.height())); | - |
| 497 | int buttonOverlap = q->style()->pixelMetric(QStyle::PM_TabBar_ScrollButtonOverlap, 0, q); executed (the execution status of this line is deduced): int buttonOverlap = q->style()->pixelMetric(QStyle::PM_TabBar_ScrollButtonOverlap, 0, q); | - |
| 498 | | - |
| 499 | if (ld == Qt::LeftToRight) { partially evaluated: ld == Qt::LeftToRight| yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-30 |
| 500 | leftB->setGeometry(arrows.left(), arrows.top(), extra/2, arrows.height()); executed (the execution status of this line is deduced): leftB->setGeometry(arrows.left(), arrows.top(), extra/2, arrows.height()); | - |
| 501 | rightB->setGeometry(arrows.right() - extra/2 + buttonOverlap, arrows.top(), executed (the execution status of this line is deduced): rightB->setGeometry(arrows.right() - extra/2 + buttonOverlap, arrows.top(), | - |
| 502 | extra/2, arrows.height()); executed (the execution status of this line is deduced): extra/2, arrows.height()); | - |
| 503 | leftB->setArrowType(Qt::LeftArrow); executed (the execution status of this line is deduced): leftB->setArrowType(Qt::LeftArrow); | - |
| 504 | rightB->setArrowType(Qt::RightArrow); executed (the execution status of this line is deduced): rightB->setArrowType(Qt::RightArrow); | - |
| 505 | } else { executed: }Execution Count:30 | 30 |
| 506 | rightB->setGeometry(arrows.left(), arrows.top(), extra/2, arrows.height()); never executed (the execution status of this line is deduced): rightB->setGeometry(arrows.left(), arrows.top(), extra/2, arrows.height()); | - |
| 507 | leftB->setGeometry(arrows.right() - extra/2 + buttonOverlap, arrows.top(), never executed (the execution status of this line is deduced): leftB->setGeometry(arrows.right() - extra/2 + buttonOverlap, arrows.top(), | - |
| 508 | extra/2, arrows.height()); never executed (the execution status of this line is deduced): extra/2, arrows.height()); | - |
| 509 | rightB->setArrowType(Qt::LeftArrow); never executed (the execution status of this line is deduced): rightB->setArrowType(Qt::LeftArrow); | - |
| 510 | leftB->setArrowType(Qt::RightArrow); never executed (the execution status of this line is deduced): leftB->setArrowType(Qt::RightArrow); | - |
| 511 | } | 0 |
| 512 | } else { | - |
| 513 | QRect arrows = QRect(0, available - extra, size.width(), extra ); executed (the execution status of this line is deduced): QRect arrows = QRect(0, available - extra, size.width(), extra ); | - |
| 514 | leftB->setGeometry(arrows.left(), arrows.top(), arrows.width(), extra/2); executed (the execution status of this line is deduced): leftB->setGeometry(arrows.left(), arrows.top(), arrows.width(), extra/2); | - |
| 515 | leftB->setArrowType(Qt::UpArrow); executed (the execution status of this line is deduced): leftB->setArrowType(Qt::UpArrow); | - |
| 516 | rightB->setGeometry(arrows.left(), arrows.bottom() - extra/2 + 1, executed (the execution status of this line is deduced): rightB->setGeometry(arrows.left(), arrows.bottom() - extra/2 + 1, | - |
| 517 | arrows.width(), extra/2); executed (the execution status of this line is deduced): arrows.width(), extra/2); | - |
| 518 | rightB->setArrowType(Qt::DownArrow); executed (the execution status of this line is deduced): rightB->setArrowType(Qt::DownArrow); | - |
| 519 | } executed: }Execution Count:2 | 2 |
| 520 | leftB->setEnabled(scrollOffset > 0); executed (the execution status of this line is deduced): leftB->setEnabled(scrollOffset > 0); | - |
| 521 | rightB->setEnabled(last - scrollOffset >= available - extra); executed (the execution status of this line is deduced): rightB->setEnabled(last - scrollOffset >= available - extra); | - |
| 522 | leftB->show(); executed (the execution status of this line is deduced): leftB->show(); | - |
| 523 | rightB->show(); executed (the execution status of this line is deduced): rightB->show(); | - |
| 524 | } else { executed: }Execution Count:32 | 32 |
| 525 | rightB->hide(); executed (the execution status of this line is deduced): rightB->hide(); | - |
| 526 | leftB->hide(); executed (the execution status of this line is deduced): leftB->hide(); | - |
| 527 | } executed: }Execution Count:138 | 138 |
| 528 | | - |
| 529 | layoutWidgets(); executed (the execution status of this line is deduced): layoutWidgets(); | - |
| 530 | q->tabLayoutChange(); executed (the execution status of this line is deduced): q->tabLayoutChange(); | - |
| 531 | } executed: }Execution Count:170 | 170 |
| 532 | | - |
| 533 | void QTabBarPrivate::makeVisible(int index) | - |
| 534 | { | - |
| 535 | Q_Q(QTabBar); executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 536 | if (!validIndex(index) || leftB->isHidden()) evaluated: !validIndex(index)| yes Evaluation Count:14 | yes Evaluation Count:253 |
evaluated: leftB->isHidden()| yes Evaluation Count:219 | yes Evaluation Count:34 |
| 14-253 |
| 537 | return; executed: return;Execution Count:233 | 233 |
| 538 | | - |
| 539 | const QRect tabRect = tabList.at(index).rect; executed (the execution status of this line is deduced): const QRect tabRect = tabList.at(index).rect; | - |
| 540 | const int oldScrollOffset = scrollOffset; executed (the execution status of this line is deduced): const int oldScrollOffset = scrollOffset; | - |
| 541 | const bool horiz = !verticalTabs(shape); executed (the execution status of this line is deduced): const bool horiz = !verticalTabs(shape); | - |
| 542 | const int available = (horiz ? q->width() : q->height()) - extraWidth(); partially evaluated: horiz| yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-34 |
| 543 | const int start = horiz ? tabRect.left() : tabRect.top(); partially evaluated: horiz| yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-34 |
| 544 | const int end = horiz ? tabRect.right() : tabRect.bottom(); partially evaluated: horiz| yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-34 |
| 545 | if (start < scrollOffset) // too far left evaluated: start < scrollOffset| yes Evaluation Count:8 | yes Evaluation Count:26 |
| 8-26 |
| 546 | scrollOffset = start - (index ? 8 : 0); executed: scrollOffset = start - (index ? 8 : 0);Execution Count:8 evaluated: index| yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-8 |
| 547 | else if (end > scrollOffset + available) // too far right evaluated: end > scrollOffset + available| yes Evaluation Count:22 | yes Evaluation Count:4 |
| 4-22 |
| 548 | scrollOffset = end - available + 1; executed: scrollOffset = end - available + 1;Execution Count:22 | 22 |
| 549 | | - |
| 550 | leftB->setEnabled(scrollOffset > 0); executed (the execution status of this line is deduced): leftB->setEnabled(scrollOffset > 0); | - |
| 551 | const int last = horiz ? tabList.last().rect.right() : tabList.last().rect.bottom(); partially evaluated: horiz| yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-34 |
| 552 | rightB->setEnabled(last - scrollOffset >= available); executed (the execution status of this line is deduced): rightB->setEnabled(last - scrollOffset >= available); | - |
| 553 | if (oldScrollOffset != scrollOffset) { evaluated: oldScrollOffset != scrollOffset| yes Evaluation Count:30 | yes Evaluation Count:4 |
| 4-30 |
| 554 | q->update(); executed (the execution status of this line is deduced): q->update(); | - |
| 555 | layoutWidgets(); executed (the execution status of this line is deduced): layoutWidgets(); | - |
| 556 | } executed: }Execution Count:30 | 30 |
| 557 | } executed: }Execution Count:34 | 34 |
| 558 | | - |
| 559 | void QTabBarPrivate::layoutTab(int index) | - |
| 560 | { | - |
| 561 | Q_Q(QTabBar); executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 562 | Q_ASSERT(index >= 0); executed (the execution status of this line is deduced): qt_noop(); | - |
| 563 | | - |
| 564 | Tab &tab = tabList[index]; executed (the execution status of this line is deduced): Tab &tab = tabList[index]; | - |
| 565 | bool vertical = verticalTabs(shape); executed (the execution status of this line is deduced): bool vertical = verticalTabs(shape); | - |
| 566 | if (!(tab.leftWidget || tab.rightWidget)) evaluated: tab.leftWidget| yes Evaluation Count:4 | yes Evaluation Count:680 |
evaluated: tab.rightWidget| yes Evaluation Count:16 | yes Evaluation Count:664 |
| 4-680 |
| 567 | return; executed: return;Execution Count:664 | 664 |
| 568 | | - |
| 569 | QStyleOptionTabV3 opt; executed (the execution status of this line is deduced): QStyleOptionTabV3 opt; | - |
| 570 | q->initStyleOption(&opt, index); executed (the execution status of this line is deduced): q->initStyleOption(&opt, index); | - |
| 571 | if (tab.leftWidget) { evaluated: tab.leftWidget| yes Evaluation Count:4 | yes Evaluation Count:16 |
| 4-16 |
| 572 | QRect rect = q->style()->subElementRect(QStyle::SE_TabBarTabLeftButton, &opt, q); executed (the execution status of this line is deduced): QRect rect = q->style()->subElementRect(QStyle::SE_TabBarTabLeftButton, &opt, q); | - |
| 573 | QPoint p = rect.topLeft(); executed (the execution status of this line is deduced): QPoint p = rect.topLeft(); | - |
| 574 | if ((index == pressedIndex) || paintWithOffsets) { partially evaluated: (index == pressedIndex)| no Evaluation Count:0 | yes Evaluation Count:4 |
partially evaluated: paintWithOffsets| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 575 | if (vertical) partially evaluated: vertical| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 576 | p.setY(p.y() + tabList[index].dragOffset); never executed: p.setY(p.y() + tabList[index].dragOffset); | 0 |
| 577 | else | - |
| 578 | p.setX(p.x() + tabList[index].dragOffset); executed: p.setX(p.x() + tabList[index].dragOffset);Execution Count:4 | 4 |
| 579 | } | - |
| 580 | tab.leftWidget->move(p); executed (the execution status of this line is deduced): tab.leftWidget->move(p); | - |
| 581 | } executed: }Execution Count:4 | 4 |
| 582 | if (tab.rightWidget) { evaluated: tab.rightWidget| yes Evaluation Count:16 | yes Evaluation Count:4 |
| 4-16 |
| 583 | QRect rect = q->style()->subElementRect(QStyle::SE_TabBarTabRightButton, &opt, q); executed (the execution status of this line is deduced): QRect rect = q->style()->subElementRect(QStyle::SE_TabBarTabRightButton, &opt, q); | - |
| 584 | QPoint p = rect.topLeft(); executed (the execution status of this line is deduced): QPoint p = rect.topLeft(); | - |
| 585 | if ((index == pressedIndex) || paintWithOffsets) { partially evaluated: (index == pressedIndex)| no Evaluation Count:0 | yes Evaluation Count:16 |
partially evaluated: paintWithOffsets| yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
| 586 | if (vertical) partially evaluated: vertical| no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
| 587 | p.setY(p.y() + tab.dragOffset); never executed: p.setY(p.y() + tab.dragOffset); | 0 |
| 588 | else | - |
| 589 | p.setX(p.x() + tab.dragOffset); executed: p.setX(p.x() + tab.dragOffset);Execution Count:16 | 16 |
| 590 | } | - |
| 591 | tab.rightWidget->move(p); executed (the execution status of this line is deduced): tab.rightWidget->move(p); | - |
| 592 | } executed: }Execution Count:16 | 16 |
| 593 | } executed: }Execution Count:20 | 20 |
| 594 | | - |
| 595 | void QTabBarPrivate::layoutWidgets(int start) | - |
| 596 | { | - |
| 597 | Q_Q(QTabBar); executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 598 | for (int i = start; i < q->count(); ++i) { evaluated: i < q->count()| yes Evaluation Count:407 | yes Evaluation Count:208 |
| 208-407 |
| 599 | layoutTab(i); executed (the execution status of this line is deduced): layoutTab(i); | - |
| 600 | } executed: }Execution Count:407 | 407 |
| 601 | } executed: }Execution Count:208 | 208 |
| 602 | | - |
| 603 | void QTabBarPrivate::_q_closeTab() | - |
| 604 | { | - |
| 605 | Q_Q(QTabBar); executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 606 | QObject *object = q->sender(); executed (the execution status of this line is deduced): QObject *object = q->sender(); | - |
| 607 | int tabToClose = -1; executed (the execution status of this line is deduced): int tabToClose = -1; | - |
| 608 | QTabBar::ButtonPosition closeSide = (QTabBar::ButtonPosition)q->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, q); executed (the execution status of this line is deduced): QTabBar::ButtonPosition closeSide = (QTabBar::ButtonPosition)q->style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, q); | - |
| 609 | for (int i = 0; i < tabList.count(); ++i) { partially evaluated: i < tabList.count()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 610 | if (closeSide == QTabBar::LeftSide) { partially evaluated: closeSide == QTabBar::LeftSide| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 611 | if (tabList.at(i).leftWidget == object) { never evaluated: tabList.at(i).leftWidget == object | 0 |
| 612 | tabToClose = i; never executed (the execution status of this line is deduced): tabToClose = i; | - |
| 613 | break; | 0 |
| 614 | } | - |
| 615 | } else { | 0 |
| 616 | if (tabList.at(i).rightWidget == object) { partially evaluated: tabList.at(i).rightWidget == object| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 617 | tabToClose = i; executed (the execution status of this line is deduced): tabToClose = i; | - |
| 618 | break; executed: break;Execution Count:1 | 1 |
| 619 | } | - |
| 620 | } | 0 |
| 621 | } | - |
| 622 | if (tabToClose != -1) partially evaluated: tabToClose != -1| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 623 | emit q->tabCloseRequested(tabToClose); executed: q->tabCloseRequested(tabToClose);Execution Count:1 | 1 |
| 624 | } executed: }Execution Count:1 | 1 |
| 625 | | - |
| 626 | void QTabBarPrivate::_q_scrollTabs() | - |
| 627 | { | - |
| 628 | Q_Q(QTabBar); never executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 629 | const QObject *sender = q->sender(); never executed (the execution status of this line is deduced): const QObject *sender = q->sender(); | - |
| 630 | int i = -1; never executed (the execution status of this line is deduced): int i = -1; | - |
| 631 | if (!verticalTabs(shape)) { never evaluated: !verticalTabs(shape) | 0 |
| 632 | if (sender == leftB) { never evaluated: sender == leftB | 0 |
| 633 | for (i = tabList.count() - 1; i >= 0; --i) { | 0 |
| 634 | if (tabList.at(i).rect.left() - scrollOffset < 0) { never evaluated: tabList.at(i).rect.left() - scrollOffset < 0 | 0 |
| 635 | makeVisible(i); never executed (the execution status of this line is deduced): makeVisible(i); | - |
| 636 | return; | 0 |
| 637 | } | - |
| 638 | } | 0 |
| 639 | } else if (sender == rightB) { never executed: } never evaluated: sender == rightB | 0 |
| 640 | int availableWidth = q->width() - extraWidth(); never executed (the execution status of this line is deduced): int availableWidth = q->width() - extraWidth(); | - |
| 641 | for (i = 0; i < tabList.count(); ++i) { never evaluated: i < tabList.count() | 0 |
| 642 | if (tabList.at(i).rect.right() - scrollOffset > availableWidth) { never evaluated: tabList.at(i).rect.right() - scrollOffset > availableWidth | 0 |
| 643 | makeVisible(i); never executed (the execution status of this line is deduced): makeVisible(i); | - |
| 644 | return; | 0 |
| 645 | } | - |
| 646 | } | 0 |
| 647 | } | 0 |
| 648 | } else { // vertical | - |
| 649 | if (sender == leftB) { never evaluated: sender == leftB | 0 |
| 650 | for (i = tabList.count() - 1; i >= 0; --i) { | 0 |
| 651 | if (tabList.at(i).rect.top() - scrollOffset < 0) { never evaluated: tabList.at(i).rect.top() - scrollOffset < 0 | 0 |
| 652 | makeVisible(i); never executed (the execution status of this line is deduced): makeVisible(i); | - |
| 653 | return; | 0 |
| 654 | } | - |
| 655 | } | 0 |
| 656 | } else if (sender == rightB) { never executed: } never evaluated: sender == rightB | 0 |
| 657 | int available = q->height() - extraWidth(); never executed (the execution status of this line is deduced): int available = q->height() - extraWidth(); | - |
| 658 | for (i = 0; i < tabList.count(); ++i) { never evaluated: i < tabList.count() | 0 |
| 659 | if (tabList.at(i).rect.bottom() - scrollOffset > available) { never evaluated: tabList.at(i).rect.bottom() - scrollOffset > available | 0 |
| 660 | makeVisible(i); never executed (the execution status of this line is deduced): makeVisible(i); | - |
| 661 | return; | 0 |
| 662 | } | - |
| 663 | } | 0 |
| 664 | } | 0 |
| 665 | } | - |
| 666 | } | - |
| 667 | | - |
| 668 | void QTabBarPrivate::refresh() | - |
| 669 | { | - |
| 670 | Q_Q(QTabBar); executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 671 | | - |
| 672 | // be safe in case a subclass is also handling move with the tabs | - |
| 673 | if (pressedIndex != -1 partially evaluated: pressedIndex != -1| no Evaluation Count:0 | yes Evaluation Count:372 |
| 0-372 |
| 674 | && movable | 0 |
| 675 | && QApplication::mouseButtons() == Qt::NoButton) { never evaluated: QApplication::mouseButtons() == Qt::NoButton | 0 |
| 676 | moveTabFinished(pressedIndex); never executed (the execution status of this line is deduced): moveTabFinished(pressedIndex); | - |
| 677 | if (!validIndex(pressedIndex)) never evaluated: !validIndex(pressedIndex) | 0 |
| 678 | pressedIndex = -1; never executed: pressedIndex = -1; | 0 |
| 679 | } | 0 |
| 680 | | - |
| 681 | if (!q->isVisible()) { evaluated: !q->isVisible()| yes Evaluation Count:344 | yes Evaluation Count:28 |
| 28-344 |
| 682 | layoutDirty = true; executed (the execution status of this line is deduced): layoutDirty = true; | - |
| 683 | } else { executed: }Execution Count:344 | 344 |
| 684 | layoutTabs(); executed (the execution status of this line is deduced): layoutTabs(); | - |
| 685 | makeVisible(currentIndex); executed (the execution status of this line is deduced): makeVisible(currentIndex); | - |
| 686 | q->update(); executed (the execution status of this line is deduced): q->update(); | - |
| 687 | q->updateGeometry(); executed (the execution status of this line is deduced): q->updateGeometry(); | - |
| 688 | } executed: }Execution Count:28 | 28 |
| 689 | } | - |
| 690 | | - |
| 691 | /*! | - |
| 692 | Creates a new tab bar with the given \a parent. | - |
| 693 | */ | - |
| 694 | QTabBar::QTabBar(QWidget* parent) | - |
| 695 | :QWidget(*new QTabBarPrivate, parent, 0) | - |
| 696 | { | - |
| 697 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 698 | d->init(); executed (the execution status of this line is deduced): d->init(); | - |
| 699 | } executed: }Execution Count:115 | 115 |
| 700 | | - |
| 701 | | - |
| 702 | /*! | - |
| 703 | Destroys the tab bar. | - |
| 704 | */ | - |
| 705 | QTabBar::~QTabBar() | - |
| 706 | { | - |
| 707 | } | - |
| 708 | | - |
| 709 | /*! | - |
| 710 | \property QTabBar::shape | - |
| 711 | \brief the shape of the tabs in the tab bar | - |
| 712 | | - |
| 713 | Possible values for this property are described by the Shape enum. | - |
| 714 | */ | - |
| 715 | | - |
| 716 | | - |
| 717 | QTabBar::Shape QTabBar::shape() const | - |
| 718 | { | - |
| 719 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 720 | return d->shape; executed: return d->shape;Execution Count:72 | 72 |
| 721 | } | - |
| 722 | | - |
| 723 | void QTabBar::setShape(Shape shape) | - |
| 724 | { | - |
| 725 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 726 | if (d->shape == shape) evaluated: d->shape == shape| yes Evaluation Count:9 | yes Evaluation Count:23 |
| 9-23 |
| 727 | return; executed: return;Execution Count:9 | 9 |
| 728 | d->shape = shape; executed (the execution status of this line is deduced): d->shape = shape; | - |
| 729 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
| 730 | } executed: }Execution Count:23 | 23 |
| 731 | | - |
| 732 | /*! | - |
| 733 | \property QTabBar::drawBase | - |
| 734 | \brief defines whether or not tab bar should draw its base. | - |
| 735 | | - |
| 736 | If true then QTabBar draws a base in relation to the styles overlab. | - |
| 737 | Otherwise only the tabs are drawn. | - |
| 738 | | - |
| 739 | \sa QStyle::pixelMetric(), QStyle::PM_TabBarBaseOverlap, QStyleOptionTabBarBaseV2 | - |
| 740 | */ | - |
| 741 | | - |
| 742 | void QTabBar::setDrawBase(bool drawBase) | - |
| 743 | { | - |
| 744 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 745 | if (d->drawBase == drawBase) evaluated: d->drawBase == drawBase| yes Evaluation Count:10 | yes Evaluation Count:41 |
| 10-41 |
| 746 | return; executed: return;Execution Count:10 | 10 |
| 747 | d->drawBase = drawBase; executed (the execution status of this line is deduced): d->drawBase = drawBase; | - |
| 748 | update(); executed (the execution status of this line is deduced): update(); | - |
| 749 | } executed: }Execution Count:41 | 41 |
| 750 | | - |
| 751 | bool QTabBar::drawBase() const | - |
| 752 | { | - |
| 753 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 754 | return d->drawBase; executed: return d->drawBase;Execution Count:2 | 2 |
| 755 | } | - |
| 756 | | - |
| 757 | /*! | - |
| 758 | Adds a new tab with text \a text. Returns the new | - |
| 759 | tab's index. | - |
| 760 | */ | - |
| 761 | int QTabBar::addTab(const QString &text) | - |
| 762 | { | - |
| 763 | return insertTab(-1, text); executed: return insertTab(-1, text);Execution Count:169 | 169 |
| 764 | } | - |
| 765 | | - |
| 766 | /*! | - |
| 767 | \overload | - |
| 768 | | - |
| 769 | Adds a new tab with icon \a icon and text \a | - |
| 770 | text. Returns the new tab's index. | - |
| 771 | */ | - |
| 772 | int QTabBar::addTab(const QIcon& icon, const QString &text) | - |
| 773 | { | - |
| 774 | return insertTab(-1, icon, text); never executed: return insertTab(-1, icon, text); | 0 |
| 775 | } | - |
| 776 | | - |
| 777 | /*! | - |
| 778 | Inserts a new tab with text \a text at position \a index. If \a | - |
| 779 | index is out of range, the new tab is appened. Returns the new | - |
| 780 | tab's index. | - |
| 781 | */ | - |
| 782 | int QTabBar::insertTab(int index, const QString &text) | - |
| 783 | { | - |
| 784 | return insertTab(index, QIcon(), text); executed: return insertTab(index, QIcon(), text);Execution Count:183 | 183 |
| 785 | } | - |
| 786 | | - |
| 787 | /*!\overload | - |
| 788 | | - |
| 789 | Inserts a new tab with icon \a icon and text \a text at position | - |
| 790 | \a index. If \a index is out of range, the new tab is | - |
| 791 | appended. Returns the new tab's index. | - |
| 792 | | - |
| 793 | If the QTabBar was empty before this function is called, the inserted tab | - |
| 794 | becomes the current tab. | - |
| 795 | | - |
| 796 | Inserting a new tab at an index less than or equal to the current index | - |
| 797 | will increment the current index, but keep the current tab. | - |
| 798 | */ | - |
| 799 | int QTabBar::insertTab(int index, const QIcon& icon, const QString &text) | - |
| 800 | { | - |
| 801 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 802 | if (!d->validIndex(index)) { evaluated: !d->validIndex(index)| yes Evaluation Count:233 | yes Evaluation Count:3 |
| 3-233 |
| 803 | index = d->tabList.count(); executed (the execution status of this line is deduced): index = d->tabList.count(); | - |
| 804 | d->tabList.append(QTabBarPrivate::Tab(icon, text)); executed (the execution status of this line is deduced): d->tabList.append(QTabBarPrivate::Tab(icon, text)); | - |
| 805 | } else { executed: }Execution Count:233 | 233 |
| 806 | d->tabList.insert(index, QTabBarPrivate::Tab(icon, text)); executed (the execution status of this line is deduced): d->tabList.insert(index, QTabBarPrivate::Tab(icon, text)); | - |
| 807 | } executed: }Execution Count:3 | 3 |
| 808 | #ifndef QT_NO_SHORTCUT | - |
| 809 | d->tabList[index].shortcutId = grabShortcut(QKeySequence::mnemonic(text)); executed (the execution status of this line is deduced): d->tabList[index].shortcutId = grabShortcut(QKeySequence::mnemonic(text)); | - |
| 810 | #endif | - |
| 811 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
| 812 | if (d->tabList.count() == 1) evaluated: d->tabList.count() == 1| yes Evaluation Count:88 | yes Evaluation Count:148 |
| 88-148 |
| 813 | setCurrentIndex(index); executed: setCurrentIndex(index);Execution Count:88 | 88 |
| 814 | else if (index <= d->currentIndex) evaluated: index <= d->currentIndex| yes Evaluation Count:3 | yes Evaluation Count:145 |
| 3-145 |
| 815 | ++d->currentIndex; executed: ++d->currentIndex;Execution Count:3 | 3 |
| 816 | | - |
| 817 | if (d->closeButtonOnTabs) { evaluated: d->closeButtonOnTabs| yes Evaluation Count:1 | yes Evaluation Count:235 |
| 1-235 |
| 818 | QStyleOptionTabV3 opt; executed (the execution status of this line is deduced): QStyleOptionTabV3 opt; | - |
| 819 | initStyleOption(&opt, index); executed (the execution status of this line is deduced): initStyleOption(&opt, index); | - |
| 820 | ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); executed (the execution status of this line is deduced): ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); | - |
| 821 | QAbstractButton *closeButton = new CloseButton(this); executed (the execution status of this line is deduced): QAbstractButton *closeButton = new CloseButton(this); | - |
| 822 | connect(closeButton, SIGNAL(clicked()), this, SLOT(_q_closeTab())); executed (the execution status of this line is deduced): connect(closeButton, "2""clicked()", this, "1""_q_closeTab()"); | - |
| 823 | setTabButton(index, closeSide, closeButton); executed (the execution status of this line is deduced): setTabButton(index, closeSide, closeButton); | - |
| 824 | } executed: }Execution Count:1 | 1 |
| 825 | | - |
| 826 | for (int i = 0; i < d->tabList.count(); ++i) { evaluated: i < d->tabList.count()| yes Evaluation Count:539 | yes Evaluation Count:236 |
| 236-539 |
| 827 | if (d->tabList[i].lastTab >= index) partially evaluated: d->tabList[i].lastTab >= index| no Evaluation Count:0 | yes Evaluation Count:539 |
| 0-539 |
| 828 | ++d->tabList[i].lastTab; never executed: ++d->tabList[i].lastTab; | 0 |
| 829 | } executed: }Execution Count:539 | 539 |
| 830 | | - |
| 831 | tabInserted(index); executed (the execution status of this line is deduced): tabInserted(index); | - |
| 832 | return index; executed: return index;Execution Count:236 | 236 |
| 833 | } | - |
| 834 | | - |
| 835 | | - |
| 836 | /*! | - |
| 837 | Removes the tab at position \a index. | - |
| 838 | | - |
| 839 | \sa SelectionBehavior | - |
| 840 | */ | - |
| 841 | void QTabBar::removeTab(int index) | - |
| 842 | { | - |
| 843 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 844 | if (d->validIndex(index)) { partially evaluated: d->validIndex(index)| yes Evaluation Count:67 | no Evaluation Count:0 |
| 0-67 |
| 845 | #ifndef QT_NO_SHORTCUT | - |
| 846 | releaseShortcut(d->tabList.at(index).shortcutId); executed (the execution status of this line is deduced): releaseShortcut(d->tabList.at(index).shortcutId); | - |
| 847 | #endif | - |
| 848 | if (d->tabList[index].leftWidget) { partially evaluated: d->tabList[index].leftWidget| no Evaluation Count:0 | yes Evaluation Count:67 |
| 0-67 |
| 849 | d->tabList[index].leftWidget->hide(); never executed (the execution status of this line is deduced): d->tabList[index].leftWidget->hide(); | - |
| 850 | d->tabList[index].leftWidget->deleteLater(); never executed (the execution status of this line is deduced): d->tabList[index].leftWidget->deleteLater(); | - |
| 851 | d->tabList[index].leftWidget = 0; never executed (the execution status of this line is deduced): d->tabList[index].leftWidget = 0; | - |
| 852 | } | 0 |
| 853 | if (d->tabList[index].rightWidget) { partially evaluated: d->tabList[index].rightWidget| no Evaluation Count:0 | yes Evaluation Count:67 |
| 0-67 |
| 854 | d->tabList[index].rightWidget->hide(); never executed (the execution status of this line is deduced): d->tabList[index].rightWidget->hide(); | - |
| 855 | d->tabList[index].rightWidget->deleteLater(); never executed (the execution status of this line is deduced): d->tabList[index].rightWidget->deleteLater(); | - |
| 856 | d->tabList[index].rightWidget = 0; never executed (the execution status of this line is deduced): d->tabList[index].rightWidget = 0; | - |
| 857 | } | 0 |
| 858 | | - |
| 859 | int newIndex = d->tabList[index].lastTab; executed (the execution status of this line is deduced): int newIndex = d->tabList[index].lastTab; | - |
| 860 | d->tabList.removeAt(index); executed (the execution status of this line is deduced): d->tabList.removeAt(index); | - |
| 861 | for (int i = 0; i < d->tabList.count(); ++i) { evaluated: i < d->tabList.count()| yes Evaluation Count:112 | yes Evaluation Count:67 |
| 67-112 |
| 862 | if (d->tabList[i].lastTab == index) evaluated: d->tabList[i].lastTab == index| yes Evaluation Count:10 | yes Evaluation Count:102 |
| 10-102 |
| 863 | d->tabList[i].lastTab = -1; executed: d->tabList[i].lastTab = -1;Execution Count:10 | 10 |
| 864 | if (d->tabList[i].lastTab > index) evaluated: d->tabList[i].lastTab > index| yes Evaluation Count:7 | yes Evaluation Count:105 |
| 7-105 |
| 865 | --d->tabList[i].lastTab; executed: --d->tabList[i].lastTab;Execution Count:7 | 7 |
| 866 | } executed: }Execution Count:112 | 112 |
| 867 | if (index == d->currentIndex) { evaluated: index == d->currentIndex| yes Evaluation Count:40 | yes Evaluation Count:27 |
| 27-40 |
| 868 | // The current tab is going away, in order to make sure | - |
| 869 | // we emit that "current has changed", we need to reset this | - |
| 870 | // around. | - |
| 871 | d->currentIndex = -1; executed (the execution status of this line is deduced): d->currentIndex = -1; | - |
| 872 | if (d->tabList.size() > 0) { evaluated: d->tabList.size() > 0| yes Evaluation Count:25 | yes Evaluation Count:15 |
| 15-25 |
| 873 | switch(d->selectionBehaviorOnRemove) { | - |
| 874 | case SelectPreviousTab: | - |
| 875 | if (newIndex > index) evaluated: newIndex > index| yes Evaluation Count:4 | yes Evaluation Count:7 |
| 4-7 |
| 876 | newIndex--; executed: newIndex--;Execution Count:4 | 4 |
| 877 | if (d->validIndex(newIndex)) evaluated: d->validIndex(newIndex)| yes Evaluation Count:10 | yes Evaluation Count:1 |
| 1-10 |
| 878 | break; executed: break;Execution Count:10 | 10 |
| 879 | // else fallthrough | - |
| 880 | case SelectRightTab: code before this statement executed: case SelectRightTab:Execution Count:1 | 1 |
| 881 | newIndex = index; executed (the execution status of this line is deduced): newIndex = index; | - |
| 882 | if (newIndex >= d->tabList.size()) evaluated: newIndex >= d->tabList.size()| yes Evaluation Count:6 | yes Evaluation Count:6 |
| 6 |
| 883 | newIndex = d->tabList.size() - 1; executed: newIndex = d->tabList.size() - 1;Execution Count:6 | 6 |
| 884 | break; executed: break;Execution Count:12 | 12 |
| 885 | case SelectLeftTab: | - |
| 886 | newIndex = index - 1; executed (the execution status of this line is deduced): newIndex = index - 1; | - |
| 887 | if (newIndex < 0) evaluated: newIndex < 0| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 888 | newIndex = 0; executed: newIndex = 0;Execution Count:1 | 1 |
| 889 | break; executed: break;Execution Count:3 | 3 |
| 890 | default: | - |
| 891 | break; | 0 |
| 892 | } | - |
| 893 | | - |
| 894 | if (d->validIndex(newIndex)) { partially evaluated: d->validIndex(newIndex)| yes Evaluation Count:25 | no Evaluation Count:0 |
| 0-25 |
| 895 | // don't loose newIndex's old through setCurrentIndex | - |
| 896 | int bump = d->tabList[newIndex].lastTab; executed (the execution status of this line is deduced): int bump = d->tabList[newIndex].lastTab; | - |
| 897 | setCurrentIndex(newIndex); executed (the execution status of this line is deduced): setCurrentIndex(newIndex); | - |
| 898 | d->tabList[newIndex].lastTab = bump; executed (the execution status of this line is deduced): d->tabList[newIndex].lastTab = bump; | - |
| 899 | } executed: }Execution Count:25 | 25 |
| 900 | } else { executed: }Execution Count:25 | 25 |
| 901 | emit currentChanged(-1); executed (the execution status of this line is deduced): currentChanged(-1); | - |
| 902 | } executed: }Execution Count:15 | 15 |
| 903 | } else if (index < d->currentIndex) { evaluated: index < d->currentIndex| yes Evaluation Count:16 | yes Evaluation Count:11 |
| 11-16 |
| 904 | setCurrentIndex(d->currentIndex - 1); executed (the execution status of this line is deduced): setCurrentIndex(d->currentIndex - 1); | - |
| 905 | } executed: }Execution Count:16 | 16 |
| 906 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
| 907 | tabRemoved(index); executed (the execution status of this line is deduced): tabRemoved(index); | - |
| 908 | } executed: }Execution Count:67 | 67 |
| 909 | } executed: }Execution Count:67 | 67 |
| 910 | | - |
| 911 | | - |
| 912 | /*! | - |
| 913 | Returns true if the tab at position \a index is enabled; otherwise | - |
| 914 | returns false. | - |
| 915 | */ | - |
| 916 | bool QTabBar::isTabEnabled(int index) const | - |
| 917 | { | - |
| 918 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 919 | if (const QTabBarPrivate::Tab *tab = d->at(index)) evaluated: const QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:18 | yes Evaluation Count:1 |
| 1-18 |
| 920 | return tab->enabled; executed: return tab->enabled;Execution Count:18 | 18 |
| 921 | return false; executed: return false;Execution Count:1 | 1 |
| 922 | } | - |
| 923 | | - |
| 924 | /*! | - |
| 925 | If \a enabled is true then the tab at position \a index is | - |
| 926 | enabled; otherwise the item at position \a index is disabled. | - |
| 927 | */ | - |
| 928 | void QTabBar::setTabEnabled(int index, bool enabled) | - |
| 929 | { | - |
| 930 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 931 | if (QTabBarPrivate::Tab *tab = d->at(index)) { evaluated: QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:8 | yes Evaluation Count:1 |
| 1-8 |
| 932 | tab->enabled = enabled; executed (the execution status of this line is deduced): tab->enabled = enabled; | - |
| 933 | #ifndef QT_NO_SHORTCUT | - |
| 934 | setShortcutEnabled(tab->shortcutId, enabled); executed (the execution status of this line is deduced): setShortcutEnabled(tab->shortcutId, enabled); | - |
| 935 | #endif | - |
| 936 | update(); executed (the execution status of this line is deduced): update(); | - |
| 937 | if (!enabled && index == d->currentIndex) evaluated: !enabled| yes Evaluation Count:5 | yes Evaluation Count:3 |
evaluated: index == d->currentIndex| yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-5 |
| 938 | setCurrentIndex(d->validIndex(index+1)?index+1:0); executed: setCurrentIndex(d->validIndex(index+1)?index+1:0);Execution Count:4 | 4 |
| 939 | else if (enabled && !d->validIndex(d->currentIndex)) evaluated: enabled| yes Evaluation Count:3 | yes Evaluation Count:1 |
partially evaluated: !d->validIndex(d->currentIndex)| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 940 | setCurrentIndex(index); never executed: setCurrentIndex(index); | 0 |
| 941 | } | - |
| 942 | } executed: }Execution Count:9 | 9 |
| 943 | | - |
| 944 | | - |
| 945 | /*! | - |
| 946 | Returns the text of the tab at position \a index, or an empty | - |
| 947 | string if \a index is out of range. | - |
| 948 | */ | - |
| 949 | QString QTabBar::tabText(int index) const | - |
| 950 | { | - |
| 951 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 952 | if (const QTabBarPrivate::Tab *tab = d->at(index)) evaluated: const QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:281 | yes Evaluation Count:1 |
| 1-281 |
| 953 | return tab->text; executed: return tab->text;Execution Count:281 | 281 |
| 954 | return QString(); executed: return QString();Execution Count:1 | 1 |
| 955 | } | - |
| 956 | | - |
| 957 | /*! | - |
| 958 | Sets the text of the tab at position \a index to \a text. | - |
| 959 | */ | - |
| 960 | void QTabBar::setTabText(int index, const QString &text) | - |
| 961 | { | - |
| 962 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 963 | if (QTabBarPrivate::Tab *tab = d->at(index)) { evaluated: QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:8 | yes Evaluation Count:2 |
| 2-8 |
| 964 | tab->text = text; executed (the execution status of this line is deduced): tab->text = text; | - |
| 965 | #ifndef QT_NO_SHORTCUT | - |
| 966 | releaseShortcut(tab->shortcutId); executed (the execution status of this line is deduced): releaseShortcut(tab->shortcutId); | - |
| 967 | tab->shortcutId = grabShortcut(QKeySequence::mnemonic(text)); executed (the execution status of this line is deduced): tab->shortcutId = grabShortcut(QKeySequence::mnemonic(text)); | - |
| 968 | setShortcutEnabled(tab->shortcutId, tab->enabled); executed (the execution status of this line is deduced): setShortcutEnabled(tab->shortcutId, tab->enabled); | - |
| 969 | #endif | - |
| 970 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
| 971 | } executed: }Execution Count:8 | 8 |
| 972 | } executed: }Execution Count:10 | 10 |
| 973 | | - |
| 974 | /*! | - |
| 975 | Returns the text color of the tab with the given \a index, or a invalid | - |
| 976 | color if \a index is out of range. | - |
| 977 | | - |
| 978 | \sa setTabTextColor() | - |
| 979 | */ | - |
| 980 | QColor QTabBar::tabTextColor(int index) const | - |
| 981 | { | - |
| 982 | Q_D(const QTabBar); never executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 983 | if (const QTabBarPrivate::Tab *tab = d->at(index)) never evaluated: const QTabBarPrivate::Tab *tab = d->at(index) | 0 |
| 984 | return tab->textColor; never executed: return tab->textColor; | 0 |
| 985 | return QColor(); never executed: return QColor(); | 0 |
| 986 | } | - |
| 987 | | - |
| 988 | /*! | - |
| 989 | Sets the color of the text in the tab with the given \a index to the specified \a color. | - |
| 990 | | - |
| 991 | If an invalid color is specified, the tab will use the QTabBar foreground role instead. | - |
| 992 | | - |
| 993 | \sa tabTextColor() | - |
| 994 | */ | - |
| 995 | void QTabBar::setTabTextColor(int index, const QColor &color) | - |
| 996 | { | - |
| 997 | Q_D(QTabBar); never executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 998 | if (QTabBarPrivate::Tab *tab = d->at(index)) { never evaluated: QTabBarPrivate::Tab *tab = d->at(index) | 0 |
| 999 | tab->textColor = color; never executed (the execution status of this line is deduced): tab->textColor = color; | - |
| 1000 | update(tabRect(index)); never executed (the execution status of this line is deduced): update(tabRect(index)); | - |
| 1001 | } | 0 |
| 1002 | } | 0 |
| 1003 | | - |
| 1004 | /*! | - |
| 1005 | Returns the icon of the tab at position \a index, or a null icon | - |
| 1006 | if \a index is out of range. | - |
| 1007 | */ | - |
| 1008 | QIcon QTabBar::tabIcon(int index) const | - |
| 1009 | { | - |
| 1010 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1011 | if (const QTabBarPrivate::Tab *tab = d->at(index)) partially evaluated: const QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1012 | return tab->icon; executed: return tab->icon;Execution Count:1 | 1 |
| 1013 | return QIcon(); never executed: return QIcon(); | 0 |
| 1014 | } | - |
| 1015 | | - |
| 1016 | /*! | - |
| 1017 | Sets the icon of the tab at position \a index to \a icon. | - |
| 1018 | */ | - |
| 1019 | void QTabBar::setTabIcon(int index, const QIcon & icon) | - |
| 1020 | { | - |
| 1021 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1022 | if (QTabBarPrivate::Tab *tab = d->at(index)) { evaluated: QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 1023 | bool simpleIconChange = (!icon.isNull() && !tab->icon.isNull()); partially evaluated: !icon.isNull()| no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: !tab->icon.isNull() | 0-1 |
| 1024 | tab->icon = icon; executed (the execution status of this line is deduced): tab->icon = icon; | - |
| 1025 | if (simpleIconChange) partially evaluated: simpleIconChange| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1026 | update(tabRect(index)); never executed: update(tabRect(index)); | 0 |
| 1027 | else | - |
| 1028 | d->refresh(); executed: d->refresh();Execution Count:1 | 1 |
| 1029 | } | - |
| 1030 | } executed: }Execution Count:2 | 2 |
| 1031 | | - |
| 1032 | #ifndef QT_NO_TOOLTIP | - |
| 1033 | /*! | - |
| 1034 | Sets the tool tip of the tab at position \a index to \a tip. | - |
| 1035 | */ | - |
| 1036 | void QTabBar::setTabToolTip(int index, const QString & tip) | - |
| 1037 | { | - |
| 1038 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1039 | if (QTabBarPrivate::Tab *tab = d->at(index)) partially evaluated: QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:11 | no Evaluation Count:0 |
| 0-11 |
| 1040 | tab->toolTip = tip; executed: tab->toolTip = tip;Execution Count:11 | 11 |
| 1041 | } executed: }Execution Count:11 | 11 |
| 1042 | | - |
| 1043 | /*! | - |
| 1044 | Returns the tool tip of the tab at position \a index, or an empty | - |
| 1045 | string if \a index is out of range. | - |
| 1046 | */ | - |
| 1047 | QString QTabBar::tabToolTip(int index) const | - |
| 1048 | { | - |
| 1049 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1050 | if (const QTabBarPrivate::Tab *tab = d->at(index)) evaluated: const QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 1051 | return tab->toolTip; executed: return tab->toolTip;Execution Count:2 | 2 |
| 1052 | return QString(); executed: return QString();Execution Count:2 | 2 |
| 1053 | } | - |
| 1054 | #endif // QT_NO_TOOLTIP | - |
| 1055 | | - |
| 1056 | #ifndef QT_NO_WHATSTHIS | - |
| 1057 | /*! | - |
| 1058 | \since 4.1 | - |
| 1059 | | - |
| 1060 | Sets the What's This help text of the tab at position \a index | - |
| 1061 | to \a text. | - |
| 1062 | */ | - |
| 1063 | void QTabBar::setTabWhatsThis(int index, const QString &text) | - |
| 1064 | { | - |
| 1065 | Q_D(QTabBar); never executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1066 | if (QTabBarPrivate::Tab *tab = d->at(index)) never evaluated: QTabBarPrivate::Tab *tab = d->at(index) | 0 |
| 1067 | tab->whatsThis = text; never executed: tab->whatsThis = text; | 0 |
| 1068 | } | 0 |
| 1069 | | - |
| 1070 | /*! | - |
| 1071 | \since 4.1 | - |
| 1072 | | - |
| 1073 | Returns the What's This help text of the tab at position \a index, | - |
| 1074 | or an empty string if \a index is out of range. | - |
| 1075 | */ | - |
| 1076 | QString QTabBar::tabWhatsThis(int index) const | - |
| 1077 | { | - |
| 1078 | Q_D(const QTabBar); never executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1079 | if (const QTabBarPrivate::Tab *tab = d->at(index)) never evaluated: const QTabBarPrivate::Tab *tab = d->at(index) | 0 |
| 1080 | return tab->whatsThis; never executed: return tab->whatsThis; | 0 |
| 1081 | return QString(); never executed: return QString(); | 0 |
| 1082 | } | - |
| 1083 | | - |
| 1084 | #endif // QT_NO_WHATSTHIS | - |
| 1085 | | - |
| 1086 | /*! | - |
| 1087 | Sets the data of the tab at position \a index to \a data. | - |
| 1088 | */ | - |
| 1089 | void QTabBar::setTabData(int index, const QVariant & data) | - |
| 1090 | { | - |
| 1091 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1092 | if (QTabBarPrivate::Tab *tab = d->at(index)) partially evaluated: QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
| 1093 | tab->data = data; executed: tab->data = data;Execution Count:9 | 9 |
| 1094 | } executed: }Execution Count:9 | 9 |
| 1095 | | - |
| 1096 | /*! | - |
| 1097 | Returns the data of the tab at position \a index, or a null | - |
| 1098 | variant if \a index is out of range. | - |
| 1099 | */ | - |
| 1100 | QVariant QTabBar::tabData(int index) const | - |
| 1101 | { | - |
| 1102 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1103 | if (const QTabBarPrivate::Tab *tab = d->at(index)) partially evaluated: const QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:310 | no Evaluation Count:0 |
| 0-310 |
| 1104 | return tab->data; executed: return tab->data;Execution Count:310 | 310 |
| 1105 | return QVariant(); never executed: return QVariant(); | 0 |
| 1106 | } | - |
| 1107 | | - |
| 1108 | /*! | - |
| 1109 | Returns the visual rectangle of the tab at position \a | - |
| 1110 | index, or a null rectangle if \a index is out of range. | - |
| 1111 | */ | - |
| 1112 | QRect QTabBar::tabRect(int index) const | - |
| 1113 | { | - |
| 1114 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1115 | if (const QTabBarPrivate::Tab *tab = d->at(index)) { evaluated: const QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:1029 | yes Evaluation Count:79 |
| 79-1029 |
| 1116 | if (d->layoutDirty) evaluated: d->layoutDirty| yes Evaluation Count:2 | yes Evaluation Count:1027 |
| 2-1027 |
| 1117 | const_cast<QTabBarPrivate*>(d)->layoutTabs(); executed: const_cast<QTabBarPrivate*>(d)->layoutTabs();Execution Count:2 | 2 |
| 1118 | QRect r = tab->rect; executed (the execution status of this line is deduced): QRect r = tab->rect; | - |
| 1119 | if (verticalTabs(d->shape)) evaluated: verticalTabs(d->shape)| yes Evaluation Count:60 | yes Evaluation Count:969 |
| 60-969 |
| 1120 | r.translate(0, -d->scrollOffset); executed: r.translate(0, -d->scrollOffset);Execution Count:60 | 60 |
| 1121 | else | - |
| 1122 | r.translate(-d->scrollOffset, 0); executed: r.translate(-d->scrollOffset, 0);Execution Count:969 | 969 |
| 1123 | if (!verticalTabs(d->shape)) evaluated: !verticalTabs(d->shape)| yes Evaluation Count:969 | yes Evaluation Count:60 |
| 60-969 |
| 1124 | r = QStyle::visualRect(layoutDirection(), rect(), r); executed: r = QStyle::visualRect(layoutDirection(), rect(), r);Execution Count:969 | 969 |
| 1125 | return r; executed: return r;Execution Count:1029 | 1029 |
| 1126 | } | - |
| 1127 | return QRect(); executed: return QRect();Execution Count:79 | 79 |
| 1128 | } | - |
| 1129 | | - |
| 1130 | /*! | - |
| 1131 | \since 4.3 | - |
| 1132 | Returns the index of the tab that covers \a position or -1 if no | - |
| 1133 | tab covers \a position; | - |
| 1134 | */ | - |
| 1135 | | - |
| 1136 | int QTabBar::tabAt(const QPoint &position) const | - |
| 1137 | { | - |
| 1138 | Q_D(const QTabBar); never executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1139 | if (d->validIndex(d->currentIndex) never evaluated: d->validIndex(d->currentIndex) | 0 |
| 1140 | && tabRect(d->currentIndex).contains(position)) { never evaluated: tabRect(d->currentIndex).contains(position) | 0 |
| 1141 | return d->currentIndex; never executed: return d->currentIndex; | 0 |
| 1142 | } | - |
| 1143 | const int max = d->tabList.size(); never executed (the execution status of this line is deduced): const int max = d->tabList.size(); | - |
| 1144 | for (int i = 0; i < max; ++i) { | 0 |
| 1145 | if (tabRect(i).contains(position)) { never evaluated: tabRect(i).contains(position) | 0 |
| 1146 | return i; never executed: return i; | 0 |
| 1147 | } | - |
| 1148 | } | 0 |
| 1149 | return -1; never executed: return -1; | 0 |
| 1150 | } | - |
| 1151 | | - |
| 1152 | /*! | - |
| 1153 | \property QTabBar::currentIndex | - |
| 1154 | \brief the index of the tab bar's visible tab | - |
| 1155 | | - |
| 1156 | The current index is -1 if there is no current tab. | - |
| 1157 | */ | - |
| 1158 | | - |
| 1159 | int QTabBar::currentIndex() const | - |
| 1160 | { | - |
| 1161 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1162 | if (d->validIndex(d->currentIndex)) evaluated: d->validIndex(d->currentIndex)| yes Evaluation Count:408 | yes Evaluation Count:105 |
| 105-408 |
| 1163 | return d->currentIndex; executed: return d->currentIndex;Execution Count:408 | 408 |
| 1164 | return -1; executed: return -1;Execution Count:105 | 105 |
| 1165 | } | - |
| 1166 | | - |
| 1167 | | - |
| 1168 | void QTabBar::setCurrentIndex(int index) | - |
| 1169 | { | - |
| 1170 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1171 | if (d->dragInProgress && d->pressedIndex != -1) partially evaluated: d->dragInProgress| no Evaluation Count:0 | yes Evaluation Count:240 |
never evaluated: d->pressedIndex != -1 | 0-240 |
| 1172 | return; | 0 |
| 1173 | | - |
| 1174 | int oldIndex = d->currentIndex; executed (the execution status of this line is deduced): int oldIndex = d->currentIndex; | - |
| 1175 | if (d->validIndex(index) && d->currentIndex != index) { evaluated: d->validIndex(index)| yes Evaluation Count:225 | yes Evaluation Count:15 |
evaluated: d->currentIndex != index| yes Evaluation Count:202 | yes Evaluation Count:23 |
| 15-225 |
| 1176 | d->currentIndex = index; executed (the execution status of this line is deduced): d->currentIndex = index; | - |
| 1177 | update(); executed (the execution status of this line is deduced): update(); | - |
| 1178 | d->makeVisible(index); executed (the execution status of this line is deduced): d->makeVisible(index); | - |
| 1179 | d->tabList[index].lastTab = oldIndex; executed (the execution status of this line is deduced): d->tabList[index].lastTab = oldIndex; | - |
| 1180 | if (oldIndex >= 0 && oldIndex < count()) evaluated: oldIndex >= 0| yes Evaluation Count:89 | yes Evaluation Count:113 |
evaluated: oldIndex < count()| yes Evaluation Count:75 | yes Evaluation Count:14 |
| 14-113 |
| 1181 | d->layoutTab(oldIndex); executed: d->layoutTab(oldIndex);Execution Count:75 | 75 |
| 1182 | d->layoutTab(index); executed (the execution status of this line is deduced): d->layoutTab(index); | - |
| 1183 | #ifndef QT_NO_ACCESSIBILITY | - |
| 1184 | if (QAccessible::isActive()) { evaluated: QAccessible::isActive()| yes Evaluation Count:3 | yes Evaluation Count:199 |
| 3-199 |
| 1185 | if (hasFocus()) { partially evaluated: hasFocus()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1186 | QAccessibleEvent focusEvent(this, QAccessible::Focus); never executed (the execution status of this line is deduced): QAccessibleEvent focusEvent(this, QAccessible::Focus); | - |
| 1187 | focusEvent.setChild(index); never executed (the execution status of this line is deduced): focusEvent.setChild(index); | - |
| 1188 | QAccessible::updateAccessibility(&focusEvent); never executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&focusEvent); | - |
| 1189 | } | 0 |
| 1190 | QAccessibleEvent selectionEvent(this, QAccessible::Selection); executed (the execution status of this line is deduced): QAccessibleEvent selectionEvent(this, QAccessible::Selection); | - |
| 1191 | selectionEvent.setChild(index); executed (the execution status of this line is deduced): selectionEvent.setChild(index); | - |
| 1192 | QAccessible::updateAccessibility(&selectionEvent); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&selectionEvent); | - |
| 1193 | } executed: }Execution Count:3 | 3 |
| 1194 | #endif | - |
| 1195 | emit currentChanged(index); executed (the execution status of this line is deduced): currentChanged(index); | - |
| 1196 | } executed: }Execution Count:202 | 202 |
| 1197 | } executed: }Execution Count:240 | 240 |
| 1198 | | - |
| 1199 | /*! | - |
| 1200 | \property QTabBar::iconSize | - |
| 1201 | \brief The size for icons in the tab bar | - |
| 1202 | \since 4.1 | - |
| 1203 | | - |
| 1204 | The default value is style-dependent. \c iconSize is a maximum | - |
| 1205 | size; icons that are smaller are not scaled up. | - |
| 1206 | | - |
| 1207 | \sa QTabWidget::iconSize | - |
| 1208 | */ | - |
| 1209 | QSize QTabBar::iconSize() const | - |
| 1210 | { | - |
| 1211 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1212 | if (d->iconSize.isValid()) evaluated: d->iconSize.isValid()| yes Evaluation Count:4 | yes Evaluation Count:687 |
| 4-687 |
| 1213 | return d->iconSize; executed: return d->iconSize;Execution Count:4 | 4 |
| 1214 | int iconExtent = style()->pixelMetric(QStyle::PM_TabBarIconSize, 0, this); executed (the execution status of this line is deduced): int iconExtent = style()->pixelMetric(QStyle::PM_TabBarIconSize, 0, this); | - |
| 1215 | return QSize(iconExtent, iconExtent); executed: return QSize(iconExtent, iconExtent);Execution Count:687 | 687 |
| 1216 | | - |
| 1217 | } | - |
| 1218 | | - |
| 1219 | void QTabBar::setIconSize(const QSize &size) | - |
| 1220 | { | - |
| 1221 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1222 | d->iconSize = size; executed (the execution status of this line is deduced): d->iconSize = size; | - |
| 1223 | d->layoutDirty = true; executed (the execution status of this line is deduced): d->layoutDirty = true; | - |
| 1224 | update(); executed (the execution status of this line is deduced): update(); | - |
| 1225 | updateGeometry(); executed (the execution status of this line is deduced): updateGeometry(); | - |
| 1226 | } executed: }Execution Count:5 | 5 |
| 1227 | | - |
| 1228 | /*! | - |
| 1229 | \property QTabBar::count | - |
| 1230 | \brief the number of tabs in the tab bar | - |
| 1231 | */ | - |
| 1232 | | - |
| 1233 | int QTabBar::count() const | - |
| 1234 | { | - |
| 1235 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1236 | return d->tabList.count(); executed: return d->tabList.count();Execution Count:1433 | 1433 |
| 1237 | } | - |
| 1238 | | - |
| 1239 | | - |
| 1240 | /*!\reimp | - |
| 1241 | */ | - |
| 1242 | QSize QTabBar::sizeHint() const | - |
| 1243 | { | - |
| 1244 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1245 | if (d->layoutDirty) evaluated: d->layoutDirty| yes Evaluation Count:84 | yes Evaluation Count:497 |
| 84-497 |
| 1246 | const_cast<QTabBarPrivate*>(d)->layoutTabs(); executed: const_cast<QTabBarPrivate*>(d)->layoutTabs();Execution Count:84 | 84 |
| 1247 | QRect r; executed (the execution status of this line is deduced): QRect r; | - |
| 1248 | for (int i = 0; i < d->tabList.count(); ++i) evaluated: i < d->tabList.count()| yes Evaluation Count:830 | yes Evaluation Count:581 |
| 581-830 |
| 1249 | r = r.united(d->tabList.at(i).maxRect); executed: r = r.united(d->tabList.at(i).maxRect);Execution Count:830 | 830 |
| 1250 | QSize sz = QApplication::globalStrut(); executed (the execution status of this line is deduced): QSize sz = QApplication::globalStrut(); | - |
| 1251 | return r.size().expandedTo(sz); executed: return r.size().expandedTo(sz);Execution Count:581 | 581 |
| 1252 | } | - |
| 1253 | | - |
| 1254 | /*!\reimp | - |
| 1255 | */ | - |
| 1256 | QSize QTabBar::minimumSizeHint() const | - |
| 1257 | { | - |
| 1258 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1259 | if (d->layoutDirty) evaluated: d->layoutDirty| yes Evaluation Count:5 | yes Evaluation Count:84 |
| 5-84 |
| 1260 | const_cast<QTabBarPrivate*>(d)->layoutTabs(); executed: const_cast<QTabBarPrivate*>(d)->layoutTabs();Execution Count:5 | 5 |
| 1261 | if (!d->useScrollButtons) { evaluated: !d->useScrollButtons| yes Evaluation Count:3 | yes Evaluation Count:86 |
| 3-86 |
| 1262 | QRect r; executed (the execution status of this line is deduced): QRect r; | - |
| 1263 | for (int i = 0; i < d->tabList.count(); ++i) evaluated: i < d->tabList.count()| yes Evaluation Count:28 | yes Evaluation Count:3 |
| 3-28 |
| 1264 | r = r.united(d->tabList.at(i).minRect); executed: r = r.united(d->tabList.at(i).minRect);Execution Count:28 | 28 |
| 1265 | return r.size().expandedTo(QApplication::globalStrut()); executed: return r.size().expandedTo(QApplication::globalStrut());Execution Count:3 | 3 |
| 1266 | } | - |
| 1267 | if (verticalTabs(d->shape)) evaluated: verticalTabs(d->shape)| yes Evaluation Count:6 | yes Evaluation Count:80 |
| 6-80 |
| 1268 | return QSize(sizeHint().width(), d->rightB->sizeHint().height() * 2 + 75); executed: return QSize(sizeHint().width(), d->rightB->sizeHint().height() * 2 + 75);Execution Count:6 | 6 |
| 1269 | else | - |
| 1270 | return QSize(d->rightB->sizeHint().width() * 2 + 75, sizeHint().height()); executed: return QSize(d->rightB->sizeHint().width() * 2 + 75, sizeHint().height());Execution Count:80 | 80 |
| 1271 | } | - |
| 1272 | | - |
| 1273 | // Compute the most-elided possible text, for minimumSizeHint | - |
| 1274 | static QString computeElidedText(Qt::TextElideMode mode, const QString &text) | - |
| 1275 | { | - |
| 1276 | if (text.length() <= 3) evaluated: text.length() <= 3| yes Evaluation Count:164 | yes Evaluation Count:127 |
| 127-164 |
| 1277 | return text; executed: return text;Execution Count:164 | 164 |
| 1278 | | - |
| 1279 | static const QLatin1String Ellipses("..."); | - |
| 1280 | QString ret; executed (the execution status of this line is deduced): QString ret; | - |
| 1281 | switch (mode) { | - |
| 1282 | case Qt::ElideRight: | - |
| 1283 | ret = text.left(2) + Ellipses; executed (the execution status of this line is deduced): ret = text.left(2) + Ellipses; | - |
| 1284 | break; executed: break;Execution Count:19 | 19 |
| 1285 | case Qt::ElideMiddle: | - |
| 1286 | ret = text.left(1) + Ellipses + text.right(1); never executed (the execution status of this line is deduced): ret = text.left(1) + Ellipses + text.right(1); | - |
| 1287 | break; | 0 |
| 1288 | case Qt::ElideLeft: | - |
| 1289 | ret = Ellipses + text.right(2); never executed (the execution status of this line is deduced): ret = Ellipses + text.right(2); | - |
| 1290 | break; | 0 |
| 1291 | case Qt::ElideNone: | - |
| 1292 | ret = text; executed (the execution status of this line is deduced): ret = text; | - |
| 1293 | break; executed: break;Execution Count:108 | 108 |
| 1294 | } | - |
| 1295 | return ret; executed: return ret;Execution Count:127 | 127 |
| 1296 | } | - |
| 1297 | | - |
| 1298 | /*! | - |
| 1299 | Returns the minimum tab size hint for the tab at position \a index. | - |
| 1300 | \since Qt 5.0 | - |
| 1301 | */ | - |
| 1302 | | - |
| 1303 | QSize QTabBar::minimumTabSizeHint(int index) const | - |
| 1304 | { | - |
| 1305 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1306 | QTabBarPrivate::Tab &tab = const_cast<QTabBarPrivate::Tab&>(d->tabList[index]); executed (the execution status of this line is deduced): QTabBarPrivate::Tab &tab = const_cast<QTabBarPrivate::Tab&>(d->tabList[index]); | - |
| 1307 | QString oldText = tab.text; executed (the execution status of this line is deduced): QString oldText = tab.text; | - |
| 1308 | tab.text = computeElidedText(d->elideMode, oldText); executed (the execution status of this line is deduced): tab.text = computeElidedText(d->elideMode, oldText); | - |
| 1309 | QSize size = tabSizeHint(index); executed (the execution status of this line is deduced): QSize size = tabSizeHint(index); | - |
| 1310 | tab.text = oldText; executed (the execution status of this line is deduced): tab.text = oldText; | - |
| 1311 | return size; executed: return size;Execution Count:291 | 291 |
| 1312 | } | - |
| 1313 | | - |
| 1314 | /*! | - |
| 1315 | Returns the size hint for the tab at position \a index. | - |
| 1316 | */ | - |
| 1317 | QSize QTabBar::tabSizeHint(int index) const | - |
| 1318 | { | - |
| 1319 | //Note: this must match with the computations in QCommonStylePrivate::tabLayout | - |
| 1320 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 1321 | if (const QTabBarPrivate::Tab *tab = d->at(index)) { partially evaluated: const QTabBarPrivate::Tab *tab = d->at(index)| yes Evaluation Count:582 | no Evaluation Count:0 |
| 0-582 |
| 1322 | QStyleOptionTabV3 opt; executed (the execution status of this line is deduced): QStyleOptionTabV3 opt; | - |
| 1323 | initStyleOption(&opt, index); executed (the execution status of this line is deduced): initStyleOption(&opt, index); | - |
| 1324 | opt.text = d->tabList.at(index).text; executed (the execution status of this line is deduced): opt.text = d->tabList.at(index).text; | - |
| 1325 | QSize iconSize = tab->icon.isNull() ? QSize(0, 0) : opt.iconSize; partially evaluated: tab->icon.isNull()| yes Evaluation Count:582 | no Evaluation Count:0 |
| 0-582 |
| 1326 | int hframe = style()->pixelMetric(QStyle::PM_TabBarTabHSpace, &opt, this); executed (the execution status of this line is deduced): int hframe = style()->pixelMetric(QStyle::PM_TabBarTabHSpace, &opt, this); | - |
| 1327 | int vframe = style()->pixelMetric(QStyle::PM_TabBarTabVSpace, &opt, this); executed (the execution status of this line is deduced): int vframe = style()->pixelMetric(QStyle::PM_TabBarTabVSpace, &opt, this); | - |
| 1328 | const QFontMetrics fm = fontMetrics(); executed (the execution status of this line is deduced): const QFontMetrics fm = fontMetrics(); | - |
| 1329 | | - |
| 1330 | int maxWidgetHeight = qMax(opt.leftButtonSize.height(), opt.rightButtonSize.height()); executed (the execution status of this line is deduced): int maxWidgetHeight = qMax(opt.leftButtonSize.height(), opt.rightButtonSize.height()); | - |
| 1331 | int maxWidgetWidth = qMax(opt.leftButtonSize.width(), opt.rightButtonSize.width()); executed (the execution status of this line is deduced): int maxWidgetWidth = qMax(opt.leftButtonSize.width(), opt.rightButtonSize.width()); | - |
| 1332 | | - |
| 1333 | int widgetWidth = 0; executed (the execution status of this line is deduced): int widgetWidth = 0; | - |
| 1334 | int widgetHeight = 0; executed (the execution status of this line is deduced): int widgetHeight = 0; | - |
| 1335 | int padding = 0; executed (the execution status of this line is deduced): int padding = 0; | - |
| 1336 | if (!opt.leftButtonSize.isEmpty()) { evaluated: !opt.leftButtonSize.isEmpty()| yes Evaluation Count:8 | yes Evaluation Count:574 |
| 8-574 |
| 1337 | padding += 4; executed (the execution status of this line is deduced): padding += 4; | - |
| 1338 | widgetWidth += opt.leftButtonSize.width(); executed (the execution status of this line is deduced): widgetWidth += opt.leftButtonSize.width(); | - |
| 1339 | widgetHeight += opt.leftButtonSize.height(); executed (the execution status of this line is deduced): widgetHeight += opt.leftButtonSize.height(); | - |
| 1340 | } executed: }Execution Count:8 | 8 |
| 1341 | if (!opt.rightButtonSize.isEmpty()) { evaluated: !opt.rightButtonSize.isEmpty()| yes Evaluation Count:28 | yes Evaluation Count:554 |
| 28-554 |
| 1342 | padding += 4; executed (the execution status of this line is deduced): padding += 4; | - |
| 1343 | widgetWidth += opt.rightButtonSize.width(); executed (the execution status of this line is deduced): widgetWidth += opt.rightButtonSize.width(); | - |
| 1344 | widgetHeight += opt.rightButtonSize.height(); executed (the execution status of this line is deduced): widgetHeight += opt.rightButtonSize.height(); | - |
| 1345 | } executed: }Execution Count:28 | 28 |
| 1346 | if (!opt.icon.isNull()) partially evaluated: !opt.icon.isNull()| no Evaluation Count:0 | yes Evaluation Count:582 |
| 0-582 |
| 1347 | padding += 4; never executed: padding += 4; | 0 |
| 1348 | | - |
| 1349 | QSize csz; executed (the execution status of this line is deduced): QSize csz; | - |
| 1350 | if (verticalTabs(d->shape)) { evaluated: verticalTabs(d->shape)| yes Evaluation Count:8 | yes Evaluation Count:574 |
| 8-574 |
| 1351 | csz = QSize( qMax(maxWidgetWidth, qMax(fm.height(), iconSize.height())) + vframe, executed (the execution status of this line is deduced): csz = QSize( qMax(maxWidgetWidth, qMax(fm.height(), iconSize.height())) + vframe, | - |
| 1352 | fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe + widgetHeight + padding); executed (the execution status of this line is deduced): fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe + widgetHeight + padding); | - |
| 1353 | } else { executed: }Execution Count:8 | 8 |
| 1354 | csz = QSize(fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe executed (the execution status of this line is deduced): csz = QSize(fm.size(Qt::TextShowMnemonic, tab->text).width() + iconSize.width() + hframe | - |
| 1355 | + widgetWidth + padding, executed (the execution status of this line is deduced): + widgetWidth + padding, | - |
| 1356 | qMax(maxWidgetHeight, qMax(fm.height(), iconSize.height())) + vframe); executed (the execution status of this line is deduced): qMax(maxWidgetHeight, qMax(fm.height(), iconSize.height())) + vframe); | - |
| 1357 | } executed: }Execution Count:574 | 574 |
| 1358 | | - |
| 1359 | QSize retSize = style()->sizeFromContents(QStyle::CT_TabBarTab, &opt, csz, this); executed (the execution status of this line is deduced): QSize retSize = style()->sizeFromContents(QStyle::CT_TabBarTab, &opt, csz, this); | - |
| 1360 | return retSize; executed: return retSize;Execution Count:582 | 582 |
| 1361 | } | - |
| 1362 | return QSize(); never executed: return QSize(); | 0 |
| 1363 | } | - |
| 1364 | | - |
| 1365 | /*! | - |
| 1366 | This virtual handler is called after a new tab was added or | - |
| 1367 | inserted at position \a index. | - |
| 1368 | | - |
| 1369 | \sa tabRemoved() | - |
| 1370 | */ | - |
| 1371 | void QTabBar::tabInserted(int index) | - |
| 1372 | { | - |
| 1373 | Q_UNUSED(index) executed (the execution status of this line is deduced): (void)index; | - |
| 1374 | } executed: }Execution Count:236 | 236 |
| 1375 | | - |
| 1376 | /*! | - |
| 1377 | This virtual handler is called after a tab was removed from | - |
| 1378 | position \a index. | - |
| 1379 | | - |
| 1380 | \sa tabInserted() | - |
| 1381 | */ | - |
| 1382 | void QTabBar::tabRemoved(int index) | - |
| 1383 | { | - |
| 1384 | Q_UNUSED(index) executed (the execution status of this line is deduced): (void)index; | - |
| 1385 | } executed: }Execution Count:67 | 67 |
| 1386 | | - |
| 1387 | /*! | - |
| 1388 | This virtual handler is called whenever the tab layout changes. | - |
| 1389 | | - |
| 1390 | \sa tabRect() | - |
| 1391 | */ | - |
| 1392 | void QTabBar::tabLayoutChange() | - |
| 1393 | { | - |
| 1394 | } | - |
| 1395 | | - |
| 1396 | | - |
| 1397 | /*!\reimp | - |
| 1398 | */ | - |
| 1399 | void QTabBar::showEvent(QShowEvent *) | - |
| 1400 | { | - |
| 1401 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1402 | if (d->layoutDirty) partially evaluated: d->layoutDirty| no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
| 1403 | d->refresh(); never executed: d->refresh(); | 0 |
| 1404 | if (!d->validIndex(d->currentIndex)) evaluated: !d->validIndex(d->currentIndex)| yes Evaluation Count:7 | yes Evaluation Count:16 |
| 7-16 |
| 1405 | setCurrentIndex(0); executed: setCurrentIndex(0);Execution Count:7 | 7 |
| 1406 | d->updateMacBorderMetrics(); executed (the execution status of this line is deduced): d->updateMacBorderMetrics(); | - |
| 1407 | } executed: }Execution Count:23 | 23 |
| 1408 | | - |
| 1409 | /*!\reimp | - |
| 1410 | */ | - |
| 1411 | void QTabBar::hideEvent(QHideEvent *) | - |
| 1412 | { | - |
| 1413 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1414 | d->updateMacBorderMetrics(); executed (the execution status of this line is deduced): d->updateMacBorderMetrics(); | - |
| 1415 | } executed: }Execution Count:16 | 16 |
| 1416 | | - |
| 1417 | /*!\reimp | - |
| 1418 | */ | - |
| 1419 | bool QTabBar::event(QEvent *event) | - |
| 1420 | { | - |
| 1421 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1422 | if (event->type() == QEvent::HoverMove partially evaluated: event->type() == QEvent::HoverMove| no Evaluation Count:0 | yes Evaluation Count:739 |
| 0-739 |
| 1423 | || event->type() == QEvent::HoverEnter) { partially evaluated: event->type() == QEvent::HoverEnter| no Evaluation Count:0 | yes Evaluation Count:739 |
| 0-739 |
| 1424 | QHoverEvent *he = static_cast<QHoverEvent *>(event); never executed (the execution status of this line is deduced): QHoverEvent *he = static_cast<QHoverEvent *>(event); | - |
| 1425 | if (!d->hoverRect.contains(he->pos())) { never evaluated: !d->hoverRect.contains(he->pos()) | 0 |
| 1426 | QRect oldHoverRect = d->hoverRect; never executed (the execution status of this line is deduced): QRect oldHoverRect = d->hoverRect; | - |
| 1427 | for (int i = 0; i < d->tabList.count(); ++i) { never evaluated: i < d->tabList.count() | 0 |
| 1428 | QRect area = tabRect(i); never executed (the execution status of this line is deduced): QRect area = tabRect(i); | - |
| 1429 | if (area.contains(he->pos())) { never evaluated: area.contains(he->pos()) | 0 |
| 1430 | d->hoverRect = area; never executed (the execution status of this line is deduced): d->hoverRect = area; | - |
| 1431 | break; | 0 |
| 1432 | } | - |
| 1433 | } | 0 |
| 1434 | if (he->oldPos() != QPoint(-1, -1)) never evaluated: he->oldPos() != QPoint(-1, -1) | 0 |
| 1435 | update(oldHoverRect); never executed: update(oldHoverRect); | 0 |
| 1436 | update(d->hoverRect); never executed (the execution status of this line is deduced): update(d->hoverRect); | - |
| 1437 | } | 0 |
| 1438 | return true; never executed: return true; | 0 |
| 1439 | } else if (event->type() == QEvent::HoverLeave ) { partially evaluated: event->type() == QEvent::HoverLeave| no Evaluation Count:0 | yes Evaluation Count:739 |
| 0-739 |
| 1440 | QRect oldHoverRect = d->hoverRect; never executed (the execution status of this line is deduced): QRect oldHoverRect = d->hoverRect; | - |
| 1441 | d->hoverRect = QRect(); never executed (the execution status of this line is deduced): d->hoverRect = QRect(); | - |
| 1442 | update(oldHoverRect); never executed (the execution status of this line is deduced): update(oldHoverRect); | - |
| 1443 | return true; never executed: return true; | 0 |
| 1444 | #ifndef QT_NO_TOOLTIP | - |
| 1445 | } else if (event->type() == QEvent::ToolTip) { partially evaluated: event->type() == QEvent::ToolTip| no Evaluation Count:0 | yes Evaluation Count:739 |
| 0-739 |
| 1446 | if (const QTabBarPrivate::Tab *tab = d->at(tabAt(static_cast<QHelpEvent*>(event)->pos()))) { never evaluated: const QTabBarPrivate::Tab *tab = d->at(tabAt(static_cast<QHelpEvent*>(event)->pos())) | 0 |
| 1447 | if (!tab->toolTip.isEmpty()) { never evaluated: !tab->toolTip.isEmpty() | 0 |
| 1448 | QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), tab->toolTip, this); never executed (the execution status of this line is deduced): QToolTip::showText(static_cast<QHelpEvent*>(event)->globalPos(), tab->toolTip, this); | - |
| 1449 | return true; never executed: return true; | 0 |
| 1450 | } | - |
| 1451 | } | 0 |
| 1452 | #endif // QT_NO_TOOLTIP | - |
| 1453 | #ifndef QT_NO_WHATSTHIS | - |
| 1454 | } else if (event->type() == QEvent::QueryWhatsThis) { never executed: } partially evaluated: event->type() == QEvent::QueryWhatsThis| no Evaluation Count:0 | yes Evaluation Count:739 |
| 0-739 |
| 1455 | const QTabBarPrivate::Tab *tab = d->at(d->indexAtPos(static_cast<QHelpEvent*>(event)->pos())); never executed (the execution status of this line is deduced): const QTabBarPrivate::Tab *tab = d->at(d->indexAtPos(static_cast<QHelpEvent*>(event)->pos())); | - |
| 1456 | if (!tab || tab->whatsThis.isEmpty()) never evaluated: !tab never evaluated: tab->whatsThis.isEmpty() | 0 |
| 1457 | event->ignore(); never executed: event->ignore(); | 0 |
| 1458 | return true; never executed: return true; | 0 |
| 1459 | } else if (event->type() == QEvent::WhatsThis) { partially evaluated: event->type() == QEvent::WhatsThis| no Evaluation Count:0 | yes Evaluation Count:739 |
| 0-739 |
| 1460 | if (const QTabBarPrivate::Tab *tab = d->at(d->indexAtPos(static_cast<QHelpEvent*>(event)->pos()))) { never evaluated: const QTabBarPrivate::Tab *tab = d->at(d->indexAtPos(static_cast<QHelpEvent*>(event)->pos())) | 0 |
| 1461 | if (!tab->whatsThis.isEmpty()) { never evaluated: !tab->whatsThis.isEmpty() | 0 |
| 1462 | QWhatsThis::showText(static_cast<QHelpEvent*>(event)->globalPos(), never executed (the execution status of this line is deduced): QWhatsThis::showText(static_cast<QHelpEvent*>(event)->globalPos(), | - |
| 1463 | tab->whatsThis, this); never executed (the execution status of this line is deduced): tab->whatsThis, this); | - |
| 1464 | return true; never executed: return true; | 0 |
| 1465 | } | - |
| 1466 | } | 0 |
| 1467 | #endif // QT_NO_WHATSTHIS | - |
| 1468 | #ifndef QT_NO_SHORTCUT | - |
| 1469 | } else if (event->type() == QEvent::Shortcut) { never executed: } partially evaluated: event->type() == QEvent::Shortcut| no Evaluation Count:0 | yes Evaluation Count:739 |
| 0-739 |
| 1470 | QShortcutEvent *se = static_cast<QShortcutEvent *>(event); never executed (the execution status of this line is deduced): QShortcutEvent *se = static_cast<QShortcutEvent *>(event); | - |
| 1471 | for (int i = 0; i < d->tabList.count(); ++i) { never evaluated: i < d->tabList.count() | 0 |
| 1472 | const QTabBarPrivate::Tab *tab = &d->tabList.at(i); never executed (the execution status of this line is deduced): const QTabBarPrivate::Tab *tab = &d->tabList.at(i); | - |
| 1473 | if (tab->shortcutId == se->shortcutId()) { never evaluated: tab->shortcutId == se->shortcutId() | 0 |
| 1474 | setCurrentIndex(i); never executed (the execution status of this line is deduced): setCurrentIndex(i); | - |
| 1475 | return true; never executed: return true; | 0 |
| 1476 | } | - |
| 1477 | } | 0 |
| 1478 | #endif | - |
| 1479 | } | 0 |
| 1480 | return QWidget::event(event); executed: return QWidget::event(event);Execution Count:739 | 739 |
| 1481 | } | - |
| 1482 | | - |
| 1483 | /*!\reimp | - |
| 1484 | */ | - |
| 1485 | void QTabBar::resizeEvent(QResizeEvent *) | - |
| 1486 | { | - |
| 1487 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1488 | if (d->layoutDirty) evaluated: d->layoutDirty| yes Evaluation Count:1 | yes Evaluation Count:36 |
| 1-36 |
| 1489 | updateGeometry(); executed: updateGeometry();Execution Count:1 | 1 |
| 1490 | d->layoutTabs(); executed (the execution status of this line is deduced): d->layoutTabs(); | - |
| 1491 | | - |
| 1492 | d->makeVisible(d->currentIndex); executed (the execution status of this line is deduced): d->makeVisible(d->currentIndex); | - |
| 1493 | } executed: }Execution Count:37 | 37 |
| 1494 | | - |
| 1495 | /*!\reimp | - |
| 1496 | */ | - |
| 1497 | void QTabBar::paintEvent(QPaintEvent *) | - |
| 1498 | { | - |
| 1499 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1500 | | - |
| 1501 | QStyleOptionTabBarBaseV2 optTabBase; executed (the execution status of this line is deduced): QStyleOptionTabBarBaseV2 optTabBase; | - |
| 1502 | QTabBarPrivate::initStyleBaseOption(&optTabBase, this, size()); executed (the execution status of this line is deduced): QTabBarPrivate::initStyleBaseOption(&optTabBase, this, size()); | - |
| 1503 | | - |
| 1504 | QStylePainter p(this); executed (the execution status of this line is deduced): QStylePainter p(this); | - |
| 1505 | int selected = -1; executed (the execution status of this line is deduced): int selected = -1; | - |
| 1506 | int cut = -1; executed (the execution status of this line is deduced): int cut = -1; | - |
| 1507 | bool rtl = optTabBase.direction == Qt::RightToLeft; executed (the execution status of this line is deduced): bool rtl = optTabBase.direction == Qt::RightToLeft; | - |
| 1508 | bool vertical = verticalTabs(d->shape); executed (the execution status of this line is deduced): bool vertical = verticalTabs(d->shape); | - |
| 1509 | QStyleOptionTab cutTab; executed (the execution status of this line is deduced): QStyleOptionTab cutTab; | - |
| 1510 | selected = d->currentIndex; executed (the execution status of this line is deduced): selected = d->currentIndex; | - |
| 1511 | if (d->dragInProgress) partially evaluated: d->dragInProgress| no Evaluation Count:0 | yes Evaluation Count:32 |
| 0-32 |
| 1512 | selected = d->pressedIndex; never executed: selected = d->pressedIndex; | 0 |
| 1513 | | - |
| 1514 | for (int i = 0; i < d->tabList.count(); ++i) evaluated: i < d->tabList.count()| yes Evaluation Count:51 | yes Evaluation Count:32 |
| 32-51 |
| 1515 | optTabBase.tabBarRect |= tabRect(i); executed: optTabBase.tabBarRect |= tabRect(i);Execution Count:51 | 51 |
| 1516 | | - |
| 1517 | optTabBase.selectedTabRect = tabRect(selected); executed (the execution status of this line is deduced): optTabBase.selectedTabRect = tabRect(selected); | - |
| 1518 | | - |
| 1519 | if (d->drawBase) evaluated: d->drawBase| yes Evaluation Count:4 | yes Evaluation Count:28 |
| 4-28 |
| 1520 | p.drawPrimitive(QStyle::PE_FrameTabBarBase, optTabBase); executed: p.drawPrimitive(QStyle::PE_FrameTabBarBase, optTabBase);Execution Count:4 | 4 |
| 1521 | | - |
| 1522 | for (int i = 0; i < d->tabList.count(); ++i) { evaluated: i < d->tabList.count()| yes Evaluation Count:51 | yes Evaluation Count:32 |
| 32-51 |
| 1523 | QStyleOptionTabV3 tab; executed (the execution status of this line is deduced): QStyleOptionTabV3 tab; | - |
| 1524 | initStyleOption(&tab, i); executed (the execution status of this line is deduced): initStyleOption(&tab, i); | - |
| 1525 | if (d->paintWithOffsets && d->tabList[i].dragOffset != 0) { partially evaluated: d->paintWithOffsets| yes Evaluation Count:51 | no Evaluation Count:0 |
partially evaluated: d->tabList[i].dragOffset != 0| no Evaluation Count:0 | yes Evaluation Count:51 |
| 0-51 |
| 1526 | if (vertical) { never evaluated: vertical | 0 |
| 1527 | tab.rect.moveTop(tab.rect.y() + d->tabList[i].dragOffset); never executed (the execution status of this line is deduced): tab.rect.moveTop(tab.rect.y() + d->tabList[i].dragOffset); | - |
| 1528 | } else { | 0 |
| 1529 | tab.rect.moveLeft(tab.rect.x() + d->tabList[i].dragOffset); never executed (the execution status of this line is deduced): tab.rect.moveLeft(tab.rect.x() + d->tabList[i].dragOffset); | - |
| 1530 | } | 0 |
| 1531 | } | - |
| 1532 | if (!(tab.state & QStyle::State_Enabled)) { partially evaluated: !(tab.state & QStyle::State_Enabled)| no Evaluation Count:0 | yes Evaluation Count:51 |
| 0-51 |
| 1533 | tab.palette.setCurrentColorGroup(QPalette::Disabled); never executed (the execution status of this line is deduced): tab.palette.setCurrentColorGroup(QPalette::Disabled); | - |
| 1534 | } | 0 |
| 1535 | // If this tab is partially obscured, make a note of it so that we can pass the information | - |
| 1536 | // along when we draw the tear. | - |
| 1537 | if (((!vertical && (!rtl && tab.rect.left() < 0)) || (rtl && tab.rect.right() > width())) evaluated: !vertical| yes Evaluation Count:47 | yes Evaluation Count:4 |
partially evaluated: !rtl| yes Evaluation Count:47 | no Evaluation Count:0 |
partially evaluated: tab.rect.left() < 0| no Evaluation Count:0 | yes Evaluation Count:47 |
partially evaluated: rtl| no Evaluation Count:0 | yes Evaluation Count:51 |
never evaluated: tab.rect.right() > width() | 0-51 |
| 1538 | || (vertical && tab.rect.top() < 0)) { evaluated: vertical| yes Evaluation Count:4 | yes Evaluation Count:47 |
partially evaluated: tab.rect.top() < 0| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-47 |
| 1539 | cut = i; never executed (the execution status of this line is deduced): cut = i; | - |
| 1540 | cutTab = tab; never executed (the execution status of this line is deduced): cutTab = tab; | - |
| 1541 | } | 0 |
| 1542 | // Don't bother drawing a tab if the entire tab is outside of the visible tab bar. | - |
| 1543 | if ((!vertical && (tab.rect.right() < 0 || tab.rect.left() > width())) evaluated: !vertical| yes Evaluation Count:47 | yes Evaluation Count:4 |
partially evaluated: tab.rect.right() < 0| no Evaluation Count:0 | yes Evaluation Count:47 |
partially evaluated: tab.rect.left() > width()| no Evaluation Count:0 | yes Evaluation Count:47 |
| 0-47 |
| 1544 | || (vertical && (tab.rect.bottom() < 0 || tab.rect.top() > height()))) evaluated: vertical| yes Evaluation Count:4 | yes Evaluation Count:47 |
partially evaluated: tab.rect.bottom() < 0| no Evaluation Count:0 | yes Evaluation Count:4 |
partially evaluated: tab.rect.top() > height()| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-47 |
| 1545 | continue; never executed: continue; | 0 |
| 1546 | | - |
| 1547 | optTabBase.tabBarRect |= tab.rect; executed (the execution status of this line is deduced): optTabBase.tabBarRect |= tab.rect; | - |
| 1548 | if (i == selected) evaluated: i == selected| yes Evaluation Count:32 | yes Evaluation Count:19 |
| 19-32 |
| 1549 | continue; executed: continue;Execution Count:32 | 32 |
| 1550 | | - |
| 1551 | p.drawControl(QStyle::CE_TabBarTab, tab); executed (the execution status of this line is deduced): p.drawControl(QStyle::CE_TabBarTab, tab); | - |
| 1552 | } executed: }Execution Count:19 | 19 |
| 1553 | | - |
| 1554 | // Draw the selected tab last to get it "on top" | - |
| 1555 | if (selected >= 0) { partially evaluated: selected >= 0| yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
| 1556 | QStyleOptionTabV3 tab; executed (the execution status of this line is deduced): QStyleOptionTabV3 tab; | - |
| 1557 | initStyleOption(&tab, selected); executed (the execution status of this line is deduced): initStyleOption(&tab, selected); | - |
| 1558 | if (d->paintWithOffsets && d->tabList[selected].dragOffset != 0) { partially evaluated: d->paintWithOffsets| yes Evaluation Count:32 | no Evaluation Count:0 |
partially evaluated: d->tabList[selected].dragOffset != 0| no Evaluation Count:0 | yes Evaluation Count:32 |
| 0-32 |
| 1559 | if (vertical) never evaluated: vertical | 0 |
| 1560 | tab.rect.moveTop(tab.rect.y() + d->tabList[selected].dragOffset); never executed: tab.rect.moveTop(tab.rect.y() + d->tabList[selected].dragOffset); | 0 |
| 1561 | else | - |
| 1562 | tab.rect.moveLeft(tab.rect.x() + d->tabList[selected].dragOffset); never executed: tab.rect.moveLeft(tab.rect.x() + d->tabList[selected].dragOffset); | 0 |
| 1563 | } | - |
| 1564 | if (!d->dragInProgress) partially evaluated: !d->dragInProgress| yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
| 1565 | p.drawControl(QStyle::CE_TabBarTab, tab); executed: p.drawControl(QStyle::CE_TabBarTab, tab);Execution Count:32 | 32 |
| 1566 | else { | - |
| 1567 | int taboverlap = style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0, this); never executed (the execution status of this line is deduced): int taboverlap = style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0, this); | - |
| 1568 | d->movingTab->setGeometry(tab.rect.adjusted(-taboverlap, 0, taboverlap, 0)); never executed (the execution status of this line is deduced): d->movingTab->setGeometry(tab.rect.adjusted(-taboverlap, 0, taboverlap, 0)); | - |
| 1569 | } | 0 |
| 1570 | } | - |
| 1571 | | - |
| 1572 | // Only draw the tear indicator if necessary. Most of the time we don't need too. | - |
| 1573 | if (d->leftB->isVisible() && cut >= 0) { partially evaluated: d->leftB->isVisible()| no Evaluation Count:0 | yes Evaluation Count:32 |
never evaluated: cut >= 0 | 0-32 |
| 1574 | cutTab.rect = rect(); never executed (the execution status of this line is deduced): cutTab.rect = rect(); | - |
| 1575 | cutTab.rect = style()->subElementRect(QStyle::SE_TabBarTearIndicator, &cutTab, this); never executed (the execution status of this line is deduced): cutTab.rect = style()->subElementRect(QStyle::SE_TabBarTearIndicator, &cutTab, this); | - |
| 1576 | p.drawPrimitive(QStyle::PE_IndicatorTabTear, cutTab); never executed (the execution status of this line is deduced): p.drawPrimitive(QStyle::PE_IndicatorTabTear, cutTab); | - |
| 1577 | } | 0 |
| 1578 | } executed: }Execution Count:32 | 32 |
| 1579 | | - |
| 1580 | /* | - |
| 1581 | Given that index at position from moved to position to where return where index goes. | - |
| 1582 | */ | - |
| 1583 | int QTabBarPrivate::calculateNewPosition(int from, int to, int index) const | - |
| 1584 | { | - |
| 1585 | if (index == from) evaluated: index == from| yes Evaluation Count:3 | yes Evaluation Count:36 |
| 3-36 |
| 1586 | return to; executed: return to;Execution Count:3 | 3 |
| 1587 | | - |
| 1588 | int start = qMin(from, to); executed (the execution status of this line is deduced): int start = qMin(from, to); | - |
| 1589 | int end = qMax(from, to); executed (the execution status of this line is deduced): int end = qMax(from, to); | - |
| 1590 | if (index >= start && index <= end) evaluated: index >= start| yes Evaluation Count:1 | yes Evaluation Count:35 |
partially evaluated: index <= end| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-35 |
| 1591 | index += (from < to) ? -1 : 1; executed: index += (from < to) ? -1 : 1;Execution Count:1 partially evaluated: (from < to)| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1592 | return index; executed: return index;Execution Count:36 | 36 |
| 1593 | } | - |
| 1594 | | - |
| 1595 | /*! | - |
| 1596 | Moves the item at index position \a from to index position \a to. | - |
| 1597 | \since 4.5 | - |
| 1598 | | - |
| 1599 | \sa tabMoved(), tabLayoutChange() | - |
| 1600 | */ | - |
| 1601 | void QTabBar::moveTab(int from, int to) | - |
| 1602 | { | - |
| 1603 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1604 | if (from == to evaluated: from == to| yes Evaluation Count:3 | yes Evaluation Count:8 |
| 3-8 |
| 1605 | || !d->validIndex(from) partially evaluated: !d->validIndex(from)| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1606 | || !d->validIndex(to)) partially evaluated: !d->validIndex(to)| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1607 | return; executed: return;Execution Count:3 | 3 |
| 1608 | | - |
| 1609 | bool vertical = verticalTabs(d->shape); executed (the execution status of this line is deduced): bool vertical = verticalTabs(d->shape); | - |
| 1610 | int oldPressedPosition = 0; executed (the execution status of this line is deduced): int oldPressedPosition = 0; | - |
| 1611 | if (d->pressedIndex != -1) { partially evaluated: d->pressedIndex != -1| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1612 | // Record the position of the pressed tab before reordering the tabs. | - |
| 1613 | oldPressedPosition = vertical ? d->tabList[d->pressedIndex].rect.y() never evaluated: vertical | 0 |
| 1614 | : d->tabList[d->pressedIndex].rect.x(); never executed (the execution status of this line is deduced): : d->tabList[d->pressedIndex].rect.x(); | - |
| 1615 | } | 0 |
| 1616 | | - |
| 1617 | // Update the locations of the tabs first | - |
| 1618 | int start = qMin(from, to); executed (the execution status of this line is deduced): int start = qMin(from, to); | - |
| 1619 | int end = qMax(from, to); executed (the execution status of this line is deduced): int end = qMax(from, to); | - |
| 1620 | int width = vertical ? d->tabList[from].rect.height() : d->tabList[from].rect.width(); partially evaluated: vertical| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1621 | if (from < to) evaluated: from < to| yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-6 |
| 1622 | width *= -1; executed: width *= -1;Execution Count:6 | 6 |
| 1623 | bool rtl = isRightToLeft(); executed (the execution status of this line is deduced): bool rtl = isRightToLeft(); | - |
| 1624 | for (int i = start; i <= end; ++i) { evaluated: i <= end| yes Evaluation Count:23 | yes Evaluation Count:8 |
| 8-23 |
| 1625 | if (i == from) evaluated: i == from| yes Evaluation Count:8 | yes Evaluation Count:15 |
| 8-15 |
| 1626 | continue; executed: continue;Execution Count:8 | 8 |
| 1627 | if (vertical) partially evaluated: vertical| no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
| 1628 | d->tabList[i].rect.moveTop(d->tabList[i].rect.y() + width); never executed: d->tabList[i].rect.moveTop(d->tabList[i].rect.y() + width); | 0 |
| 1629 | else | - |
| 1630 | d->tabList[i].rect.moveLeft(d->tabList[i].rect.x() + width); executed: d->tabList[i].rect.moveLeft(d->tabList[i].rect.x() + width);Execution Count:15 | 15 |
| 1631 | int direction = -1; executed (the execution status of this line is deduced): int direction = -1; | - |
| 1632 | if (rtl && !vertical) partially evaluated: rtl| no Evaluation Count:0 | yes Evaluation Count:15 |
never evaluated: !vertical | 0-15 |
| 1633 | direction *= -1; never executed: direction *= -1; | 0 |
| 1634 | if (d->tabList[i].dragOffset != 0) partially evaluated: d->tabList[i].dragOffset != 0| no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
| 1635 | d->tabList[i].dragOffset += (direction * width); never executed: d->tabList[i].dragOffset += (direction * width); | 0 |
| 1636 | } executed: }Execution Count:15 | 15 |
| 1637 | | - |
| 1638 | if (vertical) { partially evaluated: vertical| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1639 | if (from < to) never evaluated: from < to | 0 |
| 1640 | d->tabList[from].rect.moveTop(d->tabList[to].rect.bottom() + 1); never executed: d->tabList[from].rect.moveTop(d->tabList[to].rect.bottom() + 1); | 0 |
| 1641 | else | - |
| 1642 | d->tabList[from].rect.moveTop(d->tabList[to].rect.top() - width); never executed: d->tabList[from].rect.moveTop(d->tabList[to].rect.top() - width); | 0 |
| 1643 | } else { | - |
| 1644 | if (from < to) evaluated: from < to| yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-6 |
| 1645 | d->tabList[from].rect.moveLeft(d->tabList[to].rect.right() + 1); executed: d->tabList[from].rect.moveLeft(d->tabList[to].rect.right() + 1);Execution Count:6 | 6 |
| 1646 | else | - |
| 1647 | d->tabList[from].rect.moveLeft(d->tabList[to].rect.left() - width); executed: d->tabList[from].rect.moveLeft(d->tabList[to].rect.left() - width);Execution Count:2 | 2 |
| 1648 | } | - |
| 1649 | | - |
| 1650 | // Move the actual data structures | - |
| 1651 | d->tabList.move(from, to); executed (the execution status of this line is deduced): d->tabList.move(from, to); | - |
| 1652 | | - |
| 1653 | // update lastTab locations | - |
| 1654 | for (int i = 0; i < d->tabList.count(); ++i) evaluated: i < d->tabList.count()| yes Evaluation Count:31 | yes Evaluation Count:8 |
| 8-31 |
| 1655 | d->tabList[i].lastTab = d->calculateNewPosition(from, to, d->tabList[i].lastTab); executed: d->tabList[i].lastTab = d->calculateNewPosition(from, to, d->tabList[i].lastTab);Execution Count:31 | 31 |
| 1656 | | - |
| 1657 | // update external variables | - |
| 1658 | d->currentIndex = d->calculateNewPosition(from, to, d->currentIndex); executed (the execution status of this line is deduced): d->currentIndex = d->calculateNewPosition(from, to, d->currentIndex); | - |
| 1659 | | - |
| 1660 | // If we are in the middle of a drag update the dragStartPosition | - |
| 1661 | if (d->pressedIndex != -1) { partially evaluated: d->pressedIndex != -1| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1662 | d->pressedIndex = d->calculateNewPosition(from, to, d->pressedIndex); never executed (the execution status of this line is deduced): d->pressedIndex = d->calculateNewPosition(from, to, d->pressedIndex); | - |
| 1663 | int newPressedPosition = vertical ? d->tabList[d->pressedIndex].rect.top() : d->tabList[d->pressedIndex].rect.left(); never evaluated: vertical | 0 |
| 1664 | int diff = oldPressedPosition - newPressedPosition; never executed (the execution status of this line is deduced): int diff = oldPressedPosition - newPressedPosition; | - |
| 1665 | if (isRightToLeft() && !vertical) never evaluated: isRightToLeft() never evaluated: !vertical | 0 |
| 1666 | diff *= -1; never executed: diff *= -1; | 0 |
| 1667 | if (vertical) never evaluated: vertical | 0 |
| 1668 | d->dragStartPosition.setY(d->dragStartPosition.y() - diff); never executed: d->dragStartPosition.setY(d->dragStartPosition.y() - diff); | 0 |
| 1669 | else | - |
| 1670 | d->dragStartPosition.setX(d->dragStartPosition.x() - diff); never executed: d->dragStartPosition.setX(d->dragStartPosition.x() - diff); | 0 |
| 1671 | } | - |
| 1672 | | - |
| 1673 | d->layoutWidgets(start); executed (the execution status of this line is deduced): d->layoutWidgets(start); | - |
| 1674 | update(); executed (the execution status of this line is deduced): update(); | - |
| 1675 | emit tabMoved(from, to); executed (the execution status of this line is deduced): tabMoved(from, to); | - |
| 1676 | emit tabLayoutChange(); executed (the execution status of this line is deduced): tabLayoutChange(); | - |
| 1677 | } executed: }Execution Count:8 | 8 |
| 1678 | | - |
| 1679 | void QTabBarPrivate::slide(int from, int to) | - |
| 1680 | { | - |
| 1681 | Q_Q(QTabBar); never executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 1682 | if (from == to never evaluated: from == to | 0 |
| 1683 | || !validIndex(from) never evaluated: !validIndex(from) | 0 |
| 1684 | || !validIndex(to)) never evaluated: !validIndex(to) | 0 |
| 1685 | return; | 0 |
| 1686 | bool vertical = verticalTabs(shape); never executed (the execution status of this line is deduced): bool vertical = verticalTabs(shape); | - |
| 1687 | int preLocation = vertical ? q->tabRect(from).y() : q->tabRect(from).x(); never evaluated: vertical | 0 |
| 1688 | q->setUpdatesEnabled(false); never executed (the execution status of this line is deduced): q->setUpdatesEnabled(false); | - |
| 1689 | q->moveTab(from, to); never executed (the execution status of this line is deduced): q->moveTab(from, to); | - |
| 1690 | q->setUpdatesEnabled(true); never executed (the execution status of this line is deduced): q->setUpdatesEnabled(true); | - |
| 1691 | int postLocation = vertical ? q->tabRect(to).y() : q->tabRect(to).x(); never evaluated: vertical | 0 |
| 1692 | int length = postLocation - preLocation; never executed (the execution status of this line is deduced): int length = postLocation - preLocation; | - |
| 1693 | tabList[to].dragOffset -= length; never executed (the execution status of this line is deduced): tabList[to].dragOffset -= length; | - |
| 1694 | tabList[to].startAnimation(this, ANIMATION_DURATION); never executed (the execution status of this line is deduced): tabList[to].startAnimation(this, 250); | - |
| 1695 | } | 0 |
| 1696 | | - |
| 1697 | void QTabBarPrivate::moveTab(int index, int offset) | - |
| 1698 | { | - |
| 1699 | if (!validIndex(index)) never evaluated: !validIndex(index) | 0 |
| 1700 | return; | 0 |
| 1701 | tabList[index].dragOffset = offset; never executed (the execution status of this line is deduced): tabList[index].dragOffset = offset; | - |
| 1702 | layoutTab(index); // Make buttons follow tab never executed (the execution status of this line is deduced): layoutTab(index); | - |
| 1703 | q_func()->update(); never executed (the execution status of this line is deduced): q_func()->update(); | - |
| 1704 | } | 0 |
| 1705 | | - |
| 1706 | /*!\reimp | - |
| 1707 | */ | - |
| 1708 | void QTabBar::mousePressEvent(QMouseEvent *event) | - |
| 1709 | { | - |
| 1710 | Q_D(QTabBar); never executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1711 | if (event->button() != Qt::LeftButton) { never evaluated: event->button() != Qt::LeftButton | 0 |
| 1712 | event->ignore(); never executed (the execution status of this line is deduced): event->ignore(); | - |
| 1713 | return; | 0 |
| 1714 | } | - |
| 1715 | // Be safe! | - |
| 1716 | if (d->pressedIndex != -1 && d->movable) never evaluated: d->pressedIndex != -1 never evaluated: d->movable | 0 |
| 1717 | d->moveTabFinished(d->pressedIndex); never executed: d->moveTabFinished(d->pressedIndex); | 0 |
| 1718 | | - |
| 1719 | d->pressedIndex = d->indexAtPos(event->pos()); never executed (the execution status of this line is deduced): d->pressedIndex = d->indexAtPos(event->pos()); | - |
| 1720 | #ifdef Q_WS_MAC | - |
| 1721 | d->previousPressedIndex = d->pressedIndex; | - |
| 1722 | #endif | - |
| 1723 | if (d->validIndex(d->pressedIndex)) { never evaluated: d->validIndex(d->pressedIndex) | 0 |
| 1724 | QStyleOptionTabBarBaseV2 optTabBase; never executed (the execution status of this line is deduced): QStyleOptionTabBarBaseV2 optTabBase; | - |
| 1725 | optTabBase.init(this); never executed (the execution status of this line is deduced): optTabBase.init(this); | - |
| 1726 | optTabBase.documentMode = d->documentMode; never executed (the execution status of this line is deduced): optTabBase.documentMode = d->documentMode; | - |
| 1727 | if (event->type() == style()->styleHint(QStyle::SH_TabBar_SelectMouseType, &optTabBase, this)) never evaluated: event->type() == style()->styleHint(QStyle::SH_TabBar_SelectMouseType, &optTabBase, this) | 0 |
| 1728 | setCurrentIndex(d->pressedIndex); never executed: setCurrentIndex(d->pressedIndex); | 0 |
| 1729 | else | - |
| 1730 | repaint(tabRect(d->pressedIndex)); never executed: repaint(tabRect(d->pressedIndex)); | 0 |
| 1731 | if (d->movable) { never evaluated: d->movable | 0 |
| 1732 | d->dragStartPosition = event->pos(); never executed (the execution status of this line is deduced): d->dragStartPosition = event->pos(); | - |
| 1733 | } | 0 |
| 1734 | } | 0 |
| 1735 | } | 0 |
| 1736 | | - |
| 1737 | /*!\reimp | - |
| 1738 | */ | - |
| 1739 | void QTabBar::mouseMoveEvent(QMouseEvent *event) | - |
| 1740 | { | - |
| 1741 | Q_D(QTabBar); never executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1742 | if (d->movable) { never evaluated: d->movable | 0 |
| 1743 | // Be safe! | - |
| 1744 | if (d->pressedIndex != -1 never evaluated: d->pressedIndex != -1 | 0 |
| 1745 | && event->buttons() == Qt::NoButton) never evaluated: event->buttons() == Qt::NoButton | 0 |
| 1746 | d->moveTabFinished(d->pressedIndex); never executed: d->moveTabFinished(d->pressedIndex); | 0 |
| 1747 | | - |
| 1748 | // Start drag | - |
| 1749 | if (!d->dragInProgress && d->pressedIndex != -1) { never evaluated: !d->dragInProgress never evaluated: d->pressedIndex != -1 | 0 |
| 1750 | if ((event->pos() - d->dragStartPosition).manhattanLength() > QApplication::startDragDistance()) { never evaluated: (event->pos() - d->dragStartPosition).manhattanLength() > QApplication::startDragDistance() | 0 |
| 1751 | d->dragInProgress = true; never executed (the execution status of this line is deduced): d->dragInProgress = true; | - |
| 1752 | d->setupMovableTab(); never executed (the execution status of this line is deduced): d->setupMovableTab(); | - |
| 1753 | } | 0 |
| 1754 | } | 0 |
| 1755 | | - |
| 1756 | int offset = (event->pos() - d->dragStartPosition).manhattanLength(); never executed (the execution status of this line is deduced): int offset = (event->pos() - d->dragStartPosition).manhattanLength(); | - |
| 1757 | if (event->buttons() == Qt::LeftButton never evaluated: event->buttons() == Qt::LeftButton | 0 |
| 1758 | && offset > QApplication::startDragDistance() never evaluated: offset > QApplication::startDragDistance() | 0 |
| 1759 | && d->validIndex(d->pressedIndex)) { never evaluated: d->validIndex(d->pressedIndex) | 0 |
| 1760 | bool vertical = verticalTabs(d->shape); never executed (the execution status of this line is deduced): bool vertical = verticalTabs(d->shape); | - |
| 1761 | int dragDistance; never executed (the execution status of this line is deduced): int dragDistance; | - |
| 1762 | if (vertical) { never evaluated: vertical | 0 |
| 1763 | dragDistance = (event->pos().y() - d->dragStartPosition.y()); never executed (the execution status of this line is deduced): dragDistance = (event->pos().y() - d->dragStartPosition.y()); | - |
| 1764 | } else { | 0 |
| 1765 | dragDistance = (event->pos().x() - d->dragStartPosition.x()); never executed (the execution status of this line is deduced): dragDistance = (event->pos().x() - d->dragStartPosition.x()); | - |
| 1766 | } | 0 |
| 1767 | d->tabList[d->pressedIndex].dragOffset = dragDistance; never executed (the execution status of this line is deduced): d->tabList[d->pressedIndex].dragOffset = dragDistance; | - |
| 1768 | | - |
| 1769 | QRect startingRect = tabRect(d->pressedIndex); never executed (the execution status of this line is deduced): QRect startingRect = tabRect(d->pressedIndex); | - |
| 1770 | if (vertical) never evaluated: vertical | 0 |
| 1771 | startingRect.moveTop(startingRect.y() + dragDistance); never executed: startingRect.moveTop(startingRect.y() + dragDistance); | 0 |
| 1772 | else | - |
| 1773 | startingRect.moveLeft(startingRect.x() + dragDistance); never executed: startingRect.moveLeft(startingRect.x() + dragDistance); | 0 |
| 1774 | | - |
| 1775 | int overIndex; never executed (the execution status of this line is deduced): int overIndex; | - |
| 1776 | if (dragDistance < 0) never evaluated: dragDistance < 0 | 0 |
| 1777 | overIndex = tabAt(startingRect.topLeft()); never executed: overIndex = tabAt(startingRect.topLeft()); | 0 |
| 1778 | else | - |
| 1779 | overIndex = tabAt(startingRect.topRight()); never executed: overIndex = tabAt(startingRect.topRight()); | 0 |
| 1780 | | - |
| 1781 | if (overIndex != d->pressedIndex && overIndex != -1) { never evaluated: overIndex != d->pressedIndex never evaluated: overIndex != -1 | 0 |
| 1782 | int offset = 1; never executed (the execution status of this line is deduced): int offset = 1; | - |
| 1783 | if (isRightToLeft() && !vertical) never evaluated: isRightToLeft() never evaluated: !vertical | 0 |
| 1784 | offset *= -1; never executed: offset *= -1; | 0 |
| 1785 | if (dragDistance < 0) { never evaluated: dragDistance < 0 | 0 |
| 1786 | dragDistance *= -1; never executed (the execution status of this line is deduced): dragDistance *= -1; | - |
| 1787 | offset *= -1; never executed (the execution status of this line is deduced): offset *= -1; | - |
| 1788 | } | 0 |
| 1789 | for (int i = d->pressedIndex; never executed (the execution status of this line is deduced): for (int i = d->pressedIndex; | - |
| 1790 | offset > 0 ? i < overIndex : i > overIndex; never evaluated: offset > 0 | 0 |
| 1791 | i += offset) { never executed (the execution status of this line is deduced): i += offset) { | - |
| 1792 | QRect overIndexRect = tabRect(overIndex); never executed (the execution status of this line is deduced): QRect overIndexRect = tabRect(overIndex); | - |
| 1793 | int needsToBeOver = (vertical ? overIndexRect.height() : overIndexRect.width()) / 2; never evaluated: vertical | 0 |
| 1794 | if (dragDistance > needsToBeOver) never evaluated: dragDistance > needsToBeOver | 0 |
| 1795 | d->slide(i + offset, d->pressedIndex); never executed: d->slide(i + offset, d->pressedIndex); | 0 |
| 1796 | } | 0 |
| 1797 | } | 0 |
| 1798 | // Buttons needs to follow the dragged tab | - |
| 1799 | d->layoutTab(d->pressedIndex); never executed (the execution status of this line is deduced): d->layoutTab(d->pressedIndex); | - |
| 1800 | | - |
| 1801 | update(); never executed (the execution status of this line is deduced): update(); | - |
| 1802 | } | 0 |
| 1803 | #ifdef Q_WS_MAC | - |
| 1804 | } else if (!d->documentMode && event->buttons() == Qt::LeftButton && d->previousPressedIndex != -1) { | - |
| 1805 | int newPressedIndex = d->indexAtPos(event->pos()); | - |
| 1806 | if (d->pressedIndex == -1 && d->previousPressedIndex == newPressedIndex) { | - |
| 1807 | d->pressedIndex = d->previousPressedIndex; | - |
| 1808 | update(tabRect(d->pressedIndex)); | - |
| 1809 | } else if(d->pressedIndex != newPressedIndex) { | - |
| 1810 | d->pressedIndex = -1; | - |
| 1811 | update(tabRect(d->previousPressedIndex)); | - |
| 1812 | } | - |
| 1813 | #endif | - |
| 1814 | } | 0 |
| 1815 | | - |
| 1816 | if (event->buttons() != Qt::LeftButton) { never evaluated: event->buttons() != Qt::LeftButton | 0 |
| 1817 | event->ignore(); never executed (the execution status of this line is deduced): event->ignore(); | - |
| 1818 | return; | 0 |
| 1819 | } | - |
| 1820 | QStyleOptionTabBarBaseV2 optTabBase; never executed (the execution status of this line is deduced): QStyleOptionTabBarBaseV2 optTabBase; | - |
| 1821 | optTabBase.init(this); never executed (the execution status of this line is deduced): optTabBase.init(this); | - |
| 1822 | optTabBase.documentMode = d->documentMode; never executed (the execution status of this line is deduced): optTabBase.documentMode = d->documentMode; | - |
| 1823 | } | 0 |
| 1824 | | - |
| 1825 | void QTabBarPrivate::setupMovableTab() | - |
| 1826 | { | - |
| 1827 | Q_Q(QTabBar); never executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 1828 | if (!movingTab) never evaluated: !movingTab | 0 |
| 1829 | movingTab = new QWidget(q); never executed: movingTab = new QWidget(q); | 0 |
| 1830 | | - |
| 1831 | int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ,q); never executed (the execution status of this line is deduced): int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ,q); | - |
| 1832 | QRect grabRect = q->tabRect(pressedIndex); never executed (the execution status of this line is deduced): QRect grabRect = q->tabRect(pressedIndex); | - |
| 1833 | grabRect.adjust(-taboverlap, 0, taboverlap, 0); never executed (the execution status of this line is deduced): grabRect.adjust(-taboverlap, 0, taboverlap, 0); | - |
| 1834 | | - |
| 1835 | QPixmap grabImage(grabRect.size()); never executed (the execution status of this line is deduced): QPixmap grabImage(grabRect.size()); | - |
| 1836 | grabImage.fill(Qt::transparent); never executed (the execution status of this line is deduced): grabImage.fill(Qt::transparent); | - |
| 1837 | QStylePainter p(&grabImage, q); never executed (the execution status of this line is deduced): QStylePainter p(&grabImage, q); | - |
| 1838 | p.initFrom(q); never executed (the execution status of this line is deduced): p.initFrom(q); | - |
| 1839 | | - |
| 1840 | QStyleOptionTabV3 tab; never executed (the execution status of this line is deduced): QStyleOptionTabV3 tab; | - |
| 1841 | q->initStyleOption(&tab, pressedIndex); never executed (the execution status of this line is deduced): q->initStyleOption(&tab, pressedIndex); | - |
| 1842 | tab.rect.moveTopLeft(QPoint(taboverlap, 0)); never executed (the execution status of this line is deduced): tab.rect.moveTopLeft(QPoint(taboverlap, 0)); | - |
| 1843 | p.drawControl(QStyle::CE_TabBarTab, tab); never executed (the execution status of this line is deduced): p.drawControl(QStyle::CE_TabBarTab, tab); | - |
| 1844 | p.end(); never executed (the execution status of this line is deduced): p.end(); | - |
| 1845 | | - |
| 1846 | QPalette pal; never executed (the execution status of this line is deduced): QPalette pal; | - |
| 1847 | pal.setBrush(QPalette::All, QPalette::Window, grabImage); never executed (the execution status of this line is deduced): pal.setBrush(QPalette::All, QPalette::Window, grabImage); | - |
| 1848 | movingTab->setPalette(pal); never executed (the execution status of this line is deduced): movingTab->setPalette(pal); | - |
| 1849 | movingTab->setGeometry(grabRect); never executed (the execution status of this line is deduced): movingTab->setGeometry(grabRect); | - |
| 1850 | movingTab->setAutoFillBackground(true); never executed (the execution status of this line is deduced): movingTab->setAutoFillBackground(true); | - |
| 1851 | movingTab->raise(); never executed (the execution status of this line is deduced): movingTab->raise(); | - |
| 1852 | | - |
| 1853 | // Re-arrange widget order to avoid overlaps | - |
| 1854 | if (tabList[pressedIndex].leftWidget) never evaluated: tabList[pressedIndex].leftWidget | 0 |
| 1855 | tabList[pressedIndex].leftWidget->raise(); never executed: tabList[pressedIndex].leftWidget->raise(); | 0 |
| 1856 | if (tabList[pressedIndex].rightWidget) never evaluated: tabList[pressedIndex].rightWidget | 0 |
| 1857 | tabList[pressedIndex].rightWidget->raise(); never executed: tabList[pressedIndex].rightWidget->raise(); | 0 |
| 1858 | if (leftB) | 0 |
| 1859 | leftB->raise(); never executed: leftB->raise(); | 0 |
| 1860 | if (rightB) | 0 |
| 1861 | rightB->raise(); never executed: rightB->raise(); | 0 |
| 1862 | movingTab->setVisible(true); never executed (the execution status of this line is deduced): movingTab->setVisible(true); | - |
| 1863 | } | 0 |
| 1864 | | - |
| 1865 | void QTabBarPrivate::moveTabFinished(int index) | - |
| 1866 | { | - |
| 1867 | Q_Q(QTabBar); never executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 1868 | bool cleanup = (pressedIndex == index) || (pressedIndex == -1) || !validIndex(index); never evaluated: (pressedIndex == index) never evaluated: (pressedIndex == -1) never evaluated: !validIndex(index) | 0 |
| 1869 | bool allAnimationsFinished = true; never executed (the execution status of this line is deduced): bool allAnimationsFinished = true; | - |
| 1870 | #ifndef QT_NO_ANIMATION | - |
| 1871 | for(int i = 0; allAnimationsFinished && i < tabList.count(); ++i) { never evaluated: allAnimationsFinished never evaluated: i < tabList.count() | 0 |
| 1872 | const Tab &t = tabList.at(i); never executed (the execution status of this line is deduced): const Tab &t = tabList.at(i); | - |
| 1873 | if (t.animation && t.animation->state() == QAbstractAnimation::Running) never evaluated: t.animation never evaluated: t.animation->state() == QAbstractAnimation::Running | 0 |
| 1874 | allAnimationsFinished = false; never executed: allAnimationsFinished = false; | 0 |
| 1875 | } | 0 |
| 1876 | #endif //QT_NO_ANIMATION | - |
| 1877 | if (allAnimationsFinished && cleanup) { never evaluated: allAnimationsFinished never evaluated: cleanup | 0 |
| 1878 | if(movingTab) never evaluated: movingTab | 0 |
| 1879 | movingTab->setVisible(false); // We might not get a mouse release never executed: movingTab->setVisible(false); | 0 |
| 1880 | for (int i = 0; i < tabList.count(); ++i) { never evaluated: i < tabList.count() | 0 |
| 1881 | tabList[i].dragOffset = 0; never executed (the execution status of this line is deduced): tabList[i].dragOffset = 0; | - |
| 1882 | } | 0 |
| 1883 | if (pressedIndex != -1 && movable) { never evaluated: pressedIndex != -1 never evaluated: movable | 0 |
| 1884 | pressedIndex = -1; never executed (the execution status of this line is deduced): pressedIndex = -1; | - |
| 1885 | dragInProgress = false; never executed (the execution status of this line is deduced): dragInProgress = false; | - |
| 1886 | dragStartPosition = QPoint(); never executed (the execution status of this line is deduced): dragStartPosition = QPoint(); | - |
| 1887 | } | 0 |
| 1888 | layoutWidgets(); never executed (the execution status of this line is deduced): layoutWidgets(); | - |
| 1889 | } else { | 0 |
| 1890 | if (!validIndex(index)) never evaluated: !validIndex(index) | 0 |
| 1891 | return; | 0 |
| 1892 | tabList[index].dragOffset = 0; never executed (the execution status of this line is deduced): tabList[index].dragOffset = 0; | - |
| 1893 | } | 0 |
| 1894 | q->update(); never executed (the execution status of this line is deduced): q->update(); | - |
| 1895 | } | 0 |
| 1896 | | - |
| 1897 | /*!\reimp | - |
| 1898 | */ | - |
| 1899 | void QTabBar::mouseReleaseEvent(QMouseEvent *event) | - |
| 1900 | { | - |
| 1901 | Q_D(QTabBar); never executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1902 | if (event->button() != Qt::LeftButton) { never evaluated: event->button() != Qt::LeftButton | 0 |
| 1903 | event->ignore(); never executed (the execution status of this line is deduced): event->ignore(); | - |
| 1904 | return; | 0 |
| 1905 | } | - |
| 1906 | #ifdef Q_WS_MAC | - |
| 1907 | d->previousPressedIndex = -1; | - |
| 1908 | #endif | - |
| 1909 | if (d->movable && d->dragInProgress && d->validIndex(d->pressedIndex)) { never evaluated: d->movable never evaluated: d->dragInProgress never evaluated: d->validIndex(d->pressedIndex) | 0 |
| 1910 | int length = d->tabList[d->pressedIndex].dragOffset; never executed (the execution status of this line is deduced): int length = d->tabList[d->pressedIndex].dragOffset; | - |
| 1911 | int width = verticalTabs(d->shape) never evaluated: verticalTabs(d->shape) | 0 |
| 1912 | ? tabRect(d->pressedIndex).height() never executed (the execution status of this line is deduced): ? tabRect(d->pressedIndex).height() | - |
| 1913 | : tabRect(d->pressedIndex).width(); never executed (the execution status of this line is deduced): : tabRect(d->pressedIndex).width(); | - |
| 1914 | int duration = qMin(ANIMATION_DURATION, never executed (the execution status of this line is deduced): int duration = qMin(250, | - |
| 1915 | (qAbs(length) * ANIMATION_DURATION) / width); never executed (the execution status of this line is deduced): (qAbs(length) * 250) / width); | - |
| 1916 | d->tabList[d->pressedIndex].startAnimation(d, duration); never executed (the execution status of this line is deduced): d->tabList[d->pressedIndex].startAnimation(d, duration); | - |
| 1917 | d->dragInProgress = false; never executed (the execution status of this line is deduced): d->dragInProgress = false; | - |
| 1918 | d->movingTab->setVisible(false); never executed (the execution status of this line is deduced): d->movingTab->setVisible(false); | - |
| 1919 | d->dragStartPosition = QPoint(); never executed (the execution status of this line is deduced): d->dragStartPosition = QPoint(); | - |
| 1920 | } | 0 |
| 1921 | | - |
| 1922 | int i = d->indexAtPos(event->pos()) == d->pressedIndex ? d->pressedIndex : -1; never evaluated: d->indexAtPos(event->pos()) == d->pressedIndex | 0 |
| 1923 | d->pressedIndex = -1; never executed (the execution status of this line is deduced): d->pressedIndex = -1; | - |
| 1924 | QStyleOptionTabBarBaseV2 optTabBase; never executed (the execution status of this line is deduced): QStyleOptionTabBarBaseV2 optTabBase; | - |
| 1925 | optTabBase.initFrom(this); never executed (the execution status of this line is deduced): optTabBase.initFrom(this); | - |
| 1926 | optTabBase.documentMode = d->documentMode; never executed (the execution status of this line is deduced): optTabBase.documentMode = d->documentMode; | - |
| 1927 | if (style()->styleHint(QStyle::SH_TabBar_SelectMouseType, &optTabBase, this) == QEvent::MouseButtonRelease) never evaluated: style()->styleHint(QStyle::SH_TabBar_SelectMouseType, &optTabBase, this) == QEvent::MouseButtonRelease | 0 |
| 1928 | setCurrentIndex(i); never executed: setCurrentIndex(i); | 0 |
| 1929 | } | 0 |
| 1930 | | - |
| 1931 | /*!\reimp | - |
| 1932 | */ | - |
| 1933 | void QTabBar::keyPressEvent(QKeyEvent *event) | - |
| 1934 | { | - |
| 1935 | Q_D(QTabBar); never executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1936 | if (event->key() != Qt::Key_Left && event->key() != Qt::Key_Right) { never evaluated: event->key() != Qt::Key_Left never evaluated: event->key() != Qt::Key_Right | 0 |
| 1937 | event->ignore(); never executed (the execution status of this line is deduced): event->ignore(); | - |
| 1938 | return; | 0 |
| 1939 | } | - |
| 1940 | int offset = event->key() == (isRightToLeft() ? Qt::Key_Right : Qt::Key_Left) ? -1 : 1; never evaluated: event->key() == (isRightToLeft() ? Qt::Key_Right : Qt::Key_Left) never evaluated: isRightToLeft() | 0 |
| 1941 | d->setCurrentNextEnabledIndex(offset); never executed (the execution status of this line is deduced): d->setCurrentNextEnabledIndex(offset); | - |
| 1942 | } | 0 |
| 1943 | | - |
| 1944 | /*!\reimp | - |
| 1945 | */ | - |
| 1946 | #ifndef QT_NO_WHEELEVENT | - |
| 1947 | void QTabBar::wheelEvent(QWheelEvent *event) | - |
| 1948 | { | - |
| 1949 | Q_D(QTabBar); never executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1950 | int offset = event->delta() > 0 ? -1 : 1; never evaluated: event->delta() > 0 | 0 |
| 1951 | d->setCurrentNextEnabledIndex(offset); never executed (the execution status of this line is deduced): d->setCurrentNextEnabledIndex(offset); | - |
| 1952 | QWidget::wheelEvent(event); never executed (the execution status of this line is deduced): QWidget::wheelEvent(event); | - |
| 1953 | } | 0 |
| 1954 | #endif //QT_NO_WHEELEVENT | - |
| 1955 | | - |
| 1956 | void QTabBarPrivate::setCurrentNextEnabledIndex(int offset) | - |
| 1957 | { | - |
| 1958 | Q_Q(QTabBar); never executed (the execution status of this line is deduced): QTabBar * const q = q_func(); | - |
| 1959 | for (int index = currentIndex + offset; validIndex(index); index += offset) { never evaluated: validIndex(index) | 0 |
| 1960 | if (tabList.at(index).enabled) { never evaluated: tabList.at(index).enabled | 0 |
| 1961 | q->setCurrentIndex(index); never executed (the execution status of this line is deduced): q->setCurrentIndex(index); | - |
| 1962 | break; | 0 |
| 1963 | } | - |
| 1964 | } | 0 |
| 1965 | } | 0 |
| 1966 | | - |
| 1967 | /*!\reimp | - |
| 1968 | */ | - |
| 1969 | void QTabBar::changeEvent(QEvent *event) | - |
| 1970 | { | - |
| 1971 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 1972 | if (event->type() == QEvent::StyleChange) { evaluated: event->type() == QEvent::StyleChange| yes Evaluation Count:11 | yes Evaluation Count:5 |
| 5-11 |
| 1973 | if (!d->elideModeSetByUser) evaluated: !d->elideModeSetByUser| yes Evaluation Count:6 | yes Evaluation Count:5 |
| 5-6 |
| 1974 | d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); executed: d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this));Execution Count:6 | 6 |
| 1975 | if (!d->useScrollButtonsSetByUser) evaluated: !d->useScrollButtonsSetByUser| yes Evaluation Count:8 | yes Evaluation Count:3 |
| 3-8 |
| 1976 | d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); executed: d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this);Execution Count:8 | 8 |
| 1977 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
| 1978 | } else if (event->type() == QEvent::FontChange) { executed: }Execution Count:11 evaluated: event->type() == QEvent::FontChange| yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-11 |
| 1979 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
| 1980 | } executed: }Execution Count:1 | 1 |
| 1981 | QWidget::changeEvent(event); executed (the execution status of this line is deduced): QWidget::changeEvent(event); | - |
| 1982 | } executed: }Execution Count:16 | 16 |
| 1983 | | - |
| 1984 | /*! | - |
| 1985 | \property QTabBar::elideMode | - |
| 1986 | \brief how to elide text in the tab bar | - |
| 1987 | \since 4.2 | - |
| 1988 | | - |
| 1989 | This property controls how items are elided when there is not | - |
| 1990 | enough space to show them for a given tab bar size. | - |
| 1991 | | - |
| 1992 | By default the value is style dependent. | - |
| 1993 | | - |
| 1994 | \sa QTabWidget::elideMode, usesScrollButtons, QStyle::SH_TabBar_ElideMode | - |
| 1995 | */ | - |
| 1996 | | - |
| 1997 | Qt::TextElideMode QTabBar::elideMode() const | - |
| 1998 | { | - |
| 1999 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 2000 | return d->elideMode; executed: return d->elideMode;Execution Count:12 | 12 |
| 2001 | } | - |
| 2002 | | - |
| 2003 | void QTabBar::setElideMode(Qt::TextElideMode mode) | - |
| 2004 | { | - |
| 2005 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 2006 | d->elideMode = mode; executed (the execution status of this line is deduced): d->elideMode = mode; | - |
| 2007 | d->elideModeSetByUser = true; executed (the execution status of this line is deduced): d->elideModeSetByUser = true; | - |
| 2008 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
| 2009 | } executed: }Execution Count:12 | 12 |
| 2010 | | - |
| 2011 | /*! | - |
| 2012 | \property QTabBar::usesScrollButtons | - |
| 2013 | \brief Whether or not a tab bar should use buttons to scroll tabs when it | - |
| 2014 | has many tabs. | - |
| 2015 | \since 4.2 | - |
| 2016 | | - |
| 2017 | When there are too many tabs in a tab bar for its size, the tab bar can either choose | - |
| 2018 | to expand its size or to add buttons that allow you to scroll through the tabs. | - |
| 2019 | | - |
| 2020 | By default the value is style dependant. | - |
| 2021 | | - |
| 2022 | \sa elideMode, QTabWidget::usesScrollButtons, QStyle::SH_TabBar_PreferNoArrows | - |
| 2023 | */ | - |
| 2024 | bool QTabBar::usesScrollButtons() const | - |
| 2025 | { | - |
| 2026 | return d_func()->useScrollButtons; executed: return d_func()->useScrollButtons;Execution Count:73 | 73 |
| 2027 | } | - |
| 2028 | | - |
| 2029 | void QTabBar::setUsesScrollButtons(bool useButtons) | - |
| 2030 | { | - |
| 2031 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 2032 | d->useScrollButtonsSetByUser = true; executed (the execution status of this line is deduced): d->useScrollButtonsSetByUser = true; | - |
| 2033 | if (d->useScrollButtons == useButtons) evaluated: d->useScrollButtons == useButtons| yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
| 2034 | return; executed: return;Execution Count:2 | 2 |
| 2035 | d->useScrollButtons = useButtons; executed (the execution status of this line is deduced): d->useScrollButtons = useButtons; | - |
| 2036 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
| 2037 | } executed: }Execution Count:4 | 4 |
| 2038 | | - |
| 2039 | /*! | - |
| 2040 | \property QTabBar::tabsClosable | - |
| 2041 | \brief Whether or not a tab bar should place close buttons on each tab | - |
| 2042 | \since 4.5 | - |
| 2043 | | - |
| 2044 | When tabsClosable is set to true a close button will appear on the tab on | - |
| 2045 | either the left or right hand side depending upon the style. When the button | - |
| 2046 | is clicked the tab the signal tabCloseRequested will be emitted. | - |
| 2047 | | - |
| 2048 | By default the value is false. | - |
| 2049 | | - |
| 2050 | \sa setTabButton(), tabRemoved() | - |
| 2051 | */ | - |
| 2052 | | - |
| 2053 | bool QTabBar::tabsClosable() const | - |
| 2054 | { | - |
| 2055 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 2056 | return d->closeButtonOnTabs; executed: return d->closeButtonOnTabs;Execution Count:41 | 41 |
| 2057 | } | - |
| 2058 | | - |
| 2059 | void QTabBar::setTabsClosable(bool closable) | - |
| 2060 | { | - |
| 2061 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 2062 | if (d->closeButtonOnTabs == closable) partially evaluated: d->closeButtonOnTabs == closable| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2063 | return; | 0 |
| 2064 | d->closeButtonOnTabs = closable; executed (the execution status of this line is deduced): d->closeButtonOnTabs = closable; | - |
| 2065 | ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); executed (the execution status of this line is deduced): ButtonPosition closeSide = (ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, this); | - |
| 2066 | if (!closable) { partially evaluated: !closable| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2067 | for (int i = 0; i < d->tabList.count(); ++i) { never evaluated: i < d->tabList.count() | 0 |
| 2068 | if (closeSide == LeftSide && d->tabList[i].leftWidget) { never evaluated: closeSide == LeftSide never evaluated: d->tabList[i].leftWidget | 0 |
| 2069 | d->tabList[i].leftWidget->deleteLater(); never executed (the execution status of this line is deduced): d->tabList[i].leftWidget->deleteLater(); | - |
| 2070 | d->tabList[i].leftWidget = 0; never executed (the execution status of this line is deduced): d->tabList[i].leftWidget = 0; | - |
| 2071 | } | 0 |
| 2072 | if (closeSide == RightSide && d->tabList[i].rightWidget) { never evaluated: closeSide == RightSide never evaluated: d->tabList[i].rightWidget | 0 |
| 2073 | d->tabList[i].rightWidget->deleteLater(); never executed (the execution status of this line is deduced): d->tabList[i].rightWidget->deleteLater(); | - |
| 2074 | d->tabList[i].rightWidget = 0; never executed (the execution status of this line is deduced): d->tabList[i].rightWidget = 0; | - |
| 2075 | } | 0 |
| 2076 | } | 0 |
| 2077 | } else { | 0 |
| 2078 | bool newButtons = false; executed (the execution status of this line is deduced): bool newButtons = false; | - |
| 2079 | for (int i = 0; i < d->tabList.count(); ++i) { partially evaluated: i < d->tabList.count()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2080 | if (tabButton(i, closeSide)) never evaluated: tabButton(i, closeSide) | 0 |
| 2081 | continue; never executed: continue; | 0 |
| 2082 | newButtons = true; never executed (the execution status of this line is deduced): newButtons = true; | - |
| 2083 | QAbstractButton *closeButton = new CloseButton(this); never executed (the execution status of this line is deduced): QAbstractButton *closeButton = new CloseButton(this); | - |
| 2084 | connect(closeButton, SIGNAL(clicked()), this, SLOT(_q_closeTab())); never executed (the execution status of this line is deduced): connect(closeButton, "2""clicked()", this, "1""_q_closeTab()"); | - |
| 2085 | setTabButton(i, closeSide, closeButton); never executed (the execution status of this line is deduced): setTabButton(i, closeSide, closeButton); | - |
| 2086 | } | 0 |
| 2087 | if (newButtons) partially evaluated: newButtons| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2088 | d->layoutTabs(); never executed: d->layoutTabs(); | 0 |
| 2089 | } executed: }Execution Count:1 | 1 |
| 2090 | update(); executed (the execution status of this line is deduced): update(); | - |
| 2091 | } executed: }Execution Count:1 | 1 |
| 2092 | | - |
| 2093 | /*! | - |
| 2094 | \enum QTabBar::ButtonPosition | - |
| 2095 | \since 4.5 | - |
| 2096 | | - |
| 2097 | This enum type lists the location of the widget on a tab. | - |
| 2098 | | - |
| 2099 | \value LeftSide Left side of the tab. | - |
| 2100 | | - |
| 2101 | \value RightSide Right side of the tab. | - |
| 2102 | | - |
| 2103 | */ | - |
| 2104 | | - |
| 2105 | /*! | - |
| 2106 | \enum QTabBar::SelectionBehavior | - |
| 2107 | \since 4.5 | - |
| 2108 | | - |
| 2109 | This enum type lists the behavior of QTabBar when a tab is removed | - |
| 2110 | and the tab being removed is also the current tab. | - |
| 2111 | | - |
| 2112 | \value SelectLeftTab Select the tab to the left of the one being removed. | - |
| 2113 | | - |
| 2114 | \value SelectRightTab Select the tab to the right of the one being removed. | - |
| 2115 | | - |
| 2116 | \value SelectPreviousTab Select the previously selected tab. | - |
| 2117 | | - |
| 2118 | */ | - |
| 2119 | | - |
| 2120 | /*! | - |
| 2121 | \property QTabBar::selectionBehaviorOnRemove | - |
| 2122 | \brief What tab should be set as current when removeTab is called if | - |
| 2123 | the removed tab is also the current tab. | - |
| 2124 | \since 4.5 | - |
| 2125 | | - |
| 2126 | By default the value is SelectRightTab. | - |
| 2127 | | - |
| 2128 | \sa removeTab() | - |
| 2129 | */ | - |
| 2130 | | - |
| 2131 | | - |
| 2132 | QTabBar::SelectionBehavior QTabBar::selectionBehaviorOnRemove() const | - |
| 2133 | { | - |
| 2134 | Q_D(const QTabBar); never executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 2135 | return d->selectionBehaviorOnRemove; never executed: return d->selectionBehaviorOnRemove; | 0 |
| 2136 | } | - |
| 2137 | | - |
| 2138 | void QTabBar::setSelectionBehaviorOnRemove(QTabBar::SelectionBehavior behavior) | - |
| 2139 | { | - |
| 2140 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 2141 | d->selectionBehaviorOnRemove = behavior; executed (the execution status of this line is deduced): d->selectionBehaviorOnRemove = behavior; | - |
| 2142 | } executed: }Execution Count:29 | 29 |
| 2143 | | - |
| 2144 | /*! | - |
| 2145 | \property QTabBar::expanding | - |
| 2146 | \brief When expanding is true QTabBar will expand the tabs to use the empty space. | - |
| 2147 | \since 4.5 | - |
| 2148 | | - |
| 2149 | By default the value is true. | - |
| 2150 | | - |
| 2151 | \sa QTabWidget::documentMode | - |
| 2152 | */ | - |
| 2153 | | - |
| 2154 | bool QTabBar::expanding() const | - |
| 2155 | { | - |
| 2156 | Q_D(const QTabBar); never executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 2157 | return d->expanding; never executed: return d->expanding; | 0 |
| 2158 | } | - |
| 2159 | | - |
| 2160 | void QTabBar::setExpanding(bool enabled) | - |
| 2161 | { | - |
| 2162 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 2163 | if (d->expanding == enabled) evaluated: d->expanding == enabled| yes Evaluation Count:39 | yes Evaluation Count:5 |
| 5-39 |
| 2164 | return; executed: return;Execution Count:39 | 39 |
| 2165 | d->expanding = enabled; executed (the execution status of this line is deduced): d->expanding = enabled; | - |
| 2166 | d->layoutTabs(); executed (the execution status of this line is deduced): d->layoutTabs(); | - |
| 2167 | } executed: }Execution Count:5 | 5 |
| 2168 | | - |
| 2169 | /*! | - |
| 2170 | \property QTabBar::movable | - |
| 2171 | \brief This property holds whether the user can move the tabs | - |
| 2172 | within the tabbar area. | - |
| 2173 | | - |
| 2174 | \since 4.5 | - |
| 2175 | | - |
| 2176 | By default, this property is false; | - |
| 2177 | */ | - |
| 2178 | | - |
| 2179 | bool QTabBar::isMovable() const | - |
| 2180 | { | - |
| 2181 | Q_D(const QTabBar); never executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 2182 | return d->movable; never executed: return d->movable; | 0 |
| 2183 | } | - |
| 2184 | | - |
| 2185 | void QTabBar::setMovable(bool movable) | - |
| 2186 | { | - |
| 2187 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 2188 | d->movable = movable; executed (the execution status of this line is deduced): d->movable = movable; | - |
| 2189 | } executed: }Execution Count:1 | 1 |
| 2190 | | - |
| 2191 | | - |
| 2192 | /*! | - |
| 2193 | \property QTabBar::documentMode | - |
| 2194 | \brief Whether or not the tab bar is rendered in a mode suitable for the main window. | - |
| 2195 | \since 4.5 | - |
| 2196 | | - |
| 2197 | This property is used as a hint for styles to draw the tabs in a different | - |
| 2198 | way then they would normally look in a tab widget. On Mac OS X this will | - |
| 2199 | look similar to the tabs in Safari or Leopard's Terminal.app. | - |
| 2200 | | - |
| 2201 | \sa QTabWidget::documentMode | - |
| 2202 | */ | - |
| 2203 | bool QTabBar::documentMode() const | - |
| 2204 | { | - |
| 2205 | return d_func()->documentMode; executed: return d_func()->documentMode;Execution Count:785 | 785 |
| 2206 | } | - |
| 2207 | | - |
| 2208 | void QTabBar::setDocumentMode(bool enabled) | - |
| 2209 | { | - |
| 2210 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 2211 | | - |
| 2212 | d->documentMode = enabled; executed (the execution status of this line is deduced): d->documentMode = enabled; | - |
| 2213 | d->updateMacBorderMetrics(); executed (the execution status of this line is deduced): d->updateMacBorderMetrics(); | - |
| 2214 | } executed: }Execution Count:5 | 5 |
| 2215 | | - |
| 2216 | /*! | - |
| 2217 | Sets \a widget on the tab \a index. The widget is placed | - |
| 2218 | on the left or right hand side depending upon the \a position. | - |
| 2219 | \since 4.5 | - |
| 2220 | | - |
| 2221 | Any previously set widget in \a position is hidden. | - |
| 2222 | | - |
| 2223 | The tab bar will take ownership of the widget and so all widgets set here | - |
| 2224 | will be deleted by the tab bar when it is destroyed unless you separately | - |
| 2225 | reparent the widget after setting some other widget (or 0). | - |
| 2226 | | - |
| 2227 | \sa tabsClosable() | - |
| 2228 | */ | - |
| 2229 | void QTabBar::setTabButton(int index, ButtonPosition position, QWidget *widget) | - |
| 2230 | { | - |
| 2231 | Q_D(QTabBar); executed (the execution status of this line is deduced): QTabBarPrivate * const d = d_func(); | - |
| 2232 | if (index < 0 || index >= d->tabList.count()) evaluated: index < 0| yes Evaluation Count:2 | yes Evaluation Count:9 |
partially evaluated: index >= d->tabList.count()| no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
| 2233 | return; executed: return;Execution Count:2 | 2 |
| 2234 | if (widget) { evaluated: widget| yes Evaluation Count:7 | yes Evaluation Count:2 |
| 2-7 |
| 2235 | widget->setParent(this); executed (the execution status of this line is deduced): widget->setParent(this); | - |
| 2236 | // make sure our left and right widgets stay on top | - |
| 2237 | widget->lower(); executed (the execution status of this line is deduced): widget->lower(); | - |
| 2238 | widget->show(); executed (the execution status of this line is deduced): widget->show(); | - |
| 2239 | } executed: }Execution Count:7 | 7 |
| 2240 | if (position == LeftSide) { evaluated: position == LeftSide| yes Evaluation Count:3 | yes Evaluation Count:6 |
| 3-6 |
| 2241 | if (d->tabList[index].leftWidget) evaluated: d->tabList[index].leftWidget| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 2242 | d->tabList[index].leftWidget->hide(); executed: d->tabList[index].leftWidget->hide();Execution Count:1 | 1 |
| 2243 | d->tabList[index].leftWidget = widget; executed (the execution status of this line is deduced): d->tabList[index].leftWidget = widget; | - |
| 2244 | } else { executed: }Execution Count:3 | 3 |
| 2245 | if (d->tabList[index].rightWidget) evaluated: d->tabList[index].rightWidget| yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
| 2246 | d->tabList[index].rightWidget->hide(); executed: d->tabList[index].rightWidget->hide();Execution Count:1 | 1 |
| 2247 | d->tabList[index].rightWidget = widget; executed (the execution status of this line is deduced): d->tabList[index].rightWidget = widget; | - |
| 2248 | } executed: }Execution Count:6 | 6 |
| 2249 | d->layoutTabs(); executed (the execution status of this line is deduced): d->layoutTabs(); | - |
| 2250 | d->refresh(); executed (the execution status of this line is deduced): d->refresh(); | - |
| 2251 | update(); executed (the execution status of this line is deduced): update(); | - |
| 2252 | } executed: }Execution Count:9 | 9 |
| 2253 | | - |
| 2254 | /*! | - |
| 2255 | Returns the widget set a tab \a index and \a position or 0 if | - |
| 2256 | one is not set. | - |
| 2257 | */ | - |
| 2258 | QWidget *QTabBar::tabButton(int index, ButtonPosition position) const | - |
| 2259 | { | - |
| 2260 | Q_D(const QTabBar); executed (the execution status of this line is deduced): const QTabBarPrivate * const d = d_func(); | - |
| 2261 | if (index < 0 || index >= d->tabList.count()) evaluated: index < 0| yes Evaluation Count:2 | yes Evaluation Count:11 |
evaluated: index >= d->tabList.count()| yes Evaluation Count:2 | yes Evaluation Count:9 |
| 2-11 |
| 2262 | return 0; executed: return 0;Execution Count:4 | 4 |
| 2263 | if (position == LeftSide) evaluated: position == LeftSide| yes Evaluation Count:4 | yes Evaluation Count:5 |
| 4-5 |
| 2264 | return d->tabList.at(index).leftWidget; executed: return d->tabList.at(index).leftWidget;Execution Count:4 | 4 |
| 2265 | else | - |
| 2266 | return d->tabList.at(index).rightWidget; executed: return d->tabList.at(index).rightWidget;Execution Count:5 | 5 |
| 2267 | } | - |
| 2268 | | - |
| 2269 | CloseButton::CloseButton(QWidget *parent) | - |
| 2270 | : QAbstractButton(parent) | - |
| 2271 | { | - |
| 2272 | setFocusPolicy(Qt::NoFocus); executed (the execution status of this line is deduced): setFocusPolicy(Qt::NoFocus); | - |
| 2273 | #ifndef QT_NO_CURSOR | - |
| 2274 | setCursor(Qt::ArrowCursor); executed (the execution status of this line is deduced): setCursor(Qt::ArrowCursor); | - |
| 2275 | #endif | - |
| 2276 | #ifndef QT_NO_TOOLTIP | - |
| 2277 | setToolTip(tr("Close Tab")); executed (the execution status of this line is deduced): setToolTip(tr("Close Tab")); | - |
| 2278 | #endif | - |
| 2279 | resize(sizeHint()); executed (the execution status of this line is deduced): resize(sizeHint()); | - |
| 2280 | } executed: }Execution Count:1 | 1 |
| 2281 | | - |
| 2282 | QSize CloseButton::sizeHint() const | - |
| 2283 | { | - |
| 2284 | ensurePolished(); executed (the execution status of this line is deduced): ensurePolished(); | - |
| 2285 | int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, this); executed (the execution status of this line is deduced): int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, this); | - |
| 2286 | int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, this); executed (the execution status of this line is deduced): int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, this); | - |
| 2287 | return QSize(width, height); executed: return QSize(width, height);Execution Count:1 | 1 |
| 2288 | } | - |
| 2289 | | - |
| 2290 | void CloseButton::enterEvent(QEvent *event) | - |
| 2291 | { | - |
| 2292 | if (isEnabled()) never evaluated: isEnabled() | 0 |
| 2293 | update(); never executed: update(); | 0 |
| 2294 | QAbstractButton::enterEvent(event); never executed (the execution status of this line is deduced): QAbstractButton::enterEvent(event); | - |
| 2295 | } | 0 |
| 2296 | | - |
| 2297 | void CloseButton::leaveEvent(QEvent *event) | - |
| 2298 | { | - |
| 2299 | if (isEnabled()) never evaluated: isEnabled() | 0 |
| 2300 | update(); never executed: update(); | 0 |
| 2301 | QAbstractButton::leaveEvent(event); never executed (the execution status of this line is deduced): QAbstractButton::leaveEvent(event); | - |
| 2302 | } | 0 |
| 2303 | | - |
| 2304 | void CloseButton::paintEvent(QPaintEvent *) | - |
| 2305 | { | - |
| 2306 | QPainter p(this); never executed (the execution status of this line is deduced): QPainter p(this); | - |
| 2307 | QStyleOption opt; never executed (the execution status of this line is deduced): QStyleOption opt; | - |
| 2308 | opt.init(this); never executed (the execution status of this line is deduced): opt.init(this); | - |
| 2309 | opt.state |= QStyle::State_AutoRaise; never executed (the execution status of this line is deduced): opt.state |= QStyle::State_AutoRaise; | - |
| 2310 | if (isEnabled() && underMouse() && !isChecked() && !isDown()) never evaluated: isEnabled() never evaluated: underMouse() never evaluated: !isChecked() never evaluated: !isDown() | 0 |
| 2311 | opt.state |= QStyle::State_Raised; never executed: opt.state |= QStyle::State_Raised; | 0 |
| 2312 | if (isChecked()) never evaluated: isChecked() | 0 |
| 2313 | opt.state |= QStyle::State_On; never executed: opt.state |= QStyle::State_On; | 0 |
| 2314 | if (isDown()) never evaluated: isDown() | 0 |
| 2315 | opt.state |= QStyle::State_Sunken; never executed: opt.state |= QStyle::State_Sunken; | 0 |
| 2316 | | - |
| 2317 | if (const QTabBar *tb = qobject_cast<const QTabBar *>(parent())) { never evaluated: const QTabBar *tb = qobject_cast<const QTabBar *>(parent()) | 0 |
| 2318 | int index = tb->currentIndex(); never executed (the execution status of this line is deduced): int index = tb->currentIndex(); | - |
| 2319 | QTabBar::ButtonPosition position = (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tb); never executed (the execution status of this line is deduced): QTabBar::ButtonPosition position = (QTabBar::ButtonPosition)style()->styleHint(QStyle::SH_TabBar_CloseButtonPosition, 0, tb); | - |
| 2320 | if (tb->tabButton(index, position) == this) never evaluated: tb->tabButton(index, position) == this | 0 |
| 2321 | opt.state |= QStyle::State_Selected; never executed: opt.state |= QStyle::State_Selected; | 0 |
| 2322 | } | 0 |
| 2323 | | - |
| 2324 | style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &p, this); never executed (the execution status of this line is deduced): style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &p, this); | - |
| 2325 | } | 0 |
| 2326 | | - |
| 2327 | QT_END_NAMESPACE | - |
| 2328 | | - |
| 2329 | #include "moc_qtabbar.cpp" | - |
| 2330 | | - |
| 2331 | #endif // QT_NO_TABBAR | - |
| 2332 | | - |
| | |