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