| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qtabwidget.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | class QTabWidgetPrivate : public QWidgetPrivate | - | ||||||||||||
| 6 | { | - | ||||||||||||
| 7 | inline QTabWidget* q_func() { return static_cast<QTabWidget *>(q_ptr); } inline const QTabWidget* q_func() const { return static_cast<const QTabWidget *>(q_ptr); } friend class QTabWidget; | - | ||||||||||||
| 8 | - | |||||||||||||
| 9 | public: | - | ||||||||||||
| 10 | QTabWidgetPrivate(); | - | ||||||||||||
| 11 | ~QTabWidgetPrivate(); | - | ||||||||||||
| 12 | void updateTabBarPosition(); | - | ||||||||||||
| 13 | void _q_showTab(int); | - | ||||||||||||
| 14 | void _q_removeTab(int); | - | ||||||||||||
| 15 | void _q_tabMoved(int from, int to); | - | ||||||||||||
| 16 | void init(); | - | ||||||||||||
| 17 | - | |||||||||||||
| 18 | QTabBar *tabs; | - | ||||||||||||
| 19 | QStackedWidget *stack; | - | ||||||||||||
| 20 | QRect panelRect; | - | ||||||||||||
| 21 | bool dirty; | - | ||||||||||||
| 22 | QTabWidget::TabPosition pos; | - | ||||||||||||
| 23 | QTabWidget::TabShape shape; | - | ||||||||||||
| 24 | int alignment; | - | ||||||||||||
| 25 | QWidget *leftCornerWidget; | - | ||||||||||||
| 26 | QWidget *rightCornerWidget; | - | ||||||||||||
| 27 | }; | - | ||||||||||||
| 28 | - | |||||||||||||
| 29 | QTabWidgetPrivate::QTabWidgetPrivate() | - | ||||||||||||
| 30 | : tabs(0), stack(0), dirty(true), | - | ||||||||||||
| 31 | pos(QTabWidget::North), shape(QTabWidget::Rounded), | - | ||||||||||||
| 32 | leftCornerWidget(0), rightCornerWidget(0) | - | ||||||||||||
| 33 | {} never executed: end of block | 0 | ||||||||||||
| 34 | - | |||||||||||||
| 35 | QTabWidgetPrivate::~QTabWidgetPrivate() | - | ||||||||||||
| 36 | {} | - | ||||||||||||
| 37 | - | |||||||||||||
| 38 | void QTabWidgetPrivate::init() | - | ||||||||||||
| 39 | { | - | ||||||||||||
| 40 | QTabWidget * const q = q_func(); | - | ||||||||||||
| 41 | - | |||||||||||||
| 42 | stack = new QStackedWidget(q); | - | ||||||||||||
| 43 | stack->setObjectName(QLatin1String("qt_tabwidget_stackedwidget")); | - | ||||||||||||
| 44 | stack->setLineWidth(0); | - | ||||||||||||
| 45 | - | |||||||||||||
| 46 | stack->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::TabWidget)); | - | ||||||||||||
| 47 | - | |||||||||||||
| 48 | QObject::connect(stack, qFlagLocation("2""widgetRemoved(int)" "\0" __FILE__ ":" "236"), q, qFlagLocation("1""_q_removeTab(int)" "\0" __FILE__ ":" "236")); | - | ||||||||||||
| 49 | QTabBar *tabBar = new QTabBar(q); | - | ||||||||||||
| 50 | tabBar->setObjectName(QLatin1String("qt_tabwidget_tabbar")); | - | ||||||||||||
| 51 | tabBar->setDrawBase(false); | - | ||||||||||||
| 52 | q->setTabBar(tabBar); | - | ||||||||||||
| 53 | - | |||||||||||||
| 54 | q->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding, | - | ||||||||||||
| 55 | QSizePolicy::TabWidget)); | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | - | |||||||||||||
| 58 | - | |||||||||||||
| 59 | - | |||||||||||||
| 60 | - | |||||||||||||
| 61 | q->setFocusPolicy(Qt::TabFocus); | - | ||||||||||||
| 62 | q->setFocusProxy(tabs); | - | ||||||||||||
| 63 | q->setTabPosition(static_cast<QTabWidget::TabPosition> (q->style()->styleHint( | - | ||||||||||||
| 64 | QStyle::SH_TabWidget_DefaultTabPosition, 0, q ))); | - | ||||||||||||
| 65 | - | |||||||||||||
| 66 | } never executed: end of block | 0 | ||||||||||||
| 67 | - | |||||||||||||
| 68 | - | |||||||||||||
| 69 | - | |||||||||||||
| 70 | - | |||||||||||||
| 71 | - | |||||||||||||
| 72 | bool QTabWidget::hasHeightForWidth() const | - | ||||||||||||
| 73 | { | - | ||||||||||||
| 74 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 75 | bool has = d->size_policy.hasHeightForWidth(); | - | ||||||||||||
| 76 | if (!has
| 0 | ||||||||||||
| 77 | has = d->stack->hasHeightForWidth(); never executed: has = d->stack->hasHeightForWidth(); | 0 | ||||||||||||
| 78 | return never executed: has;return has;never executed: return has; | 0 | ||||||||||||
| 79 | } | - | ||||||||||||
| 80 | void QTabWidget::initStyleOption(QStyleOptionTabWidgetFrame *option) const | - | ||||||||||||
| 81 | { | - | ||||||||||||
| 82 | if (!option
| 0 | ||||||||||||
| 83 | return; never executed: return; | 0 | ||||||||||||
| 84 | - | |||||||||||||
| 85 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 86 | option->initFrom(this); | - | ||||||||||||
| 87 | - | |||||||||||||
| 88 | if (documentMode()
| 0 | ||||||||||||
| 89 | option->lineWidth = 0; never executed: option->lineWidth = 0; | 0 | ||||||||||||
| 90 | else | - | ||||||||||||
| 91 | option->lineWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this); never executed: option->lineWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, this); | 0 | ||||||||||||
| 92 | - | |||||||||||||
| 93 | int exth = style()->pixelMetric(QStyle::PM_TabBarBaseHeight, 0, this); | - | ||||||||||||
| 94 | QSize t(0, d->stack->frameWidth()); | - | ||||||||||||
| 95 | if (d->tabs->isVisibleTo(const_cast<QTabWidget *>(this))
| 0 | ||||||||||||
| 96 | t = d->tabs->sizeHint(); | - | ||||||||||||
| 97 | if (documentMode()
| 0 | ||||||||||||
| 98 | if (tabPosition() == East
| 0 | ||||||||||||
| 99 | t.setHeight(height()); | - | ||||||||||||
| 100 | } never executed: else {end of block | 0 | ||||||||||||
| 101 | t.setWidth(width()); | - | ||||||||||||
| 102 | } never executed: end of block | 0 | ||||||||||||
| 103 | } | - | ||||||||||||
| 104 | } never executed: end of block | 0 | ||||||||||||
| 105 | - | |||||||||||||
| 106 | if (d->rightCornerWidget
| 0 | ||||||||||||
| 107 | const QSize rightCornerSizeHint = d->rightCornerWidget->sizeHint(); | - | ||||||||||||
| 108 | const QSize bounds(rightCornerSizeHint.width(), t.height() - exth); | - | ||||||||||||
| 109 | option->rightCornerWidgetSize = rightCornerSizeHint.boundedTo(bounds); | - | ||||||||||||
| 110 | } never executed: else {end of block | 0 | ||||||||||||
| 111 | option->rightCornerWidgetSize = QSize(0, 0); | - | ||||||||||||
| 112 | } never executed: end of block | 0 | ||||||||||||
| 113 | - | |||||||||||||
| 114 | if (d->leftCornerWidget
| 0 | ||||||||||||
| 115 | const QSize leftCornerSizeHint = d->leftCornerWidget->sizeHint(); | - | ||||||||||||
| 116 | const QSize bounds(leftCornerSizeHint.width(), t.height() - exth); | - | ||||||||||||
| 117 | option->leftCornerWidgetSize = leftCornerSizeHint.boundedTo(bounds); | - | ||||||||||||
| 118 | } never executed: else {end of block | 0 | ||||||||||||
| 119 | option->leftCornerWidgetSize = QSize(0, 0); | - | ||||||||||||
| 120 | } never executed: end of block | 0 | ||||||||||||
| 121 | - | |||||||||||||
| 122 | switch (d->pos) { | - | ||||||||||||
| 123 | case never executed: QTabWidget::North:case QTabWidget::North:never executed: case QTabWidget::North: | 0 | ||||||||||||
| 124 | option->shape = d->shape == QTabWidget::Rounded
| 0 | ||||||||||||
| 125 | : QTabBar::TriangularNorth; | - | ||||||||||||
| 126 | break; never executed: break; | 0 | ||||||||||||
| 127 | case never executed: QTabWidget::South:case QTabWidget::South:never executed: case QTabWidget::South: | 0 | ||||||||||||
| 128 | option->shape = d->shape == QTabWidget::Rounded
| 0 | ||||||||||||
| 129 | : QTabBar::TriangularSouth; | - | ||||||||||||
| 130 | break; never executed: break; | 0 | ||||||||||||
| 131 | case never executed: QTabWidget::West:case QTabWidget::West:never executed: case QTabWidget::West: | 0 | ||||||||||||
| 132 | option->shape = d->shape == QTabWidget::Rounded
| 0 | ||||||||||||
| 133 | : QTabBar::TriangularWest; | - | ||||||||||||
| 134 | break; never executed: break; | 0 | ||||||||||||
| 135 | case never executed: QTabWidget::East:case QTabWidget::East:never executed: case QTabWidget::East: | 0 | ||||||||||||
| 136 | option->shape = d->shape == QTabWidget::Rounded
| 0 | ||||||||||||
| 137 | : QTabBar::TriangularEast; | - | ||||||||||||
| 138 | break; never executed: break; | 0 | ||||||||||||
| 139 | } | - | ||||||||||||
| 140 | - | |||||||||||||
| 141 | option->tabBarSize = t; | - | ||||||||||||
| 142 | - | |||||||||||||
| 143 | QRect tbRect = tabBar()->geometry(); | - | ||||||||||||
| 144 | QRect selectedTabRect = tabBar()->tabRect(tabBar()->currentIndex()); | - | ||||||||||||
| 145 | option->tabBarRect = tbRect; | - | ||||||||||||
| 146 | selectedTabRect.moveTopLeft(selectedTabRect.topLeft() + tbRect.topLeft()); | - | ||||||||||||
| 147 | option->selectedTabRect = selectedTabRect; | - | ||||||||||||
| 148 | } never executed: end of block | 0 | ||||||||||||
| 149 | - | |||||||||||||
| 150 | - | |||||||||||||
| 151 | - | |||||||||||||
| 152 | - | |||||||||||||
| 153 | QTabWidget::QTabWidget(QWidget *parent) | - | ||||||||||||
| 154 | : QWidget(*new QTabWidgetPrivate, parent, 0) | - | ||||||||||||
| 155 | { | - | ||||||||||||
| 156 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 157 | d->init(); | - | ||||||||||||
| 158 | } never executed: end of block | 0 | ||||||||||||
| 159 | - | |||||||||||||
| 160 | - | |||||||||||||
| 161 | - | |||||||||||||
| 162 | - | |||||||||||||
| 163 | - | |||||||||||||
| 164 | QTabWidget::~QTabWidget() | - | ||||||||||||
| 165 | { | - | ||||||||||||
| 166 | } | - | ||||||||||||
| 167 | int QTabWidget::addTab(QWidget *child, const QString &label) | - | ||||||||||||
| 168 | { | - | ||||||||||||
| 169 | return never executed: insertTab(-1, child, label);return insertTab(-1, child, label);never executed: return insertTab(-1, child, label); | 0 | ||||||||||||
| 170 | } | - | ||||||||||||
| 171 | int QTabWidget::addTab(QWidget *child, const QIcon& icon, const QString &label) | - | ||||||||||||
| 172 | { | - | ||||||||||||
| 173 | return never executed: insertTab(-1, child, icon, label);return insertTab(-1, child, icon, label);never executed: return insertTab(-1, child, icon, label); | 0 | ||||||||||||
| 174 | } | - | ||||||||||||
| 175 | int QTabWidget::insertTab(int index, QWidget *w, const QString &label) | - | ||||||||||||
| 176 | { | - | ||||||||||||
| 177 | return never executed: insertTab(index, w, QIcon(), label);return insertTab(index, w, QIcon(), label);never executed: return insertTab(index, w, QIcon(), label); | 0 | ||||||||||||
| 178 | } | - | ||||||||||||
| 179 | int QTabWidget::insertTab(int index, QWidget *w, const QIcon& icon, const QString &label) | - | ||||||||||||
| 180 | { | - | ||||||||||||
| 181 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 182 | if(!w
| 0 | ||||||||||||
| 183 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||
| 184 | index = d->stack->insertWidget(index, w); | - | ||||||||||||
| 185 | d->tabs->insertTab(index, icon, label); | - | ||||||||||||
| 186 | setUpLayout(); | - | ||||||||||||
| 187 | tabInserted(index); | - | ||||||||||||
| 188 | - | |||||||||||||
| 189 | return never executed: index;return index;never executed: return index; | 0 | ||||||||||||
| 190 | } | - | ||||||||||||
| 191 | void QTabWidget::setTabText(int index, const QString &label) | - | ||||||||||||
| 192 | { | - | ||||||||||||
| 193 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 194 | d->tabs->setTabText(index, label); | - | ||||||||||||
| 195 | setUpLayout(); | - | ||||||||||||
| 196 | } never executed: end of block | 0 | ||||||||||||
| 197 | - | |||||||||||||
| 198 | - | |||||||||||||
| 199 | - | |||||||||||||
| 200 | - | |||||||||||||
| 201 | - | |||||||||||||
| 202 | QString QTabWidget::tabText(int index) const | - | ||||||||||||
| 203 | { | - | ||||||||||||
| 204 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 205 | return never executed: d->tabs->tabText(index);return d->tabs->tabText(index);never executed: return d->tabs->tabText(index); | 0 | ||||||||||||
| 206 | } | - | ||||||||||||
| 207 | - | |||||||||||||
| 208 | - | |||||||||||||
| 209 | - | |||||||||||||
| 210 | - | |||||||||||||
| 211 | - | |||||||||||||
| 212 | - | |||||||||||||
| 213 | void QTabWidget::setTabIcon(int index, const QIcon &icon) | - | ||||||||||||
| 214 | { | - | ||||||||||||
| 215 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 216 | d->tabs->setTabIcon(index, icon); | - | ||||||||||||
| 217 | setUpLayout(); | - | ||||||||||||
| 218 | } never executed: end of block | 0 | ||||||||||||
| 219 | - | |||||||||||||
| 220 | - | |||||||||||||
| 221 | - | |||||||||||||
| 222 | - | |||||||||||||
| 223 | - | |||||||||||||
| 224 | QIcon QTabWidget::tabIcon(int index) const | - | ||||||||||||
| 225 | { | - | ||||||||||||
| 226 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 227 | return never executed: d->tabs->tabIcon(index);return d->tabs->tabIcon(index);never executed: return d->tabs->tabIcon(index); | 0 | ||||||||||||
| 228 | } | - | ||||||||||||
| 229 | - | |||||||||||||
| 230 | - | |||||||||||||
| 231 | - | |||||||||||||
| 232 | - | |||||||||||||
| 233 | - | |||||||||||||
| 234 | - | |||||||||||||
| 235 | - | |||||||||||||
| 236 | bool QTabWidget::isTabEnabled(int index) const | - | ||||||||||||
| 237 | { | - | ||||||||||||
| 238 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 239 | return never executed: d->tabs->isTabEnabled(index);return d->tabs->isTabEnabled(index);never executed: return d->tabs->isTabEnabled(index); | 0 | ||||||||||||
| 240 | } | - | ||||||||||||
| 241 | void QTabWidget::setTabEnabled(int index, bool enable) | - | ||||||||||||
| 242 | { | - | ||||||||||||
| 243 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 244 | d->tabs->setTabEnabled(index, enable); | - | ||||||||||||
| 245 | if (QWidget *widget = d->stack->widget(index)
| 0 | ||||||||||||
| 246 | widget->setEnabled(enable); never executed: widget->setEnabled(enable); | 0 | ||||||||||||
| 247 | } never executed: end of block | 0 | ||||||||||||
| 248 | void QTabWidget::setCornerWidget(QWidget * widget, Qt::Corner corner) | - | ||||||||||||
| 249 | { | - | ||||||||||||
| 250 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 251 | if (widget
| 0 | ||||||||||||
| 252 | widget->setParent(this); never executed: widget->setParent(this); | 0 | ||||||||||||
| 253 | - | |||||||||||||
| 254 | if (corner & Qt::TopRightCorner
| 0 | ||||||||||||
| 255 | if (d->rightCornerWidget
| 0 | ||||||||||||
| 256 | d->rightCornerWidget->hide(); never executed: d->rightCornerWidget->hide(); | 0 | ||||||||||||
| 257 | d->rightCornerWidget = widget; | - | ||||||||||||
| 258 | } never executed: else {end of block | 0 | ||||||||||||
| 259 | if (d->leftCornerWidget
| 0 | ||||||||||||
| 260 | d->leftCornerWidget->hide(); never executed: d->leftCornerWidget->hide(); | 0 | ||||||||||||
| 261 | d->leftCornerWidget = widget; | - | ||||||||||||
| 262 | } never executed: end of block | 0 | ||||||||||||
| 263 | setUpLayout(); | - | ||||||||||||
| 264 | } never executed: end of block | 0 | ||||||||||||
| 265 | - | |||||||||||||
| 266 | - | |||||||||||||
| 267 | - | |||||||||||||
| 268 | - | |||||||||||||
| 269 | QWidget * QTabWidget::cornerWidget(Qt::Corner corner) const | - | ||||||||||||
| 270 | { | - | ||||||||||||
| 271 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 272 | if (corner & Qt::TopRightCorner
| 0 | ||||||||||||
| 273 | return never executed: d->rightCornerWidget;return d->rightCornerWidget;never executed: return d->rightCornerWidget; | 0 | ||||||||||||
| 274 | return never executed: d->leftCornerWidget;return d->leftCornerWidget;never executed: return d->leftCornerWidget; | 0 | ||||||||||||
| 275 | } | - | ||||||||||||
| 276 | - | |||||||||||||
| 277 | - | |||||||||||||
| 278 | - | |||||||||||||
| 279 | - | |||||||||||||
| 280 | - | |||||||||||||
| 281 | - | |||||||||||||
| 282 | - | |||||||||||||
| 283 | void QTabWidget::removeTab(int index) | - | ||||||||||||
| 284 | { | - | ||||||||||||
| 285 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 286 | if (QWidget *w = d->stack->widget(index)
| 0 | ||||||||||||
| 287 | d->stack->removeWidget(w); never executed: d->stack->removeWidget(w); | 0 | ||||||||||||
| 288 | } never executed: end of block | 0 | ||||||||||||
| 289 | QWidget * QTabWidget::currentWidget() const | - | ||||||||||||
| 290 | { | - | ||||||||||||
| 291 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 292 | return never executed: d->stack->currentWidget();return d->stack->currentWidget();never executed: return d->stack->currentWidget(); | 0 | ||||||||||||
| 293 | } | - | ||||||||||||
| 294 | - | |||||||||||||
| 295 | - | |||||||||||||
| 296 | - | |||||||||||||
| 297 | - | |||||||||||||
| 298 | - | |||||||||||||
| 299 | - | |||||||||||||
| 300 | - | |||||||||||||
| 301 | void QTabWidget::setCurrentWidget(QWidget *widget) | - | ||||||||||||
| 302 | { | - | ||||||||||||
| 303 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 304 | d->tabs->setCurrentIndex(indexOf(widget)); | - | ||||||||||||
| 305 | } never executed: end of block | 0 | ||||||||||||
| 306 | int QTabWidget::currentIndex() const | - | ||||||||||||
| 307 | { | - | ||||||||||||
| 308 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 309 | return never executed: d->tabs->currentIndex();return d->tabs->currentIndex();never executed: return d->tabs->currentIndex(); | 0 | ||||||||||||
| 310 | } | - | ||||||||||||
| 311 | - | |||||||||||||
| 312 | void QTabWidget::setCurrentIndex(int index) | - | ||||||||||||
| 313 | { | - | ||||||||||||
| 314 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 315 | d->tabs->setCurrentIndex(index); | - | ||||||||||||
| 316 | } never executed: end of block | 0 | ||||||||||||
| 317 | - | |||||||||||||
| 318 | - | |||||||||||||
| 319 | - | |||||||||||||
| 320 | - | |||||||||||||
| 321 | - | |||||||||||||
| 322 | - | |||||||||||||
| 323 | int QTabWidget::indexOf(QWidget* w) const | - | ||||||||||||
| 324 | { | - | ||||||||||||
| 325 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 326 | return never executed: d->stack->indexOf(w);return d->stack->indexOf(w);never executed: return d->stack->indexOf(w); | 0 | ||||||||||||
| 327 | } | - | ||||||||||||
| 328 | - | |||||||||||||
| 329 | - | |||||||||||||
| 330 | - | |||||||||||||
| 331 | - | |||||||||||||
| 332 | - | |||||||||||||
| 333 | void QTabWidget::resizeEvent(QResizeEvent *e) | - | ||||||||||||
| 334 | { | - | ||||||||||||
| 335 | QWidget::resizeEvent(e); | - | ||||||||||||
| 336 | setUpLayout(); | - | ||||||||||||
| 337 | } never executed: end of block | 0 | ||||||||||||
| 338 | void QTabWidget::setTabBar(QTabBar* tb) | - | ||||||||||||
| 339 | { | - | ||||||||||||
| 340 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 341 | ((!(tb)) ? qt_assert("tb",__FILE__,699) : qt_noop()); | - | ||||||||||||
| 342 | - | |||||||||||||
| 343 | if (tb->parentWidget() != this
| 0 | ||||||||||||
| 344 | tb->setParent(this); | - | ||||||||||||
| 345 | tb->show(); | - | ||||||||||||
| 346 | } never executed: end of block | 0 | ||||||||||||
| 347 | delete d->tabs; | - | ||||||||||||
| 348 | d->tabs = tb; | - | ||||||||||||
| 349 | setFocusProxy(d->tabs); | - | ||||||||||||
| 350 | connect(d->tabs, qFlagLocation("2""currentChanged(int)" "\0" __FILE__ ":" "708"), | - | ||||||||||||
| 351 | this, qFlagLocation("1""_q_showTab(int)" "\0" __FILE__ ":" "709")); | - | ||||||||||||
| 352 | connect(d->tabs, qFlagLocation("2""tabMoved(int,int)" "\0" __FILE__ ":" "710"), | - | ||||||||||||
| 353 | this, qFlagLocation("1""_q_tabMoved(int,int)" "\0" __FILE__ ":" "711")); | - | ||||||||||||
| 354 | connect(d->tabs, qFlagLocation("2""tabBarClicked(int)" "\0" __FILE__ ":" "712"), | - | ||||||||||||
| 355 | this, qFlagLocation("2""tabBarClicked(int)" "\0" __FILE__ ":" "713")); | - | ||||||||||||
| 356 | connect(d->tabs, qFlagLocation("2""tabBarDoubleClicked(int)" "\0" __FILE__ ":" "714"), | - | ||||||||||||
| 357 | this, qFlagLocation("2""tabBarDoubleClicked(int)" "\0" __FILE__ ":" "715")); | - | ||||||||||||
| 358 | if (d->tabs->tabsClosable()
| 0 | ||||||||||||
| 359 | connect(d->tabs, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "717"), never executed: connect(d->tabs, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "717"), this, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "718")); | 0 | ||||||||||||
| 360 | this, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "718")); never executed: connect(d->tabs, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "717"), this, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "718")); | 0 | ||||||||||||
| 361 | tb->setExpanding(!documentMode()); | - | ||||||||||||
| 362 | setUpLayout(); | - | ||||||||||||
| 363 | } never executed: end of block | 0 | ||||||||||||
| 364 | - | |||||||||||||
| 365 | - | |||||||||||||
| 366 | - | |||||||||||||
| 367 | - | |||||||||||||
| 368 | - | |||||||||||||
| 369 | - | |||||||||||||
| 370 | - | |||||||||||||
| 371 | QTabBar* QTabWidget::tabBar() const | - | ||||||||||||
| 372 | { | - | ||||||||||||
| 373 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 374 | return never executed: d->tabs;return d->tabs;never executed: return d->tabs; | 0 | ||||||||||||
| 375 | } | - | ||||||||||||
| 376 | - | |||||||||||||
| 377 | - | |||||||||||||
| 378 | - | |||||||||||||
| 379 | - | |||||||||||||
| 380 | - | |||||||||||||
| 381 | - | |||||||||||||
| 382 | void QTabWidgetPrivate::_q_showTab(int index) | - | ||||||||||||
| 383 | { | - | ||||||||||||
| 384 | QTabWidget * const q = q_func(); | - | ||||||||||||
| 385 | if (index < stack->count()
| 0 | ||||||||||||
| 386 | stack->setCurrentIndex(index); never executed: stack->setCurrentIndex(index); | 0 | ||||||||||||
| 387 | q->currentChanged(index); | - | ||||||||||||
| 388 | } never executed: end of block | 0 | ||||||||||||
| 389 | - | |||||||||||||
| 390 | void QTabWidgetPrivate::_q_removeTab(int index) | - | ||||||||||||
| 391 | { | - | ||||||||||||
| 392 | QTabWidget * const q = q_func(); | - | ||||||||||||
| 393 | tabs->removeTab(index); | - | ||||||||||||
| 394 | q->setUpLayout(); | - | ||||||||||||
| 395 | q->tabRemoved(index); | - | ||||||||||||
| 396 | } never executed: end of block | 0 | ||||||||||||
| 397 | - | |||||||||||||
| 398 | void QTabWidgetPrivate::_q_tabMoved(int from, int to) | - | ||||||||||||
| 399 | { | - | ||||||||||||
| 400 | const QSignalBlocker blocker(stack); | - | ||||||||||||
| 401 | QWidget *w = stack->widget(from); | - | ||||||||||||
| 402 | stack->removeWidget(w); | - | ||||||||||||
| 403 | stack->insertWidget(to, w); | - | ||||||||||||
| 404 | } never executed: end of block | 0 | ||||||||||||
| 405 | - | |||||||||||||
| 406 | - | |||||||||||||
| 407 | - | |||||||||||||
| 408 | - | |||||||||||||
| 409 | - | |||||||||||||
| 410 | - | |||||||||||||
| 411 | void QTabWidget::setUpLayout(bool onlyCheck) | - | ||||||||||||
| 412 | { | - | ||||||||||||
| 413 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 414 | if (onlyCheck
| 0 | ||||||||||||
| 415 | return; never executed: return; | 0 | ||||||||||||
| 416 | - | |||||||||||||
| 417 | QStyleOptionTabWidgetFrame option; | - | ||||||||||||
| 418 | initStyleOption(&option); | - | ||||||||||||
| 419 | - | |||||||||||||
| 420 | - | |||||||||||||
| 421 | d->setLayoutItemMargins(QStyle::SE_TabWidgetLayoutItem, &option); | - | ||||||||||||
| 422 | - | |||||||||||||
| 423 | if (!isVisible()
| 0 | ||||||||||||
| 424 | d->dirty = true; | - | ||||||||||||
| 425 | return; never executed: return; | 0 | ||||||||||||
| 426 | } | - | ||||||||||||
| 427 | - | |||||||||||||
| 428 | QRect tabRect = style()->subElementRect(QStyle::SE_TabWidgetTabBar, &option, this); | - | ||||||||||||
| 429 | d->panelRect = style()->subElementRect(QStyle::SE_TabWidgetTabPane, &option, this); | - | ||||||||||||
| 430 | QRect contentsRect = style()->subElementRect(QStyle::SE_TabWidgetTabContents, &option, this); | - | ||||||||||||
| 431 | QRect leftCornerRect = style()->subElementRect(QStyle::SE_TabWidgetLeftCorner, &option, this); | - | ||||||||||||
| 432 | QRect rightCornerRect = style()->subElementRect(QStyle::SE_TabWidgetRightCorner, &option, this); | - | ||||||||||||
| 433 | - | |||||||||||||
| 434 | d->tabs->setGeometry(tabRect); | - | ||||||||||||
| 435 | d->stack->setGeometry(contentsRect); | - | ||||||||||||
| 436 | if (d->leftCornerWidget
| 0 | ||||||||||||
| 437 | d->leftCornerWidget->setGeometry(leftCornerRect); never executed: d->leftCornerWidget->setGeometry(leftCornerRect); | 0 | ||||||||||||
| 438 | if (d->rightCornerWidget
| 0 | ||||||||||||
| 439 | d->rightCornerWidget->setGeometry(rightCornerRect); never executed: d->rightCornerWidget->setGeometry(rightCornerRect); | 0 | ||||||||||||
| 440 | - | |||||||||||||
| 441 | if (!onlyCheck
| 0 | ||||||||||||
| 442 | update(); never executed: update(); | 0 | ||||||||||||
| 443 | updateGeometry(); | - | ||||||||||||
| 444 | } never executed: end of block | 0 | ||||||||||||
| 445 | - | |||||||||||||
| 446 | - | |||||||||||||
| 447 | - | |||||||||||||
| 448 | - | |||||||||||||
| 449 | static inline QSize basicSize( | - | ||||||||||||
| 450 | bool horizontal, const QSize &lc, const QSize &rc, const QSize &s, const QSize &t) | - | ||||||||||||
| 451 | { | - | ||||||||||||
| 452 | return never executed: horizontalreturn horizontal ? QSize(qMax(s.width(), t.width() + rc.width() + lc.width()), s.height() + (qMax(rc.height(), qMax(lc.height(), t.height())))) : QSize(s.width() + (qMax(rc.width(), qMax(lc.width(), t.width()))), qMax(s.height(), t.height() + rc.height() + lc.height()));never executed: return horizontal ? QSize(qMax(s.width(), t.width() + rc.width() + lc.width()), s.height() + (qMax(rc.height(), qMax(lc.height(), t.height())))) : QSize(s.width() + (qMax(rc.width(), qMax(lc.width(), t.width()))), qMax(s.height(), t.height() + rc.height() + lc.height())); | 0 | ||||||||||||
| 453 | ? QSize(qMax(s.width(), t.width() + rc.width() + lc.width()), never executed: return horizontal ? QSize(qMax(s.width(), t.width() + rc.width() + lc.width()), s.height() + (qMax(rc.height(), qMax(lc.height(), t.height())))) : QSize(s.width() + (qMax(rc.width(), qMax(lc.width(), t.width()))), qMax(s.height(), t.height() + rc.height() + lc.height())); | 0 | ||||||||||||
| 454 | s.height() + (qMax(rc.height(), qMax(lc.height(), t.height())))) never executed: return horizontal ? QSize(qMax(s.width(), t.width() + rc.width() + lc.width()), s.height() + (qMax(rc.height(), qMax(lc.height(), t.height())))) : QSize(s.width() + (qMax(rc.width(), qMax(lc.width(), t.width()))), qMax(s.height(), t.height() + rc.height() + lc.height())); | 0 | ||||||||||||
| 455 | : QSize(s.width() + (qMax(rc.width(), qMax(lc.width(), t.width()))), never executed: return horizontal ? QSize(qMax(s.width(), t.width() + rc.width() + lc.width()), s.height() + (qMax(rc.height(), qMax(lc.height(), t.height())))) : QSize(s.width() + (qMax(rc.width(), qMax(lc.width(), t.width()))), qMax(s.height(), t.height() + rc.height() + lc.height())); | 0 | ||||||||||||
| 456 | qMax(s.height(), t.height() + rc.height() + lc.height())); never executed: return horizontal ? QSize(qMax(s.width(), t.width() + rc.width() + lc.width()), s.height() + (qMax(rc.height(), qMax(lc.height(), t.height())))) : QSize(s.width() + (qMax(rc.width(), qMax(lc.width(), t.width()))), qMax(s.height(), t.height() + rc.height() + lc.height())); | 0 | ||||||||||||
| 457 | } | - | ||||||||||||
| 458 | - | |||||||||||||
| 459 | - | |||||||||||||
| 460 | - | |||||||||||||
| 461 | - | |||||||||||||
| 462 | QSize QTabWidget::sizeHint() const | - | ||||||||||||
| 463 | { | - | ||||||||||||
| 464 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 465 | QSize lc(0, 0), rc(0, 0); | - | ||||||||||||
| 466 | QStyleOptionTabWidgetFrame opt; | - | ||||||||||||
| 467 | initStyleOption(&opt); | - | ||||||||||||
| 468 | opt.state = QStyle::State_None; | - | ||||||||||||
| 469 | - | |||||||||||||
| 470 | if (d->leftCornerWidget
| 0 | ||||||||||||
| 471 | lc = d->leftCornerWidget->sizeHint(); never executed: lc = d->leftCornerWidget->sizeHint(); | 0 | ||||||||||||
| 472 | if(d->rightCornerWidget
| 0 | ||||||||||||
| 473 | rc = d->rightCornerWidget->sizeHint(); never executed: rc = d->rightCornerWidget->sizeHint(); | 0 | ||||||||||||
| 474 | if (!d->dirty
| 0 | ||||||||||||
| 475 | QTabWidget *that = const_cast<QTabWidget*>(this); | - | ||||||||||||
| 476 | that->setUpLayout(true); | - | ||||||||||||
| 477 | } never executed: end of block | 0 | ||||||||||||
| 478 | QSize s(d->stack->sizeHint()); | - | ||||||||||||
| 479 | QSize t(d->tabs->sizeHint()); | - | ||||||||||||
| 480 | if(usesScrollButtons()
| 0 | ||||||||||||
| 481 | t = t.boundedTo(QSize(200,200)); never executed: t = t.boundedTo(QSize(200,200)); | 0 | ||||||||||||
| 482 | else | - | ||||||||||||
| 483 | t = t.boundedTo(QApplication::desktop()->size()); never executed: t = t.boundedTo(QApplication::desktop()->size()); | 0 | ||||||||||||
| 484 | - | |||||||||||||
| 485 | QSize sz = basicSize(d->pos == North || d->pos == South, lc, rc, s, t); | - | ||||||||||||
| 486 | - | |||||||||||||
| 487 | return never executed: style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this)return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this) .expandedTo(QApplication::globalStrut());never executed: return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this) .expandedTo(QApplication::globalStrut()); | 0 | ||||||||||||
| 488 | .expandedTo(QApplication::globalStrut()); never executed: return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this) .expandedTo(QApplication::globalStrut()); | 0 | ||||||||||||
| 489 | } | - | ||||||||||||
| 490 | - | |||||||||||||
| 491 | - | |||||||||||||
| 492 | - | |||||||||||||
| 493 | - | |||||||||||||
| 494 | - | |||||||||||||
| 495 | - | |||||||||||||
| 496 | - | |||||||||||||
| 497 | QSize QTabWidget::minimumSizeHint() const | - | ||||||||||||
| 498 | { | - | ||||||||||||
| 499 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 500 | QSize lc(0, 0), rc(0, 0); | - | ||||||||||||
| 501 | - | |||||||||||||
| 502 | if(d->leftCornerWidget
| 0 | ||||||||||||
| 503 | lc = d->leftCornerWidget->minimumSizeHint(); never executed: lc = d->leftCornerWidget->minimumSizeHint(); | 0 | ||||||||||||
| 504 | if(d->rightCornerWidget
| 0 | ||||||||||||
| 505 | rc = d->rightCornerWidget->minimumSizeHint(); never executed: rc = d->rightCornerWidget->minimumSizeHint(); | 0 | ||||||||||||
| 506 | if (!d->dirty
| 0 | ||||||||||||
| 507 | QTabWidget *that = const_cast<QTabWidget*>(this); | - | ||||||||||||
| 508 | that->setUpLayout(true); | - | ||||||||||||
| 509 | } never executed: end of block | 0 | ||||||||||||
| 510 | QSize s(d->stack->minimumSizeHint()); | - | ||||||||||||
| 511 | QSize t(d->tabs->minimumSizeHint()); | - | ||||||||||||
| 512 | - | |||||||||||||
| 513 | QSize sz = basicSize(d->pos == North || d->pos == South, lc, rc, s, t); | - | ||||||||||||
| 514 | - | |||||||||||||
| 515 | QStyleOptionTabWidgetFrame opt; | - | ||||||||||||
| 516 | initStyleOption(&opt); | - | ||||||||||||
| 517 | opt.palette = palette(); | - | ||||||||||||
| 518 | opt.state = QStyle::State_None; | - | ||||||||||||
| 519 | return never executed: style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this)return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this) .expandedTo(QApplication::globalStrut());never executed: return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this) .expandedTo(QApplication::globalStrut()); | 0 | ||||||||||||
| 520 | .expandedTo(QApplication::globalStrut()); never executed: return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this) .expandedTo(QApplication::globalStrut()); | 0 | ||||||||||||
| 521 | } | - | ||||||||||||
| 522 | - | |||||||||||||
| 523 | - | |||||||||||||
| 524 | - | |||||||||||||
| 525 | - | |||||||||||||
| 526 | int QTabWidget::heightForWidth(int width) const | - | ||||||||||||
| 527 | { | - | ||||||||||||
| 528 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 529 | QStyleOptionTabWidgetFrame opt; | - | ||||||||||||
| 530 | initStyleOption(&opt); | - | ||||||||||||
| 531 | opt.state = QStyle::State_None; | - | ||||||||||||
| 532 | - | |||||||||||||
| 533 | QSize zero(0,0); | - | ||||||||||||
| 534 | const QSize padding = style()->sizeFromContents(QStyle::CT_TabWidget, &opt, zero, this) | - | ||||||||||||
| 535 | .expandedTo(QApplication::globalStrut()); | - | ||||||||||||
| 536 | - | |||||||||||||
| 537 | QSize lc(0, 0), rc(0, 0); | - | ||||||||||||
| 538 | if (d->leftCornerWidget
| 0 | ||||||||||||
| 539 | lc = d->leftCornerWidget->sizeHint(); never executed: lc = d->leftCornerWidget->sizeHint(); | 0 | ||||||||||||
| 540 | if(d->rightCornerWidget
| 0 | ||||||||||||
| 541 | rc = d->rightCornerWidget->sizeHint(); never executed: rc = d->rightCornerWidget->sizeHint(); | 0 | ||||||||||||
| 542 | if (!d->dirty
| 0 | ||||||||||||
| 543 | QTabWidget *that = const_cast<QTabWidget*>(this); | - | ||||||||||||
| 544 | that->setUpLayout(true); | - | ||||||||||||
| 545 | } never executed: end of block | 0 | ||||||||||||
| 546 | QSize t(d->tabs->sizeHint()); | - | ||||||||||||
| 547 | - | |||||||||||||
| 548 | if(usesScrollButtons()
| 0 | ||||||||||||
| 549 | t = t.boundedTo(QSize(200,200)); never executed: t = t.boundedTo(QSize(200,200)); | 0 | ||||||||||||
| 550 | else | - | ||||||||||||
| 551 | t = t.boundedTo(QApplication::desktop()->size()); never executed: t = t.boundedTo(QApplication::desktop()->size()); | 0 | ||||||||||||
| 552 | - | |||||||||||||
| 553 | const bool tabIsHorizontal = (d->pos == North
| 0 | ||||||||||||
| 554 | const int contentsWidth = width - padding.width(); | - | ||||||||||||
| 555 | int stackWidth = contentsWidth; | - | ||||||||||||
| 556 | if (!tabIsHorizontal
| 0 | ||||||||||||
| 557 | stackWidth -= qMax(t.width(), qMax(lc.width(), rc.width())); never executed: stackWidth -= qMax(t.width(), qMax(lc.width(), rc.width())); | 0 | ||||||||||||
| 558 | - | |||||||||||||
| 559 | int stackHeight = d->stack->heightForWidth(stackWidth); | - | ||||||||||||
| 560 | QSize s(stackWidth, stackHeight); | - | ||||||||||||
| 561 | - | |||||||||||||
| 562 | QSize contentSize = basicSize(tabIsHorizontal, lc, rc, s, t); | - | ||||||||||||
| 563 | return never executed: (contentSize + padding).expandedTo(QApplication::globalStrut()).height();return (contentSize + padding).expandedTo(QApplication::globalStrut()).height();never executed: return (contentSize + padding).expandedTo(QApplication::globalStrut()).height(); | 0 | ||||||||||||
| 564 | } | - | ||||||||||||
| 565 | - | |||||||||||||
| 566 | - | |||||||||||||
| 567 | - | |||||||||||||
| 568 | - | |||||||||||||
| 569 | - | |||||||||||||
| 570 | void QTabWidget::showEvent(QShowEvent *) | - | ||||||||||||
| 571 | { | - | ||||||||||||
| 572 | setUpLayout(); | - | ||||||||||||
| 573 | } never executed: end of block | 0 | ||||||||||||
| 574 | - | |||||||||||||
| 575 | void QTabWidgetPrivate::updateTabBarPosition() | - | ||||||||||||
| 576 | { | - | ||||||||||||
| 577 | QTabWidget * const q = q_func(); | - | ||||||||||||
| 578 | switch (pos) { | - | ||||||||||||
| 579 | case never executed: QTabWidget::North:case QTabWidget::North:never executed: case QTabWidget::North: | 0 | ||||||||||||
| 580 | tabs->setShape(shape == QTabWidget::Rounded ? QTabBar::RoundedNorth | - | ||||||||||||
| 581 | : QTabBar::TriangularNorth); | - | ||||||||||||
| 582 | break; never executed: break; | 0 | ||||||||||||
| 583 | case never executed: QTabWidget::South:case QTabWidget::South:never executed: case QTabWidget::South: | 0 | ||||||||||||
| 584 | tabs->setShape(shape == QTabWidget::Rounded ? QTabBar::RoundedSouth | - | ||||||||||||
| 585 | : QTabBar::TriangularSouth); | - | ||||||||||||
| 586 | break; never executed: break; | 0 | ||||||||||||
| 587 | case never executed: QTabWidget::West:case QTabWidget::West:never executed: case QTabWidget::West: | 0 | ||||||||||||
| 588 | tabs->setShape(shape == QTabWidget::Rounded ? QTabBar::RoundedWest | - | ||||||||||||
| 589 | : QTabBar::TriangularWest); | - | ||||||||||||
| 590 | break; never executed: break; | 0 | ||||||||||||
| 591 | case never executed: QTabWidget::East:case QTabWidget::East:never executed: case QTabWidget::East: | 0 | ||||||||||||
| 592 | tabs->setShape(shape == QTabWidget::Rounded ? QTabBar::RoundedEast | - | ||||||||||||
| 593 | : QTabBar::TriangularEast); | - | ||||||||||||
| 594 | break; never executed: break; | 0 | ||||||||||||
| 595 | } | - | ||||||||||||
| 596 | q->setUpLayout(); | - | ||||||||||||
| 597 | } never executed: end of block | 0 | ||||||||||||
| 598 | QTabWidget::TabPosition QTabWidget::tabPosition() const | - | ||||||||||||
| 599 | { | - | ||||||||||||
| 600 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 601 | return never executed: d->pos;return d->pos;never executed: return d->pos; | 0 | ||||||||||||
| 602 | } | - | ||||||||||||
| 603 | - | |||||||||||||
| 604 | void QTabWidget::setTabPosition(TabPosition pos) | - | ||||||||||||
| 605 | { | - | ||||||||||||
| 606 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 607 | if (d->pos == pos
| 0 | ||||||||||||
| 608 | return; never executed: return; | 0 | ||||||||||||
| 609 | d->pos = pos; | - | ||||||||||||
| 610 | d->updateTabBarPosition(); | - | ||||||||||||
| 611 | } never executed: end of block | 0 | ||||||||||||
| 612 | bool QTabWidget::tabsClosable() const | - | ||||||||||||
| 613 | { | - | ||||||||||||
| 614 | return never executed: tabBar()->tabsClosable();return tabBar()->tabsClosable();never executed: return tabBar()->tabsClosable(); | 0 | ||||||||||||
| 615 | } | - | ||||||||||||
| 616 | - | |||||||||||||
| 617 | void QTabWidget::setTabsClosable(bool closeable) | - | ||||||||||||
| 618 | { | - | ||||||||||||
| 619 | if (tabsClosable() == closeable
| 0 | ||||||||||||
| 620 | return; never executed: return; | 0 | ||||||||||||
| 621 | - | |||||||||||||
| 622 | tabBar()->setTabsClosable(closeable); | - | ||||||||||||
| 623 | if (closeable
| 0 | ||||||||||||
| 624 | connect(tabBar(), qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1003"), never executed: connect(tabBar(), qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1003"), this, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1004")); | 0 | ||||||||||||
| 625 | this, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1004")); never executed: connect(tabBar(), qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1003"), this, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1004")); | 0 | ||||||||||||
| 626 | else | - | ||||||||||||
| 627 | disconnect(tabBar(), qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1006"), never executed: disconnect(tabBar(), qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1006"), this, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1007")); | 0 | ||||||||||||
| 628 | this, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1007")); never executed: disconnect(tabBar(), qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1006"), this, qFlagLocation("2""tabCloseRequested(int)" "\0" __FILE__ ":" "1007")); | 0 | ||||||||||||
| 629 | setUpLayout(); | - | ||||||||||||
| 630 | } never executed: end of block | 0 | ||||||||||||
| 631 | bool QTabWidget::isMovable() const | - | ||||||||||||
| 632 | { | - | ||||||||||||
| 633 | return never executed: tabBar()->isMovable();return tabBar()->isMovable();never executed: return tabBar()->isMovable(); | 0 | ||||||||||||
| 634 | } | - | ||||||||||||
| 635 | - | |||||||||||||
| 636 | void QTabWidget::setMovable(bool movable) | - | ||||||||||||
| 637 | { | - | ||||||||||||
| 638 | tabBar()->setMovable(movable); | - | ||||||||||||
| 639 | } never executed: end of block | 0 | ||||||||||||
| 640 | QTabWidget::TabShape QTabWidget::tabShape() const | - | ||||||||||||
| 641 | { | - | ||||||||||||
| 642 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 643 | return never executed: d->shape;return d->shape;never executed: return d->shape; | 0 | ||||||||||||
| 644 | } | - | ||||||||||||
| 645 | - | |||||||||||||
| 646 | void QTabWidget::setTabShape(TabShape s) | - | ||||||||||||
| 647 | { | - | ||||||||||||
| 648 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 649 | if (d->shape == s
| 0 | ||||||||||||
| 650 | return; never executed: return; | 0 | ||||||||||||
| 651 | d->shape = s; | - | ||||||||||||
| 652 | d->updateTabBarPosition(); | - | ||||||||||||
| 653 | } never executed: end of block | 0 | ||||||||||||
| 654 | - | |||||||||||||
| 655 | - | |||||||||||||
| 656 | - | |||||||||||||
| 657 | - | |||||||||||||
| 658 | bool QTabWidget::event(QEvent *ev) | - | ||||||||||||
| 659 | { | - | ||||||||||||
| 660 | if (ev->type() == QEvent::LayoutRequest
| 0 | ||||||||||||
| 661 | setUpLayout(); never executed: setUpLayout(); | 0 | ||||||||||||
| 662 | return never executed: QWidget::event(ev);return QWidget::event(ev);never executed: return QWidget::event(ev); | 0 | ||||||||||||
| 663 | } | - | ||||||||||||
| 664 | - | |||||||||||||
| 665 | - | |||||||||||||
| 666 | - | |||||||||||||
| 667 | - | |||||||||||||
| 668 | void QTabWidget::changeEvent(QEvent *ev) | - | ||||||||||||
| 669 | { | - | ||||||||||||
| 670 | if (ev->type() == QEvent::StyleChange
| 0 | ||||||||||||
| 671 | - | |||||||||||||
| 672 | - | |||||||||||||
| 673 | - | |||||||||||||
| 674 | ) | - | ||||||||||||
| 675 | setUpLayout(); never executed: setUpLayout(); | 0 | ||||||||||||
| 676 | QWidget::changeEvent(ev); | - | ||||||||||||
| 677 | } never executed: end of block | 0 | ||||||||||||
| 678 | - | |||||||||||||
| 679 | - | |||||||||||||
| 680 | - | |||||||||||||
| 681 | - | |||||||||||||
| 682 | - | |||||||||||||
| 683 | void QTabWidget::keyPressEvent(QKeyEvent *e) | - | ||||||||||||
| 684 | { | - | ||||||||||||
| 685 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 686 | if (((e->key() == Qt::Key_Tab
| 0 | ||||||||||||
| 687 | count() > 1
| 0 | ||||||||||||
| 688 | - | |||||||||||||
| 689 | - | |||||||||||||
| 690 | - | |||||||||||||
| 691 | ) { | - | ||||||||||||
| 692 | int pageCount = d->tabs->count(); | - | ||||||||||||
| 693 | int page = currentIndex(); | - | ||||||||||||
| 694 | int dx = (e->key() == Qt::Key_Backtab
| 0 | ||||||||||||
| 695 | - | |||||||||||||
| 696 | - | |||||||||||||
| 697 | - | |||||||||||||
| 698 | - | |||||||||||||
| 699 | for (int pass = 0; pass < pageCount
| 0 | ||||||||||||
| 700 | page+=dx; | - | ||||||||||||
| 701 | if (page < 0
| 0 | ||||||||||||
| 702 | - | |||||||||||||
| 703 | - | |||||||||||||
| 704 | - | |||||||||||||
| 705 | ) { | - | ||||||||||||
| 706 | page = count() - 1; | - | ||||||||||||
| 707 | } never executed: else if (page >= pageCountend of block
| 0 | ||||||||||||
| 708 | - | |||||||||||||
| 709 | - | |||||||||||||
| 710 | - | |||||||||||||
| 711 | ) { | - | ||||||||||||
| 712 | page = 0; | - | ||||||||||||
| 713 | } never executed: end of block | 0 | ||||||||||||
| 714 | if (d->tabs->isTabEnabled(page)
| 0 | ||||||||||||
| 715 | setCurrentIndex(page); | - | ||||||||||||
| 716 | break; never executed: break; | 0 | ||||||||||||
| 717 | } | - | ||||||||||||
| 718 | } never executed: end of block | 0 | ||||||||||||
| 719 | if (!QApplication::focusWidget()
| 0 | ||||||||||||
| 720 | d->tabs->setFocus(); never executed: d->tabs->setFocus(); | 0 | ||||||||||||
| 721 | } never executed: else {end of block | 0 | ||||||||||||
| 722 | e->ignore(); | - | ||||||||||||
| 723 | } never executed: end of block | 0 | ||||||||||||
| 724 | } | - | ||||||||||||
| 725 | - | |||||||||||||
| 726 | - | |||||||||||||
| 727 | - | |||||||||||||
| 728 | - | |||||||||||||
| 729 | - | |||||||||||||
| 730 | QWidget *QTabWidget::widget(int index) const | - | ||||||||||||
| 731 | { | - | ||||||||||||
| 732 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 733 | return never executed: d->stack->widget(index);return d->stack->widget(index);never executed: return d->stack->widget(index); | 0 | ||||||||||||
| 734 | } | - | ||||||||||||
| 735 | - | |||||||||||||
| 736 | - | |||||||||||||
| 737 | - | |||||||||||||
| 738 | - | |||||||||||||
| 739 | - | |||||||||||||
| 740 | - | |||||||||||||
| 741 | - | |||||||||||||
| 742 | int QTabWidget::count() const | - | ||||||||||||
| 743 | { | - | ||||||||||||
| 744 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 745 | return never executed: d->tabs->count();return d->tabs->count();never executed: return d->tabs->count(); | 0 | ||||||||||||
| 746 | } | - | ||||||||||||
| 747 | - | |||||||||||||
| 748 | - | |||||||||||||
| 749 | - | |||||||||||||
| 750 | - | |||||||||||||
| 751 | - | |||||||||||||
| 752 | - | |||||||||||||
| 753 | - | |||||||||||||
| 754 | void QTabWidget::setTabToolTip(int index, const QString & tip) | - | ||||||||||||
| 755 | { | - | ||||||||||||
| 756 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 757 | d->tabs->setTabToolTip(index, tip); | - | ||||||||||||
| 758 | } never executed: end of block | 0 | ||||||||||||
| 759 | - | |||||||||||||
| 760 | - | |||||||||||||
| 761 | - | |||||||||||||
| 762 | - | |||||||||||||
| 763 | - | |||||||||||||
| 764 | - | |||||||||||||
| 765 | - | |||||||||||||
| 766 | QString QTabWidget::tabToolTip(int index) const | - | ||||||||||||
| 767 | { | - | ||||||||||||
| 768 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 769 | return never executed: d->tabs->tabToolTip(index);return d->tabs->tabToolTip(index);never executed: return d->tabs->tabToolTip(index); | 0 | ||||||||||||
| 770 | } | - | ||||||||||||
| 771 | void QTabWidget::setTabWhatsThis(int index, const QString &text) | - | ||||||||||||
| 772 | { | - | ||||||||||||
| 773 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 774 | d->tabs->setTabWhatsThis(index, text); | - | ||||||||||||
| 775 | } never executed: end of block | 0 | ||||||||||||
| 776 | - | |||||||||||||
| 777 | - | |||||||||||||
| 778 | - | |||||||||||||
| 779 | - | |||||||||||||
| 780 | - | |||||||||||||
| 781 | - | |||||||||||||
| 782 | - | |||||||||||||
| 783 | QString QTabWidget::tabWhatsThis(int index) const | - | ||||||||||||
| 784 | { | - | ||||||||||||
| 785 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 786 | return never executed: d->tabs->tabWhatsThis(index);return d->tabs->tabWhatsThis(index);never executed: return d->tabs->tabWhatsThis(index); | 0 | ||||||||||||
| 787 | } | - | ||||||||||||
| 788 | void QTabWidget::tabInserted(int index) | - | ||||||||||||
| 789 | { | - | ||||||||||||
| 790 | (void)index; | - | ||||||||||||
| 791 | } never executed: end of block | 0 | ||||||||||||
| 792 | - | |||||||||||||
| 793 | - | |||||||||||||
| 794 | - | |||||||||||||
| 795 | - | |||||||||||||
| 796 | - | |||||||||||||
| 797 | - | |||||||||||||
| 798 | - | |||||||||||||
| 799 | void QTabWidget::tabRemoved(int index) | - | ||||||||||||
| 800 | { | - | ||||||||||||
| 801 | (void)index; | - | ||||||||||||
| 802 | } never executed: end of block | 0 | ||||||||||||
| 803 | - | |||||||||||||
| 804 | - | |||||||||||||
| 805 | - | |||||||||||||
| 806 | - | |||||||||||||
| 807 | - | |||||||||||||
| 808 | - | |||||||||||||
| 809 | void QTabWidget::paintEvent(QPaintEvent *) | - | ||||||||||||
| 810 | { | - | ||||||||||||
| 811 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 812 | if (documentMode()
| 0 | ||||||||||||
| 813 | QStylePainter p(this, tabBar()); | - | ||||||||||||
| 814 | if (QWidget *w = cornerWidget(Qt::TopLeftCorner)
| 0 | ||||||||||||
| 815 | QStyleOptionTabBarBase opt; | - | ||||||||||||
| 816 | QTabBarPrivate::initStyleBaseOption(&opt, tabBar(), w->size()); | - | ||||||||||||
| 817 | opt.rect.moveLeft(w->x() + opt.rect.x()); | - | ||||||||||||
| 818 | opt.rect.moveTop(w->y() + opt.rect.y()); | - | ||||||||||||
| 819 | p.drawPrimitive(QStyle::PE_FrameTabBarBase, opt); | - | ||||||||||||
| 820 | } never executed: end of block | 0 | ||||||||||||
| 821 | if (QWidget *w = cornerWidget(Qt::TopRightCorner)
| 0 | ||||||||||||
| 822 | QStyleOptionTabBarBase opt; | - | ||||||||||||
| 823 | QTabBarPrivate::initStyleBaseOption(&opt, tabBar(), w->size()); | - | ||||||||||||
| 824 | opt.rect.moveLeft(w->x() + opt.rect.x()); | - | ||||||||||||
| 825 | opt.rect.moveTop(w->y() + opt.rect.y()); | - | ||||||||||||
| 826 | p.drawPrimitive(QStyle::PE_FrameTabBarBase, opt); | - | ||||||||||||
| 827 | } never executed: end of block | 0 | ||||||||||||
| 828 | return; never executed: return; | 0 | ||||||||||||
| 829 | } | - | ||||||||||||
| 830 | QStylePainter p(this); | - | ||||||||||||
| 831 | - | |||||||||||||
| 832 | QStyleOptionTabWidgetFrame opt; | - | ||||||||||||
| 833 | initStyleOption(&opt); | - | ||||||||||||
| 834 | opt.rect = d->panelRect; | - | ||||||||||||
| 835 | p.drawPrimitive(QStyle::PE_FrameTabWidget, opt); | - | ||||||||||||
| 836 | } never executed: end of block | 0 | ||||||||||||
| 837 | QSize QTabWidget::iconSize() const | - | ||||||||||||
| 838 | { | - | ||||||||||||
| 839 | return never executed: d_func()->tabs->iconSize();return d_func()->tabs->iconSize();never executed: return d_func()->tabs->iconSize(); | 0 | ||||||||||||
| 840 | } | - | ||||||||||||
| 841 | - | |||||||||||||
| 842 | void QTabWidget::setIconSize(const QSize &size) | - | ||||||||||||
| 843 | { | - | ||||||||||||
| 844 | d_func()->tabs->setIconSize(size); | - | ||||||||||||
| 845 | } never executed: end of block | 0 | ||||||||||||
| 846 | Qt::TextElideMode QTabWidget::elideMode() const | - | ||||||||||||
| 847 | { | - | ||||||||||||
| 848 | return never executed: d_func()->tabs->elideMode();return d_func()->tabs->elideMode();never executed: return d_func()->tabs->elideMode(); | 0 | ||||||||||||
| 849 | } | - | ||||||||||||
| 850 | - | |||||||||||||
| 851 | void QTabWidget::setElideMode(Qt::TextElideMode mode) | - | ||||||||||||
| 852 | { | - | ||||||||||||
| 853 | d_func()->tabs->setElideMode(mode); | - | ||||||||||||
| 854 | } never executed: end of block | 0 | ||||||||||||
| 855 | bool QTabWidget::usesScrollButtons() const | - | ||||||||||||
| 856 | { | - | ||||||||||||
| 857 | return never executed: d_func()->tabs->usesScrollButtons();return d_func()->tabs->usesScrollButtons();never executed: return d_func()->tabs->usesScrollButtons(); | 0 | ||||||||||||
| 858 | } | - | ||||||||||||
| 859 | - | |||||||||||||
| 860 | void QTabWidget::setUsesScrollButtons(bool useButtons) | - | ||||||||||||
| 861 | { | - | ||||||||||||
| 862 | d_func()->tabs->setUsesScrollButtons(useButtons); | - | ||||||||||||
| 863 | } never executed: end of block | 0 | ||||||||||||
| 864 | bool QTabWidget::documentMode() const | - | ||||||||||||
| 865 | { | - | ||||||||||||
| 866 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 867 | return never executed: d->tabs->documentMode();return d->tabs->documentMode();never executed: return d->tabs->documentMode(); | 0 | ||||||||||||
| 868 | } | - | ||||||||||||
| 869 | - | |||||||||||||
| 870 | void QTabWidget::setDocumentMode(bool enabled) | - | ||||||||||||
| 871 | { | - | ||||||||||||
| 872 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 873 | d->tabs->setDocumentMode(enabled); | - | ||||||||||||
| 874 | d->tabs->setExpanding(!enabled); | - | ||||||||||||
| 875 | d->tabs->setDrawBase(enabled); | - | ||||||||||||
| 876 | setUpLayout(); | - | ||||||||||||
| 877 | } never executed: end of block | 0 | ||||||||||||
| 878 | bool QTabWidget::tabBarAutoHide() const | - | ||||||||||||
| 879 | { | - | ||||||||||||
| 880 | const QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 881 | return never executed: d->tabs->autoHide();return d->tabs->autoHide();never executed: return d->tabs->autoHide(); | 0 | ||||||||||||
| 882 | } | - | ||||||||||||
| 883 | - | |||||||||||||
| 884 | void QTabWidget::setTabBarAutoHide(bool enabled) | - | ||||||||||||
| 885 | { | - | ||||||||||||
| 886 | QTabWidgetPrivate * const d = d_func(); | - | ||||||||||||
| 887 | return never executed: d->tabs->setAutoHide(enabled);return d->tabs->setAutoHide(enabled);never executed: return d->tabs->setAutoHide(enabled); | 0 | ||||||||||||
| 888 | } | - | ||||||||||||
| 889 | - | |||||||||||||
| 890 | - | |||||||||||||
| 891 | - | |||||||||||||
| 892 | - | |||||||||||||
| 893 | - | |||||||||||||
| 894 | void QTabWidget::clear() | - | ||||||||||||
| 895 | { | - | ||||||||||||
| 896 | - | |||||||||||||
| 897 | while (count()
| 0 | ||||||||||||
| 898 | removeTab(0); never executed: removeTab(0); | 0 | ||||||||||||
| 899 | } never executed: end of block | 0 | ||||||||||||
| 900 | - | |||||||||||||
| 901 | - | |||||||||||||
| 902 | - | |||||||||||||
| Switch to Source code | Preprocessed file |