OpenCoverage

qcombobox.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qcombobox.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15QComboBoxPrivate::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-
44QComboBoxPrivate::~QComboBoxPrivate()-
45{-
46-
47-
48-
49}-
50-
51QStyleOptionMenuItem 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>()
value.canConvert<QBrush>()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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()
mCombo->window...ActiveWindow()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
66 menuOption.state = QStyle::State_Active;
never executed: menuOption.state = QStyle::State_Active;
0
67 if ((
(option.state ...State_Enabled)Description
TRUEnever evaluated
FALSEnever evaluated
option.state & QStyle::State_Enabled)
(option.state ...State_Enabled)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(index.model()...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
index.model()->flags(index) & Qt::ItemIsEnabled)
(index.model()...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
)
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
option.state &...State_SelectedDescription
TRUEnever evaluated
FALSEnever evaluated
)
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)
QComboBoxDeleg...parator(index)Description
TRUEnever evaluated
FALSEnever evaluated
)
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: case QVariant::Icon:
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: case QVariant::Color:
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>()
index.data(Qt:...vert<QBrush>()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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)
mCombo->testAt...t::WA_SetFont)Description
TRUEnever evaluated
FALSEnever evaluated
0
107 || mCombo->testAttribute(Qt::WA_MacSmallSize)
mCombo->testAt..._MacSmallSize)Description
TRUEnever evaluated
FALSEnever evaluated
0
108 || mCombo->testAttribute(Qt::WA_MacMiniSize)
mCombo->testAt...A_MacMiniSize)Description
TRUEnever evaluated
FALSEnever evaluated
0
109 || mCombo->font() != qt_app_fonts_hash()->value("QComboBox", QFont())
mCombo->font()...Box", QFont())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
110 menuOption.font = mCombo->font();-
111 }
never executed: end of block
else {
0
112 QVariant fontRoleData = index.data(Qt::FontRole);-
113 if (fontRoleData.isValid()
fontRoleData.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
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: return menuOption;
menuOption;
never executed: return menuOption;
0
122}-
123-
124-
125void QComboBoxPrivate::_q_completerActivated(const QModelIndex &index)-
126{-
127 QComboBox * const q = q_func();-
128 if (index.isValid()
index.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& q->completer()
q->completer()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
129 QAbstractProxyModel *proxy = qobject_cast<QAbstractProxyModel *>(q->completer()->completionModel());-
130 if (proxy
proxyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
138void QComboBoxPrivate::updateArrow(QStyle::StateFlag state)-
139{-
140 QComboBox * const q = q_func();-
141 if (arrowState == state
arrowState == stateDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
149void QComboBoxPrivate::_q_modelReset()-
150{-
151 QComboBox * const q = q_func();-
152 if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
153 lineEdit->setText(QString());-
154 updateLineEditGeometry();-
155 }
never executed: end of block
0
156 if (currentIndex.row() != indexBeforeChange
currentIndex.r...exBeforeChangeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
157 _q_emitCurrentIndexChanged(currentIndex);
never executed: _q_emitCurrentIndexChanged(currentIndex);
0
158 modelChanged();-
159 q->update();-
160}
never executed: end of block
0
161-
162void QComboBoxPrivate::_q_modelDestroyed()-
163{-
164 model = QAbstractItemModelPrivate::staticEmptyModel();-
165}
never executed: end of block
0
166-
167-
168-
169QRect QComboBoxPrivate::popupGeometry(int screen) const-
170{-
171 bool useFullScreenForPopupMenu = false;-
172 if (const
const QPlatfor...latformTheme()Description
TRUEnever evaluated
FALSEnever evaluated
QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()
const QPlatfor...latformTheme()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
173 useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool();
never executed: useFullScreenForPopupMenu = theme->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool();
0
174 return
never executed: return useFullScreenForPopupMenu ? QApplication::desktop()->screenGeometry(screen) : QApplication::desktop()->availableGeometry(screen);
useFullScreenForPopupMenu ?
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-
179bool 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)
lastHoverContr...erControl(pos)Description
TRUEnever evaluated
FALSEnever evaluated
&& doesHover
doesHoverDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
187 q->update(lastHoverRect);-
188 q->update(hoverRect);-
189 return
never executed: return true;
true;
never executed: return true;
0
190 }-
191 return
never executed: return !doesHover;
!doesHover;
never executed: return !doesHover;
0
192}-
193-
194QStyle::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 = (
(hoverControl ...tyle::SC_None)Description
TRUEnever evaluated
FALSEnever evaluated
hoverControl != QStyle::SC_None)
(hoverControl ...tyle::SC_None)Description
TRUEnever evaluated
FALSEnever evaluated
0
202 ? q->style()->subControlRect(QStyle::CC_ComboBox, &opt, hoverControl, q)-
203 : QRect();-
204 return
never executed: return hoverControl;
hoverControl;
never executed: return hoverControl;
0
205}-
206-
207-
208-
209-
210-
211int 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
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
221 const int textWidth = fontMetrics.width(q->itemText(i));-
222 if (q->itemIcon(i).isNull()
q->itemIcon(i).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
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: return tmp.width();
tmp.width();
never executed: return tmp.width();
0
233}-
234-
235QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const-
236{-
237 const QComboBox * const q = q_func();-
238 if (!sh.isValid()
!sh.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
&sh == &sizeHintDescription
TRUEnever evaluated
FALSEnever evaluated
|| minimumContentsLength == 0
minimumContentsLength == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
246 switch (sizeAdjustPolicy) {-
247 case
never executed: case QComboBox::AdjustToContents:
QComboBox::AdjustToContents:
never executed: case QComboBox::AdjustToContents:
0
248 case
never executed: case QComboBox::AdjustToContentsOnFirstShow:
QComboBox::AdjustToContentsOnFirstShow:
never executed: case QComboBox::AdjustToContentsOnFirstShow:
0
249 if (count == 0
count == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
250 sh.rwidth() = 7 * fm.width(QLatin1Char('x'));-
251 }
never executed: end of block
else {
0
252 for (int i = 0; i < count
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
253 if (!q->itemIcon(i).isNull()
!q->itemIcon(i).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
254 hasIcon = true;-
255 sh.setWidth(qMax(sh.width(), fm.boundingRect(q->itemText(i)).width() + iconSize.width() + 4));-
256 }
never executed: end of block
else {
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: case QComboBox::AdjustToMinimumContentsLength:
QComboBox::AdjustToMinimumContentsLength:
never executed: case QComboBox::AdjustToMinimumContentsLength:
0
263 for (int i = 0; i < count
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
&& !hasIcon
!hasIconDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
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
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
&& !hasIcon
!hasIconDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
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
minimumContentsLength > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
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
hasIconDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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: return sh.expandedTo(QApplication::globalStrut());
sh.expandedTo(QApplication::globalStrut());
never executed: return sh.expandedTo(QApplication::globalStrut());
0
288}-
289-
290void QComboBoxPrivate::adjustComboBoxSize()-
291{-
292 viewContainer()->adjustSizeTimer.start(20, container);-
293}
never executed: end of block
0
294-
295void 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
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
303 lineEdit->setLayoutDirection(dir);
never executed: lineEdit->setLayoutDirection(dir);
0
304 if (container
containerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
305 container->setLayoutDirection(dir);
never executed: container->setLayoutDirection(dir);
0
306}
never executed: end of block
0
307-
308-
309void QComboBoxPrivateContainer::timerEvent(QTimerEvent *timerEvent)-
310{-
311 if (timerEvent->timerId() == adjustSizeTimer.timerId()
timerEvent->ti...imer.timerId()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
312 adjustSizeTimer.stop();-
313 if (combo->sizeAdjustPolicy() == QComboBox::AdjustToContents
combo->sizeAdj...justToContentsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
321void QComboBoxPrivateContainer::resizeEvent(QResizeEvent *e)-
322{-
323 QStyleOptionComboBox opt = comboStyleOption();-
324 if (combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo)
combo->style()..., &opt, combo)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
325 QStyleOption myOpt;-
326 myOpt.initFrom(this);-
327 QStyleHintReturnMask mask;-
328 if (combo->style()->styleHint(QStyle::SH_Menu_Mask, &myOpt, this, &mask)
combo->style()..., this, &mask)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
329 setMask(mask.region);-
330 }
never executed: end of block
0
331 }
never executed: end of block
else {
0
332 clearMask();-
333 }
never executed: end of block
0
334 QFrame::resizeEvent(e);-
335}
never executed: end of block
0
336-
337void QComboBoxPrivateContainer::leaveEvent(QEvent *)-
338{-
339-
340-
341-
342-
343-
344-
345-
346}-
347-
348QComboBoxPrivateContainer::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
usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
373 top = new QComboBoxPrivateScroller(QAbstractSlider::SliderSingleStepSub, this);-
374 bottom = new QComboBoxPrivateScroller(QAbstractSlider::SliderSingleStepAdd, this);-
375 top->hide();-
376 bottom->hide();-
377 }
never executed: end of block
else {
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
topDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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
bottomDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
398void QComboBoxPrivateContainer::scrollItemView(int action)-
399{-
400-
401 if (view->verticalScrollBar()
view->verticalScrollBar()Description
TRUEnever evaluated
FALSEnever evaluated
)
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-
409void QComboBoxPrivateContainer::updateScrollers()-
410{-
411-
412 if (!top
!topDescription
TRUEnever evaluated
FALSEnever evaluated
|| !bottom
!bottomDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
413 return;
never executed: return;
0
414-
415 if (isVisible() == false
isVisible() == falseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
416 return;
never executed: return;
0
417-
418 QStyleOptionComboBox opt = comboStyleOption();-
419 if (combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo)
combo->style()..., &opt, combo)Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
420 view->verticalScrollBar()->minimum() < view->verticalScrollBar()->maximum()
view->vertical...r()->maximum()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
needTopDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
427 top->show();
never executed: top->show();
0
428 else-
429 top->hide();
never executed: top->hide();
0
430 if (needBottom
needBottomDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
444void QComboBoxPrivateContainer::viewDestroyed()-
445{-
446 view = 0;-
447 setItemView(new QComboBoxListView());-
448}
never executed: end of block
0
449-
450-
451-
452-
453QAbstractItemView *QComboBoxPrivateContainer::itemView() const-
454{-
455 return
never executed: return view;
view;
never executed: return view;
0
456}-
457-
458-
459-
460-
461void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)-
462{-
463 ((!(itemView)) ? qt_assert("itemView",__FILE__,540) : qt_noop());-
464-
465-
466 if (view
viewDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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)
isAncestorOf(view)Description
TRUEnever evaluated
FALSEnever evaluated
)
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
usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
)
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)
combo->style()..., &opt, combo)Description
TRUEnever evaluated
FALSEnever evaluated
||
0
499 usePopup
usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
519int QComboBoxPrivateContainer::topMargin() const-
520{-
521 if (const
const QListVie...stView*>(view)Description
TRUEnever evaluated
FALSEnever evaluated
QListView *lview = qobject_cast<const QListView*>(view)
const QListVie...stView*>(view)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
522 return
never executed: return lview->spacing();
lview->spacing();
never executed: return lview->spacing();
0
523-
524 if (const
const QTableVi...leView*>(view)Description
TRUEnever evaluated
FALSEnever evaluated
QTableView *tview = qobject_cast<const QTableView*>(view)
const QTableVi...leView*>(view)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
525 return
never executed: return tview->showGrid() ? 1 : 0;
tview->showGrid() ? 1 : 0;
never executed: return tview->showGrid() ? 1 : 0;
0
526-
527 return
never executed: return 0;
0;
never executed: return 0;
0
528}-
529-
530-
531-
532-
533int QComboBoxPrivateContainer::spacing() const-
534{-
535 QListView *lview = qobject_cast<QListView*>(view);-
536 if (lview
lviewDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
537 return
never executed: return 2 * lview->spacing();
2 * lview->spacing();
never executed: return 2 * lview->spacing();
0
538-
539 QTableView *tview = qobject_cast<QTableView*>(view);-
540 if (tview
tviewDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
541 return
never executed: return tview->showGrid() ? 1 : 0;
tview->showGrid() ? 1 : 0;
never executed: return tview->showGrid() ? 1 : 0;
0
542-
543 return
never executed: return 0;
0;
never executed: return 0;
0
544}-
545-
546void QComboBoxPrivateContainer::updateTopBottomMargin()-
547{-
548 if (!layout()
!layout()Description
TRUEnever evaluated
FALSEnever evaluated
|| layout()->count() < 1
layout()->count() < 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
549 return;
never executed: return;
0
550-
551 QBoxLayout *boxLayout = qobject_cast<QBoxLayout *>(layout());-
552 if (!boxLayout
!boxLayoutDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
? combo->style()->pixelMetric(QStyle::PM_MenuVMargin, &opt, combo) : 0;
0
558-
559 QSpacerItem *topSpacer = boxLayout->itemAt(0)->spacerItem();-
560 if (topSpacer
topSpacerDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
bottomSpacerDescription
TRUEnever evaluated
FALSEnever evaluated
&& bottomSpacer != topSpacer
bottomSpacer != topSpacerDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
570void QComboBoxPrivateContainer::changeEvent(QEvent *e)-
571{-
572 if (e->type() == QEvent::StyleChange
e->type() == Q...t::StyleChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
583bool QComboBoxPrivateContainer::eventFilter(QObject *o, QEvent *e)-
584{-
585 switch (e->type()) {-
586 case
never executed: case QEvent::ShortcutOverride:
QEvent::ShortcutOverride:
never executed: case QEvent::ShortcutOverride:
{
0
587 QKeyEvent *keyEvent = static_cast<QKeyEvent*>(e);-
588 switch (keyEvent->key()) {-
589 case
never executed: case Qt::Key_Enter:
Qt::Key_Enter:
never executed: case Qt::Key_Enter:
0
590 case
never executed: case Qt::Key_Return:
Qt::Key_Return:
never executed: case Qt::Key_Return:
0
591-
592-
593-
594 if (view->currentIndex().isValid()
view->currentIndex().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(view->current...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
view->currentIndex().flags() & Qt::ItemIsEnabled)
(view->current...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
595 combo->hidePopup();-
596 itemSelected(view->currentIndex());-
597 }
never executed: end of block
0
598 return
never executed: return true;
true;
never executed: return true;
0
599 case
never executed: case Qt::Key_Down:
Qt::Key_Down:
never executed: case Qt::Key_Down:
0
600 if (!(keyEvent->modifiers() & Qt::AltModifier)
!(keyEvent->mo...::AltModifier)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
601 break;
never executed: break;
0
602-
603 case
never executed: case Qt::Key_F4:
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: return true;
true;
never executed: return true;
0
606 default
never executed: default:
:
never executed: default:
0
607 if (keyEvent->matches(QKeySequence::Cancel)
keyEvent->matc...uence::Cancel)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
608 combo->hidePopup();-
609 return
never executed: return true;
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: case QEvent::MouseMove:
QEvent::MouseMove:
never executed: case QEvent::MouseMove:
0
616 if (isVisible()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
vector.manhattanLength() > 9Description
TRUEnever evaluated
FALSEnever evaluated
&& blockMouseReleaseTimer.isActive()
blockMouseRele...mer.isActive()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
621 blockMouseReleaseTimer.stop();
never executed: blockMouseReleaseTimer.stop();
0
622 QModelIndex indexUnderMouse = view->indexAt(m->pos());-
623 if (indexUnderMouse.isValid()
indexUnderMouse.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
624 && !QComboBoxDelegate::isSeparator(indexUnderMouse)
!QComboBoxDele...dexUnderMouse)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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: case QEvent::MouseButtonPress:
QEvent::MouseButtonPress:
never executed: case QEvent::MouseButtonPress:
0
630 maybeIgnoreMouseButtonRelease = false;-
631 break;
never executed: break;
0
632 case
never executed: case QEvent::MouseButtonRelease:
QEvent::MouseButtonRelease:
never executed: case QEvent::MouseButtonRelease:
{
0
633 bool ignoreEvent = maybeIgnoreMouseButtonRelease
maybeIgnoreMouseButtonReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
&& popupTimer.elapsed() < QApplication::doubleClickInterval()
popupTimer.ela...lickInterval()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
634-
635 QMouseEvent *m = static_cast<QMouseEvent *>(e);-
636 if (isVisible()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
&& view->rect().contains(m->pos())
view->rect().c...ains(m->pos())Description
TRUEnever evaluated
FALSEnever evaluated
&& view->currentIndex().isValid()
view->currentIndex().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
637 && !blockMouseReleaseTimer.isActive()
!blockMouseRel...mer.isActive()Description
TRUEnever evaluated
FALSEnever evaluated
&& !ignoreEvent
!ignoreEventDescription
TRUEnever evaluated
FALSEnever evaluated
0
638 && (
(view->current...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
view->currentIndex().flags() & Qt::ItemIsEnabled)
(view->current...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
0
639 && (
(view->current...mIsSelectable)Description
TRUEnever evaluated
FALSEnever evaluated
view->currentIndex().flags() & Qt::ItemIsSelectable)
(view->current...mIsSelectable)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
640 combo->hidePopup();-
641 itemSelected(view->currentIndex());-
642 return
never executed: return true;
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: return QFrame::eventFilter(o, e);
QFrame::eventFilter(o, e);
never executed: return QFrame::eventFilter(o, e);
0
650}-
651-
652void QComboBoxPrivateContainer::showEvent(QShowEvent *)-
653{-
654 combo->update();-
655}
never executed: end of block
0
656-
657void QComboBoxPrivateContainer::hideEvent(QHideEvent *)-
658{-
659 resetButton();-
660 combo->update();-
661-
662-
663-
664-
665 if (QGraphicsProxyWidget *proxy = graphicsProxyWidget()
QGraphicsProxy...sProxyWidget()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
666 proxy->hide();
never executed: proxy->hide();
0
667-
668}
never executed: end of block
0
669-
670void 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()
combo->isEditable()Description
TRUEnever evaluated
FALSEnever evaluated
&& sc == QStyle::SC_ComboBoxArrow
sc == QStyle::SC_ComboBoxArrowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
680 || (!combo->isEditable()
!combo->isEditable()Description
TRUEnever evaluated
FALSEnever evaluated
&& sc != QStyle::SC_None
sc != QStyle::SC_NoneDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
681 setAttribute(Qt::WA_NoMouseReplay);
never executed: setAttribute(Qt::WA_NoMouseReplay);
0
682 combo->hidePopup();-
683}
never executed: end of block
0
684-
685void QComboBoxPrivateContainer::mouseReleaseEvent(QMouseEvent *e)-
686{-
687 (void)e;;-
688 if (!blockMouseReleaseTimer.isActive()
!blockMouseRel...mer.isActive()Description
TRUEnever evaluated
FALSEnever evaluated
){
0
689 combo->hidePopup();-
690 resetButton();-
691 }
never executed: end of block
0
692}
never executed: end of block
0
693-
694QStyleOptionComboBox 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: return opt;
opt;
never executed: return opt;
0
704}-
705QComboBox::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-
715QComboBox::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
721void 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()
!q->isEditable()Description
TRUEnever evaluated
FALSEnever evaluated
)
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-
736QComboBoxPrivateContainer* QComboBoxPrivate::viewContainer()-
737{-
738 if (container
containerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
739 return
never executed: return container;
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: return container;
container;
never executed: return container;
0
755}-
756-
757-
758void QComboBoxPrivate::_q_resetButton()-
759{-
760 updateArrow(QStyle::State_None);-
761}
never executed: end of block
0
762-
763void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)-
764{-
765 QComboBox * const q = q_func();-
766 if (inserting
insertingDescription
TRUEnever evaluated
FALSEnever evaluated
|| topLeft.parent() != root
topLeft.parent() != rootDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
767 return;
never executed: return;
0
768-
769 if (sizeAdjustPolicy == QComboBox::AdjustToContents
sizeAdjustPoli...justToContentsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
770 sizeHint = QSize();-
771 adjustComboBoxSize();-
772 q->updateGeometry();-
773 }
never executed: end of block
0
774-
775 if (currentIndex.row() >= topLeft.row()
currentIndex.r... topLeft.row()Description
TRUEnever evaluated
FALSEnever evaluated
&& currentIndex.row() <= bottomRight.row()
currentIndex.r...tomRight.row()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
776 const QString text = q->itemText(currentIndex.row());-
777 if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
778 lineEdit->setText(text);-
779 updateLineEditGeometry();-
780 }
never executed: end of block
else {
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-
791void QComboBoxPrivate::_q_rowsInserted(const QModelIndex &parent, int start, int end)-
792{-
793 QComboBox * const q = q_func();-
794 if (inserting
insertingDescription
TRUEnever evaluated
FALSEnever evaluated
|| parent != root
parent != rootDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
795 return;
never executed: return;
0
796-
797 if (sizeAdjustPolicy == QComboBox::AdjustToContents
sizeAdjustPoli...justToContentsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
798 sizeHint = QSize();-
799 adjustComboBoxSize();-
800 q->updateGeometry();-
801 }
never executed: end of block
0
802-
803-
804 if (start == 0
start == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(end - start +... == q->count()Description
TRUEnever evaluated
FALSEnever evaluated
end - start + 1) == q->count()
(end - start +... == q->count()Description
TRUEnever evaluated
FALSEnever evaluated
&& !currentIndex.isValid()
!currentIndex.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
805 q->setCurrentIndex(0);-
806-
807 }
never executed: end of block
else if (currentIndex.row() != indexBeforeChange
currentIndex.r...exBeforeChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
808 q->update();-
809 _q_emitCurrentIndexChanged(currentIndex);-
810 }
never executed: end of block
0
811}
never executed: end of block
0
812-
813void QComboBoxPrivate::_q_updateIndexBeforeChange()-
814{-
815 indexBeforeChange = currentIndex.row();-
816}
never executed: end of block
0
817-
818void QComboBoxPrivate::_q_rowsRemoved(const QModelIndex &parent, int , int )-
819{-
820 QComboBox * const q = q_func();-
821 if (parent != root
parent != rootDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
822 return;
never executed: return;
0
823-
824 if (sizeAdjustPolicy == QComboBox::AdjustToContents
sizeAdjustPoli...justToContentsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
825 sizeHint = QSize();-
826 adjustComboBoxSize();-
827 q->updateGeometry();-
828 }
never executed: end of block
0
829-
830-
831 if (currentIndex.row() != indexBeforeChange
currentIndex.r...exBeforeChangeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
832 if (!currentIndex.isValid()
!currentIndex.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& q->count()
q->count()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
833 q->setCurrentIndex(qMin(q->count() - 1, qMax(indexBeforeChange, 0)));-
834 return;
never executed: return;
0
835 }-
836 if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
846void QComboBoxPrivate::updateViewContainerPaletteAndOpacity()-
847{-
848 if (!container
!containerDescription
TRUEnever evaluated
FALSEnever evaluated
)
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)
q->style()->st...opup, &opt, q)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
855 QMenu menu;-
856 menu.ensurePolished();-
857 container->setPalette(menu.palette());-
858 container->setWindowOpacity(menu.windowOpacity());-
859 }
never executed: end of block
else
0
860-
861 {-
862 container->setPalette(q->palette());-
863 container->setWindowOpacity(1.0);-
864 }
never executed: end of block
0
865 if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
866 lineEdit->setPalette(q->palette());
never executed: lineEdit->setPalette(q->palette());
0
867}
never executed: end of block
0
868-
869void QComboBoxPrivate::updateFocusPolicy()-
870{-
871}-
872void QComboBox::initStyleOption(QStyleOptionComboBox *option) const-
873{-
874 if (!option
!optionDescription
TRUEnever evaluated
FALSEnever evaluated
)
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()
hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
&& !option->editable
!option->editableDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
d->arrowState ...::State_SunkenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
885 option->activeSubControls = QStyle::SC_ComboBoxArrow;-
886 option->state |= d->arrowState;-
887 }
never executed: end of block
else {
0
888 option->activeSubControls = d->hoverControl;-
889 }
never executed: end of block
0
890 if (d->currentIndex.isValid()
d->currentIndex.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
d->containerDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->container->isVisible()
d->container->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
896 option->state |= QStyle::State_On;
never executed: option->state |= QStyle::State_On;
0
897}
never executed: end of block
0
898-
899void QComboBoxPrivate::updateLineEditGeometry()-
900{-
901 if (!lineEdit
!lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
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()
!q->itemIcon(q...ex()).isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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-
918Qt::MatchFlags QComboBoxPrivate::matchFlags() const-
919{-
920-
921 Qt::MatchFlags flags = Qt::MatchFixedString;-
922-
923 if (!lineEdit->completer()
!lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
|| lineEdit->completer()->caseSensitivity() == Qt::CaseSensitive
lineEdit->comp...:CaseSensitiveDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
924-
925 flags |= Qt::MatchCaseSensitive;
never executed: flags |= Qt::MatchCaseSensitive;
0
926 return
never executed: return flags;
flags;
never executed: return flags;
0
927}-
928-
929-
930void QComboBoxPrivate::_q_editingFinished()-
931{-
932 QComboBox * const q = q_func();-
933 if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
&& !lineEdit->text().isEmpty()
!lineEdit->text().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& itemText(currentIndex) != lineEdit->text()
itemText(curre...neEdit->text()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
934 const int index = q_func()->findText(lineEdit->text(), matchFlags());-
935 if (index != -1
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
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-
943void QComboBoxPrivate::_q_returnPressed()-
944{-
945 QComboBox * const q = q_func();-
946-
947-
948-
949-
950-
951 if (insertPolicy == QComboBox::NoInsert
insertPolicy =...oBox::NoInsertDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
952 return;
never executed: return;
0
953-
954 if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
&& !lineEdit->text().isEmpty()
!lineEdit->text().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
955 if (q->count() >= maxCount
q->count() >= maxCountDescription
TRUEnever evaluated
FALSEnever evaluated
&& !(this->insertPolicy == QComboBox::InsertAtCurrent)
!(this->insert...sertAtCurrent)Description
TRUEnever evaluated
FALSEnever evaluated
)
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
!duplicatesEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
963 index = q->findText(text, matchFlags());-
964 if (index != -1
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
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: case QComboBox::InsertAtTop:
QComboBox::InsertAtTop:
never executed: case QComboBox::InsertAtTop:
0
972 index = 0;-
973 break;
never executed: break;
0
974 case
never executed: case QComboBox::InsertAtBottom:
QComboBox::InsertAtBottom:
never executed: case QComboBox::InsertAtBottom:
0
975 index = q->count();-
976 break;
never executed: break;
0
977 case
never executed: case QComboBox::InsertAtCurrent:
QComboBox::InsertAtCurrent:
never executed: case QComboBox::InsertAtCurrent:
0
978 case
never executed: case QComboBox::InsertAfterCurrent:
QComboBox::InsertAfterCurrent:
never executed: case QComboBox::InsertAfterCurrent:
0
979 case
never executed: case QComboBox::InsertBeforeCurrent:
QComboBox::InsertBeforeCurrent:
never executed: case QComboBox::InsertBeforeCurrent:
0
980 if (!q->count()
!q->count()Description
TRUEnever evaluated
FALSEnever evaluated
|| !currentIndex.isValid()
!currentIndex.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
981 index = 0;
never executed: index = 0;
0
982 else if (insertPolicy == QComboBox::InsertAtCurrent
insertPolicy =...nsertAtCurrentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
983 q->setItemText(q->currentIndex(), text);
never executed: q->setItemText(q->currentIndex(), text);
0
984 else if (insertPolicy == QComboBox::InsertAfterCurrent
insertPolicy =...rtAfterCurrentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
985 index = q->currentIndex() + 1;
never executed: index = q->currentIndex() + 1;
0
986 else if (insertPolicy == QComboBox::InsertBeforeCurrent
insertPolicy =...tBeforeCurrentDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
987 index = q->currentIndex();
never executed: index = q->currentIndex();
0
988 break;
never executed: break;
0
989 case
never executed: case QComboBox::InsertAlphabetically:
QComboBox::InsertAlphabetically:
never executed: case QComboBox::InsertAlphabetically:
0
990 index = 0;-
991 for (int i=0; i< q->count()
i< q->count()Description
TRUEnever evaluated
FALSEnever evaluated
; i++, index++ ) {
0
992 if (text.toLower() < q->itemText(i).toLower()
text.toLower()...t(i).toLower()Description
TRUEnever evaluated
FALSEnever evaluated
)
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
index >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
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-
1007void QComboBoxPrivate::_q_itemSelected(const QModelIndex &item)-
1008{-
1009 QComboBox * const q = q_func();-
1010 if (item != currentIndex
item != currentIndexDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1011 setCurrentIndex(item);-
1012 }
never executed: end of block
else if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
1019void QComboBoxPrivate::emitActivated(const QModelIndex &index)-
1020{-
1021 QComboBox * const q = q_func();-
1022 if (!index.isValid()
!index.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
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-
1029void QComboBoxPrivate::_q_emitHighlighted(const QModelIndex &index)-
1030{-
1031 QComboBox * const q = q_func();-
1032 if (!index.isValid()
!index.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
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-
1039void 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
!lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
1054QString QComboBoxPrivate::itemText(const QModelIndex &index) const-
1055{-
1056 return
never executed: return index.isValid() ? model->data(index, itemRole()).toString() : QString();
index.isValid() ? model->data(index, itemRole()).toString() : QString();
never executed: return index.isValid() ? model->data(index, itemRole()).toString() : QString();
0
1057}-
1058-
1059int QComboBoxPrivate::itemRole() const-
1060{-
1061 return
never executed: return q_func()->isEditable() ? Qt::EditRole : Qt::DisplayRole;
q_func()->isEditable() ? Qt::EditRole : Qt::DisplayRole;
never executed: return q_func()->isEditable() ? Qt::EditRole : Qt::DisplayRole;
0
1062}-
1063-
1064-
1065-
1066-
1067QComboBox::~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: end of block
else {
dead code: { ; }
-
1076 ;
dead code: { ; }
-
1077 }
dead code: { ; }
-
1078}-
1079int QComboBox::maxVisibleItems() const-
1080{-
1081 const QComboBoxPrivate * const d = d_func();-
1082 return
never executed: return d->maxVisibleItems;
d->maxVisibleItems;
never executed: return d->maxVisibleItems;
0
1083}-
1084-
1085void QComboBox::setMaxVisibleItems(int maxItems)-
1086{-
1087 QComboBoxPrivate * const d = d_func();-
1088 if (__builtin_expect(!!(maxItems < 0), false)
__builtin_expe...s < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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-
1102int QComboBox::count() const-
1103{-
1104 const QComboBoxPrivate * const d = d_func();-
1105 return
never executed: return d->model->rowCount(d->root);
d->model->rowCount(d->root);
never executed: return d->model->rowCount(d->root);
0
1106}-
1107void QComboBox::setMaxCount(int max)-
1108{-
1109 QComboBoxPrivate * const d = d_func();-
1110 if (__builtin_expect(!!(max < 0), false)
__builtin_expe...x < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
rowCount > maxDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
1122int QComboBox::maxCount() const-
1123{-
1124 const QComboBoxPrivate * const d = d_func();-
1125 return
never executed: return d->maxCount;
d->maxCount;
never executed: return d->maxCount;
0
1126}-
1127bool QComboBox::autoCompletion() const-
1128{-
1129 const QComboBoxPrivate * const d = d_func();-
1130 return
never executed: return d->autoCompletion;
d->autoCompletion;
never executed: return d->autoCompletion;
0
1131}-
1132-
1133-
1134-
1135-
1136-
1137-
1138void 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
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1149 return;
never executed: return;
0
1150 if (enable
enableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1151 if (d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
)
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: end of block
else {
0
1161 d->lineEdit->setCompleter(0);-
1162 }
never executed: end of block
0
1163}-
1164Qt::CaseSensitivity QComboBox::autoCompletionCaseSensitivity() const-
1165{-
1166 const QComboBoxPrivate * const d = d_func();-
1167 return
never executed: return d->autoCompletionCaseSensitivity;
d->autoCompletionCaseSensitivity;
never executed: return d->autoCompletionCaseSensitivity;
0
1168}-
1169-
1170-
1171-
1172-
1173-
1174-
1175void QComboBox::setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity)-
1176{-
1177 QComboBoxPrivate * const d = d_func();-
1178 d->autoCompletionCaseSensitivity = sensitivity;-
1179 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1180 d->lineEdit->completer()->setCaseSensitivity(sensitivity);
never executed: d->lineEdit->completer()->setCaseSensitivity(sensitivity);
0
1181}
never executed: end of block
0
1182bool QComboBox::duplicatesEnabled() const-
1183{-
1184 const QComboBoxPrivate * const d = d_func();-
1185 return
never executed: return d->duplicatesEnabled;
d->duplicatesEnabled;
never executed: return d->duplicatesEnabled;
0
1186}-
1187-
1188void QComboBox::setDuplicatesEnabled(bool enable)-
1189{-
1190 QComboBoxPrivate * const d = d_func();-
1191 d->duplicatesEnabled = enable;-
1192}
never executed: end of block
0
1193int 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()
result.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1199 return
never executed: return -1;
-1;
never executed: return -1;
0
1200 return
never executed: return result.first().row();
result.first().row();
never executed: return result.first().row();
0
1201}-
1202QComboBox::InsertPolicy QComboBox::insertPolicy() const-
1203{-
1204 const QComboBoxPrivate * const d = d_func();-
1205 return
never executed: return d->insertPolicy;
d->insertPolicy;
never executed: return d->insertPolicy;
0
1206}-
1207-
1208void QComboBox::setInsertPolicy(InsertPolicy policy)-
1209{-
1210 QComboBoxPrivate * const d = d_func();-
1211 d->insertPolicy = policy;-
1212}
never executed: end of block
0
1213QComboBox::SizeAdjustPolicy QComboBox::sizeAdjustPolicy() const-
1214{-
1215 const QComboBoxPrivate * const d = d_func();-
1216 return
never executed: return d->sizeAdjustPolicy;
d->sizeAdjustPolicy;
never executed: return d->sizeAdjustPolicy;
0
1217}-
1218-
1219void QComboBox::setSizeAdjustPolicy(QComboBox::SizeAdjustPolicy policy)-
1220{-
1221 QComboBoxPrivate * const d = d_func();-
1222 if (policy == d->sizeAdjustPolicy
policy == d->sizeAdjustPolicyDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
1230int QComboBox::minimumContentsLength() const-
1231{-
1232 const QComboBoxPrivate * const d = d_func();-
1233 return
never executed: return d->minimumContentsLength;
d->minimumContentsLength;
never executed: return d->minimumContentsLength;
0
1234}-
1235-
1236void QComboBox::setMinimumContentsLength(int characters)-
1237{-
1238 QComboBoxPrivate * const d = d_func();-
1239 if (characters == d->minimumContentsLength
characters == ...ContentsLengthDescription
TRUEnever evaluated
FALSEnever evaluated
|| characters < 0
characters < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1240 return;
never executed: return;
0
1241-
1242 d->minimumContentsLength = characters;-
1243-
1244 if (d->sizeAdjustPolicy == AdjustToContents
d->sizeAdjustP...justToContentsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1245 || d->sizeAdjustPolicy == AdjustToMinimumContentsLength
d->sizeAdjustP...ContentsLengthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1246 || d->sizeAdjustPolicy == AdjustToMinimumContentsLengthWithIcon
d->sizeAdjustP...LengthWithIconDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1247 d->sizeHint = QSize();-
1248 d->adjustComboBoxSize();-
1249 updateGeometry();-
1250 }
never executed: end of block
0
1251}
never executed: end of block
0
1252QSize QComboBox::iconSize() const-
1253{-
1254 const QComboBoxPrivate * const d = d_func();-
1255 if (d->iconSize.isValid()
d->iconSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1256 return
never executed: return d->iconSize;
d->iconSize;
never executed: return d->iconSize;
0
1257-
1258 int iconWidth = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);-
1259 return
never executed: return QSize(iconWidth, iconWidth);
QSize(iconWidth, iconWidth);
never executed: return QSize(iconWidth, iconWidth);
0
1260}-
1261-
1262void QComboBox::setIconSize(const QSize &size)-
1263{-
1264 QComboBoxPrivate * const d = d_func();-
1265 if (size == d->iconSize
size == d->iconSizeDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
1273bool QComboBox::isEditable() const-
1274{-
1275 const QComboBoxPrivate * const d = d_func();-
1276 return
never executed: return d->lineEdit != 0;
d->lineEdit != 0;
never executed: return d->lineEdit != 0;
0
1277}-
1278void 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)
q->style()->st...opup, &opt, q)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1284 if (force
forceDescription
TRUEnever evaluated
FALSEnever evaluated
|| qobject_cast<QComboBoxDelegate *>(q->itemDelegate())
qobject_cast<Q...temDelegate())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1285 q->setItemDelegate(new QComboMenuDelegate(q->view(), q));
never executed: q->setItemDelegate(new QComboMenuDelegate(q->view(), q));
0
1286 }
never executed: end of block
else {
0
1287 if (force
forceDescription
TRUEnever evaluated
FALSEnever evaluated
|| qobject_cast<QComboMenuDelegate *>(q->itemDelegate())
qobject_cast<Q...temDelegate())Description
TRUEnever evaluated
FALSEnever evaluated
)
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-
1292QIcon QComboBoxPrivate::itemIcon(const QModelIndex &index) const-
1293{-
1294 QVariant decoration = model->data(index, Qt::DecorationRole);-
1295 if (decoration.type() == QVariant::Pixmap
decoration.typ...ariant::PixmapDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1296 return
never executed: return QIcon(qvariant_cast<QPixmap>(decoration));
QIcon(qvariant_cast<QPixmap>(decoration));
never executed: return QIcon(qvariant_cast<QPixmap>(decoration));
0
1297 else-
1298 return
never executed: return qvariant_cast<QIcon>(decoration);
qvariant_cast<QIcon>(decoration);
never executed: return qvariant_cast<QIcon>(decoration);
0
1299}-
1300-
1301void QComboBox::setEditable(bool editable)-
1302{-
1303 QComboBoxPrivate * const d = d_func();-
1304 if (isEditable() == editable
isEditable() == editableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1305 return;
never executed: return;
0
1306-
1307 QStyleOptionComboBox opt;-
1308 initStyleOption(&opt);-
1309 if (editable
editableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1310 if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)
style()->style...p, &opt, this)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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: end of block
else {
0
1317 if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)
style()->style...p, &opt, this)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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)
!testAttribute(Qt::WA_Resized)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1332 adjustSize();
never executed: adjustSize();
0
1333}
never executed: end of block
0
1334-
1335-
1336-
1337-
1338-
1339-
1340void QComboBox::setLineEdit(QLineEdit *edit)-
1341{-
1342 QComboBoxPrivate * const d = d_func();-
1343 if (__builtin_expect(!!(!edit), false)
__builtin_expe...!edit), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
edit == d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
d->lineEdit->parent() != thisDescription
TRUEnever evaluated
FALSEnever evaluated
)
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()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
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-
1388QLineEdit *QComboBox::lineEdit() const-
1389{-
1390 const QComboBoxPrivate * const d = d_func();-
1391 return
never executed: return d->lineEdit;
d->lineEdit;
never executed: return d->lineEdit;
0
1392}-
1393void QComboBox::setValidator(const QValidator *v)-
1394{-
1395 QComboBoxPrivate * const d = d_func();-
1396 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
1406const QValidator *QComboBox::validator() const-
1407{-
1408 const QComboBoxPrivate * const d = d_func();-
1409 return
never executed: return d->lineEdit ? d->lineEdit->validator() : 0;
d->lineEdit ? d->lineEdit->validator() : 0;
never executed: return d->lineEdit ? d->lineEdit->validator() : 0;
0
1410}-
1411void QComboBox::setCompleter(QCompleter *c)-
1412{-
1413 QComboBoxPrivate * const d = d_func();-
1414 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1415 return;
never executed: return;
0
1416 d->lineEdit->setCompleter(c);-
1417 if (c
cDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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
1422QCompleter *QComboBox::completer() const-
1423{-
1424 const QComboBoxPrivate * const d = d_func();-
1425 return
never executed: return d->lineEdit ? d->lineEdit->completer() : 0;
d->lineEdit ? d->lineEdit->completer() : 0;
never executed: return d->lineEdit ? d->lineEdit->completer() : 0;
0
1426}-
1427QAbstractItemDelegate *QComboBox::itemDelegate() const-
1428{-
1429 return
never executed: return view()->itemDelegate();
view()->itemDelegate();
never executed: return view()->itemDelegate();
0
1430}-
1431void QComboBox::setItemDelegate(QAbstractItemDelegate *delegate)-
1432{-
1433 if (__builtin_expect(!!(!delegate), false)
__builtin_expe...egate), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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-
1445QAbstractItemModel *QComboBox::model() const-
1446{-
1447 const QComboBoxPrivate * const d = d_func();-
1448 if (d->model == QAbstractItemModelPrivate::staticEmptyModel()
d->model == QA...icEmptyModel()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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: return d->model;
d->model;
never executed: return d->model;
0
1453}-
1454-
1455-
1456-
1457-
1458-
1459-
1460-
1461void QComboBox::setModel(QAbstractItemModel *model)-
1462{-
1463 QComboBoxPrivate * const d = d_func();-
1464-
1465 if (__builtin_expect(!!(!model), false)
__builtin_expe...model), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
model == d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1471 return;
never executed: return;
0
1472-
1473-
1474 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
0
1475 && d->lineEdit->completer() == d->completer
d->lineEdit->c...= d->completerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1476 d->lineEdit->completer()->setModel(model);
never executed: d->lineEdit->completer()->setModel(model);
0
1477-
1478 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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
d->model->QObj...rent() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
d->containerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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
pos < rowCountDescription
TRUEnever evaluated
FALSEnever evaluated
; pos++) {
0
1531 if (d->model->index(pos, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled
d->model->inde...:ItemIsEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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
!currentResetDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
1550QModelIndex QComboBox::rootModelIndex() const-
1551{-
1552 const QComboBoxPrivate * const d = d_func();-
1553 return
never executed: return QModelIndex(d->root);
QModelIndex(d->root);
never executed: return QModelIndex(d->root);
0
1554}-
1555-
1556-
1557-
1558-
1559-
1560-
1561void QComboBox::setRootModelIndex(const QModelIndex &index)-
1562{-
1563 QComboBoxPrivate * const d = d_func();-
1564 if (d->root == index
d->root == indexDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
1570int QComboBox::currentIndex() const-
1571{-
1572 const QComboBoxPrivate * const d = d_func();-
1573 return
never executed: return d->currentIndex.row();
d->currentIndex.row();
never executed: return d->currentIndex.row();
0
1574}-
1575-
1576void 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-
1583void QComboBox::setCurrentText(const QString &text)-
1584{-
1585 if (isEditable()
isEditable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1586 setEditText(text);-
1587 }
never executed: end of block
else {
0
1588 const int i = findText(text);-
1589 if (i > -1
i > -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1590 setCurrentIndex(i);
never executed: setCurrentIndex(i);
0
1591 }
never executed: end of block
0
1592}-
1593-
1594void 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()
!normalized.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1600 normalized = mi;
never executed: normalized = mi;
0
1601-
1602 bool indexChanged = (normalized != currentIndex);-
1603 if (indexChanged
indexChangedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1604 currentIndex = QPersistentModelIndex(normalized);
never executed: currentIndex = QPersistentModelIndex(normalized);
0
1605 if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1606 const QString newText = itemText(normalized);-
1607 if (lineEdit->text() != newText
lineEdit->text() != newTextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1608 lineEdit->setText(newText);-
1609-
1610 if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
&& lineEdit->completer()
lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
)
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
indexChangedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1617 q->update();-
1618 _q_emitCurrentIndexChanged(currentIndex);-
1619 }
never executed: end of block
0
1620}
never executed: end of block
0
1621QString QComboBox::currentText() const-
1622{-
1623 const QComboBoxPrivate * const d = d_func();-
1624 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1625 return
never executed: return d->lineEdit->text();
d->lineEdit->text();
never executed: return d->lineEdit->text();
0
1626 else if (d->currentIndex.isValid()
d->currentIndex.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1627 return
never executed: return d->itemText(d->currentIndex);
d->itemText(d->currentIndex);
never executed: return d->itemText(d->currentIndex);
0
1628 else-
1629 return
never executed: return QString();
QString();
never executed: return QString();
0
1630}-
1631QVariant QComboBox::currentData(int role) const-
1632{-
1633 const QComboBoxPrivate * const d = d_func();-
1634 return
never executed: return d->currentIndex.data(role);
d->currentIndex.data(role);
never executed: return d->currentIndex.data(role);
0
1635}-
1636-
1637-
1638-
1639-
1640QString 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: return d->itemText(mi);
d->itemText(mi);
never executed: return d->itemText(mi);
0
1645}-
1646-
1647-
1648-
1649-
1650QIcon 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: return d->itemIcon(mi);
d->itemIcon(mi);
never executed: return d->itemIcon(mi);
0
1655}-
1656-
1657-
1658-
1659-
1660-
1661QVariant 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: return d->model->data(mi, role);
d->model->data(mi, role);
never executed: return d->model->data(mi, role);
0
1666}-
1667void 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
index >= d->maxCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1673 return;
never executed: return;
0
1674-
1675-
1676-
1677 if (QStandardItemModel *m = qobject_cast<QStandardItemModel*>(d->model)
QStandardItemM...el*>(d->model)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1678 QStandardItem *item = new QStandardItem(text);-
1679 if (!icon.isNull()
!icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) item->setData(icon, Qt::DecorationRole);
never executed: item->setData(icon, Qt::DecorationRole);
0
1680 if (userData.isValid()
userData.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) item->setData(userData, Qt::UserRole);
never executed: item->setData(userData, Qt::UserRole);
0
1681 m->insertRow(index, item);-
1682 ++itemCount;-
1683 }
never executed: end of block
else {
0
1684 d->inserting = true;-
1685 if (d->model->insertRows(index, 1, d->root)
d->model->inse...x, 1, d->root)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1686 QModelIndex item = d->model->index(index, d->modelColumn, d->root);-
1687 if (icon.isNull()
icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
&& !userData.isValid()
!userData.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1688 d->model->setData(item, text, Qt::EditRole);-
1689 }
never executed: end of block
else {
0
1690 QMap<int, QVariant> values;-
1691 if (!text.isNull()
!text.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) values.insert(Qt::EditRole, text);
never executed: values.insert(Qt::EditRole, text);
0
1692 if (!icon.isNull()
!icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) values.insert(Qt::DecorationRole, icon);
never executed: values.insert(Qt::DecorationRole, icon);
0
1693 if (userData.isValid()
userData.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) values.insert(Qt::UserRole, userData);
never executed: values.insert(Qt::UserRole, userData);
0
1694 if (!values.isEmpty()
!values.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) d->model->setItemData(item, values);
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: end of block
else {
0
1700 d->inserting = false;-
1701 }
never executed: end of block
0
1702 }-
1703-
1704 if (itemCount > d->maxCount
itemCount > d->maxCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
1707void QComboBox::insertItems(int index, const QStringList &list)-
1708{-
1709 QComboBoxPrivate * const d = d_func();-
1710 if (list.isEmpty()
list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
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
insertCount <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1715 return;
never executed: return;
0
1716-
1717-
1718 if (QStandardItemModel *m = qobject_cast<QStandardItemModel*>(d->model)
QStandardItemM...el*>(d->model)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1719 QList<QStandardItem *> items;-
1720 items.reserve(insertCount);-
1721 QStandardItem *hiddenRoot = m->invisibleRootItem();-
1722 for (int i = 0; i < insertCount
i < insertCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
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: end of block
else {
0
1726 d->inserting = true;-
1727 if (d->model->insertRows(index, insertCount, d->root)
d->model->inse...ount, d->root)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1728 QModelIndex item;-
1729 for (int i = 0; i < insertCount
i < insertCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
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: end of block
else {
0
1736 d->inserting = false;-
1737 }
never executed: end of block
0
1738 }-
1739-
1740 int mc = count();-
1741 if (mc > d->maxCount
mc > d->maxCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
1744void 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
index >= d->maxCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
1761void QComboBox::removeItem(int index)-
1762{-
1763 QComboBoxPrivate * const d = d_func();-
1764 if (index < 0
index < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| index >= count()
index >= count()Description
TRUEnever evaluated
FALSEnever evaluated
)
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-
1772void 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()
item.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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-
1784void 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()
item.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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-
1797void 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()
item.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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-
1809QAbstractItemView *QComboBox::view() const-
1810{-
1811 const QComboBoxPrivate * const d = d_func();-
1812 return
never executed: return const_cast<QComboBoxPrivate*>(d)->viewContainer()->itemView();
const_cast<QComboBoxPrivate*>(d)->viewContainer()->itemView();
never executed: return const_cast<QComboBoxPrivate*>(d)->viewContainer()->itemView();
0
1813}-
1814void QComboBox::setView(QAbstractItemView *itemView)-
1815{-
1816 QComboBoxPrivate * const d = d_func();-
1817 if (__builtin_expect(!!(!itemView), false)
__builtin_expe...mView), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
itemView->model() != d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
1830QSize QComboBox::minimumSizeHint() const-
1831{-
1832 const QComboBoxPrivate * const d = d_func();-
1833 return
never executed: return d->recomputeSizeHint(d->minimumSizeHint);
d->recomputeSizeHint(d->minimumSizeHint);
never executed: return d->recomputeSizeHint(d->minimumSizeHint);
0
1834}-
1835QSize QComboBox::sizeHint() const-
1836{-
1837 const QComboBoxPrivate * const d = d_func();-
1838 return
never executed: return d->recomputeSizeHint(d->sizeHint);
d->recomputeSizeHint(d->sizeHint);
never executed: return d->recomputeSizeHint(d->sizeHint);
0
1839}-
1840void QComboBox::showPopup()-
1841{-
1842 QComboBoxPrivate * const d = d_func();-
1843 if (count() <= 0
count() <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
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
treeViewDescription
TRUEnever evaluated
FALSEnever evaluated
&& treeView->header()
treeView->header()Description
TRUEnever evaluated
FALSEnever evaluated
&& !treeView->header()->isHidden()
!treeView->hea...()->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1871 listHeight += treeView->header()->height();
never executed: listHeight += treeView->header()->height();
0
1872-
1873 while (!toCheck.isEmpty()
!toCheck.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1874 QModelIndex parent = toCheck.pop();-
1875 for (int i = 0, end = d->model->rowCount(parent); i < end
i < endDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1876 QModelIndex idx = d->model->index(i, d->modelColumn, parent);-
1877 if (!idx.isValid()
!idx.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1878 continue;
never executed: continue;
0
1879 listHeight += view()->visualRect(idx).height();-
1880-
1881 if (d->model->hasChildren(idx)
d->model->hasChildren(idx)Description
TRUEnever evaluated
FALSEnever evaluated
&& treeView
treeViewDescription
TRUEnever evaluated
FALSEnever evaluated
&& treeView->isExpanded(idx)
treeView->isExpanded(idx)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1882 toCheck.push(idx);
never executed: toCheck.push(idx);
0
1883-
1884 ++count;-
1885 if (!usePopup
!usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
&& count >= d->maxVisibleItems
count >= d->maxVisibleItemsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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
count > 1Description
TRUEnever evaluated
FALSEnever evaluated
)
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
usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1920 const int diff = d->computeWidthHint() - width();-
1921 if (diff > 0
diff > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
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
boundToScreenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1933 if (listRect.width() > screen.width()
listRect.width...screen.width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1934 listRect.setWidth(screen.width());
never executed: listRect.setWidth(screen.width());
0
1935 if (mapToGlobal(listRect.bottomRight()).x() > screen.right()
mapToGlobal(li...screen.right()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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()
mapToGlobal(li...) < screen.x()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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
!boundToScreenDescription
TRUEnever evaluated
FALSEnever evaluated
? listRect.height() : qMin(listRect.height(), screen.height());
0
1959 listRect.setHeight(height);-
1960-
1961 if (boundToScreen
boundToScreenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1962 if (listRect.top() < screen.top()
listRect.top() < screen.top()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1963 listRect.moveTop(screen.top());
never executed: listRect.moveTop(screen.top());
0
1964 if (listRect.bottom() > screen.bottom()
listRect.botto...creen.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1965 listRect.moveBottom(screen.bottom());
never executed: listRect.moveBottom(screen.bottom());
0
1966 }
never executed: end of block
0
1967 }
never executed: end of block
else if (!boundToScreen
!boundToScreenDescription
TRUEnever evaluated
FALSEnever evaluated
|| listRect.height() <= belowHeight
listRect.heigh...<= belowHeightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1968 listRect.moveTopLeft(below);-
1969 }
never executed: end of block
else if (listRect.height() <= aboveHeight
listRect.heigh...<= aboveHeightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1970 listRect.moveBottomLeft(above);-
1971 }
never executed: end of block
else if (belowHeight >= aboveHeight
belowHeight >= aboveHeightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1972 listRect.setHeight(belowHeight);-
1973 listRect.moveTopLeft(below);-
1974 }
never executed: end of block
else {
0
1975 listRect.setHeight(aboveHeight);-
1976 listRect.moveBottomLeft(above);-
1977 }
never executed: end of block
0
1978-
1979 if ((static_cast<
(static_cast<Q...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
QApplication *>(QCoreApplication::instance()))
(static_cast<Q...::instance()))Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
policy == Qt::...ollBarAsNeededDescription
TRUEnever evaluated
FALSEnever evaluated
|| policy == Qt::ScrollBarAlwaysOn
policy == Qt::...ollBarAlwaysOnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1986 && sb->minimum() < sb->maximum()
sb->minimum() < sb->maximum()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
1987 if (needHorizontalScrollBar
needHorizontalScrollBarDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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)
QApplication::..._AnimateCombo)Description
TRUEnever evaluated
FALSEnever evaluated
0
1999 && !style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)
!style->styleH...p, &opt, this)Description
TRUEnever evaluated
FALSEnever evaluated
&& !window()->testAttribute(Qt::WA_DontShowOnScreen)
!window()->tes...tShowOnScreen)Description
TRUEnever evaluated
FALSEnever evaluated
)
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
startTimerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2025 container->popupTimer.start();-
2026 container->maybeIgnoreMouseButtonRelease = true;-
2027 }
never executed: end of block
0
2028}
never executed: end of block
0
2029void QComboBox::hidePopup()-
2030{-
2031 QComboBoxPrivate * const d = d_func();-
2032 if (d->container
d->containerDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->container->isVisible()
d->container->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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)
style()->style...TriggeredItem)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2039 QItemSelectionModel *selectionModel = view()
view()Description
TRUEnever evaluated
FALSEnever evaluated
? view()->selectionModel() : 0;
0
2040 if (selectionModel
selectionModelDescription
TRUEnever evaluated
FALSEnever evaluated
&& selectionModel->hasSelection()
selectionModel->hasSelection()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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
needFadeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2060 }
never executed: end of block
0
2061 containerBlocker.unblock();-
2062 viewBlocker.unblock();-
2063 modelBlocker.unblock();-
2064-
2065 if (!didFade
!didFadeDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
2083void 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-
2096void QComboBox::clearEditText()-
2097{-
2098 QComboBoxPrivate * const d = d_func();-
2099 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
2110void QComboBox::setEditText(const QString &text)-
2111{-
2112 QComboBoxPrivate * const d = d_func();-
2113 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
2124void QComboBox::focusInEvent(QFocusEvent *e)-
2125{-
2126 QComboBoxPrivate * const d = d_func();-
2127 update();-
2128 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2129 d->lineEdit->event(e);-
2130-
2131 if (d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
)
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-
2140void QComboBox::focusOutEvent(QFocusEvent *e)-
2141{-
2142 QComboBoxPrivate * const d = d_func();-
2143 update();-
2144 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2145 d->lineEdit->event(e);
never executed: d->lineEdit->event(e);
0
2146}
never executed: end of block
0
2147-
2148-
2149void QComboBox::changeEvent(QEvent *e)-
2150{-
2151 QComboBoxPrivate * const d = d_func();-
2152 switch (e->type()) {-
2153 case
never executed: case QEvent::StyleChange:
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
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2162 d->updateLineEditGeometry();
never executed: d->updateLineEditGeometry();
0
2163 d->setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem);-
2164-
2165 if (e->type() == QEvent::MacSizeChange
e->type() == Q...:MacSizeChangeDescription
TRUEnever evaluated
FALSEnever evaluated
){
0
2166 QPlatformTheme::Font f = QPlatformTheme::SystemFont;-
2167 if (testAttribute(Qt::WA_MacSmallSize)
testAttribute(..._MacSmallSize)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2168 f = QPlatformTheme::SmallFont;
never executed: f = QPlatformTheme::SmallFont;
0
2169 else if (testAttribute(Qt::WA_MacMiniSize)
testAttribute(...A_MacMiniSize)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2170 f = QPlatformTheme::MiniFont;
never executed: f = QPlatformTheme::MiniFont;
0
2171 if (const
const QFont *p...eme()->font(f)Description
TRUEnever evaluated
FALSEnever evaluated
QFont *platformFont = QApplicationPrivate::platformTheme()->font(f)
const QFont *p...eme()->font(f)Description
TRUEnever evaluated
FALSEnever evaluated
) {
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: case QEvent::EnabledChange:
QEvent::EnabledChange:
never executed: case QEvent::EnabledChange:
0
2180 if (!isEnabled()
!isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2181 hidePopup();
never executed: hidePopup();
0
2182 break;
never executed: break;
0
2183 case
never executed: case QEvent::PaletteChange:
QEvent::PaletteChange:
never executed: case QEvent::PaletteChange:
{
0
2184 d->updateViewContainerPaletteAndOpacity();-
2185 break;
never executed: break;
0
2186 }-
2187 case
never executed: case QEvent::FontChange:
QEvent::FontChange:
never executed: case QEvent::FontChange:
0
2188 d->sizeHint = QSize();-
2189 d->viewContainer()->setFont(font());-
2190 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
2202void QComboBox::resizeEvent(QResizeEvent *)-
2203{-
2204 QComboBoxPrivate * const d = d_func();-
2205 d->updateLineEditGeometry();-
2206}
never executed: end of block
0
2207-
2208-
2209-
2210-
2211void 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-
2228void QComboBox::showEvent(QShowEvent *e)-
2229{-
2230 QComboBoxPrivate * const d = d_func();-
2231 if (!d->shownOnce
!d->shownOnceDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->sizeAdjustPolicy == QComboBox::AdjustToContentsOnFirstShow
d->sizeAdjustP...ntsOnFirstShowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
2242void QComboBox::hideEvent(QHideEvent *)-
2243{-
2244 hidePopup();-
2245}
never executed: end of block
0
2246-
2247-
2248-
2249-
2250bool QComboBox::event(QEvent *event)-
2251{-
2252 QComboBoxPrivate * const d = d_func();-
2253 switch(event->type()) {-
2254 case
never executed: case QEvent::LayoutDirectionChange:
QEvent::LayoutDirectionChange:
never executed: case QEvent::LayoutDirectionChange:
0
2255 case
never executed: case QEvent::ApplicationLayoutDirectionChange:
QEvent::ApplicationLayoutDirectionChange:
never executed: case QEvent::ApplicationLayoutDirectionChange:
0
2256 d->updateLayoutDirection();-
2257 d->updateLineEditGeometry();-
2258 break;
never executed: break;
0
2259 case
never executed: case QEvent::HoverEnter:
QEvent::HoverEnter:
never executed: case QEvent::HoverEnter:
0
2260 case
never executed: case QEvent::HoverLeave:
QEvent::HoverLeave:
never executed: case QEvent::HoverLeave:
0
2261 case
never executed: case QEvent::HoverMove:
QEvent::HoverMove:
never executed: case QEvent::HoverMove:
0
2262 if (const
const QHoverEv...vent *>(event)Description
TRUEnever evaluated
FALSEnever evaluated
QHoverEvent *he = static_cast<const QHoverEvent *>(event)
const QHoverEv...vent *>(event)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2263 d->updateHoverControl(he->pos());
never executed: d->updateHoverControl(he->pos());
0
2264 break;
never executed: break;
0
2265 case
never executed: case QEvent::ShortcutOverride:
QEvent::ShortcutOverride:
never executed: case QEvent::ShortcutOverride:
0
2266 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2267 return
never executed: return d->lineEdit->event(event);
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: return QWidget::event(event);
QWidget::event(event);
never executed: return QWidget::event(event);
0
2273}-
2274-
2275-
2276-
2277-
2278void QComboBox::mousePressEvent(QMouseEvent *e)-
2279{-
2280 QComboBoxPrivate * const d = d_func();-
2281 if (!QGuiApplication::styleHints()->setFocusOnTouchRelease()
!QGuiApplicati...TouchRelease()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2282 d->showPopupFromMouseEvent(e);
never executed: d->showPopupFromMouseEvent(e);
0
2283}
never executed: end of block
0
2284-
2285void 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
e->button() == Qt::LeftButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
2293 && !(sc == QStyle::SC_None
sc == QStyle::SC_NoneDescription
TRUEnever evaluated
FALSEnever evaluated
&& e->type() == QEvent::MouseButtonRelease
e->type() == Q...eButtonReleaseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2294 && (sc == QStyle::SC_ComboBoxArrow
sc == QStyle::SC_ComboBoxArrowDescription
TRUEnever evaluated
FALSEnever evaluated
|| !q->isEditable()
!q->isEditable()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2295 && !viewContainer()->isVisible()
!viewContainer()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2296 if (sc == QStyle::SC_ComboBoxArrow
sc == QStyle::SC_ComboBoxArrowDescription
TRUEnever evaluated
FALSEnever evaluated
)
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()
viewContainer()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2314 viewContainer()->maybeIgnoreMouseButtonRelease = false;
never executed: viewContainer()->maybeIgnoreMouseButtonRelease = false;
0
2315 }
never executed: end of block
else {
0
2316-
2317-
2318-
2319-
2320-
2321-
2322 e->ignore();-
2323 }
never executed: end of block
0
2324}-
2325-
2326-
2327-
2328-
2329void QComboBox::mouseReleaseEvent(QMouseEvent *e)-
2330{-
2331 QComboBoxPrivate * const d = d_func();-
2332 d->updateArrow(QStyle::State_None);-
2333 if (QGuiApplication::styleHints()->setFocusOnTouchRelease()
QGuiApplicatio...TouchRelease()Description
TRUEnever evaluated
FALSEnever evaluated
&& hasFocus()
hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2334 d->showPopupFromMouseEvent(e);
never executed: d->showPopupFromMouseEvent(e);
0
2335}
never executed: end of block
0
2336-
2337-
2338-
2339-
2340void QComboBox::keyPressEvent(QKeyEvent *e)-
2341{-
2342 QComboBoxPrivate * const d = d_func();-
2343-
2344-
2345 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
0
2346 && d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
0
2347 && d->lineEdit->completer()->popup()
d->lineEdit->c...ter()->popup()Description
TRUEnever evaluated
FALSEnever evaluated
0
2348 && d->lineEdit->completer()->popup()->isVisible()
d->lineEdit->c...)->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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: case Qt::Key_Up:
Qt::Key_Up:
never executed: case Qt::Key_Up:
0
2361 if (e->modifiers() & Qt::ControlModifier
e->modifiers()...ontrolModifierDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2362 break;
never executed: break;
0
2363-
2364 case
never executed: case Qt::Key_PageUp:
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: case Qt::Key_Down:
Qt::Key_Down:
never executed: case Qt::Key_Down:
0
2373 if (e->modifiers() & Qt::AltModifier
e->modifiers()...t::AltModifierDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2374 showPopup();-
2375 return;
never executed: return;
0
2376 } else if (e->modifiers() & Qt::ControlModifier
e->modifiers()...ontrolModifierDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2377 break;
never executed: break;
0
2378-
2379 case
never executed: case Qt::Key_PageDown:
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: case Qt::Key_Home:
Qt::Key_Home:
never executed: case Qt::Key_Home:
0
2388 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2389 move = MoveFirst;
never executed: move = MoveFirst;
0
2390 break;
never executed: break;
0
2391 case
never executed: case Qt::Key_End:
Qt::Key_End:
never executed: case Qt::Key_End:
0
2392 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2393 move = MoveLast;
never executed: move = MoveLast;
0
2394 break;
never executed: break;
0
2395 case
never executed: case Qt::Key_F4:
Qt::Key_F4:
never executed: case Qt::Key_F4:
0
2396 if (!e->modifiers()
!e->modifiers()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2397 showPopup();-
2398 return;
never executed: return;
0
2399 }-
2400 break;
never executed: break;
0
2401 case
never executed: case Qt::Key_Space:
Qt::Key_Space:
never executed: case Qt::Key_Space:
0
2402 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2403 showPopup();-
2404 return;
never executed: return;
0
2405 }-
2406 break;
never executed: break;
0
2407 case
never executed: case Qt::Key_Enter:
Qt::Key_Enter:
never executed: case Qt::Key_Enter:
0
2408 case
never executed: case Qt::Key_Return:
Qt::Key_Return:
never executed: case Qt::Key_Return:
0
2409 case
never executed: case Qt::Key_Escape:
Qt::Key_Escape:
never executed: case Qt::Key_Escape:
0
2410 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2415 if (!e->text().isEmpty()
!e->text().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
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
move != NoMoveDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2425 e->accept();-
2426 switch (move) {-
2427 case
never executed: case MoveFirst:
MoveFirst:
never executed: case MoveFirst:
0
2428 newIndex = -1;-
2429-
2430 case
never executed: case MoveDown:
MoveDown:
never executed: case MoveDown:
code before this statement never executed: case MoveDown:
0
2431 newIndex++;-
2432 while (newIndex < rowCount
newIndex < rowCountDescription
TRUEnever evaluated
FALSEnever evaluated
&& !(d->model->index(newIndex, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled)
!(d->model->in...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2433 newIndex++;
never executed: newIndex++;
0
2434 break;
never executed: break;
0
2435 case
never executed: case MoveLast:
MoveLast:
never executed: case MoveLast:
0
2436 newIndex = rowCount;-
2437-
2438 case
never executed: case MoveUp:
MoveUp:
never executed: case MoveUp:
code before this statement never executed: case MoveUp:
0
2439 newIndex--;-
2440 while ((
(newIndex >= 0)Description
TRUEnever evaluated
FALSEnever evaluated
newIndex >= 0)
(newIndex >= 0)Description
TRUEnever evaluated
FALSEnever evaluated
&& !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)
!(d->model->fl...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
)
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
newIndex >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& newIndex < rowCount
newIndex < rowCountDescription
TRUEnever evaluated
FALSEnever evaluated
&& newIndex != currentIndex()
newIndex != currentIndex()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2449 setCurrentIndex(newIndex);-
2450 d->emitActivated(d->currentIndex);-
2451 }
never executed: end of block
0
2452 }
never executed: end of block
else if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
2461void QComboBox::keyReleaseEvent(QKeyEvent *e)-
2462{-
2463 QComboBoxPrivate * const d = d_func();-
2464 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
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-
2474void QComboBox::wheelEvent(QWheelEvent *e)-
2475{-
2476-
2477-
2478-
2479 QComboBoxPrivate * const d = d_func();-
2480 if (!d->viewContainer()->isVisible()
!d->viewContai...)->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2481 const int rowCount = count();-
2482 int newIndex = currentIndex();-
2483-
2484 if (e->delta() > 0
e->delta() > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2485 newIndex--;-
2486 while ((
(newIndex >= 0)Description
TRUEnever evaluated
FALSEnever evaluated
newIndex >= 0)
(newIndex >= 0)Description
TRUEnever evaluated
FALSEnever evaluated
&& !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)
!(d->model->fl...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2487 newIndex--;
never executed: newIndex--;
0
2488 }
never executed: end of block
else if (e->delta() < 0
e->delta() < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2489 newIndex++;-
2490 while (newIndex < rowCount
newIndex < rowCountDescription
TRUEnever evaluated
FALSEnever evaluated
&& !(d->model->index(newIndex, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled)
!(d->model->in...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2491 newIndex++;
never executed: newIndex++;
0
2492 }
never executed: end of block
0
2493-
2494 if (newIndex >= 0
newIndex >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& newIndex < rowCount
newIndex < rowCountDescription
TRUEnever evaluated
FALSEnever evaluated
&& newIndex != currentIndex()
newIndex != currentIndex()Description
TRUEnever evaluated
FALSEnever evaluated
) {
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-
2508void QComboBox::contextMenuEvent(QContextMenuEvent *e)-
2509{-
2510 QComboBoxPrivate * const d = d_func();-
2511 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
2520void 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()
currentRow != ...tIndex().row()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2528 setCurrentIndex(view->currentIndex());-
2529 emitActivated(currentIndex);-
2530 }
never executed: end of block
0
2531}
never executed: end of block
0
2532-
2533void QComboBoxPrivate::modelChanged()-
2534{-
2535 QComboBox * const q = q_func();-
2536-
2537 if (sizeAdjustPolicy == QComboBox::AdjustToContents
sizeAdjustPoli...justToContentsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
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-
2547void QComboBox::inputMethodEvent(QInputMethodEvent *e)-
2548{-
2549 QComboBoxPrivate * const d = d_func();-
2550 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2551 d->lineEdit->event(e);-
2552 }
never executed: end of block
else {
0
2553 if (!e->commitString().isEmpty()
!e->commitString().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
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-
2563QVariant QComboBox::inputMethodQuery(Qt::InputMethodQuery query) const-
2564{-
2565 const QComboBoxPrivate * const d = d_func();-
2566 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2567 return
never executed: return d->lineEdit->inputMethodQuery(query);
d->lineEdit->inputMethodQuery(query);
never executed: return d->lineEdit->inputMethodQuery(query);
0
2568 return
never executed: return QWidget::inputMethodQuery(query);
QWidget::inputMethodQuery(query);
never executed: return QWidget::inputMethodQuery(query);
0
2569}-
2570-
2571-
2572-
2573QVariant QComboBox::inputMethodQuery(Qt::InputMethodQuery query, const QVariant &argument) const-
2574{-
2575 const QComboBoxPrivate * const d = d_func();-
2576 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2577 return
never executed: return d->lineEdit->inputMethodQuery(query, argument);
d->lineEdit->inputMethodQuery(query, argument);
never executed: return d->lineEdit->inputMethodQuery(query, argument);
0
2578 return
never executed: return QWidget::inputMethodQuery(query);
QWidget::inputMethodQuery(query);
never executed: return QWidget::inputMethodQuery(query);
0
2579}-
2580bool QComboBox::hasFrame() const-
2581{-
2582 const QComboBoxPrivate * const d = d_func();-
2583 return
never executed: return d->frame;
d->frame;
never executed: return d->frame;
0
2584}-
2585-
2586-
2587void 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
2594int QComboBox::modelColumn() const-
2595{-
2596 const QComboBoxPrivate * const d = d_func();-
2597 return
never executed: return d->modelColumn;
d->modelColumn;
never executed: return d->modelColumn;
0
2598}-
2599-
2600void 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
lvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2606 lv->setModelColumn(visibleColumn);
never executed: lv->setModelColumn(visibleColumn);
0
2607-
2608 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
0
2609 && d->lineEdit->completer() == d->completer
d->lineEdit->c...= d->completerDescription
TRUEnever evaluated
FALSEnever evaluated
)
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 codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9