| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | QComboBoxPrivate::QComboBoxPrivate() | - |
| 16 | : QWidgetPrivate(), | - |
| 17 | model(0), | - |
| 18 | lineEdit(0), | - |
| 19 | container(0), | - |
| 20 | insertPolicy(QComboBox::InsertAtBottom), | - |
| 21 | sizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow), | - |
| 22 | minimumContentsLength(0), | - |
| 23 | shownOnce(false), | - |
| 24 | autoCompletion(true), | - |
| 25 | duplicatesEnabled(false), | - |
| 26 | frame(true), | - |
| 27 | maxVisibleItems(10), | - |
| 28 | maxCount(2147483647), | - |
| 29 | modelColumn(0), | - |
| 30 | inserting(false), | - |
| 31 | arrowState(QStyle::State_None), | - |
| 32 | hoverControl(QStyle::SC_None), | - |
| 33 | autoCompletionCaseSensitivity(Qt::CaseInsensitive), | - |
| 34 | indexBeforeChange(-1) | - |
| 35 | | - |
| 36 | , completer(0) | - |
| 37 | | - |
| 38 | { | - |
| 39 | } executed: }Execution Count:558 | 558 |
| 40 | | - |
| 41 | QStyleOptionMenuItem QComboMenuDelegate::getStyleOption(const QStyleOptionViewItem &option, | - |
| 42 | const QModelIndex &index) const | - |
| 43 | { | - |
| 44 | QStyleOptionMenuItem menuOption; | - |
| 45 | | - |
| 46 | QPalette resolvedpalette = option.palette.resolve(QApplication::palette("QMenu")); | - |
| 47 | QVariant value = index.data(Qt::ForegroundRole); | - |
| 48 | if (value.canConvert<QBrush>()) { never evaluated: value.canConvert<QBrush>() | 0 |
| 49 | resolvedpalette.setBrush(QPalette::WindowText, qvariant_cast<QBrush>(value)); | - |
| 50 | resolvedpalette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(value)); | - |
| 51 | resolvedpalette.setBrush(QPalette::Text, qvariant_cast<QBrush>(value)); | - |
| 52 | } | 0 |
| 53 | menuOption.palette = resolvedpalette; | - |
| 54 | menuOption.state = QStyle::State_None; | - |
| 55 | if (mCombo->window()->isActiveWindow()) never evaluated: mCombo->window()->isActiveWindow() | 0 |
| 56 | menuOption.state = QStyle::State_Active; never executed: menuOption.state = QStyle::State_Active; | 0 |
| 57 | if ((option.state & QStyle::State_Enabled) && (index.model()->flags(index) & Qt::ItemIsEnabled)) never evaluated: (option.state & QStyle::State_Enabled) never evaluated: (index.model()->flags(index) & Qt::ItemIsEnabled) | 0 |
| 58 | menuOption.state |= QStyle::State_Enabled; never executed: menuOption.state |= QStyle::State_Enabled; | 0 |
| 59 | else | - |
| 60 | menuOption.palette.setCurrentColorGroup(QPalette::Disabled); never executed: menuOption.palette.setCurrentColorGroup(QPalette::Disabled); | 0 |
| 61 | if (option.state & QStyle::State_Selected) never evaluated: option.state & QStyle::State_Selected | 0 |
| 62 | menuOption.state |= QStyle::State_Selected; never executed: menuOption.state |= QStyle::State_Selected; | 0 |
| 63 | menuOption.checkType = QStyleOptionMenuItem::NonExclusive; | - |
| 64 | menuOption.checked = mCombo->currentIndex() == index.row(); | - |
| 65 | if (QComboBoxDelegate::isSeparator(index)) never evaluated: QComboBoxDelegate::isSeparator(index) | 0 |
| 66 | menuOption.menuItemType = QStyleOptionMenuItem::Separator; never executed: menuOption.menuItemType = QStyleOptionMenuItem::Separator; | 0 |
| 67 | else | - |
| 68 | menuOption.menuItemType = QStyleOptionMenuItem::Normal; never executed: menuOption.menuItemType = QStyleOptionMenuItem::Normal; | 0 |
| 69 | | - |
| 70 | QVariant variant = index.model()->data(index, Qt::DecorationRole); | - |
| 71 | switch (variant.type()) { | - |
| 72 | case QVariant::Icon: | - |
| 73 | menuOption.icon = qvariant_cast<QIcon>(variant); | - |
| 74 | break; | 0 |
| 75 | case QVariant::Color: { | - |
| 76 | static QPixmap pixmap(option.decorationSize); | - |
| 77 | pixmap.fill(qvariant_cast<QColor>(variant)); | - |
| 78 | menuOption.icon = pixmap; | - |
| 79 | break; } | 0 |
| 80 | default: | - |
| 81 | menuOption.icon = qvariant_cast<QPixmap>(variant); | - |
| 82 | break; | 0 |
| 83 | } | - |
| 84 | if (index.data(Qt::BackgroundRole).canConvert<QBrush>()) { never evaluated: index.data(Qt::BackgroundRole).canConvert<QBrush>() | 0 |
| 85 | menuOption.palette.setBrush(QPalette::All, QPalette::Background, | - |
| 86 | qvariant_cast<QBrush>(index.data(Qt::BackgroundRole))); | - |
| 87 | } | 0 |
| 88 | menuOption.text = index.model()->data(index, Qt::DisplayRole).toString() | - |
| 89 | .replace(QLatin1Char('&'), QLatin1String("&&")); | - |
| 90 | menuOption.tabWidth = 0; | - |
| 91 | menuOption.maxIconWidth = option.decorationSize.width() + 4; | - |
| 92 | menuOption.menuRect = option.rect; | - |
| 93 | menuOption.rect = option.rect; | - |
| 94 | | - |
| 95 | | - |
| 96 | if (mCombo->testAttribute(Qt::WA_SetFont) never evaluated: mCombo->testAttribute(Qt::WA_SetFont) | 0 |
| 97 | || mCombo->testAttribute(Qt::WA_MacSmallSize) never evaluated: mCombo->testAttribute(Qt::WA_MacSmallSize) | 0 |
| 98 | || mCombo->testAttribute(Qt::WA_MacMiniSize) never evaluated: mCombo->testAttribute(Qt::WA_MacMiniSize) | 0 |
| 99 | || mCombo->font() != qt_app_fonts_hash()->value("QComboBox", QFont())) never evaluated: mCombo->font() != qt_app_fonts_hash()->value("QComboBox", QFont()) | 0 |
| 100 | menuOption.font = mCombo->font(); never executed: menuOption.font = mCombo->font(); | 0 |
| 101 | else | - |
| 102 | menuOption.font = qt_app_fonts_hash()->value("QComboMenuItem", mCombo->font()); never executed: menuOption.font = qt_app_fonts_hash()->value("QComboMenuItem", mCombo->font()); | 0 |
| 103 | | - |
| 104 | menuOption.fontMetrics = QFontMetrics(menuOption.font); | - |
| 105 | | - |
| 106 | return menuOption; never executed: return menuOption; | 0 |
| 107 | } | - |
| 108 | void QComboBoxPrivate::updateArrow(QStyle::StateFlag state) | - |
| 109 | { | - |
| 110 | QComboBox * const q = q_func(); | - |
| 111 | if (arrowState == state) partially evaluated: arrowState == state| yes Evaluation Count:133 | no Evaluation Count:0 |
| 0-133 |
| 112 | return; executed: return;Execution Count:133 | 133 |
| 113 | arrowState = state; | - |
| 114 | QStyleOptionComboBox opt; | - |
| 115 | q->initStyleOption(&opt); | - |
| 116 | q->update(q->style()->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, q)); | - |
| 117 | } | 0 |
| 118 | | - |
| 119 | void QComboBoxPrivate::_q_modelReset() | - |
| 120 | { | - |
| 121 | QComboBox * const q = q_func(); | - |
| 122 | if (lineEdit) { never evaluated: lineEdit | 0 |
| 123 | lineEdit->setText(QString()); | - |
| 124 | updateLineEditGeometry(); | - |
| 125 | } | 0 |
| 126 | if (currentIndex.row() != indexBeforeChange) never evaluated: currentIndex.row() != indexBeforeChange | 0 |
| 127 | _q_emitCurrentIndexChanged(currentIndex); never executed: _q_emitCurrentIndexChanged(currentIndex); | 0 |
| 128 | q->update(); | - |
| 129 | } | 0 |
| 130 | | - |
| 131 | void QComboBoxPrivate::_q_modelDestroyed() | - |
| 132 | { | - |
| 133 | model = QAbstractItemModelPrivate::staticEmptyModel(); | - |
| 134 | } | 0 |
| 135 | | - |
| 136 | | - |
| 137 | | - |
| 138 | QRect QComboBoxPrivate::popupGeometry(int screen) const | - |
| 139 | { | - |
| 140 | bool useFullScreenForPopupMenu = false; | - |
| 141 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) partially evaluated: const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 142 | useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool(); executed: useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool();Execution Count:1 | 1 |
| 143 | return useFullScreenForPopupMenu ? | 1 |
| 144 | QApplication::desktop()->screenGeometry(screen) : | 1 |
| 145 | QApplication::desktop()->availableGeometry(screen); executed: return useFullScreenForPopupMenu ? QApplication::desktop()->screenGeometry(screen) : QApplication::desktop()->availableGeometry(screen);Execution Count:1 | 1 |
| 146 | } | - |
| 147 | | - |
| 148 | bool QComboBoxPrivate::updateHoverControl(const QPoint &pos) | - |
| 149 | { | - |
| 150 | | - |
| 151 | QComboBox * const q = q_func(); | - |
| 152 | QRect lastHoverRect = hoverRect; | - |
| 153 | QStyle::SubControl lastHoverControl = hoverControl; | - |
| 154 | bool doesHover = q->testAttribute(Qt::WA_Hover); | - |
| 155 | if (lastHoverControl != newHoverControl(pos) && doesHover) { never evaluated: lastHoverControl != newHoverControl(pos) never evaluated: doesHover | 0 |
| 156 | q->update(lastHoverRect); | - |
| 157 | q->update(hoverRect); | - |
| 158 | return true; never executed: return true; | 0 |
| 159 | } | - |
| 160 | return !doesHover; never executed: return !doesHover; | 0 |
| 161 | } | - |
| 162 | | - |
| 163 | QStyle::SubControl QComboBoxPrivate::newHoverControl(const QPoint &pos) | - |
| 164 | { | - |
| 165 | QComboBox * const q = q_func(); | - |
| 166 | QStyleOptionComboBox opt; | - |
| 167 | q->initStyleOption(&opt); | - |
| 168 | opt.subControls = QStyle::SC_All; | - |
| 169 | hoverControl = q->style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, pos, q); | - |
| 170 | hoverRect = (hoverControl != QStyle::SC_None) never evaluated: (hoverControl != QStyle::SC_None) | 0 |
| 171 | ? q->style()->subControlRect(QStyle::CC_ComboBox, &opt, hoverControl, q) | - |
| 172 | : QRect(); | - |
| 173 | return hoverControl; never executed: return hoverControl; | 0 |
| 174 | } | - |
| 175 | | - |
| 176 | | - |
| 177 | | - |
| 178 | | - |
| 179 | | - |
| 180 | int QComboBoxPrivate::computeWidthHint() const | - |
| 181 | { | - |
| 182 | const QComboBox * const q = q_func(); | - |
| 183 | | - |
| 184 | int width = 0; | - |
| 185 | const int count = q->count(); | - |
| 186 | const int iconWidth = q->iconSize().width() + 4; | - |
| 187 | const QFontMetrics &fontMetrics = q->fontMetrics(); | - |
| 188 | | - |
| 189 | for (int i = 0; i < count; ++i) { never evaluated: i < count | 0 |
| 190 | const int textWidth = fontMetrics.width(q->itemText(i)); | - |
| 191 | if (q->itemIcon(i).isNull()) never evaluated: q->itemIcon(i).isNull() | 0 |
| 192 | width = (qMax(width, textWidth)); never executed: width = (qMax(width, textWidth)); | 0 |
| 193 | else | - |
| 194 | width = (qMax(width, textWidth + iconWidth)); never executed: width = (qMax(width, textWidth + iconWidth)); | 0 |
| 195 | } | - |
| 196 | | - |
| 197 | QStyleOptionComboBox opt; | - |
| 198 | q->initStyleOption(&opt); | - |
| 199 | QSize tmp(width, 0); | - |
| 200 | tmp = q->style()->sizeFromContents(QStyle::CT_ComboBox, &opt, tmp, q); | - |
| 201 | return tmp.width(); never executed: return tmp.width(); | 0 |
| 202 | } | - |
| 203 | | - |
| 204 | QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const | - |
| 205 | { | - |
| 206 | const QComboBox * const q = q_func(); | - |
| 207 | if (!sh.isValid()) { evaluated: !sh.isValid()| yes Evaluation Count:995 | yes Evaluation Count:196 |
| 196-995 |
| 208 | bool hasIcon = sizeAdjustPolicy == QComboBox::AdjustToMinimumContentsLengthWithIcon ? true : false; partially evaluated: sizeAdjustPolicy == QComboBox::AdjustToMinimumContentsLengthWithIcon| no Evaluation Count:0 | yes Evaluation Count:995 |
| 0-995 |
| 209 | int count = q->count(); | - |
| 210 | QSize iconSize = q->iconSize(); | - |
| 211 | const QFontMetrics &fm = q->fontMetrics(); | - |
| 212 | | - |
| 213 | | - |
| 214 | if (&sh == &sizeHint || minimumContentsLength == 0) { evaluated: &sh == &sizeHint| yes Evaluation Count:598 | yes Evaluation Count:397 |
partially evaluated: minimumContentsLength == 0| yes Evaluation Count:397 | no Evaluation Count:0 |
| 0-598 |
| 215 | switch (sizeAdjustPolicy) { | - |
| 216 | case QComboBox::AdjustToContents: | - |
| 217 | case QComboBox::AdjustToContentsOnFirstShow: | - |
| 218 | if (count == 0) { evaluated: count == 0| yes Evaluation Count:170 | yes Evaluation Count:447 |
| 170-447 |
| 219 | sh.rwidth() = 7 * fm.width(QLatin1Char('x')); | - |
| 220 | } else { executed: }Execution Count:170 | 170 |
| 221 | for (int i = 0; i < count; ++i) { evaluated: i < count| yes Evaluation Count:674 | yes Evaluation Count:447 |
| 447-674 |
| 222 | if (!q->itemIcon(i).isNull()) { evaluated: !q->itemIcon(i).isNull()| yes Evaluation Count:414 | yes Evaluation Count:260 |
| 260-414 |
| 223 | hasIcon = true; | - |
| 224 | sh.setWidth(qMax(sh.width(), fm.boundingRect(q->itemText(i)).width() + iconSize.width() + 4)); | - |
| 225 | } else { executed: }Execution Count:414 | 414 |
| 226 | sh.setWidth(qMax(sh.width(), fm.boundingRect(q->itemText(i)).width())); | - |
| 227 | } executed: }Execution Count:260 | 260 |
| 228 | } | - |
| 229 | } executed: }Execution Count:447 | 447 |
| 230 | break; executed: break;Execution Count:617 | 617 |
| 231 | case QComboBox::AdjustToMinimumContentsLength: | - |
| 232 | for (int i = 0; i < count && !hasIcon; ++i) evaluated: i < count| yes Evaluation Count:378 | yes Evaluation Count:378 |
partially evaluated: !hasIcon| yes Evaluation Count:378 | no Evaluation Count:0 |
| 0-378 |
| 233 | hasIcon = !q->itemIcon(i).isNull(); executed: hasIcon = !q->itemIcon(i).isNull();Execution Count:378 | 378 |
| 234 | default: code before this statement executed: default:Execution Count:378 | 378 |
| 235 | ; | - |
| 236 | } executed: }Execution Count:378 | 378 |
| 237 | } else { executed: }Execution Count:995 | 995 |
| 238 | for (int i = 0; i < count && !hasIcon; ++i) never evaluated: i < count never evaluated: !hasIcon | 0 |
| 239 | hasIcon = !q->itemIcon(i).isNull(); never executed: hasIcon = !q->itemIcon(i).isNull(); | 0 |
| 240 | } | 0 |
| 241 | if (minimumContentsLength > 0) partially evaluated: minimumContentsLength > 0| no Evaluation Count:0 | yes Evaluation Count:995 |
| 0-995 |
| 242 | sh.setWidth(qMax(sh.width(), minimumContentsLength * fm.width(QLatin1Char('X')) + (hasIcon ? iconSize.width() + 4 : 0))); never executed: sh.setWidth(qMax(sh.width(), minimumContentsLength * fm.width(QLatin1Char('X')) + (hasIcon ? iconSize.width() + 4 : 0))); | 0 |
| 243 | | - |
| 244 | | - |
| 245 | | - |
| 246 | sh.setHeight(qMax(qCeil(QFontMetricsF(fm).height()), 14) + 2); | - |
| 247 | if (hasIcon) { evaluated: hasIcon| yes Evaluation Count:414 | yes Evaluation Count:581 |
| 414-581 |
| 248 | sh.setHeight(qMax(sh.height(), iconSize.height() + 2)); | - |
| 249 | } executed: }Execution Count:414 | 414 |
| 250 | | - |
| 251 | | - |
| 252 | QStyleOptionComboBox opt; | - |
| 253 | q->initStyleOption(&opt); | - |
| 254 | sh = q->style()->sizeFromContents(QStyle::CT_ComboBox, &opt, sh, q); | - |
| 255 | } executed: }Execution Count:995 | 995 |
| 256 | return sh.expandedTo(QApplication::globalStrut()); executed: return sh.expandedTo(QApplication::globalStrut());Execution Count:1191 | 1191 |
| 257 | } | - |
| 258 | | - |
| 259 | void QComboBoxPrivate::adjustComboBoxSize() | - |
| 260 | { | - |
| 261 | viewContainer()->adjustSizeTimer.start(20, container); | - |
| 262 | } executed: }Execution Count:189 | 189 |
| 263 | | - |
| 264 | void QComboBoxPrivate::updateLayoutDirection() | - |
| 265 | { | - |
| 266 | const QComboBox * const q = q_func(); | - |
| 267 | QStyleOptionComboBox opt; | - |
| 268 | q->initStyleOption(&opt); | - |
| 269 | Qt::LayoutDirection dir = Qt::LayoutDirection( | - |
| 270 | q->style()->styleHint(QStyle::SH_ComboBox_LayoutDirection, &opt, q)); | - |
| 271 | if (lineEdit) evaluated: lineEdit| yes Evaluation Count:152 | yes Evaluation Count:339 |
| 152-339 |
| 272 | lineEdit->setLayoutDirection(dir); executed: lineEdit->setLayoutDirection(dir);Execution Count:152 | 152 |
| 273 | if (container) partially evaluated: container| yes Evaluation Count:491 | no Evaluation Count:0 |
| 0-491 |
| 274 | container->setLayoutDirection(dir); executed: container->setLayoutDirection(dir);Execution Count:491 | 491 |
| 275 | } executed: }Execution Count:491 | 491 |
| 276 | | - |
| 277 | | - |
| 278 | void QComboBoxPrivateContainer::timerEvent(QTimerEvent *timerEvent) | - |
| 279 | { | - |
| 280 | if (timerEvent->timerId() == adjustSizeTimer.timerId()) { never evaluated: timerEvent->timerId() == adjustSizeTimer.timerId() | 0 |
| 281 | adjustSizeTimer.stop(); | - |
| 282 | if (combo->sizeAdjustPolicy() == QComboBox::AdjustToContents) { never evaluated: combo->sizeAdjustPolicy() == QComboBox::AdjustToContents | 0 |
| 283 | combo->updateGeometry(); | - |
| 284 | combo->adjustSize(); | - |
| 285 | combo->update(); | - |
| 286 | } | 0 |
| 287 | } | 0 |
| 288 | } | 0 |
| 289 | | - |
| 290 | void QComboBoxPrivateContainer::resizeEvent(QResizeEvent *e) | - |
| 291 | { | - |
| 292 | QStyleOptionComboBox opt = comboStyleOption(); | - |
| 293 | if (combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo)) { partially evaluated: combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo)| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 294 | QStyleOption myOpt; | - |
| 295 | myOpt.initFrom(this); | - |
| 296 | QStyleHintReturnMask mask; | - |
| 297 | if (combo->style()->styleHint(QStyle::SH_Menu_Mask, &myOpt, this, &mask)) { never evaluated: combo->style()->styleHint(QStyle::SH_Menu_Mask, &myOpt, this, &mask) | 0 |
| 298 | setMask(mask.region); | - |
| 299 | } | 0 |
| 300 | } else { | 0 |
| 301 | clearMask(); | - |
| 302 | } executed: }Execution Count:1 | 1 |
| 303 | QFrame::resizeEvent(e); | - |
| 304 | } executed: }Execution Count:1 | 1 |
| 305 | | - |
| 306 | void QComboBoxPrivateContainer::leaveEvent(QEvent *) | - |
| 307 | { | - |
| 308 | | - |
| 309 | | - |
| 310 | | - |
| 311 | | - |
| 312 | | - |
| 313 | | - |
| 314 | | - |
| 315 | } | - |
| 316 | | - |
| 317 | QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView, QComboBox *parent) | - |
| 318 | : QFrame(parent, Qt::Popup), combo(parent), view(0), top(0), bottom(0) | - |
| 319 | { | - |
| 320 | | - |
| 321 | qt_noop(); | - |
| 322 | qt_noop(); | - |
| 323 | | - |
| 324 | setAttribute(Qt::WA_WindowPropagation); | - |
| 325 | setAttribute(Qt::WA_X11NetWmWindowTypeCombo); | - |
| 326 | | - |
| 327 | | - |
| 328 | blockMouseReleaseTimer.setSingleShot(true); | - |
| 329 | | - |
| 330 | | - |
| 331 | QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this); | - |
| 332 | layout->setSpacing(0); | - |
| 333 | layout->setMargin(0); | - |
| 334 | | - |
| 335 | | - |
| 336 | setItemView(itemView); | - |
| 337 | | - |
| 338 | | - |
| 339 | QStyleOptionComboBox opt = comboStyleOption(); | - |
| 340 | const bool usePopup = combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo); | - |
| 341 | if (usePopup) { partially evaluated: usePopup| no Evaluation Count:0 | yes Evaluation Count:339 |
| 0-339 |
| 342 | top = new QComboBoxPrivateScroller(QAbstractSlider::SliderSingleStepSub, this); | - |
| 343 | bottom = new QComboBoxPrivateScroller(QAbstractSlider::SliderSingleStepAdd, this); | - |
| 344 | top->hide(); | - |
| 345 | bottom->hide(); | - |
| 346 | } else { | 0 |
| 347 | setLineWidth(1); | - |
| 348 | } executed: }Execution Count:339 | 339 |
| 349 | | - |
| 350 | setFrameStyle(combo->style()->styleHint(QStyle::SH_ComboBox_PopupFrameStyle, &opt, combo)); | - |
| 351 | | - |
| 352 | if (top) { partially evaluated: top| no Evaluation Count:0 | yes Evaluation Count:339 |
| 0-339 |
| 353 | layout->insertWidget(0, top); | - |
| 354 | connect(top, "2""doScroll(int)", this, "1""scrollItemView(int)"); | - |
| 355 | } | 0 |
| 356 | if (bottom) { partially evaluated: bottom| no Evaluation Count:0 | yes Evaluation Count:339 |
| 0-339 |
| 357 | layout->addWidget(bottom); | - |
| 358 | connect(bottom, "2""doScroll(int)", this, "1""scrollItemView(int)"); | - |
| 359 | } | 0 |
| 360 | | - |
| 361 | | - |
| 362 | layout->insertSpacing(0, 0); | - |
| 363 | layout->addSpacing(0); | - |
| 364 | updateTopBottomMargin(); | - |
| 365 | } executed: }Execution Count:339 | 339 |
| 366 | | - |
| 367 | void QComboBoxPrivateContainer::scrollItemView(int action) | - |
| 368 | { | - |
| 369 | | - |
| 370 | if (view->verticalScrollBar()) never evaluated: view->verticalScrollBar() | 0 |
| 371 | view->verticalScrollBar()->triggerAction(static_cast<QAbstractSlider::SliderAction>(action)); never executed: view->verticalScrollBar()->triggerAction(static_cast<QAbstractSlider::SliderAction>(action)); | 0 |
| 372 | | - |
| 373 | } | 0 |
| 374 | | - |
| 375 | | - |
| 376 | | - |
| 377 | | - |
| 378 | void QComboBoxPrivateContainer::updateScrollers() | - |
| 379 | { | - |
| 380 | | - |
| 381 | if (!top || !bottom) partially evaluated: !top| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 382 | return; executed: return;Execution Count:1 | 1 |
| 383 | | - |
| 384 | if (isVisible() == false) never evaluated: isVisible() == false | 0 |
| 385 | return; | 0 |
| 386 | | - |
| 387 | QStyleOptionComboBox opt = comboStyleOption(); | - |
| 388 | if (combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo) && never evaluated: combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo) | 0 |
| 389 | view->verticalScrollBar()->minimum() < view->verticalScrollBar()->maximum()) { never evaluated: view->verticalScrollBar()->minimum() < view->verticalScrollBar()->maximum() | 0 |
| 390 | | - |
| 391 | bool needTop = view->verticalScrollBar()->value() | - |
| 392 | > (view->verticalScrollBar()->minimum() + spacing()); | - |
| 393 | bool needBottom = view->verticalScrollBar()->value() | - |
| 394 | < (view->verticalScrollBar()->maximum() - spacing()*2); | - |
| 395 | if (needTop) | 0 |
| 396 | top->show(); never executed: top->show(); | 0 |
| 397 | else | - |
| 398 | top->hide(); never executed: top->hide(); | 0 |
| 399 | if (needBottom) never evaluated: needBottom | 0 |
| 400 | bottom->show(); never executed: bottom->show(); | 0 |
| 401 | else | - |
| 402 | bottom->hide(); never executed: bottom->hide(); | 0 |
| 403 | } else { | - |
| 404 | top->hide(); | - |
| 405 | bottom->hide(); | - |
| 406 | } | 0 |
| 407 | | - |
| 408 | } | - |
| 409 | | - |
| 410 | | - |
| 411 | | - |
| 412 | | - |
| 413 | void QComboBoxPrivateContainer::viewDestroyed() | - |
| 414 | { | - |
| 415 | view = 0; | - |
| 416 | setItemView(new QComboBoxListView()); | - |
| 417 | } | 0 |
| 418 | | - |
| 419 | | - |
| 420 | | - |
| 421 | | - |
| 422 | QAbstractItemView *QComboBoxPrivateContainer::itemView() const | - |
| 423 | { | - |
| 424 | return view; executed: return view;Execution Count:3409 | 3409 |
| 425 | } | - |
| 426 | | - |
| 427 | | - |
| 428 | | - |
| 429 | | - |
| 430 | void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView) | - |
| 431 | { | - |
| 432 | qt_noop(); | - |
| 433 | | - |
| 434 | | - |
| 435 | if (view) { partially evaluated: view| no Evaluation Count:0 | yes Evaluation Count:339 |
| 0-339 |
| 436 | view->removeEventFilter(this); | - |
| 437 | view->viewport()->removeEventFilter(this); | - |
| 438 | | - |
| 439 | disconnect(view->verticalScrollBar(), "2""valueChanged(int)", | - |
| 440 | this, "1""updateScrollers()"); | - |
| 441 | disconnect(view->verticalScrollBar(), "2""rangeChanged(int,int)", | - |
| 442 | this, "1""updateScrollers()"); | - |
| 443 | | - |
| 444 | disconnect(view, "2""destroyed()", | - |
| 445 | this, "1""viewDestroyed()"); | - |
| 446 | | - |
| 447 | delete view; | - |
| 448 | view = 0; | - |
| 449 | } | 0 |
| 450 | | - |
| 451 | | - |
| 452 | view = itemView; | - |
| 453 | view->setParent(this); | - |
| 454 | view->setAttribute(Qt::WA_MacShowFocusRect, false); | - |
| 455 | qobject_cast<QBoxLayout*>(layout())->insertWidget(top ? 2 : 0, view); | - |
| 456 | view->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); | - |
| 457 | view->installEventFilter(this); | - |
| 458 | view->viewport()->installEventFilter(this); | - |
| 459 | view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | - |
| 460 | QStyleOptionComboBox opt = comboStyleOption(); | - |
| 461 | const bool usePopup = combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo); | - |
| 462 | | - |
| 463 | if (usePopup) partially evaluated: usePopup| no Evaluation Count:0 | yes Evaluation Count:339 |
| 0-339 |
| 464 | view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); never executed: view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | 0 |
| 465 | | - |
| 466 | if (combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) || partially evaluated: combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo)| yes Evaluation Count:339 | no Evaluation Count:0 |
| 0-339 |
| 467 | usePopup) { never evaluated: usePopup | 0 |
| 468 | view->setMouseTracking(true); | - |
| 469 | } executed: }Execution Count:339 | 339 |
| 470 | view->setSelectionMode(QAbstractItemView::SingleSelection); | - |
| 471 | view->setFrameStyle(QFrame::NoFrame); | - |
| 472 | view->setLineWidth(0); | - |
| 473 | view->setEditTriggers(QAbstractItemView::NoEditTriggers); | - |
| 474 | | - |
| 475 | connect(view->verticalScrollBar(), "2""valueChanged(int)", | - |
| 476 | this, "1""updateScrollers()"); | - |
| 477 | connect(view->verticalScrollBar(), "2""rangeChanged(int,int)", | - |
| 478 | this, "1""updateScrollers()"); | - |
| 479 | | - |
| 480 | connect(view, "2""destroyed()", | - |
| 481 | this, "1""viewDestroyed()"); | - |
| 482 | } executed: }Execution Count:339 | 339 |
| 483 | | - |
| 484 | | - |
| 485 | | - |
| 486 | | - |
| 487 | int QComboBoxPrivateContainer::spacing() const | - |
| 488 | { | - |
| 489 | QListView *lview = qobject_cast<QListView*>(view); | - |
| 490 | if (lview) partially evaluated: lview| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 491 | return lview->spacing(); executed: return lview->spacing();Execution Count:4 | 4 |
| 492 | | - |
| 493 | QTableView *tview = qobject_cast<QTableView*>(view); | - |
| 494 | if (tview) | 0 |
| 495 | return tview->showGrid() ? 1 : 0; never executed: return tview->showGrid() ? 1 : 0; | 0 |
| 496 | | - |
| 497 | return 0; never executed: return 0; | 0 |
| 498 | } | - |
| 499 | | - |
| 500 | void QComboBoxPrivateContainer::updateTopBottomMargin() | - |
| 501 | { | - |
| 502 | if (!layout() || layout()->count() < 1) partially evaluated: !layout()| no Evaluation Count:0 | yes Evaluation Count:489 |
partially evaluated: layout()->count() < 1| no Evaluation Count:0 | yes Evaluation Count:489 |
| 0-489 |
| 503 | return; | 0 |
| 504 | | - |
| 505 | QBoxLayout *boxLayout = qobject_cast<QBoxLayout *>(layout()); | - |
| 506 | if (!boxLayout) partially evaluated: !boxLayout| no Evaluation Count:0 | yes Evaluation Count:489 |
| 0-489 |
| 507 | return; | 0 |
| 508 | | - |
| 509 | const QStyleOptionComboBox opt = comboStyleOption(); | - |
| 510 | const bool usePopup = combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo); | - |
| 511 | const int margin = usePopup ? combo->style()->pixelMetric(QStyle::PM_MenuVMargin, &opt, combo) : 0; partially evaluated: usePopup| no Evaluation Count:0 | yes Evaluation Count:489 |
| 0-489 |
| 512 | | - |
| 513 | QSpacerItem *topSpacer = boxLayout->itemAt(0)->spacerItem(); | - |
| 514 | if (topSpacer) partially evaluated: topSpacer| yes Evaluation Count:489 | no Evaluation Count:0 |
| 0-489 |
| 515 | topSpacer->changeSize(0, margin, QSizePolicy::Minimum, QSizePolicy::Fixed); executed: topSpacer->changeSize(0, margin, QSizePolicy::Minimum, QSizePolicy::Fixed);Execution Count:489 | 489 |
| 516 | | - |
| 517 | QSpacerItem *bottomSpacer = boxLayout->itemAt(boxLayout->count() - 1)->spacerItem(); | - |
| 518 | if (bottomSpacer && bottomSpacer != topSpacer) partially evaluated: bottomSpacer| yes Evaluation Count:489 | no Evaluation Count:0 |
partially evaluated: bottomSpacer != topSpacer| yes Evaluation Count:489 | no Evaluation Count:0 |
| 0-489 |
| 519 | bottomSpacer->changeSize(0, margin, QSizePolicy::Minimum, QSizePolicy::Fixed); executed: bottomSpacer->changeSize(0, margin, QSizePolicy::Minimum, QSizePolicy::Fixed);Execution Count:489 | 489 |
| 520 | | - |
| 521 | boxLayout->invalidate(); | - |
| 522 | } executed: }Execution Count:489 | 489 |
| 523 | | - |
| 524 | void QComboBoxPrivateContainer::changeEvent(QEvent *e) | - |
| 525 | { | - |
| 526 | if (e->type() == QEvent::StyleChange) { evaluated: e->type() == QEvent::StyleChange| yes Evaluation Count:2 | yes Evaluation Count:361 |
| 2-361 |
| 527 | QStyleOptionComboBox opt = comboStyleOption(); | - |
| 528 | view->setMouseTracking(combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) || | - |
| 529 | combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo)); | - |
| 530 | setFrameStyle(combo->style()->styleHint(QStyle::SH_ComboBox_PopupFrameStyle, &opt, combo)); | - |
| 531 | } executed: }Execution Count:2 | 2 |
| 532 | | - |
| 533 | QWidget::changeEvent(e); | - |
| 534 | } executed: }Execution Count:363 | 363 |
| 535 | | - |
| 536 | | - |
| 537 | bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e) | - |
| 538 | { | - |
| 539 | switch (e->type()) { | - |
| 540 | case QEvent::ShortcutOverride: | - |
| 541 | switch (static_cast<QKeyEvent*>(e)->key()) { | - |
| 542 | case Qt::Key_Enter: | - |
| 543 | case Qt::Key_Return: | - |
| 544 | | - |
| 545 | | - |
| 546 | | - |
| 547 | if (view->currentIndex().isValid() && (view->currentIndex().flags() & Qt::ItemIsEnabled) ) { never evaluated: view->currentIndex().isValid() never evaluated: (view->currentIndex().flags() & Qt::ItemIsEnabled) | 0 |
| 548 | combo->hidePopup(); | - |
| 549 | itemSelected(view->currentIndex()); | - |
| 550 | } | 0 |
| 551 | return true; never executed: return true; | 0 |
| 552 | case Qt::Key_Down: | - |
| 553 | if (!(static_cast<QKeyEvent*>(e)->modifiers() & Qt::AltModifier)) never evaluated: !(static_cast<QKeyEvent*>(e)->modifiers() & Qt::AltModifier) | 0 |
| 554 | break; | 0 |
| 555 | | - |
| 556 | case Qt::Key_F4: code before this statement never executed: case Qt::Key_F4: | 0 |
| 557 | case Qt::Key_Escape: | - |
| 558 | combo->hidePopup(); | - |
| 559 | return true; never executed: return true; | 0 |
| 560 | default: | - |
| 561 | break; | 0 |
| 562 | } | - |
| 563 | break; | 0 |
| 564 | case QEvent::MouseMove: | - |
| 565 | if (isVisible()) { never evaluated: isVisible() | 0 |
| 566 | QMouseEvent *m = static_cast<QMouseEvent *>(e); | - |
| 567 | QWidget *widget = static_cast<QWidget *>(o); | - |
| 568 | QPoint vector = widget->mapToGlobal(m->pos()) - initialClickPosition; | - |
| 569 | if (vector.manhattanLength() > 9 && blockMouseReleaseTimer.isActive()) never evaluated: vector.manhattanLength() > 9 never evaluated: blockMouseReleaseTimer.isActive() | 0 |
| 570 | blockMouseReleaseTimer.stop(); never executed: blockMouseReleaseTimer.stop(); | 0 |
| 571 | QModelIndex indexUnderMouse = view->indexAt(m->pos()); | - |
| 572 | if (indexUnderMouse.isValid() never evaluated: indexUnderMouse.isValid() | 0 |
| 573 | && !QComboBoxDelegate::isSeparator(indexUnderMouse)) { never evaluated: !QComboBoxDelegate::isSeparator(indexUnderMouse) | 0 |
| 574 | view->setCurrentIndex(indexUnderMouse); | - |
| 575 | } | 0 |
| 576 | } | 0 |
| 577 | break; | 0 |
| 578 | case QEvent::MouseButtonRelease: { | - |
| 579 | QMouseEvent *m = static_cast<QMouseEvent *>(e); | - |
| 580 | if (isVisible() && view->rect().contains(m->pos()) && view->currentIndex().isValid() never evaluated: isVisible() never evaluated: view->rect().contains(m->pos()) never evaluated: view->currentIndex().isValid() | 0 |
| 581 | && !blockMouseReleaseTimer.isActive() never evaluated: !blockMouseReleaseTimer.isActive() | 0 |
| 582 | && (view->currentIndex().flags() & Qt::ItemIsEnabled) never evaluated: (view->currentIndex().flags() & Qt::ItemIsEnabled) | 0 |
| 583 | && (view->currentIndex().flags() & Qt::ItemIsSelectable)) { never evaluated: (view->currentIndex().flags() & Qt::ItemIsSelectable) | 0 |
| 584 | combo->hidePopup(); | - |
| 585 | itemSelected(view->currentIndex()); | - |
| 586 | return true; never executed: return true; | 0 |
| 587 | } | - |
| 588 | break; | 0 |
| 589 | } | - |
| 590 | default: | - |
| 591 | break; executed: break;Execution Count:4192 | 4192 |
| 592 | } | - |
| 593 | return QFrame::eventFilter(o, e); executed: return QFrame::eventFilter(o, e);Execution Count:4192 | 4192 |
| 594 | } | - |
| 595 | | - |
| 596 | void QComboBoxPrivateContainer::showEvent(QShowEvent *) | - |
| 597 | { | - |
| 598 | combo->update(); | - |
| 599 | } executed: }Execution Count:1 | 1 |
| 600 | | - |
| 601 | void QComboBoxPrivateContainer::hideEvent(QHideEvent *) | - |
| 602 | { | - |
| 603 | resetButton(); | - |
| 604 | combo->update(); | - |
| 605 | | - |
| 606 | | - |
| 607 | | - |
| 608 | | - |
| 609 | if (QGraphicsProxyWidget *proxy = graphicsProxyWidget()) never evaluated: QGraphicsProxyWidget *proxy = graphicsProxyWidget() | 0 |
| 610 | proxy->hide(); never executed: proxy->hide(); | 0 |
| 611 | | - |
| 612 | } | 0 |
| 613 | | - |
| 614 | void QComboBoxPrivateContainer::mousePressEvent(QMouseEvent *e) | - |
| 615 | { | - |
| 616 | | - |
| 617 | QStyleOptionComboBox opt = comboStyleOption(); | - |
| 618 | opt.subControls = QStyle::SC_All; | - |
| 619 | opt.activeSubControls = QStyle::SC_ComboBoxArrow; | - |
| 620 | QStyle::SubControl sc = combo->style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, | - |
| 621 | combo->mapFromGlobal(e->globalPos()), | - |
| 622 | combo); | - |
| 623 | if ((combo->isEditable() && sc == QStyle::SC_ComboBoxArrow) never evaluated: combo->isEditable() never evaluated: sc == QStyle::SC_ComboBoxArrow | 0 |
| 624 | || (!combo->isEditable() && sc != QStyle::SC_None)) never evaluated: !combo->isEditable() never evaluated: sc != QStyle::SC_None | 0 |
| 625 | setAttribute(Qt::WA_NoMouseReplay); never executed: setAttribute(Qt::WA_NoMouseReplay); | 0 |
| 626 | combo->hidePopup(); | - |
| 627 | } | 0 |
| 628 | | - |
| 629 | void QComboBoxPrivateContainer::mouseReleaseEvent(QMouseEvent *e) | - |
| 630 | { | - |
| 631 | (void)e;; | - |
| 632 | if (!blockMouseReleaseTimer.isActive()){ never evaluated: !blockMouseReleaseTimer.isActive() | 0 |
| 633 | combo->hidePopup(); | - |
| 634 | resetButton(); | - |
| 635 | } | 0 |
| 636 | } | 0 |
| 637 | | - |
| 638 | QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const | - |
| 639 | { | - |
| 640 | | - |
| 641 | | - |
| 642 | QStyleOptionComboBox opt; | - |
| 643 | opt.initFrom(combo); | - |
| 644 | opt.subControls = QStyle::SC_All; | - |
| 645 | opt.activeSubControls = QStyle::SC_None; | - |
| 646 | opt.editable = combo->isEditable(); | - |
| 647 | return opt; executed: return opt;Execution Count:1170 | 1170 |
| 648 | } | - |
| 649 | QComboBox::QComboBox(QWidget *parent) | - |
| 650 | : QWidget(*new QComboBoxPrivate(), parent, 0) | - |
| 651 | { | - |
| 652 | QComboBoxPrivate * const d = d_func(); | - |
| 653 | d->init(); | - |
| 654 | } executed: }Execution Count:418 | 418 |
| 655 | | - |
| 656 | | - |
| 657 | | - |
| 658 | | - |
| 659 | QComboBox::QComboBox(QComboBoxPrivate &dd, QWidget *parent) | - |
| 660 | : QWidget(dd, parent, 0) | - |
| 661 | { | - |
| 662 | QComboBoxPrivate * const d = d_func(); | - |
| 663 | d->init(); | - |
| 664 | } executed: }Execution Count:140 | 140 |
| 665 | void QComboBoxPrivate::init() | - |
| 666 | { | - |
| 667 | QComboBox * const q = q_func(); | - |
| 668 | q->setFocusPolicy(Qt::WheelFocus); | - |
| 669 | | - |
| 670 | q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed, | - |
| 671 | QSizePolicy::ComboBox)); | - |
| 672 | setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem); | - |
| 673 | q->setModel(new QStandardItemModel(0, 1, q)); | - |
| 674 | if (!q->isEditable()) partially evaluated: !q->isEditable()| yes Evaluation Count:558 | no Evaluation Count:0 |
| 0-558 |
| 675 | q->setAttribute(Qt::WA_InputMethodEnabled, false); executed: q->setAttribute(Qt::WA_InputMethodEnabled, false);Execution Count:558 | 558 |
| 676 | else | - |
| 677 | q->setAttribute(Qt::WA_InputMethodEnabled); never executed: q->setAttribute(Qt::WA_InputMethodEnabled); | 0 |
| 678 | } | - |
| 679 | | - |
| 680 | QComboBoxPrivateContainer* QComboBoxPrivate::viewContainer() | - |
| 681 | { | - |
| 682 | if (container) evaluated: container| yes Evaluation Count:2113 | yes Evaluation Count:339 |
| 339-2113 |
| 683 | return container; executed: return container;Execution Count:2113 | 2113 |
| 684 | | - |
| 685 | QComboBox * const q = q_func(); | - |
| 686 | container = new QComboBoxPrivateContainer(new QComboBoxListView(q), q); | - |
| 687 | container->itemView()->setModel(model); | - |
| 688 | container->itemView()->setTextElideMode(Qt::ElideMiddle); | - |
| 689 | updateDelegate(true); | - |
| 690 | updateLayoutDirection(); | - |
| 691 | updateViewContainerPaletteAndOpacity(); | - |
| 692 | QObject::connect(container, "2""itemSelected(QModelIndex)", | - |
| 693 | q, "1""_q_itemSelected(QModelIndex)"); | - |
| 694 | QObject::connect(container->itemView()->selectionModel(), | - |
| 695 | "2""currentChanged(QModelIndex,QModelIndex)", | - |
| 696 | q, "1""_q_emitHighlighted(QModelIndex)"); | - |
| 697 | QObject::connect(container, "2""resetButton()", q, "1""_q_resetButton()"); | - |
| 698 | return container; executed: return container;Execution Count:339 | 339 |
| 699 | } | - |
| 700 | | - |
| 701 | | - |
| 702 | void QComboBoxPrivate::_q_resetButton() | - |
| 703 | { | - |
| 704 | updateArrow(QStyle::State_None); | - |
| 705 | } executed: }Execution Count:132 | 132 |
| 706 | | - |
| 707 | void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) | - |
| 708 | { | - |
| 709 | QComboBox * const q = q_func(); | - |
| 710 | if (inserting || topLeft.parent() != root) partially evaluated: inserting| no Evaluation Count:0 | yes Evaluation Count:1550 |
partially evaluated: topLeft.parent() != root| no Evaluation Count:0 | yes Evaluation Count:1550 |
| 0-1550 |
| 711 | return; | 0 |
| 712 | | - |
| 713 | if (sizeAdjustPolicy == QComboBox::AdjustToContents) { partially evaluated: sizeAdjustPolicy == QComboBox::AdjustToContents| no Evaluation Count:0 | yes Evaluation Count:1550 |
| 0-1550 |
| 714 | sizeHint = QSize(); | - |
| 715 | adjustComboBoxSize(); | - |
| 716 | q->updateGeometry(); | - |
| 717 | } | 0 |
| 718 | | - |
| 719 | if (currentIndex.row() >= topLeft.row() && currentIndex.row() <= bottomRight.row()) { partially evaluated: currentIndex.row() >= topLeft.row()| yes Evaluation Count:1550 | no Evaluation Count:0 |
partially evaluated: currentIndex.row() <= bottomRight.row()| yes Evaluation Count:1550 | no Evaluation Count:0 |
| 0-1550 |
| 720 | const QString text = q->itemText(currentIndex.row()); | - |
| 721 | if (lineEdit) { partially evaluated: lineEdit| no Evaluation Count:0 | yes Evaluation Count:1550 |
| 0-1550 |
| 722 | lineEdit->setText(text); | - |
| 723 | updateLineEditGeometry(); | - |
| 724 | } else { | 0 |
| 725 | q->currentTextChanged(text); | - |
| 726 | } executed: }Execution Count:1550 | 1550 |
| 727 | q->update(); | - |
| 728 | } executed: }Execution Count:1550 | 1550 |
| 729 | | - |
| 730 | QAccessibleEvent event(q, QAccessible::NameChanged); | - |
| 731 | QAccessible::updateAccessibility(&event); | - |
| 732 | | - |
| 733 | } executed: }Execution Count:1550 | 1550 |
| 734 | | - |
| 735 | void QComboBoxPrivate::_q_rowsInserted(const QModelIndex &parent, int start, int end) | - |
| 736 | { | - |
| 737 | QComboBox * const q = q_func(); | - |
| 738 | if (inserting || parent != root) partially evaluated: inserting| no Evaluation Count:0 | yes Evaluation Count:702 |
partially evaluated: parent != root| no Evaluation Count:0 | yes Evaluation Count:702 |
| 0-702 |
| 739 | return; | 0 |
| 740 | | - |
| 741 | if (sizeAdjustPolicy == QComboBox::AdjustToContents) { partially evaluated: sizeAdjustPolicy == QComboBox::AdjustToContents| no Evaluation Count:0 | yes Evaluation Count:702 |
| 0-702 |
| 742 | sizeHint = QSize(); | - |
| 743 | adjustComboBoxSize(); | - |
| 744 | q->updateGeometry(); | - |
| 745 | } | 0 |
| 746 | | - |
| 747 | | - |
| 748 | if (start == 0 && (end - start + 1) == q->count() && !currentIndex.isValid()) { evaluated: start == 0| yes Evaluation Count:592 | yes Evaluation Count:110 |
partially evaluated: (end - start + 1) == q->count()| yes Evaluation Count:592 | no Evaluation Count:0 |
partially evaluated: !currentIndex.isValid()| yes Evaluation Count:592 | no Evaluation Count:0 |
| 0-592 |
| 749 | q->setCurrentIndex(0); | - |
| 750 | | - |
| 751 | } else if (currentIndex.row() != indexBeforeChange) { executed: }Execution Count:592 partially evaluated: currentIndex.row() != indexBeforeChange| no Evaluation Count:0 | yes Evaluation Count:110 |
| 0-592 |
| 752 | q->update(); | - |
| 753 | _q_emitCurrentIndexChanged(currentIndex); | - |
| 754 | } | 0 |
| 755 | } | - |
| 756 | | - |
| 757 | void QComboBoxPrivate::_q_updateIndexBeforeChange() | - |
| 758 | { | - |
| 759 | indexBeforeChange = currentIndex.row(); | - |
| 760 | } executed: }Execution Count:901 | 901 |
| 761 | | - |
| 762 | void QComboBoxPrivate::_q_rowsRemoved(const QModelIndex &parent, int , int ) | - |
| 763 | { | - |
| 764 | QComboBox * const q = q_func(); | - |
| 765 | if (parent != root) partially evaluated: parent != root| no Evaluation Count:0 | yes Evaluation Count:199 |
| 0-199 |
| 766 | return; | 0 |
| 767 | | - |
| 768 | if (sizeAdjustPolicy == QComboBox::AdjustToContents) { partially evaluated: sizeAdjustPolicy == QComboBox::AdjustToContents| no Evaluation Count:0 | yes Evaluation Count:199 |
| 0-199 |
| 769 | sizeHint = QSize(); | - |
| 770 | adjustComboBoxSize(); | - |
| 771 | q->updateGeometry(); | - |
| 772 | } | 0 |
| 773 | | - |
| 774 | | - |
| 775 | if (currentIndex.row() != indexBeforeChange) { partially evaluated: currentIndex.row() != indexBeforeChange| yes Evaluation Count:199 | no Evaluation Count:0 |
| 0-199 |
| 776 | if (!currentIndex.isValid() && q->count()) { partially evaluated: !currentIndex.isValid()| yes Evaluation Count:199 | no Evaluation Count:0 |
partially evaluated: q->count()| no Evaluation Count:0 | yes Evaluation Count:199 |
| 0-199 |
| 777 | q->setCurrentIndex(qMin(q->count() - 1, qMax(indexBeforeChange, 0))); | - |
| 778 | return; | 0 |
| 779 | } | - |
| 780 | if (lineEdit) { partially evaluated: lineEdit| no Evaluation Count:0 | yes Evaluation Count:199 |
| 0-199 |
| 781 | lineEdit->setText(q->itemText(currentIndex.row())); | - |
| 782 | updateLineEditGeometry(); | - |
| 783 | } | 0 |
| 784 | q->update(); | - |
| 785 | _q_emitCurrentIndexChanged(currentIndex); | - |
| 786 | } executed: }Execution Count:199 | 199 |
| 787 | } executed: }Execution Count:199 | 199 |
| 788 | | - |
| 789 | | - |
| 790 | void QComboBoxPrivate::updateViewContainerPaletteAndOpacity() | - |
| 791 | { | - |
| 792 | if (!container) partially evaluated: !container| no Evaluation Count:0 | yes Evaluation Count:339 |
| 0-339 |
| 793 | return; | 0 |
| 794 | QComboBox * const q = q_func(); | - |
| 795 | QStyleOptionComboBox opt; | - |
| 796 | q->initStyleOption(&opt); | - |
| 797 | | - |
| 798 | if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) { partially evaluated: q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)| no Evaluation Count:0 | yes Evaluation Count:339 |
| 0-339 |
| 799 | QMenu menu; | - |
| 800 | menu.ensurePolished(); | - |
| 801 | container->setPalette(menu.palette()); | - |
| 802 | container->setWindowOpacity(menu.windowOpacity()); | - |
| 803 | } else | 0 |
| 804 | | - |
| 805 | { | - |
| 806 | container->setPalette(q->palette()); | - |
| 807 | container->setWindowOpacity(1.0); | - |
| 808 | } executed: }Execution Count:339 | 339 |
| 809 | if (lineEdit) partially evaluated: lineEdit| no Evaluation Count:0 | yes Evaluation Count:339 |
| 0-339 |
| 810 | lineEdit->setPalette(q->palette()); never executed: lineEdit->setPalette(q->palette()); | 0 |
| 811 | } executed: }Execution Count:339 | 339 |
| 812 | void QComboBox::initStyleOption(QStyleOptionComboBox *option) const | - |
| 813 | { | - |
| 814 | if (!option) partially evaluated: !option| no Evaluation Count:0 | yes Evaluation Count:3153 |
| 0-3153 |
| 815 | return; | 0 |
| 816 | | - |
| 817 | const QComboBoxPrivate * const d = d_func(); | - |
| 818 | option->initFrom(this); | - |
| 819 | option->editable = isEditable(); | - |
| 820 | option->frame = d->frame; | - |
| 821 | if (hasFocus() && !option->editable) evaluated: hasFocus()| yes Evaluation Count:16 | yes Evaluation Count:3137 |
evaluated: !option->editable| yes Evaluation Count:9 | yes Evaluation Count:7 |
| 7-3137 |
| 822 | option->state |= QStyle::State_Selected; executed: option->state |= QStyle::State_Selected;Execution Count:9 | 9 |
| 823 | option->subControls = QStyle::SC_All; | - |
| 824 | if (d->arrowState == QStyle::State_Sunken) { partially evaluated: d->arrowState == QStyle::State_Sunken| no Evaluation Count:0 | yes Evaluation Count:3153 |
| 0-3153 |
| 825 | option->activeSubControls = QStyle::SC_ComboBoxArrow; | - |
| 826 | option->state |= d->arrowState; | - |
| 827 | } else { | 0 |
| 828 | option->activeSubControls = d->hoverControl; | - |
| 829 | } executed: }Execution Count:3153 | 3153 |
| 830 | if (d->currentIndex.isValid()) { evaluated: d->currentIndex.isValid()| yes Evaluation Count:1230 | yes Evaluation Count:1923 |
| 1230-1923 |
| 831 | option->currentText = currentText(); | - |
| 832 | option->currentIcon = d->itemIcon(d->currentIndex); | - |
| 833 | } executed: }Execution Count:1230 | 1230 |
| 834 | option->iconSize = iconSize(); | - |
| 835 | if (d->container && d->container->isVisible()) evaluated: d->container| yes Evaluation Count:2477 | yes Evaluation Count:676 |
partially evaluated: d->container->isVisible()| no Evaluation Count:0 | yes Evaluation Count:2477 |
| 0-2477 |
| 836 | option->state |= QStyle::State_On; never executed: option->state |= QStyle::State_On; | 0 |
| 837 | } executed: }Execution Count:3153 | 3153 |
| 838 | | - |
| 839 | void QComboBoxPrivate::updateLineEditGeometry() | - |
| 840 | { | - |
| 841 | if (!lineEdit) evaluated: !lineEdit| yes Evaluation Count:104 | yes Evaluation Count:567 |
| 104-567 |
| 842 | return; executed: return;Execution Count:104 | 104 |
| 843 | | - |
| 844 | QComboBox * const q = q_func(); | - |
| 845 | QStyleOptionComboBox opt; | - |
| 846 | q->initStyleOption(&opt); | - |
| 847 | QRect editRect = q->style()->subControlRect(QStyle::CC_ComboBox, &opt, | - |
| 848 | QStyle::SC_ComboBoxEditField, q); | - |
| 849 | if (!q->itemIcon(q->currentIndex()).isNull()) { partially evaluated: !q->itemIcon(q->currentIndex()).isNull()| no Evaluation Count:0 | yes Evaluation Count:567 |
| 0-567 |
| 850 | QRect comboRect(editRect); | - |
| 851 | editRect.setWidth(editRect.width() - q->iconSize().width() - 4); | - |
| 852 | editRect = QStyle::alignedRect(q->layoutDirection(), Qt::AlignRight, | - |
| 853 | editRect.size(), comboRect); | - |
| 854 | } | 0 |
| 855 | lineEdit->setGeometry(editRect); | - |
| 856 | } executed: }Execution Count:567 | 567 |
| 857 | | - |
| 858 | Qt::MatchFlags QComboBoxPrivate::matchFlags() const | - |
| 859 | { | - |
| 860 | | - |
| 861 | Qt::MatchFlags flags = Qt::MatchFixedString; | - |
| 862 | | - |
| 863 | if (!lineEdit->completer() || lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive) partially evaluated: !lineEdit->completer()| no Evaluation Count:0 | yes Evaluation Count:9 |
evaluated: lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive| yes Evaluation Count:2 | yes Evaluation Count:7 |
| 0-9 |
| 864 | | - |
| 865 | flags |= Qt::MatchCaseSensitive; executed: flags |= Qt::MatchCaseSensitive;Execution Count:2 | 2 |
| 866 | return flags; executed: return flags;Execution Count:9 | 9 |
| 867 | } | - |
| 868 | | - |
| 869 | | - |
| 870 | void QComboBoxPrivate::_q_editingFinished() | - |
| 871 | { | - |
| 872 | QComboBox * const q = q_func(); | - |
| 873 | if (lineEdit && !lineEdit->text().isEmpty()) { partially evaluated: lineEdit| yes Evaluation Count:8 | no Evaluation Count:0 |
evaluated: !lineEdit->text().isEmpty()| yes Evaluation Count:7 | yes Evaluation Count:1 |
| 0-8 |
| 874 | | - |
| 875 | const int index = q_func()->findText(lineEdit->text(), matchFlags()); | - |
| 876 | if (index != -1 && itemText(currentIndex) != lineEdit->text()) { evaluated: index != -1| yes Evaluation Count:5 | yes Evaluation Count:2 |
partially evaluated: itemText(currentIndex) != lineEdit->text()| no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
| 877 | q->setCurrentIndex(index); | - |
| 878 | emitActivated(currentIndex); | - |
| 879 | } | 0 |
| 880 | } executed: }Execution Count:7 | 7 |
| 881 | | - |
| 882 | } executed: }Execution Count:8 | 8 |
| 883 | | - |
| 884 | void QComboBoxPrivate::_q_returnPressed() | - |
| 885 | { | - |
| 886 | QComboBox * const q = q_func(); | - |
| 887 | if (lineEdit && !lineEdit->text().isEmpty()) { partially evaluated: lineEdit| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: !lineEdit->text().isEmpty()| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 888 | if (q->count() >= maxCount && !(this->insertPolicy == QComboBox::InsertAtCurrent)) partially evaluated: q->count() >= maxCount| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !(this->insertPolicy == QComboBox::InsertAtCurrent) | 0-2 |
| 889 | return; | 0 |
| 890 | lineEdit->deselect(); | - |
| 891 | lineEdit->end(false); | - |
| 892 | QString text = lineEdit->text(); | - |
| 893 | | - |
| 894 | int index = -1; | - |
| 895 | if (!duplicatesEnabled) { partially evaluated: !duplicatesEnabled| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 896 | index = q->findText(text, matchFlags()); | - |
| 897 | if (index != -1) { evaluated: index != -1| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 898 | q->setCurrentIndex(index); | - |
| 899 | emitActivated(currentIndex); | - |
| 900 | return; executed: return;Execution Count:1 | 1 |
| 901 | } | - |
| 902 | } executed: }Execution Count:1 | 1 |
| 903 | switch (insertPolicy) { | - |
| 904 | case QComboBox::InsertAtTop: | - |
| 905 | index = 0; | - |
| 906 | break; | 0 |
| 907 | case QComboBox::InsertAtBottom: | - |
| 908 | index = q->count(); | - |
| 909 | break; executed: break;Execution Count:1 | 1 |
| 910 | case QComboBox::InsertAtCurrent: | - |
| 911 | case QComboBox::InsertAfterCurrent: | - |
| 912 | case QComboBox::InsertBeforeCurrent: | - |
| 913 | if (!q->count() || !currentIndex.isValid()) never evaluated: !q->count() never evaluated: !currentIndex.isValid() | 0 |
| 914 | index = 0; never executed: index = 0; | 0 |
| 915 | else if (insertPolicy == QComboBox::InsertAtCurrent) never evaluated: insertPolicy == QComboBox::InsertAtCurrent | 0 |
| 916 | q->setItemText(q->currentIndex(), text); never executed: q->setItemText(q->currentIndex(), text); | 0 |
| 917 | else if (insertPolicy == QComboBox::InsertAfterCurrent) never evaluated: insertPolicy == QComboBox::InsertAfterCurrent | 0 |
| 918 | index = q->currentIndex() + 1; never executed: index = q->currentIndex() + 1; | 0 |
| 919 | else if (insertPolicy == QComboBox::InsertBeforeCurrent) never evaluated: insertPolicy == QComboBox::InsertBeforeCurrent | 0 |
| 920 | index = q->currentIndex(); never executed: index = q->currentIndex(); | 0 |
| 921 | break; | 0 |
| 922 | case QComboBox::InsertAlphabetically: | - |
| 923 | index = 0; | - |
| 924 | for (int i=0; i< q->count(); i++, index++ ) { never evaluated: i< q->count() | 0 |
| 925 | if (text.toLower() < q->itemText(i).toLower()) never evaluated: text.toLower() < q->itemText(i).toLower() | 0 |
| 926 | break; | 0 |
| 927 | } | 0 |
| 928 | break; | 0 |
| 929 | case QComboBox::NoInsert: | - |
| 930 | default: | - |
| 931 | break; | 0 |
| 932 | } | - |
| 933 | if (index >= 0) { partially evaluated: index >= 0| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 934 | q->insertItem(index, text); | - |
| 935 | q->setCurrentIndex(index); | - |
| 936 | emitActivated(currentIndex); | - |
| 937 | } executed: }Execution Count:1 | 1 |
| 938 | } executed: }Execution Count:1 | 1 |
| 939 | } executed: }Execution Count:1 | 1 |
| 940 | | - |
| 941 | void QComboBoxPrivate::_q_itemSelected(const QModelIndex &item) | - |
| 942 | { | - |
| 943 | QComboBox * const q = q_func(); | - |
| 944 | if (item != currentIndex) { never evaluated: item != currentIndex | 0 |
| 945 | setCurrentIndex(item); | - |
| 946 | } else if (lineEdit) { never evaluated: lineEdit | 0 |
| 947 | lineEdit->selectAll(); | - |
| 948 | lineEdit->setText(q->itemText(currentIndex.row())); | - |
| 949 | } | 0 |
| 950 | emitActivated(currentIndex); | - |
| 951 | } | 0 |
| 952 | | - |
| 953 | void QComboBoxPrivate::emitActivated(const QModelIndex &index) | - |
| 954 | { | - |
| 955 | QComboBox * const q = q_func(); | - |
| 956 | if (!index.isValid()) partially evaluated: !index.isValid()| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 957 | return; | 0 |
| 958 | QString text(itemText(index)); | - |
| 959 | q->activated(index.row()); | - |
| 960 | q->activated(text); | - |
| 961 | } executed: }Execution Count:4 | 4 |
| 962 | | - |
| 963 | void QComboBoxPrivate::_q_emitHighlighted(const QModelIndex &index) | - |
| 964 | { | - |
| 965 | QComboBox * const q = q_func(); | - |
| 966 | if (!index.isValid()) partially evaluated: !index.isValid()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 967 | return; | 0 |
| 968 | QString text(itemText(index)); | - |
| 969 | q->highlighted(index.row()); | - |
| 970 | q->highlighted(text); | - |
| 971 | } executed: }Execution Count:1 | 1 |
| 972 | | - |
| 973 | void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index) | - |
| 974 | { | - |
| 975 | QComboBox * const q = q_func(); | - |
| 976 | q->currentIndexChanged(index.row()); | - |
| 977 | const QString text = itemText(index); | - |
| 978 | q->currentIndexChanged(text); | - |
| 979 | | - |
| 980 | if (!lineEdit) evaluated: !lineEdit| yes Evaluation Count:818 | yes Evaluation Count:267 |
| 267-818 |
| 981 | q->currentTextChanged(text); executed: q->currentTextChanged(text);Execution Count:818 | 818 |
| 982 | | - |
| 983 | QAccessibleEvent event(q, QAccessible::NameChanged); | - |
| 984 | QAccessible::updateAccessibility(&event); | - |
| 985 | | - |
| 986 | } executed: }Execution Count:1085 | 1085 |
| 987 | | - |
| 988 | QString QComboBoxPrivate::itemText(const QModelIndex &index) const | - |
| 989 | { | - |
| 990 | return index.isValid() ? model->data(index, itemRole()).toString() : QString(); executed: return index.isValid() ? model->data(index, itemRole()).toString() : QString();Execution Count:4717 | 4717 |
| 991 | } | - |
| 992 | | - |
| 993 | int QComboBoxPrivate::itemRole() const | - |
| 994 | { | - |
| 995 | return q_func()->isEditable() ? Qt::EditRole : Qt::DisplayRole; executed: return q_func()->isEditable() ? Qt::EditRole : Qt::DisplayRole;Execution Count:4372 | 4372 |
| 996 | } | - |
| 997 | | - |
| 998 | | - |
| 999 | | - |
| 1000 | | - |
| 1001 | QComboBox::~QComboBox() | - |
| 1002 | { | - |
| 1003 | | - |
| 1004 | QComboBoxPrivate * const d = d_func(); | - |
| 1005 | | - |
| 1006 | if (true) { partially evaluated: true| yes Evaluation Count:557 | no Evaluation Count:0 |
| 0-557 |
| 1007 | disconnect(d->model, "2""destroyed()", | - |
| 1008 | this, "1""_q_modelDestroyed()"); | - |
| 1009 | } else { executed: }Execution Count:557 | 557 |
| 1010 | ; | - |
| 1011 | } | 0 |
| 1012 | } | - |
| 1013 | int QComboBox::maxVisibleItems() const | - |
| 1014 | { | - |
| 1015 | const QComboBoxPrivate * const d = d_func(); | - |
| 1016 | return d->maxVisibleItems; never executed: return d->maxVisibleItems; | 0 |
| 1017 | } | - |
| 1018 | | - |
| 1019 | void QComboBox::setMaxVisibleItems(int maxItems) | - |
| 1020 | { | - |
| 1021 | QComboBoxPrivate * const d = d_func(); | - |
| 1022 | if (maxItems < 0) { never evaluated: maxItems < 0 | 0 |
| 1023 | QMessageLogger("widgets/qcombobox.cpp", 1299, __PRETTY_FUNCTION__).warning("QComboBox::setMaxVisibleItems: " | - |
| 1024 | "Invalid max visible items (%d) must be >= 0", maxItems); | - |
| 1025 | return; | 0 |
| 1026 | } | - |
| 1027 | d->maxVisibleItems = maxItems; | - |
| 1028 | } | 0 |
| 1029 | | - |
| 1030 | | - |
| 1031 | | - |
| 1032 | | - |
| 1033 | | - |
| 1034 | | - |
| 1035 | | - |
| 1036 | int QComboBox::count() const | - |
| 1037 | { | - |
| 1038 | const QComboBoxPrivate * const d = d_func(); | - |
| 1039 | return d->model->rowCount(d->root); executed: return d->model->rowCount(d->root);Execution Count:3637 | 3637 |
| 1040 | } | - |
| 1041 | void QComboBox::setMaxCount(int max) | - |
| 1042 | { | - |
| 1043 | QComboBoxPrivate * const d = d_func(); | - |
| 1044 | if (max < 0) { | 0 |
| 1045 | QMessageLogger("widgets/qcombobox.cpp", 1334, __PRETTY_FUNCTION__).warning("QComboBox::setMaxCount: Invalid count (%d) must be >= 0", max); | - |
| 1046 | return; | 0 |
| 1047 | } | - |
| 1048 | | - |
| 1049 | if (max < count()) never evaluated: max < count() | 0 |
| 1050 | d->model->removeRows(max, count() - max, d->root); never executed: d->model->removeRows(max, count() - max, d->root); | 0 |
| 1051 | | - |
| 1052 | d->maxCount = max; | - |
| 1053 | } | 0 |
| 1054 | | - |
| 1055 | int QComboBox::maxCount() const | - |
| 1056 | { | - |
| 1057 | const QComboBoxPrivate * const d = d_func(); | - |
| 1058 | return d->maxCount; never executed: return d->maxCount; | 0 |
| 1059 | } | - |
| 1060 | bool QComboBox::autoCompletion() const | - |
| 1061 | { | - |
| 1062 | const QComboBoxPrivate * const d = d_func(); | - |
| 1063 | return d->autoCompletion; never executed: return d->autoCompletion; | 0 |
| 1064 | } | - |
| 1065 | | - |
| 1066 | | - |
| 1067 | | - |
| 1068 | | - |
| 1069 | | - |
| 1070 | | - |
| 1071 | void QComboBox::setAutoCompletion(bool enable) | - |
| 1072 | { | - |
| 1073 | QComboBoxPrivate * const d = d_func(); | - |
| 1074 | | - |
| 1075 | | - |
| 1076 | | - |
| 1077 | | - |
| 1078 | | - |
| 1079 | | - |
| 1080 | d->autoCompletion = enable; | - |
| 1081 | if (!d->lineEdit) partially evaluated: !d->lineEdit| no Evaluation Count:0 | yes Evaluation Count:150 |
| 0-150 |
| 1082 | return; | 0 |
| 1083 | if (enable) { partially evaluated: enable| yes Evaluation Count:150 | no Evaluation Count:0 |
| 0-150 |
| 1084 | if (d->lineEdit->completer()) partially evaluated: d->lineEdit->completer()| no Evaluation Count:0 | yes Evaluation Count:150 |
| 0-150 |
| 1085 | return; | 0 |
| 1086 | d->completer = new QCompleter(d->model, d->lineEdit); | - |
| 1087 | d->completer->setCaseSensitivity(d->autoCompletionCaseSensitivity); | - |
| 1088 | d->completer->setCompletionMode(QCompleter::InlineCompletion); | - |
| 1089 | d->completer->setCompletionColumn(d->modelColumn); | - |
| 1090 | d->lineEdit->setCompleter(d->completer); | - |
| 1091 | d->completer->setWidget(this); | - |
| 1092 | } else { executed: }Execution Count:150 | 150 |
| 1093 | d->lineEdit->setCompleter(0); | - |
| 1094 | } | 0 |
| 1095 | } | - |
| 1096 | Qt::CaseSensitivity QComboBox::autoCompletionCaseSensitivity() const | - |
| 1097 | { | - |
| 1098 | const QComboBoxPrivate * const d = d_func(); | - |
| 1099 | return d->autoCompletionCaseSensitivity; never executed: return d->autoCompletionCaseSensitivity; | 0 |
| 1100 | } | - |
| 1101 | | - |
| 1102 | | - |
| 1103 | | - |
| 1104 | | - |
| 1105 | | - |
| 1106 | | - |
| 1107 | void QComboBox::setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity) | - |
| 1108 | { | - |
| 1109 | QComboBoxPrivate * const d = d_func(); | - |
| 1110 | d->autoCompletionCaseSensitivity = sensitivity; | - |
| 1111 | if (d->lineEdit && d->lineEdit->completer()) never evaluated: d->lineEdit never evaluated: d->lineEdit->completer() | 0 |
| 1112 | d->lineEdit->completer()->setCaseSensitivity(sensitivity); never executed: d->lineEdit->completer()->setCaseSensitivity(sensitivity); | 0 |
| 1113 | } | 0 |
| 1114 | bool QComboBox::duplicatesEnabled() const | - |
| 1115 | { | - |
| 1116 | const QComboBoxPrivate * const d = d_func(); | - |
| 1117 | return d->duplicatesEnabled; never executed: return d->duplicatesEnabled; | 0 |
| 1118 | } | - |
| 1119 | | - |
| 1120 | void QComboBox::setDuplicatesEnabled(bool enable) | - |
| 1121 | { | - |
| 1122 | QComboBoxPrivate * const d = d_func(); | - |
| 1123 | d->duplicatesEnabled = enable; | - |
| 1124 | } executed: }Execution Count:378 | 378 |
| 1125 | int QComboBox::findData(const QVariant &data, int role, Qt::MatchFlags flags) const | - |
| 1126 | { | - |
| 1127 | const QComboBoxPrivate * const d = d_func(); | - |
| 1128 | QModelIndexList result; | - |
| 1129 | QModelIndex start = d->model->index(0, d->modelColumn, d->root); | - |
| 1130 | result = d->model->match(start, role, data, 1, flags); | - |
| 1131 | if (result.isEmpty()) evaluated: result.isEmpty()| yes Evaluation Count:10 | yes Evaluation Count:18 |
| 10-18 |
| 1132 | return -1; executed: return -1;Execution Count:10 | 10 |
| 1133 | return result.first().row(); executed: return result.first().row();Execution Count:18 | 18 |
| 1134 | } | - |
| 1135 | QComboBox::InsertPolicy QComboBox::insertPolicy() const | - |
| 1136 | { | - |
| 1137 | const QComboBoxPrivate * const d = d_func(); | - |
| 1138 | return d->insertPolicy; never executed: return d->insertPolicy; | 0 |
| 1139 | } | - |
| 1140 | | - |
| 1141 | void QComboBox::setInsertPolicy(InsertPolicy policy) | - |
| 1142 | { | - |
| 1143 | QComboBoxPrivate * const d = d_func(); | - |
| 1144 | d->insertPolicy = policy; | - |
| 1145 | } executed: }Execution Count:190 | 190 |
| 1146 | QComboBox::SizeAdjustPolicy QComboBox::sizeAdjustPolicy() const | - |
| 1147 | { | - |
| 1148 | const QComboBoxPrivate * const d = d_func(); | - |
| 1149 | return d->sizeAdjustPolicy; never executed: return d->sizeAdjustPolicy; | 0 |
| 1150 | } | - |
| 1151 | | - |
| 1152 | void QComboBox::setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy policy) | - |
| 1153 | { | - |
| 1154 | QComboBoxPrivate * const d = d_func(); | - |
| 1155 | if (policy == d->sizeAdjustPolicy) partially evaluated: policy == d->sizeAdjustPolicy| no Evaluation Count:0 | yes Evaluation Count:189 |
| 0-189 |
| 1156 | return; | 0 |
| 1157 | | - |
| 1158 | d->sizeAdjustPolicy = policy; | - |
| 1159 | d->sizeHint = QSize(); | - |
| 1160 | d->adjustComboBoxSize(); | - |
| 1161 | updateGeometry(); | - |
| 1162 | } executed: }Execution Count:189 | 189 |
| 1163 | int QComboBox::minimumContentsLength() const | - |
| 1164 | { | - |
| 1165 | const QComboBoxPrivate * const d = d_func(); | - |
| 1166 | return d->minimumContentsLength; never executed: return d->minimumContentsLength; | 0 |
| 1167 | } | - |
| 1168 | | - |
| 1169 | void QComboBox::setMinimumContentsLength(int characters) | - |
| 1170 | { | - |
| 1171 | QComboBoxPrivate * const d = d_func(); | - |
| 1172 | if (characters == d->minimumContentsLength || characters < 0) never evaluated: characters == d->minimumContentsLength never evaluated: characters < 0 | 0 |
| 1173 | return; | 0 |
| 1174 | | - |
| 1175 | d->minimumContentsLength = characters; | - |
| 1176 | | - |
| 1177 | if (d->sizeAdjustPolicy == AdjustToContents never evaluated: d->sizeAdjustPolicy == AdjustToContents | 0 |
| 1178 | || d->sizeAdjustPolicy == AdjustToMinimumContentsLength never evaluated: d->sizeAdjustPolicy == AdjustToMinimumContentsLength | 0 |
| 1179 | || d->sizeAdjustPolicy == AdjustToMinimumContentsLengthWithIcon) { never evaluated: d->sizeAdjustPolicy == AdjustToMinimumContentsLengthWithIcon | 0 |
| 1180 | d->sizeHint = QSize(); | - |
| 1181 | d->adjustComboBoxSize(); | - |
| 1182 | updateGeometry(); | - |
| 1183 | } | 0 |
| 1184 | } | 0 |
| 1185 | QSize QComboBox::iconSize() const | - |
| 1186 | { | - |
| 1187 | const QComboBoxPrivate * const d = d_func(); | - |
| 1188 | if (d->iconSize.isValid()) partially evaluated: d->iconSize.isValid()| no Evaluation Count:0 | yes Evaluation Count:4148 |
| 0-4148 |
| 1189 | return d->iconSize; never executed: return d->iconSize; | 0 |
| 1190 | | - |
| 1191 | int iconWidth = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this); | - |
| 1192 | return QSize(iconWidth, iconWidth); executed: return QSize(iconWidth, iconWidth);Execution Count:4148 | 4148 |
| 1193 | } | - |
| 1194 | | - |
| 1195 | void QComboBox::setIconSize(const QSize &size) | - |
| 1196 | { | - |
| 1197 | QComboBoxPrivate * const d = d_func(); | - |
| 1198 | if (size == d->iconSize) never evaluated: size == d->iconSize | 0 |
| 1199 | return; | 0 |
| 1200 | | - |
| 1201 | view()->setIconSize(size); | - |
| 1202 | d->iconSize = size; | - |
| 1203 | d->sizeHint = QSize(); | - |
| 1204 | updateGeometry(); | - |
| 1205 | } | 0 |
| 1206 | bool QComboBox::isEditable() const | - |
| 1207 | { | - |
| 1208 | const QComboBoxPrivate * const d = d_func(); | - |
| 1209 | return d->lineEdit != 0; executed: return d->lineEdit != 0;Execution Count:9454 | 9454 |
| 1210 | } | - |
| 1211 | void QComboBoxPrivate::updateDelegate(bool force) | - |
| 1212 | { | - |
| 1213 | QComboBox * const q = q_func(); | - |
| 1214 | QStyleOptionComboBox opt; | - |
| 1215 | q->initStyleOption(&opt); | - |
| 1216 | if (q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)) { partially evaluated: q->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, q)| no Evaluation Count:0 | yes Evaluation Count:491 |
| 0-491 |
| 1217 | if (force || qobject_cast<QComboBoxDelegate *>(q->itemDelegate())) never evaluated: qobject_cast<QComboBoxDelegate *>(q->itemDelegate()) | 0 |
| 1218 | q->setItemDelegate(new QComboMenuDelegate(q->view(), q)); never executed: q->setItemDelegate(new QComboMenuDelegate(q->view(), q)); | 0 |
| 1219 | } else { | 0 |
| 1220 | if (force || qobject_cast<QComboMenuDelegate *>(q->itemDelegate())) evaluated: force| yes Evaluation Count:339 | yes Evaluation Count:152 |
partially evaluated: qobject_cast<QComboMenuDelegate *>(q->itemDelegate())| no Evaluation Count:0 | yes Evaluation Count:152 |
| 0-339 |
| 1221 | q->setItemDelegate(new QComboBoxDelegate(q->view(), q)); executed: q->setItemDelegate(new QComboBoxDelegate(q->view(), q));Execution Count:339 | 339 |
| 1222 | } executed: }Execution Count:491 | 491 |
| 1223 | } | - |
| 1224 | | - |
| 1225 | QIcon QComboBoxPrivate::itemIcon(const QModelIndex &index) const | - |
| 1226 | { | - |
| 1227 | QVariant decoration = model->data(index, Qt::DecorationRole); | - |
| 1228 | if (decoration.type() == QVariant::Pixmap) partially evaluated: decoration.type() == QVariant::Pixmap| no Evaluation Count:0 | yes Evaluation Count:2849 |
| 0-2849 |
| 1229 | return QIcon(qvariant_cast<QPixmap>(decoration)); never executed: return QIcon(qvariant_cast<QPixmap>(decoration)); | 0 |
| 1230 | else | - |
| 1231 | return qvariant_cast<QIcon>(decoration); executed: return qvariant_cast<QIcon>(decoration);Execution Count:2849 | 2849 |
| 1232 | } | - |
| 1233 | | - |
| 1234 | void QComboBox::setEditable(bool editable) | - |
| 1235 | { | - |
| 1236 | QComboBoxPrivate * const d = d_func(); | - |
| 1237 | if (isEditable() == editable) evaluated: isEditable() == editable| yes Evaluation Count:30 | yes Evaluation Count:150 |
| 30-150 |
| 1238 | return; executed: return;Execution Count:30 | 30 |
| 1239 | | - |
| 1240 | d->updateDelegate(); | - |
| 1241 | | - |
| 1242 | QStyleOptionComboBox opt; | - |
| 1243 | initStyleOption(&opt); | - |
| 1244 | if (editable) { partially evaluated: editable| yes Evaluation Count:150 | no Evaluation Count:0 |
| 0-150 |
| 1245 | if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) { partially evaluated: style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)| no Evaluation Count:0 | yes Evaluation Count:150 |
| 0-150 |
| 1246 | d->viewContainer()->updateScrollers(); | - |
| 1247 | view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); | - |
| 1248 | } | 0 |
| 1249 | QLineEdit *le = new QLineEdit(this); | - |
| 1250 | setLineEdit(le); | - |
| 1251 | | - |
| 1252 | | - |
| 1253 | | - |
| 1254 | | - |
| 1255 | } else { executed: }Execution Count:150 | 150 |
| 1256 | if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) { never evaluated: style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) | 0 |
| 1257 | d->viewContainer()->updateScrollers(); | - |
| 1258 | view()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | - |
| 1259 | } | 0 |
| 1260 | setAttribute(Qt::WA_InputMethodEnabled, false); | - |
| 1261 | d->lineEdit->hide(); | - |
| 1262 | d->lineEdit->deleteLater(); | - |
| 1263 | d->lineEdit = 0; | - |
| 1264 | | - |
| 1265 | | - |
| 1266 | | - |
| 1267 | | - |
| 1268 | } | 0 |
| 1269 | | - |
| 1270 | d->viewContainer()->updateTopBottomMargin(); | - |
| 1271 | if (!testAttribute(Qt::WA_Resized)) evaluated: !testAttribute(Qt::WA_Resized)| yes Evaluation Count:149 | yes Evaluation Count:1 |
| 1-149 |
| 1272 | adjustSize(); executed: adjustSize();Execution Count:149 | 149 |
| 1273 | } executed: }Execution Count:150 | 150 |
| 1274 | | - |
| 1275 | | - |
| 1276 | | - |
| 1277 | | - |
| 1278 | | - |
| 1279 | | - |
| 1280 | void QComboBox::setLineEdit(QLineEdit *edit) | - |
| 1281 | { | - |
| 1282 | QComboBoxPrivate * const d = d_func(); | - |
| 1283 | if (!edit) { partially evaluated: !edit| no Evaluation Count:0 | yes Evaluation Count:150 |
| 0-150 |
| 1284 | QMessageLogger("widgets/qcombobox.cpp", 1703, __PRETTY_FUNCTION__).warning("QComboBox::setLineEdit: cannot set a 0 line edit"); | - |
| 1285 | return; | 0 |
| 1286 | } | - |
| 1287 | | - |
| 1288 | if (edit == d->lineEdit) partially evaluated: edit == d->lineEdit| no Evaluation Count:0 | yes Evaluation Count:150 |
| 0-150 |
| 1289 | return; | 0 |
| 1290 | | - |
| 1291 | edit->setText(currentText()); | - |
| 1292 | delete d->lineEdit; | - |
| 1293 | | - |
| 1294 | d->lineEdit = edit; | - |
| 1295 | if (d->lineEdit->parent() != this) partially evaluated: d->lineEdit->parent() != this| no Evaluation Count:0 | yes Evaluation Count:150 |
| 0-150 |
| 1296 | d->lineEdit->setParent(this); never executed: d->lineEdit->setParent(this); | 0 |
| 1297 | connect(d->lineEdit, "2""returnPressed()", this, "1""_q_returnPressed()"); | - |
| 1298 | connect(d->lineEdit, "2""editingFinished()", this, "1""_q_editingFinished()"); | - |
| 1299 | connect(d->lineEdit, "2""textChanged(QString)", this, "2""editTextChanged(QString)"); | - |
| 1300 | connect(d->lineEdit, "2""textChanged(QString)", this, "2""currentTextChanged(QString)"); | - |
| 1301 | d->lineEdit->setFrame(false); | - |
| 1302 | d->lineEdit->setContextMenuPolicy(Qt::NoContextMenu); | - |
| 1303 | d->lineEdit->setFocusProxy(this); | - |
| 1304 | d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false); | - |
| 1305 | | - |
| 1306 | setAutoCompletion(d->autoCompletion); | - |
| 1307 | setAttribute(Qt::WA_InputMethodEnabled); | - |
| 1308 | d->updateLayoutDirection(); | - |
| 1309 | d->updateLineEditGeometry(); | - |
| 1310 | if (isVisible()) evaluated: isVisible()| yes Evaluation Count:2 | yes Evaluation Count:148 |
| 2-148 |
| 1311 | d->lineEdit->show(); executed: d->lineEdit->show();Execution Count:2 | 2 |
| 1312 | | - |
| 1313 | update(); | - |
| 1314 | } executed: }Execution Count:150 | 150 |
| 1315 | | - |
| 1316 | | - |
| 1317 | | - |
| 1318 | | - |
| 1319 | | - |
| 1320 | | - |
| 1321 | | - |
| 1322 | QLineEdit *QComboBox::lineEdit() const | - |
| 1323 | { | - |
| 1324 | const QComboBoxPrivate * const d = d_func(); | - |
| 1325 | return d->lineEdit; executed: return d->lineEdit;Execution Count:9 | 9 |
| 1326 | } | - |
| 1327 | void QComboBox::setValidator(const QValidator *v) | - |
| 1328 | { | - |
| 1329 | QComboBoxPrivate * const d = d_func(); | - |
| 1330 | if (d->lineEdit) never evaluated: d->lineEdit | 0 |
| 1331 | d->lineEdit->setValidator(v); never executed: d->lineEdit->setValidator(v); | 0 |
| 1332 | } | 0 |
| 1333 | | - |
| 1334 | | - |
| 1335 | | - |
| 1336 | | - |
| 1337 | | - |
| 1338 | | - |
| 1339 | | - |
| 1340 | const QValidator *QComboBox::validator() const | - |
| 1341 | { | - |
| 1342 | const QComboBoxPrivate * const d = d_func(); | - |
| 1343 | return d->lineEdit ? d->lineEdit->validator() : 0; never executed: return d->lineEdit ? d->lineEdit->validator() : 0; | 0 |
| 1344 | } | - |
| 1345 | void QComboBox::setCompleter(QCompleter *c) | - |
| 1346 | { | - |
| 1347 | QComboBoxPrivate * const d = d_func(); | - |
| 1348 | if (!d->lineEdit) partially evaluated: !d->lineEdit| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1349 | return; | 0 |
| 1350 | d->lineEdit->setCompleter(c); | - |
| 1351 | if (c) partially evaluated: c| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1352 | c->setWidget(this); executed: c->setWidget(this);Execution Count:2 | 2 |
| 1353 | } executed: }Execution Count:2 | 2 |
| 1354 | QCompleter *QComboBox::completer() const | - |
| 1355 | { | - |
| 1356 | const QComboBoxPrivate * const d = d_func(); | - |
| 1357 | return d->lineEdit ? d->lineEdit->completer() : 0; executed: return d->lineEdit ? d->lineEdit->completer() : 0;Execution Count:10 | 10 |
| 1358 | } | - |
| 1359 | QAbstractItemDelegate *QComboBox::itemDelegate() const | - |
| 1360 | { | - |
| 1361 | return view()->itemDelegate(); executed: return view()->itemDelegate();Execution Count:152 | 152 |
| 1362 | } | - |
| 1363 | void QComboBox::setItemDelegate(QAbstractItemDelegate *delegate) | - |
| 1364 | { | - |
| 1365 | if (!delegate) { partially evaluated: !delegate| no Evaluation Count:0 | yes Evaluation Count:479 |
| 0-479 |
| 1366 | QMessageLogger("widgets/qcombobox.cpp", 1854, __PRETTY_FUNCTION__).warning("QComboBox::setItemDelegate: cannot set a 0 delegate"); | - |
| 1367 | return; | 0 |
| 1368 | } | - |
| 1369 | delete view()->itemDelegate(); | - |
| 1370 | view()->setItemDelegate(delegate); | - |
| 1371 | } executed: }Execution Count:479 | 479 |
| 1372 | | - |
| 1373 | | - |
| 1374 | | - |
| 1375 | | - |
| 1376 | | - |
| 1377 | QAbstractItemModel *QComboBox::model() const | - |
| 1378 | { | - |
| 1379 | const QComboBoxPrivate * const d = d_func(); | - |
| 1380 | if (d->model == QAbstractItemModelPrivate::staticEmptyModel()) { partially evaluated: d->model == QAbstractItemModelPrivate::staticEmptyModel()| no Evaluation Count:0 | yes Evaluation Count:326 |
| 0-326 |
| 1381 | QComboBox *that = const_cast<QComboBox*>(this); | - |
| 1382 | that->setModel(new QStandardItemModel(0, 1, that)); | - |
| 1383 | } | 0 |
| 1384 | return d->model; executed: return d->model;Execution Count:326 | 326 |
| 1385 | } | - |
| 1386 | | - |
| 1387 | | - |
| 1388 | | - |
| 1389 | | - |
| 1390 | | - |
| 1391 | | - |
| 1392 | | - |
| 1393 | void QComboBox::setModel(QAbstractItemModel *model) | - |
| 1394 | { | - |
| 1395 | QComboBoxPrivate * const d = d_func(); | - |
| 1396 | | - |
| 1397 | if (!model) { partially evaluated: !model| no Evaluation Count:0 | yes Evaluation Count:887 |
| 0-887 |
| 1398 | QMessageLogger("widgets/qcombobox.cpp", 1886, __PRETTY_FUNCTION__).warning("QComboBox::setModel: cannot set a 0 model"); | - |
| 1399 | return; | 0 |
| 1400 | } | - |
| 1401 | | - |
| 1402 | | - |
| 1403 | if (d->lineEdit && d->lineEdit->completer() evaluated: d->lineEdit| yes Evaluation Count:140 | yes Evaluation Count:747 |
partially evaluated: d->lineEdit->completer()| yes Evaluation Count:140 | no Evaluation Count:0 |
| 0-747 |
| 1404 | && d->lineEdit->completer() == d->completer) partially evaluated: d->lineEdit->completer() == d->completer| yes Evaluation Count:140 | no Evaluation Count:0 |
| 0-140 |
| 1405 | d->lineEdit->completer()->setModel(model); executed: d->lineEdit->completer()->setModel(model);Execution Count:140 | 140 |
| 1406 | | - |
| 1407 | if (d->model) { evaluated: d->model| yes Evaluation Count:329 | yes Evaluation Count:558 |
| 329-558 |
| 1408 | disconnect(d->model, "2""dataChanged(QModelIndex,QModelIndex)", | - |
| 1409 | this, "1""_q_dataChanged(QModelIndex,QModelIndex)"); | - |
| 1410 | disconnect(d->model, "2""rowsAboutToBeInserted(QModelIndex,int,int)", | - |
| 1411 | this, "1""_q_updateIndexBeforeChange()"); | - |
| 1412 | disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)", | - |
| 1413 | this, "1""_q_rowsInserted(QModelIndex,int,int)"); | - |
| 1414 | disconnect(d->model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)", | - |
| 1415 | this, "1""_q_updateIndexBeforeChange()"); | - |
| 1416 | disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)", | - |
| 1417 | this, "1""_q_rowsRemoved(QModelIndex,int,int)"); | - |
| 1418 | disconnect(d->model, "2""destroyed()", | - |
| 1419 | this, "1""_q_modelDestroyed()"); | - |
| 1420 | disconnect(d->model, "2""modelAboutToBeReset()", | - |
| 1421 | this, "1""_q_updateIndexBeforeChange()"); | - |
| 1422 | disconnect(d->model, "2""modelReset()", | - |
| 1423 | this, "1""_q_modelReset()"); | - |
| 1424 | if (d->model->QObject::parent() == this) partially evaluated: d->model->QObject::parent() == this| yes Evaluation Count:329 | no Evaluation Count:0 |
| 0-329 |
| 1425 | delete d->model; executed: delete d->model;Execution Count:329 | 329 |
| 1426 | } executed: }Execution Count:329 | 329 |
| 1427 | | - |
| 1428 | d->model = model; | - |
| 1429 | | - |
| 1430 | connect(model, "2""dataChanged(QModelIndex,QModelIndex)", | - |
| 1431 | this, "1""_q_dataChanged(QModelIndex,QModelIndex)"); | - |
| 1432 | connect(model, "2""rowsAboutToBeInserted(QModelIndex,int,int)", | - |
| 1433 | this, "1""_q_updateIndexBeforeChange()"); | - |
| 1434 | connect(model, "2""rowsInserted(QModelIndex,int,int)", | - |
| 1435 | this, "1""_q_rowsInserted(QModelIndex,int,int)"); | - |
| 1436 | connect(model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)", | - |
| 1437 | this, "1""_q_updateIndexBeforeChange()"); | - |
| 1438 | connect(model, "2""rowsRemoved(QModelIndex,int,int)", | - |
| 1439 | this, "1""_q_rowsRemoved(QModelIndex,int,int)"); | - |
| 1440 | connect(model, "2""destroyed()", | - |
| 1441 | this, "1""_q_modelDestroyed()"); | - |
| 1442 | connect(model, "2""modelAboutToBeReset()", | - |
| 1443 | this, "1""_q_updateIndexBeforeChange()"); | - |
| 1444 | connect(model, "2""modelReset()", | - |
| 1445 | this, "1""_q_modelReset()"); | - |
| 1446 | | - |
| 1447 | if (d->container) { evaluated: d->container| yes Evaluation Count:140 | yes Evaluation Count:747 |
| 140-747 |
| 1448 | d->container->itemView()->setModel(model); | - |
| 1449 | connect(d->container->itemView()->selectionModel(), | - |
| 1450 | "2""currentChanged(QModelIndex,QModelIndex)", | - |
| 1451 | this, "1""_q_emitHighlighted(QModelIndex)", Qt::UniqueConnection); | - |
| 1452 | } executed: }Execution Count:140 | 140 |
| 1453 | | - |
| 1454 | bool currentReset = false; | - |
| 1455 | | - |
| 1456 | if (count()) { partially evaluated: count()| no Evaluation Count:0 | yes Evaluation Count:887 |
| 0-887 |
| 1457 | for (int pos=0; pos < count(); pos++) { never evaluated: pos < count() | 0 |
| 1458 | if (d->model->index(pos, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled) { never evaluated: d->model->index(pos, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled | 0 |
| 1459 | setCurrentIndex(pos); | - |
| 1460 | currentReset = true; | - |
| 1461 | break; | 0 |
| 1462 | } | - |
| 1463 | } | 0 |
| 1464 | } | 0 |
| 1465 | | - |
| 1466 | if (!currentReset) partially evaluated: !currentReset| yes Evaluation Count:887 | no Evaluation Count:0 |
| 0-887 |
| 1467 | setCurrentIndex(-1); executed: setCurrentIndex(-1);Execution Count:887 | 887 |
| 1468 | | - |
| 1469 | d->modelChanged(); | - |
| 1470 | } executed: }Execution Count:887 | 887 |
| 1471 | | - |
| 1472 | | - |
| 1473 | | - |
| 1474 | | - |
| 1475 | | - |
| 1476 | | - |
| 1477 | | - |
| 1478 | QModelIndex QComboBox::rootModelIndex() const | - |
| 1479 | { | - |
| 1480 | const QComboBoxPrivate * const d = d_func(); | - |
| 1481 | return QModelIndex(d->root); never executed: return QModelIndex(d->root); | 0 |
| 1482 | } | - |
| 1483 | | - |
| 1484 | | - |
| 1485 | | - |
| 1486 | | - |
| 1487 | | - |
| 1488 | | - |
| 1489 | void QComboBox::setRootModelIndex(const QModelIndex &index) | - |
| 1490 | { | - |
| 1491 | QComboBoxPrivate * const d = d_func(); | - |
| 1492 | d->root = QPersistentModelIndex(index); | - |
| 1493 | view()->setRootIndex(index); | - |
| 1494 | update(); | - |
| 1495 | } | 0 |
| 1496 | int QComboBox::currentIndex() const | - |
| 1497 | { | - |
| 1498 | const QComboBoxPrivate * const d = d_func(); | - |
| 1499 | return d->currentIndex.row(); executed: return d->currentIndex.row();Execution Count:600 | 600 |
| 1500 | } | - |
| 1501 | | - |
| 1502 | void QComboBox::setCurrentIndex(int index) | - |
| 1503 | { | - |
| 1504 | QComboBoxPrivate * const d = d_func(); | - |
| 1505 | QModelIndex mi = d->model->index(index, d->modelColumn, d->root); | - |
| 1506 | d->setCurrentIndex(mi); | - |
| 1507 | } executed: }Execution Count:1786 | 1786 |
| 1508 | | - |
| 1509 | void QComboBox::setCurrentText(const QString &text) | - |
| 1510 | { | - |
| 1511 | if (isEditable()) { partially evaluated: isEditable()| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
| 1512 | setEditText(text); | - |
| 1513 | } else { executed: }Execution Count:3 | 3 |
| 1514 | const int i = findText(text); | - |
| 1515 | if (i > -1) | 0 |
| 1516 | setCurrentIndex(i); never executed: setCurrentIndex(i); | 0 |
| 1517 | } | 0 |
| 1518 | } | - |
| 1519 | | - |
| 1520 | void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi) | - |
| 1521 | { | - |
| 1522 | QComboBox * const q = q_func(); | - |
| 1523 | | - |
| 1524 | QModelIndex normalized; | - |
| 1525 | if (mi.column() != modelColumn) evaluated: mi.column() != modelColumn| yes Evaluation Count:889 | yes Evaluation Count:897 |
| 889-897 |
| 1526 | normalized = model->index(mi.row(), modelColumn, mi.parent()); executed: normalized = model->index(mi.row(), modelColumn, mi.parent());Execution Count:889 | 889 |
| 1527 | if (!normalized.isValid()) partially evaluated: !normalized.isValid()| yes Evaluation Count:1786 | no Evaluation Count:0 |
| 0-1786 |
| 1528 | normalized = mi; executed: normalized = mi;Execution Count:1786 | 1786 |
| 1529 | | - |
| 1530 | bool indexChanged = (normalized != currentIndex); | - |
| 1531 | if (indexChanged) evaluated: indexChanged| yes Evaluation Count:886 | yes Evaluation Count:900 |
| 886-900 |
| 1532 | currentIndex = QPersistentModelIndex(normalized); executed: currentIndex = QPersistentModelIndex(normalized);Execution Count:886 | 886 |
| 1533 | if (lineEdit) { evaluated: lineEdit| yes Evaluation Count:407 | yes Evaluation Count:1379 |
| 407-1379 |
| 1534 | QString newText = q->itemText(normalized.row()); | - |
| 1535 | if (lineEdit->text() != newText) evaluated: lineEdit->text() != newText| yes Evaluation Count:240 | yes Evaluation Count:167 |
| 167-240 |
| 1536 | lineEdit->setText(newText); executed: lineEdit->setText(newText);Execution Count:240 | 240 |
| 1537 | updateLineEditGeometry(); | - |
| 1538 | } executed: }Execution Count:407 | 407 |
| 1539 | if (indexChanged) { evaluated: indexChanged| yes Evaluation Count:886 | yes Evaluation Count:900 |
| 886-900 |
| 1540 | q->update(); | - |
| 1541 | _q_emitCurrentIndexChanged(currentIndex); | - |
| 1542 | } executed: }Execution Count:886 | 886 |
| 1543 | } executed: }Execution Count:1786 | 1786 |
| 1544 | QString QComboBox::currentText() const | - |
| 1545 | { | - |
| 1546 | const QComboBoxPrivate * const d = d_func(); | - |
| 1547 | if (d->lineEdit) evaluated: d->lineEdit| yes Evaluation Count:299 | yes Evaluation Count:1131 |
| 299-1131 |
| 1548 | return d->lineEdit->text(); executed: return d->lineEdit->text();Execution Count:299 | 299 |
| 1549 | else if (d->currentIndex.isValid()) evaluated: d->currentIndex.isValid()| yes Evaluation Count:981 | yes Evaluation Count:150 |
| 150-981 |
| 1550 | return d->itemText(d->currentIndex); executed: return d->itemText(d->currentIndex);Execution Count:981 | 981 |
| 1551 | else | - |
| 1552 | return QString(); executed: return QString();Execution Count:150 | 150 |
| 1553 | } | - |
| 1554 | | - |
| 1555 | | - |
| 1556 | | - |
| 1557 | | - |
| 1558 | QString QComboBox::itemText(int index) const | - |
| 1559 | { | - |
| 1560 | const QComboBoxPrivate * const d = d_func(); | - |
| 1561 | QModelIndex mi = d->model->index(index, d->modelColumn, d->root); | - |
| 1562 | return d->itemText(mi); executed: return d->itemText(mi);Execution Count:2641 | 2641 |
| 1563 | } | - |
| 1564 | | - |
| 1565 | | - |
| 1566 | | - |
| 1567 | | - |
| 1568 | QIcon QComboBox::itemIcon(int index) const | - |
| 1569 | { | - |
| 1570 | const QComboBoxPrivate * const d = d_func(); | - |
| 1571 | QModelIndex mi = d->model->index(index, d->modelColumn, d->root); | - |
| 1572 | return d->itemIcon(mi); executed: return d->itemIcon(mi);Execution Count:1619 | 1619 |
| 1573 | } | - |
| 1574 | | - |
| 1575 | | - |
| 1576 | | - |
| 1577 | | - |
| 1578 | | - |
| 1579 | QVariant QComboBox::itemData(int index, int role) const | - |
| 1580 | { | - |
| 1581 | const QComboBoxPrivate * const d = d_func(); | - |
| 1582 | QModelIndex mi = d->model->index(index, d->modelColumn, d->root); | - |
| 1583 | return d->model->data(mi, role); never executed: return d->model->data(mi, role); | 0 |
| 1584 | } | - |
| 1585 | void QComboBox::insertItem(int index, const QIcon &icon, const QString &text, const QVariant &userData) | - |
| 1586 | { | - |
| 1587 | QComboBoxPrivate * const d = d_func(); | - |
| 1588 | int itemCount = count(); | - |
| 1589 | index = qBound(0, index, itemCount); | - |
| 1590 | if (index >= d->maxCount) partially evaluated: index >= d->maxCount| no Evaluation Count:0 | yes Evaluation Count:132 |
| 0-132 |
| 1591 | return; | 0 |
| 1592 | | - |
| 1593 | | - |
| 1594 | | - |
| 1595 | if (QStandardItemModel *m = qobject_cast<QStandardItemModel*>(d->model)) { partially evaluated: QStandardItemModel *m = qobject_cast<QStandardItemModel*>(d->model)| yes Evaluation Count:132 | no Evaluation Count:0 |
| 0-132 |
| 1596 | QStandardItem *item = new QStandardItem(text); | - |
| 1597 | if (!icon.isNull()) item->setData(icon, Qt::DecorationRole); never executed: item->setData(icon, Qt::DecorationRole); partially evaluated: !icon.isNull()| no Evaluation Count:0 | yes Evaluation Count:132 |
| 0-132 |
| 1598 | if (userData.isValid()) item->setData(userData, Qt::UserRole); never executed: item->setData(userData, Qt::UserRole); partially evaluated: userData.isValid()| no Evaluation Count:0 | yes Evaluation Count:132 |
| 0-132 |
| 1599 | m->insertRow(index, item); | - |
| 1600 | ++itemCount; | - |
| 1601 | } else { executed: }Execution Count:132 | 132 |
| 1602 | d->inserting = true; | - |
| 1603 | if (d->model->insertRows(index, 1, d->root)) { never evaluated: d->model->insertRows(index, 1, d->root) | 0 |
| 1604 | QModelIndex item = d->model->index(index, d->modelColumn, d->root); | - |
| 1605 | if (icon.isNull() && !userData.isValid()) { never evaluated: icon.isNull() never evaluated: !userData.isValid() | 0 |
| 1606 | d->model->setData(item, text, Qt::EditRole); | - |
| 1607 | } else { | 0 |
| 1608 | QMap<int, QVariant> values; | - |
| 1609 | if (!text.isNull()) values.insert(Qt::EditRole, text); never executed: values.insert(Qt::EditRole, text); never evaluated: !text.isNull() | 0 |
| 1610 | if (!icon.isNull()) values.insert(Qt::DecorationRole, icon); never executed: values.insert(Qt::DecorationRole, icon); never evaluated: !icon.isNull() | 0 |
| 1611 | if (userData.isValid()) values.insert(Qt::UserRole, userData); never executed: values.insert(Qt::UserRole, userData); never evaluated: userData.isValid() | 0 |
| 1612 | if (!values.isEmpty()) d->model->setItemData(item, values); never executed: d->model->setItemData(item, values); never evaluated: !values.isEmpty() | 0 |
| 1613 | } | 0 |
| 1614 | d->inserting = false; | - |
| 1615 | d->_q_rowsInserted(d->root, index, index); | - |
| 1616 | ++itemCount; | - |
| 1617 | } else { | 0 |
| 1618 | d->inserting = false; | - |
| 1619 | } | 0 |
| 1620 | } | - |
| 1621 | | - |
| 1622 | if (itemCount > d->maxCount) partially evaluated: itemCount > d->maxCount| no Evaluation Count:0 | yes Evaluation Count:132 |
| 0-132 |
| 1623 | d->model->removeRows(itemCount - 1, itemCount - d->maxCount, d->root); never executed: d->model->removeRows(itemCount - 1, itemCount - d->maxCount, d->root); | 0 |
| 1624 | } executed: }Execution Count:132 | 132 |
| 1625 | void QComboBox::insertItems(int index, const QStringList &list) | - |
| 1626 | { | - |
| 1627 | QComboBoxPrivate * const d = d_func(); | - |
| 1628 | if (list.isEmpty()) partially evaluated: list.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:224 |
| 0-224 |
| 1629 | return; | 0 |
| 1630 | index = qBound(0, index, count()); | - |
| 1631 | int insertCount = qMin(d->maxCount - index, list.count()); | - |
| 1632 | if (insertCount <= 0) partially evaluated: insertCount <= 0| no Evaluation Count:0 | yes Evaluation Count:224 |
| 0-224 |
| 1633 | return; | 0 |
| 1634 | | - |
| 1635 | | - |
| 1636 | if (QStandardItemModel *m = qobject_cast<QStandardItemModel*>(d->model)) { partially evaluated: QStandardItemModel *m = qobject_cast<QStandardItemModel*>(d->model)| yes Evaluation Count:224 | no Evaluation Count:0 |
| 0-224 |
| 1637 | QList<QStandardItem *> items; | - |
| 1638 | QStandardItem *hiddenRoot = m->invisibleRootItem(); | - |
| 1639 | for (int i = 0; i < insertCount; ++i) evaluated: i < insertCount| yes Evaluation Count:274 | yes Evaluation Count:224 |
| 224-274 |
| 1640 | items.append(new QStandardItem(list.at(i))); executed: items.append(new QStandardItem(list.at(i)));Execution Count:274 | 274 |
| 1641 | hiddenRoot->insertRows(index, items); | - |
| 1642 | } else { executed: }Execution Count:224 | 224 |
| 1643 | d->inserting = true; | - |
| 1644 | if (d->model->insertRows(index, insertCount, d->root)) { never evaluated: d->model->insertRows(index, insertCount, d->root) | 0 |
| 1645 | QModelIndex item; | - |
| 1646 | for (int i = 0; i < insertCount; ++i) { never evaluated: i < insertCount | 0 |
| 1647 | item = d->model->index(i+index, d->modelColumn, d->root); | - |
| 1648 | d->model->setData(item, list.at(i), Qt::EditRole); | - |
| 1649 | } | 0 |
| 1650 | d->inserting = false; | - |
| 1651 | d->_q_rowsInserted(d->root, index, index + insertCount - 1); | - |
| 1652 | } else { | 0 |
| 1653 | d->inserting = false; | - |
| 1654 | } | 0 |
| 1655 | } | - |
| 1656 | | - |
| 1657 | int mc = count(); | - |
| 1658 | if (mc > d->maxCount) partially evaluated: mc > d->maxCount| no Evaluation Count:0 | yes Evaluation Count:224 |
| 0-224 |
| 1659 | d->model->removeRows(d->maxCount, mc - d->maxCount, d->root); never executed: d->model->removeRows(d->maxCount, mc - d->maxCount, d->root); | 0 |
| 1660 | } executed: }Execution Count:224 | 224 |
| 1661 | void QComboBox::insertSeparator(int index) | - |
| 1662 | { | - |
| 1663 | QComboBoxPrivate * const d = d_func(); | - |
| 1664 | int itemCount = count(); | - |
| 1665 | index = qBound(0, index, itemCount); | - |
| 1666 | if (index >= d->maxCount) never evaluated: index >= d->maxCount | 0 |
| 1667 | return; | 0 |
| 1668 | insertItem(index, QIcon(), QString()); | - |
| 1669 | QComboBoxDelegate::setSeparator(d->model, d->model->index(index, 0, d->root)); | - |
| 1670 | } | 0 |
| 1671 | | - |
| 1672 | | - |
| 1673 | | - |
| 1674 | | - |
| 1675 | | - |
| 1676 | | - |
| 1677 | | - |
| 1678 | void QComboBox::removeItem(int index) | - |
| 1679 | { | - |
| 1680 | QComboBoxPrivate * const d = d_func(); | - |
| 1681 | if (index < 0 || index >= count()) never evaluated: index < 0 never evaluated: index >= count() | 0 |
| 1682 | return; | 0 |
| 1683 | d->model->removeRows(index, 1, d->root); | - |
| 1684 | } | 0 |
| 1685 | | - |
| 1686 | | - |
| 1687 | | - |
| 1688 | | - |
| 1689 | void QComboBox::setItemText(int index, const QString &text) | - |
| 1690 | { | - |
| 1691 | const QComboBoxPrivate * const d = d_func(); | - |
| 1692 | QModelIndex item = d->model->index(index, d->modelColumn, d->root); | - |
| 1693 | if (item.isValid()) { never evaluated: item.isValid() | 0 |
| 1694 | d->model->setData(item, text, Qt::EditRole); | - |
| 1695 | } | 0 |
| 1696 | } | 0 |
| 1697 | | - |
| 1698 | | - |
| 1699 | | - |
| 1700 | | - |
| 1701 | void QComboBox::setItemIcon(int index, const QIcon &icon) | - |
| 1702 | { | - |
| 1703 | const QComboBoxPrivate * const d = d_func(); | - |
| 1704 | QModelIndex item = d->model->index(index, d->modelColumn, d->root); | - |
| 1705 | if (item.isValid()) { never evaluated: item.isValid() | 0 |
| 1706 | d->model->setData(item, icon, Qt::DecorationRole); | - |
| 1707 | } | 0 |
| 1708 | } | 0 |
| 1709 | | - |
| 1710 | | - |
| 1711 | | - |
| 1712 | | - |
| 1713 | | - |
| 1714 | void QComboBox::setItemData(int index, const QVariant &value, int role) | - |
| 1715 | { | - |
| 1716 | const QComboBoxPrivate * const d = d_func(); | - |
| 1717 | QModelIndex item = d->model->index(index, d->modelColumn, d->root); | - |
| 1718 | if (item.isValid()) { never evaluated: item.isValid() | 0 |
| 1719 | d->model->setData(item, value, role); | - |
| 1720 | } | 0 |
| 1721 | } | 0 |
| 1722 | | - |
| 1723 | | - |
| 1724 | | - |
| 1725 | | - |
| 1726 | QAbstractItemView *QComboBox::view() const | - |
| 1727 | { | - |
| 1728 | const QComboBoxPrivate * const d = d_func(); | - |
| 1729 | return const_cast<QComboBoxPrivate*>(d)->viewContainer()->itemView(); executed: return const_cast<QComboBoxPrivate*>(d)->viewContainer()->itemView();Execution Count:2112 | 2112 |
| 1730 | } | - |
| 1731 | void QComboBox::setView(QAbstractItemView *itemView) | - |
| 1732 | { | - |
| 1733 | QComboBoxPrivate * const d = d_func(); | - |
| 1734 | if (!itemView) { never evaluated: !itemView | 0 |
| 1735 | QMessageLogger("widgets/qcombobox.cpp", 2308, __PRETTY_FUNCTION__).warning("QComboBox::setView: cannot set a 0 view"); | - |
| 1736 | return; | 0 |
| 1737 | } | - |
| 1738 | | - |
| 1739 | if (itemView->model() != d->model) never evaluated: itemView->model() != d->model | 0 |
| 1740 | itemView->setModel(d->model); never executed: itemView->setModel(d->model); | 0 |
| 1741 | d->viewContainer()->setItemView(itemView); | - |
| 1742 | } | 0 |
| 1743 | | - |
| 1744 | | - |
| 1745 | | - |
| 1746 | | - |
| 1747 | QSize QComboBox::minimumSizeHint() const | - |
| 1748 | { | - |
| 1749 | const QComboBoxPrivate * const d = d_func(); | - |
| 1750 | return d->recomputeSizeHint(d->minimumSizeHint); executed: return d->recomputeSizeHint(d->minimumSizeHint);Execution Count:518 | 518 |
| 1751 | } | - |
| 1752 | QSize QComboBox::sizeHint() const | - |
| 1753 | { | - |
| 1754 | const QComboBoxPrivate * const d = d_func(); | - |
| 1755 | return d->recomputeSizeHint(d->sizeHint); executed: return d->recomputeSizeHint(d->sizeHint);Execution Count:673 | 673 |
| 1756 | } | - |
| 1757 | void QComboBox::showPopup() | - |
| 1758 | { | - |
| 1759 | QComboBoxPrivate * const d = d_func(); | - |
| 1760 | if (count() <= 0) partially evaluated: count() <= 0| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1761 | return; | 0 |
| 1762 | QStyle * const style = this->style(); | - |
| 1763 | | - |
| 1764 | | - |
| 1765 | view()->selectionModel()->setCurrentIndex(d->currentIndex, | - |
| 1766 | QItemSelectionModel::ClearAndSelect); | - |
| 1767 | QComboBoxPrivateContainer* container = d->viewContainer(); | - |
| 1768 | QStyleOptionComboBox opt; | - |
| 1769 | initStyleOption(&opt); | - |
| 1770 | QRect listRect(style->subControlRect(QStyle::CC_ComboBox, &opt, | - |
| 1771 | QStyle::SC_ComboBoxListBoxPopup, this)); | - |
| 1772 | QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this)); | - |
| 1773 | | - |
| 1774 | QPoint below = mapToGlobal(listRect.bottomLeft()); | - |
| 1775 | int belowHeight = screen.bottom() - below.y(); | - |
| 1776 | QPoint above = mapToGlobal(listRect.topLeft()); | - |
| 1777 | int aboveHeight = above.y() - screen.y(); | - |
| 1778 | bool boundToScreen = !window()->testAttribute(Qt::WA_DontShowOnScreen); | - |
| 1779 | | - |
| 1780 | const bool usePopup = style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this); | - |
| 1781 | { | - |
| 1782 | int listHeight = 0; | - |
| 1783 | int count = 0; | - |
| 1784 | QStack<QModelIndex> toCheck; | - |
| 1785 | toCheck.push(view()->rootIndex()); | - |
| 1786 | | - |
| 1787 | QTreeView *treeView = qobject_cast<QTreeView*>(view()); | - |
| 1788 | if (treeView && treeView->header() && !treeView->header()->isHidden()) partially evaluated: treeView| no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: treeView->header() never evaluated: !treeView->header()->isHidden() | 0-1 |
| 1789 | listHeight += treeView->header()->height(); never executed: listHeight += treeView->header()->height(); | 0 |
| 1790 | | - |
| 1791 | while (!toCheck.isEmpty()) { evaluated: !toCheck.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 1792 | QModelIndex parent = toCheck.pop(); | - |
| 1793 | for (int i = 0; i < d->model->rowCount(parent); ++i) { evaluated: i < d->model->rowCount(parent)| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 1794 | QModelIndex idx = d->model->index(i, d->modelColumn, parent); | - |
| 1795 | if (!idx.isValid()) partially evaluated: !idx.isValid()| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1796 | continue; never executed: continue; | 0 |
| 1797 | listHeight += view()->visualRect(idx).height() + container->spacing(); | - |
| 1798 | | - |
| 1799 | if (d->model->hasChildren(idx) && treeView && treeView->isExpanded(idx)) partially evaluated: d->model->hasChildren(idx)| no Evaluation Count:0 | yes Evaluation Count:3 |
never evaluated: treeView never evaluated: treeView->isExpanded(idx) | 0-3 |
| 1800 | toCheck.push(idx); never executed: toCheck.push(idx); | 0 |
| 1801 | | - |
| 1802 | ++count; | - |
| 1803 | if (!usePopup && count >= d->maxVisibleItems) { partially evaluated: !usePopup| yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: count >= d->maxVisibleItems| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1804 | toCheck.clear(); | - |
| 1805 | break; | 0 |
| 1806 | } | - |
| 1807 | } executed: }Execution Count:3 | 3 |
| 1808 | } executed: }Execution Count:1 | 1 |
| 1809 | listRect.setHeight(listHeight); | - |
| 1810 | } | - |
| 1811 | | - |
| 1812 | { | - |
| 1813 | | - |
| 1814 | int heightMargin = 2*container->spacing(); | - |
| 1815 | | - |
| 1816 | | - |
| 1817 | int marginTop, marginBottom; | - |
| 1818 | container->getContentsMargins(0, &marginTop, 0, &marginBottom); | - |
| 1819 | heightMargin += marginTop + marginBottom; | - |
| 1820 | | - |
| 1821 | | - |
| 1822 | view()->getContentsMargins(0, &marginTop, 0, &marginBottom); | - |
| 1823 | marginTop += static_cast<QAbstractScrollAreaPrivate *>(QObjectPrivate::get(view()))->top; | - |
| 1824 | marginBottom += static_cast<QAbstractScrollAreaPrivate *>(QObjectPrivate::get(view()))->bottom; | - |
| 1825 | heightMargin += marginTop + marginBottom; | - |
| 1826 | | - |
| 1827 | listRect.setHeight(listRect.height() + heightMargin); | - |
| 1828 | } | - |
| 1829 | | - |
| 1830 | | - |
| 1831 | if (usePopup) partially evaluated: usePopup| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1832 | listRect.setHeight(listRect.height() + style->pixelMetric(QStyle::PM_MenuVMargin, &opt, this) * 2); never executed: listRect.setHeight(listRect.height() + style->pixelMetric(QStyle::PM_MenuVMargin, &opt, this) * 2); | 0 |
| 1833 | | - |
| 1834 | | - |
| 1835 | if (usePopup) { partially evaluated: usePopup| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1836 | const int diff = d->computeWidthHint() - width(); | - |
| 1837 | if (diff > 0) never evaluated: diff > 0 | 0 |
| 1838 | listRect.setWidth(listRect.width() + diff); never executed: listRect.setWidth(listRect.width() + diff); | 0 |
| 1839 | } | 0 |
| 1840 | | - |
| 1841 | | - |
| 1842 | container->layout()->activate(); | - |
| 1843 | | - |
| 1844 | listRect.setSize( listRect.size().expandedTo(container->minimumSize()) | - |
| 1845 | .boundedTo(container->maximumSize())); | - |
| 1846 | | - |
| 1847 | | - |
| 1848 | if (boundToScreen) { partially evaluated: boundToScreen| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1849 | if (listRect.width() > screen.width() ) partially evaluated: listRect.width() > screen.width()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1850 | listRect.setWidth(screen.width()); never executed: listRect.setWidth(screen.width()); | 0 |
| 1851 | if (mapToGlobal(listRect.bottomRight()).x() > screen.right()) { partially evaluated: mapToGlobal(listRect.bottomRight()).x() > screen.right()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1852 | below.setX(screen.x() + screen.width() - listRect.width()); | - |
| 1853 | above.setX(screen.x() + screen.width() - listRect.width()); | - |
| 1854 | } | 0 |
| 1855 | if (mapToGlobal(listRect.topLeft()).x() < screen.x() ) { partially evaluated: mapToGlobal(listRect.topLeft()).x() < screen.x()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1856 | below.setX(screen.x()); | - |
| 1857 | above.setX(screen.x()); | - |
| 1858 | } | 0 |
| 1859 | } executed: }Execution Count:1 | 1 |
| 1860 | | - |
| 1861 | if (usePopup) { partially evaluated: usePopup| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1862 | | - |
| 1863 | listRect.moveLeft(above.x()); | - |
| 1864 | | - |
| 1865 | | - |
| 1866 | | - |
| 1867 | const QRect currentItemRect = view()->visualRect(view()->currentIndex()); | - |
| 1868 | const int offset = listRect.top() - currentItemRect.top(); | - |
| 1869 | listRect.moveTop(above.y() + offset - listRect.top()); | - |
| 1870 | | - |
| 1871 | | - |
| 1872 | | - |
| 1873 | | - |
| 1874 | const int height = !boundToScreen ? listRect.height() : qMin(listRect.height(), screen.height()); never evaluated: !boundToScreen | 0 |
| 1875 | listRect.setHeight(height); | - |
| 1876 | | - |
| 1877 | if (boundToScreen) { never evaluated: boundToScreen | 0 |
| 1878 | if (listRect.top() < screen.top()) never evaluated: listRect.top() < screen.top() | 0 |
| 1879 | listRect.moveTop(screen.top()); never executed: listRect.moveTop(screen.top()); | 0 |
| 1880 | if (listRect.bottom() > screen.bottom()) never evaluated: listRect.bottom() > screen.bottom() | 0 |
| 1881 | listRect.moveBottom(screen.bottom()); never executed: listRect.moveBottom(screen.bottom()); | 0 |
| 1882 | } | 0 |
| 1883 | } else if (!boundToScreen || listRect.height() <= belowHeight) { partially evaluated: !boundToScreen| no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: listRect.height() <= belowHeight| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1884 | listRect.moveTopLeft(below); | - |
| 1885 | } else if (listRect.height() <= aboveHeight) { executed: }Execution Count:1 never evaluated: listRect.height() <= aboveHeight | 0-1 |
| 1886 | listRect.moveBottomLeft(above); | - |
| 1887 | } else if (belowHeight >= aboveHeight) { never evaluated: belowHeight >= aboveHeight | 0 |
| 1888 | listRect.setHeight(belowHeight); | - |
| 1889 | listRect.moveTopLeft(below); | - |
| 1890 | } else { | 0 |
| 1891 | listRect.setHeight(aboveHeight); | - |
| 1892 | listRect.moveBottomLeft(above); | - |
| 1893 | } | 0 |
| 1894 | | - |
| 1895 | if ((static_cast<QApplication *>(QCoreApplication::instance()))) { partially evaluated: (static_cast<QApplication *>(QCoreApplication::instance()))| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1896 | (static_cast<QApplication *>(QCoreApplication::instance()))->inputMethod()->reset(); | - |
| 1897 | } executed: }Execution Count:1 | 1 |
| 1898 | | - |
| 1899 | QScrollBar *sb = view()->horizontalScrollBar(); | - |
| 1900 | Qt::ScrollBarPolicy policy = view()->horizontalScrollBarPolicy(); | - |
| 1901 | bool needHorizontalScrollBar = (policy == Qt::ScrollBarAsNeeded || policy == Qt::ScrollBarAlwaysOn) partially evaluated: policy == Qt::ScrollBarAsNeeded| no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: policy == Qt::ScrollBarAlwaysOn| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1902 | && sb->minimum() < sb->maximum(); never evaluated: sb->minimum() < sb->maximum() | 0 |
| 1903 | if (needHorizontalScrollBar) { partially evaluated: needHorizontalScrollBar| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1904 | listRect.adjust(0, 0, 0, sb->height()); | - |
| 1905 | } | 0 |
| 1906 | container->setGeometry(listRect); | - |
| 1907 | | - |
| 1908 | | - |
| 1909 | const bool updatesEnabled = container->updatesEnabled(); | - |
| 1910 | | - |
| 1911 | | - |
| 1912 | | - |
| 1913 | bool scrollDown = (listRect.topLeft() == below); | - |
| 1914 | if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo) partially evaluated: QApplication::isEffectEnabled(Qt::UI_AnimateCombo)| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1915 | && !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) && !window()->testAttribute(Qt::WA_DontShowOnScreen)) never evaluated: !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) never evaluated: !window()->testAttribute(Qt::WA_DontShowOnScreen) | 0 |
| 1916 | qScrollEffect(container, scrollDown ? QEffects::DownScroll : QEffects::UpScroll, 150); never executed: qScrollEffect(container, scrollDown ? QEffects::DownScroll : QEffects::UpScroll, 150); | 0 |
| 1917 | container->setUpdatesEnabled(false); | - |
| 1918 | | - |
| 1919 | | - |
| 1920 | container->raise(); | - |
| 1921 | container->show(); | - |
| 1922 | container->updateScrollers(); | - |
| 1923 | view()->setFocus(); | - |
| 1924 | | - |
| 1925 | view()->scrollTo(view()->currentIndex(), | - |
| 1926 | style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this) | - |
| 1927 | ? QAbstractItemView::PositionAtCenter | - |
| 1928 | : QAbstractItemView::EnsureVisible); | - |
| 1929 | | - |
| 1930 | | - |
| 1931 | container->setUpdatesEnabled(updatesEnabled); | - |
| 1932 | | - |
| 1933 | | - |
| 1934 | container->update(); | - |
| 1935 | | - |
| 1936 | | - |
| 1937 | | - |
| 1938 | | - |
| 1939 | } executed: }Execution Count:1 | 1 |
| 1940 | void QComboBox::hidePopup() | - |
| 1941 | { | - |
| 1942 | QComboBoxPrivate * const d = d_func(); | - |
| 1943 | if (d->container && d->container->isVisible()) { evaluated: d->container| yes Evaluation Count:57 | yes Evaluation Count:75 |
partially evaluated: d->container->isVisible()| no Evaluation Count:0 | yes Evaluation Count:57 |
| 0-75 |
| 1944 | | - |
| 1945 | d->model->blockSignals(true); | - |
| 1946 | d->container->itemView()->blockSignals(true); | - |
| 1947 | d->container->blockSignals(true); | - |
| 1948 | | - |
| 1949 | if (style()->styleHint(QStyle::SH_Menu_FlashTriggeredItem)) { never evaluated: style()->styleHint(QStyle::SH_Menu_FlashTriggeredItem) | 0 |
| 1950 | QItemSelectionModel *selectionModel = view() ? view()->selectionModel() : 0; | 0 |
| 1951 | if (selectionModel && selectionModel->hasSelection()) { never evaluated: selectionModel never evaluated: selectionModel->hasSelection() | 0 |
| 1952 | QEventLoop eventLoop; | - |
| 1953 | const QItemSelection selection = selectionModel->selection(); | - |
| 1954 | | - |
| 1955 | | - |
| 1956 | selectionModel->select(selection, QItemSelectionModel::Toggle); | - |
| 1957 | QTimer::singleShot(60, &eventLoop, "1""quit()"); | - |
| 1958 | eventLoop.exec(); | - |
| 1959 | | - |
| 1960 | | - |
| 1961 | selectionModel->select(selection, QItemSelectionModel::Toggle); | - |
| 1962 | QTimer::singleShot(20, &eventLoop, "1""quit()"); | - |
| 1963 | eventLoop.exec(); | - |
| 1964 | } | 0 |
| 1965 | } | 0 |
| 1966 | | - |
| 1967 | | - |
| 1968 | bool needFade = style()->styleHint(QStyle::SH_Menu_FadeOutOnHide); | - |
| 1969 | bool didFade = false; | - |
| 1970 | if (needFade) { never evaluated: needFade | 0 |
| 1971 | } | 0 |
| 1972 | d->model->blockSignals(false); | - |
| 1973 | d->container->itemView()->blockSignals(false); | - |
| 1974 | d->container->blockSignals(false); | - |
| 1975 | | - |
| 1976 | if (!didFade) never evaluated: !didFade | 0 |
| 1977 | | - |
| 1978 | | - |
| 1979 | d->container->hide(); never executed: d->container->hide(); | 0 |
| 1980 | } | 0 |
| 1981 | | - |
| 1982 | | - |
| 1983 | | - |
| 1984 | | - |
| 1985 | d->_q_resetButton(); | - |
| 1986 | } executed: }Execution Count:132 | 132 |
| 1987 | | - |
| 1988 | | - |
| 1989 | | - |
| 1990 | | - |
| 1991 | | - |
| 1992 | | - |
| 1993 | | - |
| 1994 | void QComboBox::clear() | - |
| 1995 | { | - |
| 1996 | QComboBoxPrivate * const d = d_func(); | - |
| 1997 | d->model->removeRows(0, d->model->rowCount(d->root), d->root); | - |
| 1998 | | - |
| 1999 | QAccessibleEvent event(this, QAccessible::NameChanged); | - |
| 2000 | QAccessible::updateAccessibility(&event); | - |
| 2001 | | - |
| 2002 | } executed: }Execution Count:238 | 238 |
| 2003 | | - |
| 2004 | | - |
| 2005 | | - |
| 2006 | | - |
| 2007 | void QComboBox::clearEditText() | - |
| 2008 | { | - |
| 2009 | QComboBoxPrivate * const d = d_func(); | - |
| 2010 | if (d->lineEdit) partially evaluated: d->lineEdit| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 2011 | d->lineEdit->clear(); executed: d->lineEdit->clear();Execution Count:1 | 1 |
| 2012 | | - |
| 2013 | QAccessibleEvent event(this, QAccessible::NameChanged); | - |
| 2014 | QAccessible::updateAccessibility(&event); | - |
| 2015 | | - |
| 2016 | } executed: }Execution Count:1 | 1 |
| 2017 | | - |
| 2018 | | - |
| 2019 | | - |
| 2020 | | - |
| 2021 | void QComboBox::setEditText(const QString &text) | - |
| 2022 | { | - |
| 2023 | QComboBoxPrivate * const d = d_func(); | - |
| 2024 | if (d->lineEdit) partially evaluated: d->lineEdit| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 2025 | d->lineEdit->setText(text); executed: d->lineEdit->setText(text);Execution Count:4 | 4 |
| 2026 | | - |
| 2027 | QAccessibleEvent event(this, QAccessible::NameChanged); | - |
| 2028 | QAccessible::updateAccessibility(&event); | - |
| 2029 | | - |
| 2030 | } executed: }Execution Count:4 | 4 |
| 2031 | | - |
| 2032 | | - |
| 2033 | | - |
| 2034 | | - |
| 2035 | void QComboBox::focusInEvent(QFocusEvent *e) | - |
| 2036 | { | - |
| 2037 | QComboBoxPrivate * const d = d_func(); | - |
| 2038 | update(); | - |
| 2039 | if (d->lineEdit) { evaluated: d->lineEdit| yes Evaluation Count:9 | yes Evaluation Count:7 |
| 7-9 |
| 2040 | d->lineEdit->event(e); | - |
| 2041 | | - |
| 2042 | if (d->lineEdit->completer()) partially evaluated: d->lineEdit->completer()| yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
| 2043 | d->lineEdit->completer()->setWidget(this); executed: d->lineEdit->completer()->setWidget(this);Execution Count:9 | 9 |
| 2044 | | - |
| 2045 | } executed: }Execution Count:9 | 9 |
| 2046 | } executed: }Execution Count:16 | 16 |
| 2047 | | - |
| 2048 | | - |
| 2049 | | - |
| 2050 | | - |
| 2051 | void QComboBox::focusOutEvent(QFocusEvent *e) | - |
| 2052 | { | - |
| 2053 | QComboBoxPrivate * const d = d_func(); | - |
| 2054 | update(); | - |
| 2055 | if (d->lineEdit) evaluated: d->lineEdit| yes Evaluation Count:6 | yes Evaluation Count:5 |
| 5-6 |
| 2056 | d->lineEdit->event(e); executed: d->lineEdit->event(e);Execution Count:6 | 6 |
| 2057 | } executed: }Execution Count:11 | 11 |
| 2058 | | - |
| 2059 | | - |
| 2060 | void QComboBox::changeEvent(QEvent *e) | - |
| 2061 | { | - |
| 2062 | QComboBoxPrivate * const d = d_func(); | - |
| 2063 | switch (e->type()) { | - |
| 2064 | case QEvent::StyleChange: | - |
| 2065 | d->updateDelegate(); | - |
| 2066 | | - |
| 2067 | | - |
| 2068 | | - |
| 2069 | d->sizeHint = QSize(); | - |
| 2070 | d->minimumSizeHint = QSize(); | - |
| 2071 | d->updateLayoutDirection(); | - |
| 2072 | if (d->lineEdit) partially evaluated: d->lineEdit| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 2073 | d->updateLineEditGeometry(); executed: d->updateLineEditGeometry();Execution Count:2 | 2 |
| 2074 | d->setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem); | - |
| 2075 | | - |
| 2076 | | - |
| 2077 | break; executed: break;Execution Count:2 | 2 |
| 2078 | case QEvent::EnabledChange: | - |
| 2079 | if (!isEnabled()) evaluated: !isEnabled()| yes Evaluation Count:16 | yes Evaluation Count:12 |
| 12-16 |
| 2080 | hidePopup(); executed: hidePopup();Execution Count:16 | 16 |
| 2081 | break; executed: break;Execution Count:28 | 28 |
| 2082 | case QEvent::PaletteChange: { | - |
| 2083 | d->updateViewContainerPaletteAndOpacity(); | - |
| 2084 | break; | 0 |
| 2085 | } | - |
| 2086 | case QEvent::FontChange: | - |
| 2087 | d->sizeHint = QSize(); | - |
| 2088 | d->viewContainer()->setFont(font()); | - |
| 2089 | if (d->lineEdit) never evaluated: d->lineEdit | 0 |
| 2090 | d->updateLineEditGeometry(); never executed: d->updateLineEditGeometry(); | 0 |
| 2091 | break; | 0 |
| 2092 | default: | - |
| 2093 | break; executed: break;Execution Count:23 | 23 |
| 2094 | } | - |
| 2095 | QWidget::changeEvent(e); | - |
| 2096 | } executed: }Execution Count:53 | 53 |
| 2097 | | - |
| 2098 | | - |
| 2099 | | - |
| 2100 | | - |
| 2101 | void QComboBox::resizeEvent(QResizeEvent *) | - |
| 2102 | { | - |
| 2103 | QComboBoxPrivate * const d = d_func(); | - |
| 2104 | d->updateLineEditGeometry(); | - |
| 2105 | } executed: }Execution Count:112 | 112 |
| 2106 | | - |
| 2107 | | - |
| 2108 | | - |
| 2109 | | - |
| 2110 | void QComboBox::paintEvent(QPaintEvent *) | - |
| 2111 | { | - |
| 2112 | QStylePainter painter(this); | - |
| 2113 | painter.setPen(palette().color(QPalette::Text)); | - |
| 2114 | | - |
| 2115 | | - |
| 2116 | QStyleOptionComboBox opt; | - |
| 2117 | initStyleOption(&opt); | - |
| 2118 | painter.drawComplexControl(QStyle::CC_ComboBox, opt); | - |
| 2119 | | - |
| 2120 | | - |
| 2121 | painter.drawControl(QStyle::CE_ComboBoxLabel, opt); | - |
| 2122 | } executed: }Execution Count:60 | 60 |
| 2123 | | - |
| 2124 | | - |
| 2125 | | - |
| 2126 | | - |
| 2127 | void QComboBox::showEvent(QShowEvent *e) | - |
| 2128 | { | - |
| 2129 | QComboBoxPrivate * const d = d_func(); | - |
| 2130 | if (!d->shownOnce && d->sizeAdjustPolicy == QComboBox::AdjustToContentsOnFirstShow) { evaluated: !d->shownOnce| yes Evaluation Count:109 | yes Evaluation Count:7 |
evaluated: d->sizeAdjustPolicy == QComboBox::AdjustToContentsOnFirstShow| yes Evaluation Count:67 | yes Evaluation Count:42 |
| 7-109 |
| 2131 | d->sizeHint = QSize(); | - |
| 2132 | updateGeometry(); | - |
| 2133 | } executed: }Execution Count:67 | 67 |
| 2134 | d->shownOnce = true; | - |
| 2135 | QWidget::showEvent(e); | - |
| 2136 | } executed: }Execution Count:116 | 116 |
| 2137 | | - |
| 2138 | | - |
| 2139 | | - |
| 2140 | | - |
| 2141 | void QComboBox::hideEvent(QHideEvent *) | - |
| 2142 | { | - |
| 2143 | hidePopup(); | - |
| 2144 | } executed: }Execution Count:116 | 116 |
| 2145 | | - |
| 2146 | | - |
| 2147 | | - |
| 2148 | | - |
| 2149 | bool QComboBox::event(QEvent *event) | - |
| 2150 | { | - |
| 2151 | QComboBoxPrivate * const d = d_func(); | - |
| 2152 | switch(event->type()) { | - |
| 2153 | case QEvent::LayoutDirectionChange: | - |
| 2154 | case QEvent::ApplicationLayoutDirectionChange: | - |
| 2155 | d->updateLayoutDirection(); | - |
| 2156 | d->updateLineEditGeometry(); | - |
| 2157 | break; | 0 |
| 2158 | case QEvent::HoverEnter: | - |
| 2159 | case QEvent::HoverLeave: | - |
| 2160 | case QEvent::HoverMove: | - |
| 2161 | if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event)) never evaluated: const QHoverEvent *he = static_cast<const QHoverEvent *>(event) | 0 |
| 2162 | d->updateHoverControl(he->pos()); never executed: d->updateHoverControl(he->pos()); | 0 |
| 2163 | break; | 0 |
| 2164 | case QEvent::ShortcutOverride: | - |
| 2165 | if (d->lineEdit) evaluated: d->lineEdit| yes Evaluation Count:8 | yes Evaluation Count:1 |
| 1-8 |
| 2166 | return d->lineEdit->event(event); executed: return d->lineEdit->event(event);Execution Count:8 | 8 |
| 2167 | break; executed: break;Execution Count:1 | 1 |
| 2168 | default: | - |
| 2169 | break; executed: break;Execution Count:4080 | 4080 |
| 2170 | } | - |
| 2171 | return QWidget::event(event); executed: return QWidget::event(event);Execution Count:4081 | 4081 |
| 2172 | } | - |
| 2173 | | - |
| 2174 | | - |
| 2175 | | - |
| 2176 | | - |
| 2177 | void QComboBox::mousePressEvent(QMouseEvent *e) | - |
| 2178 | { | - |
| 2179 | QComboBoxPrivate * const d = d_func(); | - |
| 2180 | QStyleOptionComboBox opt; | - |
| 2181 | initStyleOption(&opt); | - |
| 2182 | QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, e->pos(), | - |
| 2183 | this); | - |
| 2184 | if (e->button() == Qt::LeftButton && (sc == QStyle::SC_ComboBoxArrow || !isEditable()) partially evaluated: e->button() == Qt::LeftButton| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: sc == QStyle::SC_ComboBoxArrow| no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: !isEditable()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2185 | && !d->viewContainer()->isVisible()) { never evaluated: !d->viewContainer()->isVisible() | 0 |
| 2186 | if (sc == QStyle::SC_ComboBoxArrow) never evaluated: sc == QStyle::SC_ComboBoxArrow | 0 |
| 2187 | d->updateArrow(QStyle::State_Sunken); never executed: d->updateArrow(QStyle::State_Sunken); | 0 |
| 2188 | | - |
| 2189 | | - |
| 2190 | | - |
| 2191 | | - |
| 2192 | | - |
| 2193 | | - |
| 2194 | d->viewContainer()->blockMouseReleaseTimer.start(QApplication::doubleClickInterval()); | - |
| 2195 | d->viewContainer()->initialClickPosition = mapToGlobal(e->pos()); | - |
| 2196 | | - |
| 2197 | | - |
| 2198 | | - |
| 2199 | showPopup(); | - |
| 2200 | } else { | 0 |
| 2201 | | - |
| 2202 | | - |
| 2203 | | - |
| 2204 | | - |
| 2205 | | - |
| 2206 | | - |
| 2207 | QWidget::mousePressEvent(e); | - |
| 2208 | } executed: }Execution Count:1 | 1 |
| 2209 | } | - |
| 2210 | | - |
| 2211 | | - |
| 2212 | | - |
| 2213 | | - |
| 2214 | void QComboBox::mouseReleaseEvent(QMouseEvent *e) | - |
| 2215 | { | - |
| 2216 | QComboBoxPrivate * const d = d_func(); | - |
| 2217 | (void)e;; | - |
| 2218 | d->updateArrow(QStyle::State_None); | - |
| 2219 | } executed: }Execution Count:1 | 1 |
| 2220 | | - |
| 2221 | | - |
| 2222 | | - |
| 2223 | | - |
| 2224 | void QComboBox::keyPressEvent(QKeyEvent *e) | - |
| 2225 | { | - |
| 2226 | QComboBoxPrivate * const d = d_func(); | - |
| 2227 | | - |
| 2228 | | - |
| 2229 | if (d->lineEdit evaluated: d->lineEdit| yes Evaluation Count:6 | yes Evaluation Count:1 |
| 1-6 |
| 2230 | && d->lineEdit->completer() partially evaluated: d->lineEdit->completer()| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 2231 | && d->lineEdit->completer()->popup() evaluated: d->lineEdit->completer()->popup()| yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
| 2232 | && d->lineEdit->completer()->popup()->isVisible()) { evaluated: d->lineEdit->completer()->popup()->isVisible()| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 2233 | | - |
| 2234 | d->lineEdit->event(e); | - |
| 2235 | return; executed: return;Execution Count:1 | 1 |
| 2236 | } | - |
| 2237 | | - |
| 2238 | | - |
| 2239 | enum Move { NoMove=0 , MoveUp , MoveDown , MoveFirst , MoveLast}; | - |
| 2240 | | - |
| 2241 | Move move = NoMove; | - |
| 2242 | int newIndex = currentIndex(); | - |
| 2243 | switch (e->key()) { | - |
| 2244 | case Qt::Key_Up: | - |
| 2245 | if (e->modifiers() & Qt::ControlModifier) never evaluated: e->modifiers() & Qt::ControlModifier | 0 |
| 2246 | break; | 0 |
| 2247 | case Qt::Key_PageUp: code before this statement never executed: case Qt::Key_PageUp: | 0 |
| 2248 | | - |
| 2249 | | - |
| 2250 | | - |
| 2251 | | - |
| 2252 | | - |
| 2253 | move = MoveUp; | - |
| 2254 | break; | 0 |
| 2255 | case Qt::Key_Down: | - |
| 2256 | if (e->modifiers() & Qt::AltModifier) { partially evaluated: e->modifiers() & Qt::AltModifier| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 2257 | showPopup(); | - |
| 2258 | return; | 0 |
| 2259 | } else if (e->modifiers() & Qt::ControlModifier) partially evaluated: e->modifiers() & Qt::ControlModifier| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 2260 | break; | 0 |
| 2261 | | - |
| 2262 | case Qt::Key_PageDown: code before this statement executed: case Qt::Key_PageDown:Execution Count:2 | 2 |
| 2263 | | - |
| 2264 | | - |
| 2265 | | - |
| 2266 | | - |
| 2267 | | - |
| 2268 | move = MoveDown; | - |
| 2269 | break; executed: break;Execution Count:2 | 2 |
| 2270 | case Qt::Key_Home: | - |
| 2271 | if (!d->lineEdit) never evaluated: !d->lineEdit | 0 |
| 2272 | move = MoveFirst; never executed: move = MoveFirst; | 0 |
| 2273 | break; | 0 |
| 2274 | case Qt::Key_End: | - |
| 2275 | if (!d->lineEdit) never evaluated: !d->lineEdit | 0 |
| 2276 | move = MoveLast; never executed: move = MoveLast; | 0 |
| 2277 | break; | 0 |
| 2278 | case Qt::Key_F4: | - |
| 2279 | if (!e->modifiers()) { never evaluated: !e->modifiers() | 0 |
| 2280 | showPopup(); | - |
| 2281 | return; | 0 |
| 2282 | } | - |
| 2283 | break; | 0 |
| 2284 | case Qt::Key_Space: | - |
| 2285 | if (!d->lineEdit) { never evaluated: !d->lineEdit | 0 |
| 2286 | showPopup(); | - |
| 2287 | return; | 0 |
| 2288 | } | - |
| 2289 | case Qt::Key_Enter: code before this statement never executed: case Qt::Key_Enter: | 0 |
| 2290 | case Qt::Key_Return: | - |
| 2291 | case Qt::Key_Escape: | - |
| 2292 | if (!d->lineEdit) partially evaluated: !d->lineEdit| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 2293 | e->ignore(); never executed: e->ignore(); | 0 |
| 2294 | break; executed: break;Execution Count:1 | 1 |
| 2295 | default: | - |
| 2296 | if (!d->lineEdit) { partially evaluated: !d->lineEdit| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 2297 | if (!e->text().isEmpty()) never evaluated: !e->text().isEmpty() | 0 |
| 2298 | d->keyboardSearchString(e->text()); never executed: d->keyboardSearchString(e->text()); | 0 |
| 2299 | else | - |
| 2300 | e->ignore(); never executed: e->ignore(); | 0 |
| 2301 | } | - |
| 2302 | } executed: }Execution Count:3 | 3 |
| 2303 | | - |
| 2304 | if (move != NoMove) { evaluated: move != NoMove| yes Evaluation Count:2 | yes Evaluation Count:4 |
| 2-4 |
| 2305 | e->accept(); | - |
| 2306 | switch (move) { | - |
| 2307 | case MoveFirst: | - |
| 2308 | newIndex = -1; | - |
| 2309 | case MoveDown: code before this statement never executed: case MoveDown: | 0 |
| 2310 | newIndex++; | - |
| 2311 | while ((newIndex < count()) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) partially evaluated: (newIndex < count())| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 2312 | newIndex++; never executed: newIndex++; | 0 |
| 2313 | break; executed: break;Execution Count:2 | 2 |
| 2314 | case MoveLast: | - |
| 2315 | newIndex = count(); | - |
| 2316 | case MoveUp: code before this statement never executed: case MoveUp: | 0 |
| 2317 | newIndex--; | - |
| 2318 | while ((newIndex >= 0) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) never evaluated: (newIndex >= 0) never evaluated: !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled) | 0 |
| 2319 | newIndex--; never executed: newIndex--; | 0 |
| 2320 | break; | 0 |
| 2321 | default: | - |
| 2322 | e->ignore(); | - |
| 2323 | break; | 0 |
| 2324 | } | - |
| 2325 | | - |
| 2326 | if (newIndex >= 0 && newIndex < count() && newIndex != currentIndex()) { partially evaluated: newIndex >= 0| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: newIndex < count()| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: newIndex != currentIndex()| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 2327 | setCurrentIndex(newIndex); | - |
| 2328 | d->emitActivated(d->currentIndex); | - |
| 2329 | } executed: }Execution Count:2 | 2 |
| 2330 | } else if (d->lineEdit) { executed: }Execution Count:2 partially evaluated: d->lineEdit| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 2331 | d->lineEdit->event(e); | - |
| 2332 | } executed: }Execution Count:4 | 4 |
| 2333 | } | - |
| 2334 | | - |
| 2335 | | - |
| 2336 | | - |
| 2337 | | - |
| 2338 | | - |
| 2339 | void QComboBox::keyReleaseEvent(QKeyEvent *e) | - |
| 2340 | { | - |
| 2341 | QComboBoxPrivate * const d = d_func(); | - |
| 2342 | if (d->lineEdit) never evaluated: d->lineEdit | 0 |
| 2343 | d->lineEdit->event(e); never executed: d->lineEdit->event(e); | 0 |
| 2344 | } | 0 |
| 2345 | | - |
| 2346 | | - |
| 2347 | | - |
| 2348 | | - |
| 2349 | | - |
| 2350 | void QComboBox::wheelEvent(QWheelEvent *e) | - |
| 2351 | { | - |
| 2352 | QComboBoxPrivate * const d = d_func(); | - |
| 2353 | if (!d->viewContainer()->isVisible()) { never evaluated: !d->viewContainer()->isVisible() | 0 |
| 2354 | int newIndex = currentIndex(); | - |
| 2355 | | - |
| 2356 | if (e->delta() > 0) { never evaluated: e->delta() > 0 | 0 |
| 2357 | newIndex--; | - |
| 2358 | while ((newIndex >= 0) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) never evaluated: (newIndex >= 0) never evaluated: !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled) | 0 |
| 2359 | newIndex--; never executed: newIndex--; | 0 |
| 2360 | } else { | 0 |
| 2361 | newIndex++; | - |
| 2362 | while ((newIndex < count()) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) never evaluated: (newIndex < count()) never evaluated: !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled) | 0 |
| 2363 | newIndex++; never executed: newIndex++; | 0 |
| 2364 | } | 0 |
| 2365 | | - |
| 2366 | if (newIndex >= 0 && newIndex < count() && newIndex != currentIndex()) { never evaluated: newIndex >= 0 never evaluated: newIndex < count() never evaluated: newIndex != currentIndex() | 0 |
| 2367 | setCurrentIndex(newIndex); | - |
| 2368 | d->emitActivated(d->currentIndex); | - |
| 2369 | } | 0 |
| 2370 | e->accept(); | - |
| 2371 | } | 0 |
| 2372 | } | 0 |
| 2373 | | - |
| 2374 | | - |
| 2375 | | - |
| 2376 | | - |
| 2377 | | - |
| 2378 | | - |
| 2379 | void QComboBox::contextMenuEvent(QContextMenuEvent *e) | - |
| 2380 | { | - |
| 2381 | QComboBoxPrivate * const d = d_func(); | - |
| 2382 | if (d->lineEdit) { never evaluated: d->lineEdit | 0 |
| 2383 | Qt::ContextMenuPolicy p = d->lineEdit->contextMenuPolicy(); | - |
| 2384 | d->lineEdit->setContextMenuPolicy(Qt::DefaultContextMenu); | - |
| 2385 | d->lineEdit->event(e); | - |
| 2386 | d->lineEdit->setContextMenuPolicy(p); | - |
| 2387 | } | 0 |
| 2388 | } | 0 |
| 2389 | | - |
| 2390 | | - |
| 2391 | void QComboBoxPrivate::keyboardSearchString(const QString &text) | - |
| 2392 | { | - |
| 2393 | | - |
| 2394 | QAbstractItemView *view = viewContainer()->itemView(); | - |
| 2395 | view->setCurrentIndex(currentIndex); | - |
| 2396 | int currentRow = view->currentIndex().row(); | - |
| 2397 | view->keyboardSearch(text); | - |
| 2398 | if (currentRow != view->currentIndex().row()) { never evaluated: currentRow != view->currentIndex().row() | 0 |
| 2399 | setCurrentIndex(view->currentIndex()); | - |
| 2400 | emitActivated(currentIndex); | - |
| 2401 | } | 0 |
| 2402 | } | 0 |
| 2403 | | - |
| 2404 | void QComboBoxPrivate::modelChanged() | - |
| 2405 | { | - |
| 2406 | QComboBox * const q = q_func(); | - |
| 2407 | | - |
| 2408 | if (sizeAdjustPolicy == QComboBox::AdjustToContents) { partially evaluated: sizeAdjustPolicy == QComboBox::AdjustToContents| no Evaluation Count:0 | yes Evaluation Count:887 |
| 0-887 |
| 2409 | sizeHint = QSize(); | - |
| 2410 | adjustComboBoxSize(); | - |
| 2411 | q->updateGeometry(); | - |
| 2412 | } | 0 |
| 2413 | } executed: }Execution Count:887 | 887 |
| 2414 | | - |
| 2415 | | - |
| 2416 | | - |
| 2417 | | - |
| 2418 | void QComboBox::inputMethodEvent(QInputMethodEvent *e) | - |
| 2419 | { | - |
| 2420 | QComboBoxPrivate * const d = d_func(); | - |
| 2421 | if (d->lineEdit) { never evaluated: d->lineEdit | 0 |
| 2422 | d->lineEdit->event(e); | - |
| 2423 | } else { | 0 |
| 2424 | if (!e->commitString().isEmpty()) never evaluated: !e->commitString().isEmpty() | 0 |
| 2425 | d->keyboardSearchString(e->commitString()); never executed: d->keyboardSearchString(e->commitString()); | 0 |
| 2426 | else | - |
| 2427 | e->ignore(); never executed: e->ignore(); | 0 |
| 2428 | } | - |
| 2429 | } | - |
| 2430 | | - |
| 2431 | | - |
| 2432 | | - |
| 2433 | | - |
| 2434 | QVariant QComboBox::inputMethodQuery(Qt::InputMethodQuery query) const | - |
| 2435 | { | - |
| 2436 | const QComboBoxPrivate * const d = d_func(); | - |
| 2437 | if (d->lineEdit) partially evaluated: d->lineEdit| yes Evaluation Count:30 | no Evaluation Count:0 |
| 0-30 |
| 2438 | return d->lineEdit->inputMethodQuery(query); executed: return d->lineEdit->inputMethodQuery(query);Execution Count:30 | 30 |
| 2439 | return QWidget::inputMethodQuery(query); never executed: return QWidget::inputMethodQuery(query); | 0 |
| 2440 | } | - |
| 2441 | bool QComboBox::hasFrame() const | - |
| 2442 | { | - |
| 2443 | const QComboBoxPrivate * const d = d_func(); | - |
| 2444 | return d->frame; never executed: return d->frame; | 0 |
| 2445 | } | - |
| 2446 | | - |
| 2447 | | - |
| 2448 | void QComboBox::setFrame(bool enable) | - |
| 2449 | { | - |
| 2450 | QComboBoxPrivate * const d = d_func(); | - |
| 2451 | d->frame = enable; | - |
| 2452 | update(); | - |
| 2453 | updateGeometry(); | - |
| 2454 | } executed: }Execution Count:1 | 1 |
| 2455 | int QComboBox::modelColumn() const | - |
| 2456 | { | - |
| 2457 | const QComboBoxPrivate * const d = d_func(); | - |
| 2458 | return d->modelColumn; never executed: return d->modelColumn; | 0 |
| 2459 | } | - |
| 2460 | | - |
| 2461 | void QComboBox::setModelColumn(int visibleColumn) | - |
| 2462 | { | - |
| 2463 | QComboBoxPrivate * const d = d_func(); | - |
| 2464 | d->modelColumn = visibleColumn; | - |
| 2465 | QListView *lv = qobject_cast<QListView *>(d->viewContainer()->itemView()); | - |
| 2466 | if (lv) | 0 |
| 2467 | lv->setModelColumn(visibleColumn); never executed: lv->setModelColumn(visibleColumn); | 0 |
| 2468 | | - |
| 2469 | if (d->lineEdit && d->lineEdit->completer() never evaluated: d->lineEdit never evaluated: d->lineEdit->completer() | 0 |
| 2470 | && d->lineEdit->completer() == d->completer) never evaluated: d->lineEdit->completer() == d->completer | 0 |
| 2471 | d->lineEdit->completer()->setCompletionColumn(visibleColumn); never executed: d->lineEdit->completer()->setCompletionColumn(visibleColumn); | 0 |
| 2472 | | - |
| 2473 | setCurrentIndex(currentIndex()); | - |
| 2474 | } | 0 |
| 2475 | | - |
| 2476 | | - |
| 2477 | | - |
| 2478 | | - |
| | |