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
useFullScreenForPopupMenuDescription
TRUEnever evaluated
FALSEnever evaluated
?
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__,423) : qt_noop());-
353 ((!(itemView)) ? qt_assert("itemView",__FILE__,424) : 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__ ":" "456"), this, qFlagLocation("1""scrollItemView(int)" "\0" __FILE__ ":" "456"));-
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__ ":" "460"), this, qFlagLocation("1""scrollItemView(int)" "\0" __FILE__ ":" "460"));-
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__,534) : 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__ ":" "541"),-
471 this, qFlagLocation("1""updateScrollers()" "\0" __FILE__ ":" "542"));-
472 disconnect(view->verticalScrollBar(), qFlagLocation("2""rangeChanged(int,int)" "\0" __FILE__ ":" "543"),-
473 this, qFlagLocation("1""updateScrollers()" "\0" __FILE__ ":" "544"));-
474-
475 disconnect(view, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "546"),-
476 this, qFlagLocation("1""viewDestroyed()" "\0" __FILE__ ":" "547"));-
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__ ":" "578"),-
508 this, qFlagLocation("1""updateScrollers()" "\0" __FILE__ ":" "579"));-
509 connect(view->verticalScrollBar(), qFlagLocation("2""rangeChanged(int,int)" "\0" __FILE__ ":" "580"),-
510 this, qFlagLocation("1""updateScrollers()" "\0" __FILE__ ":" "581"));-
511-
512 connect(view, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "583"),-
513 this, qFlagLocation("1""viewDestroyed()" "\0" __FILE__ ":" "584"));-
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()
tview->showGrid()Description
TRUEnever evaluated
FALSEnever evaluated
? 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()
tview->showGrid()Description
TRUEnever evaluated
FALSEnever evaluated
? 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__ ":" "996"),-
749 q, qFlagLocation("1""_q_itemSelected(QModelIndex)" "\0" __FILE__ ":" "997"));-
750 QObject::connect(container->itemView()->selectionModel(),-
751 qFlagLocation("2""currentChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "999"),-
752 q, qFlagLocation("1""_q_emitHighlighted(QModelIndex)" "\0" __FILE__ ":" "1000"));-
753 QObject::connect(container, qFlagLocation("2""resetButton()" "\0" __FILE__ ":" "1001"), q, qFlagLocation("1""_q_resetButton()" "\0" __FILE__ ":" "1001"));-
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()
index.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
? 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()
q_func()->isEditable()Description
TRUEnever evaluated
FALSEnever evaluated
? 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__ ":" "1338"),-
1074 this, qFlagLocation("1""_q_modelDestroyed()" "\0" __FILE__ ":" "1339"));-
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 (maxItems < 0
maxItems < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1089 QMessageLogger(__FILE__, 1364, __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 (max < 0
max < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1111 QMessageLogger(__FILE__, 1399, __PRETTY_FUNCTION__).warning("QComboBox::setMaxCount: Invalid count (%d) must be >= 0", max);-
1112 return;
never executed: return;
0
1113 }-
1114-
1115 if (max < count()
max < count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1116 d->model->removeRows(max, count() - max, d->root);
never executed: d->model->removeRows(max, count() - max, d->root);
0
1117-
1118 d->maxCount = max;-
1119}
never executed: end of block
0
1120-
1121int QComboBox::maxCount() const-
1122{-
1123 const QComboBoxPrivate * const d = d_func();-
1124 return
never executed: return d->maxCount;
d->maxCount;
never executed: return d->maxCount;
0
1125}-
1126bool QComboBox::autoCompletion() const-
1127{-
1128 const QComboBoxPrivate * const d = d_func();-
1129 return
never executed: return d->autoCompletion;
d->autoCompletion;
never executed: return d->autoCompletion;
0
1130}-
1131-
1132-
1133-
1134-
1135-
1136-
1137void QComboBox::setAutoCompletion(bool enable)-
1138{-
1139 QComboBoxPrivate * const d = d_func();-
1140-
1141-
1142-
1143-
1144-
1145-
1146 d->autoCompletion = enable;-
1147 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1148 return;
never executed: return;
0
1149 if (enable
enableDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1150 if (d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1151 return;
never executed: return;
0
1152 d->completer = new QCompleter(d->model, d->lineEdit);-
1153 connect(d->completer, qFlagLocation("2""activated(QModelIndex)" "\0" __FILE__ ":" "1462"), this, qFlagLocation("1""_q_completerActivated(QModelIndex)" "\0" __FILE__ ":" "1462"));-
1154 d->completer->setCaseSensitivity(d->autoCompletionCaseSensitivity);-
1155 d->completer->setCompletionMode(QCompleter::InlineCompletion);-
1156 d->completer->setCompletionColumn(d->modelColumn);-
1157 d->lineEdit->setCompleter(d->completer);-
1158 d->completer->setWidget(this);-
1159 }
never executed: end of block
else {
0
1160 d->lineEdit->setCompleter(0);-
1161 }
never executed: end of block
0
1162}-
1163Qt::CaseSensitivity QComboBox::autoCompletionCaseSensitivity() const-
1164{-
1165 const QComboBoxPrivate * const d = d_func();-
1166 return
never executed: return d->autoCompletionCaseSensitivity;
d->autoCompletionCaseSensitivity;
never executed: return d->autoCompletionCaseSensitivity;
0
1167}-
1168-
1169-
1170-
1171-
1172-
1173-
1174void QComboBox::setAutoCompletionCaseSensitivity(Qt::CaseSensitivity sensitivity)-
1175{-
1176 QComboBoxPrivate * const d = d_func();-
1177 d->autoCompletionCaseSensitivity = sensitivity;-
1178 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1179 d->lineEdit->completer()->setCaseSensitivity(sensitivity);
never executed: d->lineEdit->completer()->setCaseSensitivity(sensitivity);
0
1180}
never executed: end of block
0
1181bool QComboBox::duplicatesEnabled() const-
1182{-
1183 const QComboBoxPrivate * const d = d_func();-
1184 return
never executed: return d->duplicatesEnabled;
d->duplicatesEnabled;
never executed: return d->duplicatesEnabled;
0
1185}-
1186-
1187void QComboBox::setDuplicatesEnabled(bool enable)-
1188{-
1189 QComboBoxPrivate * const d = d_func();-
1190 d->duplicatesEnabled = enable;-
1191}
never executed: end of block
0
1192int QComboBox::findData(const QVariant &data, int role, Qt::MatchFlags flags) const-
1193{-
1194 const QComboBoxPrivate * const d = d_func();-
1195 QModelIndexList result;-
1196 QModelIndex start = d->model->index(0, d->modelColumn, d->root);-
1197 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 (!edit
!editDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1344 QMessageLogger(__FILE__, 1765, __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 qt_widget_private(d->lineEdit)->inheritsInputMethodHints = 1;-
1356 if (d->lineEdit->parent() != this
d->lineEdit->parent() != thisDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1357 d->lineEdit->setParent(this);
never executed: d->lineEdit->setParent(this);
0
1358 connect(d->lineEdit, qFlagLocation("2""returnPressed()" "\0" __FILE__ ":" "1779"), this, qFlagLocation("1""_q_returnPressed()" "\0" __FILE__ ":" "1779"));-
1359 connect(d->lineEdit, qFlagLocation("2""editingFinished()" "\0" __FILE__ ":" "1780"), this, qFlagLocation("1""_q_editingFinished()" "\0" __FILE__ ":" "1780"));-
1360 connect(d->lineEdit, qFlagLocation("2""textChanged(QString)" "\0" __FILE__ ":" "1781"), this, qFlagLocation("2""editTextChanged(QString)" "\0" __FILE__ ":" "1781"));-
1361 connect(d->lineEdit, qFlagLocation("2""textChanged(QString)" "\0" __FILE__ ":" "1782"), this, qFlagLocation("2""currentTextChanged(QString)" "\0" __FILE__ ":" "1782"));-
1362 connect(d->lineEdit, qFlagLocation("2""cursorPositionChanged(int,int)" "\0" __FILE__ ":" "1783"), this, qFlagLocation("1""updateMicroFocus()" "\0" __FILE__ ":" "1783"));-
1363 connect(d->lineEdit, qFlagLocation("2""selectionChanged()" "\0" __FILE__ ":" "1784"), this, qFlagLocation("1""updateMicroFocus()" "\0" __FILE__ ":" "1784"));-
1364 d->lineEdit->setFrame(false);-
1365 d->lineEdit->setContextMenuPolicy(Qt::NoContextMenu);-
1366 d->updateFocusPolicy();-
1367 d->lineEdit->setFocusProxy(this);-
1368 d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false);-
1369-
1370 setAutoCompletion(d->autoCompletion);-
1371 setAttribute(Qt::WA_InputMethodEnabled);-
1372 d->updateLayoutDirection();-
1373 d->updateLineEditGeometry();-
1374 if (isVisible()
isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1375 d->lineEdit->show();
never executed: d->lineEdit->show();
0
1376-
1377 update();-
1378}
never executed: end of block
0
1379-
1380-
1381-
1382-
1383-
1384-
1385-
1386QLineEdit *QComboBox::lineEdit() const-
1387{-
1388 const QComboBoxPrivate * const d = d_func();-
1389 return
never executed: return d->lineEdit;
d->lineEdit;
never executed: return d->lineEdit;
0
1390}-
1391void QComboBox::setValidator(const QValidator *v)-
1392{-
1393 QComboBoxPrivate * const d = d_func();-
1394 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1395 d->lineEdit->setValidator(v);
never executed: d->lineEdit->setValidator(v);
0
1396}
never executed: end of block
0
1397-
1398-
1399-
1400-
1401-
1402-
1403-
1404const QValidator *QComboBox::validator() const-
1405{-
1406 const QComboBoxPrivate * const d = d_func();-
1407 return
never executed: return d->lineEdit ? d->lineEdit->validator() : 0;
d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
? d->lineEdit->validator() : 0;
never executed: return d->lineEdit ? d->lineEdit->validator() : 0;
0
1408}-
1409void QComboBox::setCompleter(QCompleter *c)-
1410{-
1411 QComboBoxPrivate * const d = d_func();-
1412 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1413 return;
never executed: return;
0
1414 d->lineEdit->setCompleter(c);-
1415 if (c
cDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1416 connect(c, qFlagLocation("2""activated(QModelIndex)" "\0" __FILE__ ":" "1880"), this, qFlagLocation("1""_q_completerActivated(QModelIndex)" "\0" __FILE__ ":" "1880"));-
1417 c->setWidget(this);-
1418 }
never executed: end of block
0
1419}
never executed: end of block
0
1420QCompleter *QComboBox::completer() const-
1421{-
1422 const QComboBoxPrivate * const d = d_func();-
1423 return
never executed: return d->lineEdit ? d->lineEdit->completer() : 0;
d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
? d->lineEdit->completer() : 0;
never executed: return d->lineEdit ? d->lineEdit->completer() : 0;
0
1424}-
1425QAbstractItemDelegate *QComboBox::itemDelegate() const-
1426{-
1427 return
never executed: return view()->itemDelegate();
view()->itemDelegate();
never executed: return view()->itemDelegate();
0
1428}-
1429void QComboBox::setItemDelegate(QAbstractItemDelegate *delegate)-
1430{-
1431 if (!delegate
!delegateDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1432 QMessageLogger(__FILE__, 1926, __PRETTY_FUNCTION__).warning("QComboBox::setItemDelegate: cannot set a 0 delegate");-
1433 return;
never executed: return;
0
1434 }-
1435 delete view()->itemDelegate();-
1436 view()->setItemDelegate(delegate);-
1437}
never executed: end of block
0
1438-
1439-
1440-
1441-
1442-
1443QAbstractItemModel *QComboBox::model() const-
1444{-
1445 const QComboBoxPrivate * const d = d_func();-
1446 if (d->model == QAbstractItemModelPrivate::staticEmptyModel()
d->model == QA...icEmptyModel()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1447 QComboBox *that = const_cast<QComboBox*>(this);-
1448 that->setModel(new QStandardItemModel(0, 1, that));-
1449 }
never executed: end of block
0
1450 return
never executed: return d->model;
d->model;
never executed: return d->model;
0
1451}-
1452-
1453-
1454-
1455-
1456-
1457-
1458-
1459void QComboBox::setModel(QAbstractItemModel *model)-
1460{-
1461 QComboBoxPrivate * const d = d_func();-
1462-
1463 if (!model
!modelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1464 QMessageLogger(__FILE__, 1958, __PRETTY_FUNCTION__).warning("QComboBox::setModel: cannot set a 0 model");-
1465 return;
never executed: return;
0
1466 }-
1467-
1468 if (model == d->model
model == d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1469 return;
never executed: return;
0
1470-
1471-
1472 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
0
1473 && d->lineEdit->completer() == d->completer
d->lineEdit->c...= d->completerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1474 d->lineEdit->completer()->setModel(model);
never executed: d->lineEdit->completer()->setModel(model);
0
1475-
1476 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1477 disconnect(d->model, qFlagLocation("2""dataChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1971"),-
1478 this, qFlagLocation("1""_q_dataChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1972"));-
1479 disconnect(d->model, qFlagLocation("2""rowsAboutToBeInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "1973"),-
1480 this, qFlagLocation("1""_q_updateIndexBeforeChange()" "\0" __FILE__ ":" "1974"));-
1481 disconnect(d->model, qFlagLocation("2""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "1975"),-
1482 this, qFlagLocation("1""_q_rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "1976"));-
1483 disconnect(d->model, qFlagLocation("2""rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "1977"),-
1484 this, qFlagLocation("1""_q_updateIndexBeforeChange()" "\0" __FILE__ ":" "1978"));-
1485 disconnect(d->model, qFlagLocation("2""rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "1979"),-
1486 this, qFlagLocation("1""_q_rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "1980"));-
1487 disconnect(d->model, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "1981"),-
1488 this, qFlagLocation("1""_q_modelDestroyed()" "\0" __FILE__ ":" "1982"));-
1489 disconnect(d->model, qFlagLocation("2""modelAboutToBeReset()" "\0" __FILE__ ":" "1983"),-
1490 this, qFlagLocation("1""_q_updateIndexBeforeChange()" "\0" __FILE__ ":" "1984"));-
1491 disconnect(d->model, qFlagLocation("2""modelReset()" "\0" __FILE__ ":" "1985"),-
1492 this, qFlagLocation("1""_q_modelReset()" "\0" __FILE__ ":" "1986"));-
1493 if (d->model->QObject::parent() == this
d->model->QObj...rent() == thisDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1494 delete d->model;
never executed: delete d->model;
0
1495 }
never executed: end of block
0
1496-
1497 d->model = model;-
1498-
1499 connect(model, qFlagLocation("2""dataChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1993"),-
1500 this, qFlagLocation("1""_q_dataChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "1994"));-
1501 connect(model, qFlagLocation("2""rowsAboutToBeInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "1995"),-
1502 this, qFlagLocation("1""_q_updateIndexBeforeChange()" "\0" __FILE__ ":" "1996"));-
1503 connect(model, qFlagLocation("2""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "1997"),-
1504 this, qFlagLocation("1""_q_rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "1998"));-
1505 connect(model, qFlagLocation("2""rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "1999"),-
1506 this, qFlagLocation("1""_q_updateIndexBeforeChange()" "\0" __FILE__ ":" "2000"));-
1507 connect(model, qFlagLocation("2""rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "2001"),-
1508 this, qFlagLocation("1""_q_rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "2002"));-
1509 connect(model, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "2003"),-
1510 this, qFlagLocation("1""_q_modelDestroyed()" "\0" __FILE__ ":" "2004"));-
1511 connect(model, qFlagLocation("2""modelAboutToBeReset()" "\0" __FILE__ ":" "2005"),-
1512 this, qFlagLocation("1""_q_updateIndexBeforeChange()" "\0" __FILE__ ":" "2006"));-
1513 connect(model, qFlagLocation("2""modelReset()" "\0" __FILE__ ":" "2007"),-
1514 this, qFlagLocation("1""_q_modelReset()" "\0" __FILE__ ":" "2008"));-
1515-
1516 if (d->container
d->containerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1517 d->container->itemView()->setModel(model);-
1518 connect(d->container->itemView()->selectionModel(),-
1519 qFlagLocation("2""currentChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "2013"),-
1520 this, qFlagLocation("1""_q_emitHighlighted(QModelIndex)" "\0" __FILE__ ":" "2014"), Qt::UniqueConnection);-
1521 }
never executed: end of block
0
1522-
1523 setRootModelIndex(QModelIndex());-
1524-
1525 bool currentReset = false;-
1526-
1527 const int rowCount = count();-
1528 for (int pos=0; pos < rowCount
pos < rowCountDescription
TRUEnever evaluated
FALSEnever evaluated
; pos++) {
0
1529 if (d->model->index(pos, d->modelColumn, d->root).flags() & Qt::ItemIsEnabled
d->model->inde...:ItemIsEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1530 setCurrentIndex(pos);-
1531 currentReset = true;-
1532 break;
never executed: break;
0
1533 }-
1534 }
never executed: end of block
0
1535-
1536 if (!currentReset
!currentResetDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1537 setCurrentIndex(-1);
never executed: setCurrentIndex(-1);
0
1538-
1539 d->modelChanged();-
1540}
never executed: end of block
0
1541-
1542-
1543-
1544-
1545-
1546-
1547-
1548QModelIndex QComboBox::rootModelIndex() const-
1549{-
1550 const QComboBoxPrivate * const d = d_func();-
1551 return
never executed: return QModelIndex(d->root);
QModelIndex(d->root);
never executed: return QModelIndex(d->root);
0
1552}-
1553-
1554-
1555-
1556-
1557-
1558-
1559void QComboBox::setRootModelIndex(const QModelIndex &index)-
1560{-
1561 QComboBoxPrivate * const d = d_func();-
1562 if (d->root == index
d->root == indexDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1563 return;
never executed: return;
0
1564 d->root = QPersistentModelIndex(index);-
1565 view()->setRootIndex(index);-
1566 update();-
1567}
never executed: end of block
0
1568int QComboBox::currentIndex() const-
1569{-
1570 const QComboBoxPrivate * const d = d_func();-
1571 return
never executed: return d->currentIndex.row();
d->currentIndex.row();
never executed: return d->currentIndex.row();
0
1572}-
1573-
1574void QComboBox::setCurrentIndex(int index)-
1575{-
1576 QComboBoxPrivate * const d = d_func();-
1577 QModelIndex mi = d->model->index(index, d->modelColumn, d->root);-
1578 d->setCurrentIndex(mi);-
1579}
never executed: end of block
0
1580-
1581void QComboBox::setCurrentText(const QString &text)-
1582{-
1583 if (isEditable()
isEditable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1584 setEditText(text);-
1585 }
never executed: end of block
else {
0
1586 const int i = findText(text);-
1587 if (i > -1
i > -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1588 setCurrentIndex(i);
never executed: setCurrentIndex(i);
0
1589 }
never executed: end of block
0
1590}-
1591-
1592void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi)-
1593{-
1594 QComboBox * const q = q_func();-
1595-
1596 QModelIndex normalized = mi.sibling(mi.row(), modelColumn);-
1597 if (!normalized.isValid()
!normalized.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1598 normalized = mi;
never executed: normalized = mi;
0
1599-
1600 bool indexChanged = (normalized != currentIndex);-
1601 if (indexChanged
indexChangedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1602 currentIndex = QPersistentModelIndex(normalized);
never executed: currentIndex = QPersistentModelIndex(normalized);
0
1603 if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1604 const QString newText = itemText(normalized);-
1605 if (lineEdit->text() != newText
lineEdit->text() != newTextDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1606 lineEdit->setText(newText);-
1607-
1608 if (lineEdit
lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
&& lineEdit->completer()
lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1609 lineEdit->completer()->setCompletionPrefix(newText);
never executed: lineEdit->completer()->setCompletionPrefix(newText);
0
1610-
1611 }
never executed: end of block
0
1612 updateLineEditGeometry();-
1613 }
never executed: end of block
0
1614 if (indexChanged
indexChangedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1615 q->update();-
1616 _q_emitCurrentIndexChanged(currentIndex);-
1617 }
never executed: end of block
0
1618}
never executed: end of block
0
1619QString QComboBox::currentText() const-
1620{-
1621 const QComboBoxPrivate * const d = d_func();-
1622 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1623 return
never executed: return d->lineEdit->text();
d->lineEdit->text();
never executed: return d->lineEdit->text();
0
1624 else if (d->currentIndex.isValid()
d->currentIndex.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1625 return
never executed: return d->itemText(d->currentIndex);
d->itemText(d->currentIndex);
never executed: return d->itemText(d->currentIndex);
0
1626 else-
1627 return
never executed: return QString();
QString();
never executed: return QString();
0
1628}-
1629QVariant QComboBox::currentData(int role) const-
1630{-
1631 const QComboBoxPrivate * const d = d_func();-
1632 return
never executed: return d->currentIndex.data(role);
d->currentIndex.data(role);
never executed: return d->currentIndex.data(role);
0
1633}-
1634-
1635-
1636-
1637-
1638QString QComboBox::itemText(int index) const-
1639{-
1640 const QComboBoxPrivate * const d = d_func();-
1641 QModelIndex mi = d->model->index(index, d->modelColumn, d->root);-
1642 return
never executed: return d->itemText(mi);
d->itemText(mi);
never executed: return d->itemText(mi);
0
1643}-
1644-
1645-
1646-
1647-
1648QIcon QComboBox::itemIcon(int index) const-
1649{-
1650 const QComboBoxPrivate * const d = d_func();-
1651 QModelIndex mi = d->model->index(index, d->modelColumn, d->root);-
1652 return
never executed: return d->itemIcon(mi);
d->itemIcon(mi);
never executed: return d->itemIcon(mi);
0
1653}-
1654-
1655-
1656-
1657-
1658-
1659QVariant QComboBox::itemData(int index, int role) const-
1660{-
1661 const QComboBoxPrivate * const d = d_func();-
1662 QModelIndex mi = d->model->index(index, d->modelColumn, d->root);-
1663 return
never executed: return d->model->data(mi, role);
d->model->data(mi, role);
never executed: return d->model->data(mi, role);
0
1664}-
1665void QComboBox::insertItem(int index, const QIcon &icon, const QString &text, const QVariant &userData)-
1666{-
1667 QComboBoxPrivate * const d = d_func();-
1668 int itemCount = count();-
1669 index = qBound(0, index, itemCount);-
1670 if (index >= d->maxCount
index >= d->maxCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1671 return;
never executed: return;
0
1672-
1673-
1674-
1675 if (QStandardItemModel *m = qobject_cast<QStandardItemModel*>(d->model)
QStandardItemM...el*>(d->model)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1676 QStandardItem *item = new QStandardItem(text);-
1677 if (!icon.isNull()
!icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) item->setData(icon, Qt::DecorationRole);
never executed: item->setData(icon, Qt::DecorationRole);
0
1678 if (userData.isValid()
userData.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) item->setData(userData, Qt::UserRole);
never executed: item->setData(userData, Qt::UserRole);
0
1679 m->insertRow(index, item);-
1680 ++itemCount;-
1681 }
never executed: end of block
else {
0
1682 d->inserting = true;-
1683 if (d->model->insertRows(index, 1, d->root)
d->model->inse...x, 1, d->root)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1684 QModelIndex item = d->model->index(index, d->modelColumn, d->root);-
1685 if (icon.isNull()
icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
&& !userData.isValid()
!userData.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1686 d->model->setData(item, text, Qt::EditRole);-
1687 }
never executed: end of block
else {
0
1688 QMap<int, QVariant> values;-
1689 if (!text.isNull()
!text.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) values.insert(Qt::EditRole, text);
never executed: values.insert(Qt::EditRole, text);
0
1690 if (!icon.isNull()
!icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) values.insert(Qt::DecorationRole, icon);
never executed: values.insert(Qt::DecorationRole, icon);
0
1691 if (userData.isValid()
userData.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) values.insert(Qt::UserRole, userData);
never executed: values.insert(Qt::UserRole, userData);
0
1692 if (!values.isEmpty()
!values.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) d->model->setItemData(item, values);
never executed: d->model->setItemData(item, values);
0
1693 }
never executed: end of block
0
1694 d->inserting = false;-
1695 d->_q_rowsInserted(d->root, index, index);-
1696 ++itemCount;-
1697 }
never executed: end of block
else {
0
1698 d->inserting = false;-
1699 }
never executed: end of block
0
1700 }-
1701-
1702 if (itemCount > d->maxCount
itemCount > d->maxCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1703 d->model->removeRows(itemCount - 1, itemCount - d->maxCount, d->root);
never executed: d->model->removeRows(itemCount - 1, itemCount - d->maxCount, d->root);
0
1704}
never executed: end of block
0
1705void QComboBox::insertItems(int index, const QStringList &list)-
1706{-
1707 QComboBoxPrivate * const d = d_func();-
1708 if (list.isEmpty()
list.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1709 return;
never executed: return;
0
1710 index = qBound(0, index, count());-
1711 int insertCount = qMin(d->maxCount - index, list.count());-
1712 if (insertCount <= 0
insertCount <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1713 return;
never executed: return;
0
1714-
1715-
1716 if (QStandardItemModel *m = qobject_cast<QStandardItemModel*>(d->model)
QStandardItemM...el*>(d->model)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1717 QList<QStandardItem *> items;-
1718 items.reserve(insertCount);-
1719 QStandardItem *hiddenRoot = m->invisibleRootItem();-
1720 for (int i = 0; i < insertCount
i < insertCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
1721 items.append(new QStandardItem(list.at(i)));
never executed: items.append(new QStandardItem(list.at(i)));
0
1722 hiddenRoot->insertRows(index, items);-
1723 }
never executed: end of block
else {
0
1724 d->inserting = true;-
1725 if (d->model->insertRows(index, insertCount, d->root)
d->model->inse...ount, d->root)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1726 QModelIndex item;-
1727 for (int i = 0; i < insertCount
i < insertCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1728 item = d->model->index(i+index, d->modelColumn, d->root);-
1729 d->model->setData(item, list.at(i), Qt::EditRole);-
1730 }
never executed: end of block
0
1731 d->inserting = false;-
1732 d->_q_rowsInserted(d->root, index, index + insertCount - 1);-
1733 }
never executed: end of block
else {
0
1734 d->inserting = false;-
1735 }
never executed: end of block
0
1736 }-
1737-
1738 int mc = count();-
1739 if (mc > d->maxCount
mc > d->maxCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1740 d->model->removeRows(d->maxCount, mc - d->maxCount, d->root);
never executed: d->model->removeRows(d->maxCount, mc - d->maxCount, d->root);
0
1741}
never executed: end of block
0
1742void QComboBox::insertSeparator(int index)-
1743{-
1744 QComboBoxPrivate * const d = d_func();-
1745 int itemCount = count();-
1746 index = qBound(0, index, itemCount);-
1747 if (index >= d->maxCount
index >= d->maxCountDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1748 return;
never executed: return;
0
1749 insertItem(index, QIcon(), QString());-
1750 QComboBoxDelegate::setSeparator(d->model, d->model->index(index, 0, d->root));-
1751}
never executed: end of block
0
1752-
1753-
1754-
1755-
1756-
1757-
1758-
1759void QComboBox::removeItem(int index)-
1760{-
1761 QComboBoxPrivate * const d = d_func();-
1762 if (index < 0
index < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| index >= count()
index >= count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1763 return;
never executed: return;
0
1764 d->model->removeRows(index, 1, d->root);-
1765}
never executed: end of block
0
1766-
1767-
1768-
1769-
1770void QComboBox::setItemText(int index, const QString &text)-
1771{-
1772 const QComboBoxPrivate * const d = d_func();-
1773 QModelIndex item = d->model->index(index, d->modelColumn, d->root);-
1774 if (item.isValid()
item.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1775 d->model->setData(item, text, Qt::EditRole);-
1776 }
never executed: end of block
0
1777}
never executed: end of block
0
1778-
1779-
1780-
1781-
1782void QComboBox::setItemIcon(int index, const QIcon &icon)-
1783{-
1784 const QComboBoxPrivate * const d = d_func();-
1785 QModelIndex item = d->model->index(index, d->modelColumn, d->root);-
1786 if (item.isValid()
item.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1787 d->model->setData(item, icon, Qt::DecorationRole);-
1788 }
never executed: end of block
0
1789}
never executed: end of block
0
1790-
1791-
1792-
1793-
1794-
1795void QComboBox::setItemData(int index, const QVariant &value, int role)-
1796{-
1797 const QComboBoxPrivate * const d = d_func();-
1798 QModelIndex item = d->model->index(index, d->modelColumn, d->root);-
1799 if (item.isValid()
item.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1800 d->model->setData(item, value, role);-
1801 }
never executed: end of block
0
1802}
never executed: end of block
0
1803-
1804-
1805-
1806-
1807QAbstractItemView *QComboBox::view() const-
1808{-
1809 const QComboBoxPrivate * const d = d_func();-
1810 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
1811}-
1812void QComboBox::setView(QAbstractItemView *itemView)-
1813{-
1814 QComboBoxPrivate * const d = d_func();-
1815 if (!itemView
!itemViewDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1816 QMessageLogger(__FILE__, 2404, __PRETTY_FUNCTION__).warning("QComboBox::setView: cannot set a 0 view");-
1817 return;
never executed: return;
0
1818 }-
1819-
1820 if (itemView->model() != d->model
itemView->model() != d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1821 itemView->setModel(d->model);
never executed: itemView->setModel(d->model);
0
1822 d->viewContainer()->setItemView(itemView);-
1823}
never executed: end of block
0
1824-
1825-
1826-
1827-
1828QSize QComboBox::minimumSizeHint() const-
1829{-
1830 const QComboBoxPrivate * const d = d_func();-
1831 return
never executed: return d->recomputeSizeHint(d->minimumSizeHint);
d->recomputeSizeHint(d->minimumSizeHint);
never executed: return d->recomputeSizeHint(d->minimumSizeHint);
0
1832}-
1833QSize QComboBox::sizeHint() const-
1834{-
1835 const QComboBoxPrivate * const d = d_func();-
1836 return
never executed: return d->recomputeSizeHint(d->sizeHint);
d->recomputeSizeHint(d->sizeHint);
never executed: return d->recomputeSizeHint(d->sizeHint);
0
1837}-
1838void QComboBox::showPopup()-
1839{-
1840 QComboBoxPrivate * const d = d_func();-
1841 if (count() <= 0
count() <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1842 return;
never executed: return;
0
1843-
1844 QStyle * const style = this->style();-
1845 QStyleOptionComboBox opt;-
1846 initStyleOption(&opt);-
1847 const bool usePopup = style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this);-
1848 view()->selectionModel()->setCurrentIndex(d->currentIndex,-
1849 QItemSelectionModel::ClearAndSelect);-
1850 QComboBoxPrivateContainer* container = d->viewContainer();-
1851 QRect listRect(style->subControlRect(QStyle::CC_ComboBox, &opt,-
1852 QStyle::SC_ComboBoxListBoxPopup, this));-
1853 QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this));-
1854-
1855 QPoint below = mapToGlobal(listRect.bottomLeft());-
1856 int belowHeight = screen.bottom() - below.y();-
1857 QPoint above = mapToGlobal(listRect.topLeft());-
1858 int aboveHeight = above.y() - screen.y();-
1859 bool boundToScreen = !window()->testAttribute(Qt::WA_DontShowOnScreen);-
1860-
1861 {-
1862 int listHeight = 0;-
1863 int count = 0;-
1864 QStack<QModelIndex> toCheck;-
1865 toCheck.push(view()->rootIndex());-
1866-
1867 QTreeView *treeView = qobject_cast<QTreeView*>(view());-
1868 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
1869 listHeight += treeView->header()->height();
never executed: listHeight += treeView->header()->height();
0
1870-
1871 while (!toCheck.isEmpty()
!toCheck.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1872 QModelIndex parent = toCheck.pop();-
1873 for (int i = 0; i < d->model->rowCount(parent)
i < d->model->rowCount(parent)Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1874 QModelIndex idx = d->model->index(i, d->modelColumn, parent);-
1875 if (!idx.isValid()
!idx.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1876 continue;
never executed: continue;
0
1877 listHeight += view()->visualRect(idx).height();-
1878-
1879 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
1880 toCheck.push(idx);
never executed: toCheck.push(idx);
0
1881-
1882 ++count;-
1883 if (!usePopup
!usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
&& count >= d->maxVisibleItems
count >= d->maxVisibleItemsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1884 toCheck.clear();-
1885 break;
never executed: break;
0
1886 }-
1887 }
never executed: end of block
0
1888 }
never executed: end of block
0
1889 if (count > 1
count > 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1890 listHeight += (count - 1) * container->spacing();
never executed: listHeight += (count - 1) * container->spacing();
0
1891 listRect.setHeight(listHeight);-
1892 }-
1893-
1894 {-
1895-
1896 int heightMargin = container->topMargin() + container->bottomMargin();-
1897-
1898-
1899 int marginTop, marginBottom;-
1900 container->getContentsMargins(0, &marginTop, 0, &marginBottom);-
1901 heightMargin += marginTop + marginBottom;-
1902-
1903-
1904 view()->getContentsMargins(0, &marginTop, 0, &marginBottom);-
1905 marginTop += static_cast<QAbstractScrollAreaPrivate *>(QObjectPrivate::get(view()))->top;-
1906 marginBottom += static_cast<QAbstractScrollAreaPrivate *>(QObjectPrivate::get(view()))->bottom;-
1907 heightMargin += marginTop + marginBottom;-
1908-
1909 listRect.setHeight(listRect.height() + heightMargin);-
1910 }-
1911-
1912-
1913 if (usePopup
usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1914 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
1915-
1916-
1917 if (usePopup
usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1918 const int diff = d->computeWidthHint() - width();-
1919 if (diff > 0
diff > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1920 listRect.setWidth(listRect.width() + diff);
never executed: listRect.setWidth(listRect.width() + diff);
0
1921 }
never executed: end of block
0
1922-
1923-
1924 container->layout()->activate();-
1925-
1926 listRect.setSize( listRect.size().expandedTo(container->minimumSize())-
1927 .boundedTo(container->maximumSize()));-
1928-
1929-
1930 if (boundToScreen
boundToScreenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1931 if (listRect.width() > screen.width()
listRect.width...screen.width()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1932 listRect.setWidth(screen.width());
never executed: listRect.setWidth(screen.width());
0
1933 if (mapToGlobal(listRect.bottomRight()).x() > screen.right()
mapToGlobal(li...screen.right()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1934 below.setX(screen.x() + screen.width() - listRect.width());-
1935 above.setX(screen.x() + screen.width() - listRect.width());-
1936 }
never executed: end of block
0
1937 if (mapToGlobal(listRect.topLeft()).x() < screen.x()
mapToGlobal(li...) < screen.x()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1938 below.setX(screen.x());-
1939 above.setX(screen.x());-
1940 }
never executed: end of block
0
1941 }
never executed: end of block
0
1942-
1943 if (usePopup
usePopupDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1944-
1945 listRect.moveLeft(above.x());-
1946-
1947-
1948-
1949 const QRect currentItemRect = view()->visualRect(view()->currentIndex());-
1950 const int offset = listRect.top() - currentItemRect.top();-
1951 listRect.moveTop(above.y() + offset - listRect.top());-
1952-
1953-
1954-
1955-
1956 const int height = !boundToScreen
!boundToScreenDescription
TRUEnever evaluated
FALSEnever evaluated
? listRect.height() : qMin(listRect.height(), screen.height());
0
1957 listRect.setHeight(height);-
1958-
1959 if (boundToScreen
boundToScreenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1960 if (listRect.top() < screen.top()
listRect.top() < screen.top()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1961 listRect.moveTop(screen.top());
never executed: listRect.moveTop(screen.top());
0
1962 if (listRect.bottom() > screen.bottom()
listRect.botto...creen.bottom()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1963 listRect.moveBottom(screen.bottom());
never executed: listRect.moveBottom(screen.bottom());
0
1964 }
never executed: end of block
0
1965 }
never executed: end of block
else if (!boundToScreen
!boundToScreenDescription
TRUEnever evaluated
FALSEnever evaluated
|| listRect.height() <= belowHeight
listRect.heigh...<= belowHeightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1966 listRect.moveTopLeft(below);-
1967 }
never executed: end of block
else if (listRect.height() <= aboveHeight
listRect.heigh...<= aboveHeightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1968 listRect.moveBottomLeft(above);-
1969 }
never executed: end of block
else if (belowHeight >= aboveHeight
belowHeight >= aboveHeightDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1970 listRect.setHeight(belowHeight);-
1971 listRect.moveTopLeft(below);-
1972 }
never executed: end of block
else {
0
1973 listRect.setHeight(aboveHeight);-
1974 listRect.moveBottomLeft(above);-
1975 }
never executed: end of block
0
1976-
1977 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
1978 QGuiApplication::inputMethod()->reset();-
1979 }
never executed: end of block
0
1980-
1981 QScrollBar *sb = view()->horizontalScrollBar();-
1982 Qt::ScrollBarPolicy policy = view()->horizontalScrollBarPolicy();-
1983 bool needHorizontalScrollBar = (policy == Qt::ScrollBarAsNeeded
policy == Qt::...ollBarAsNeededDescription
TRUEnever evaluated
FALSEnever evaluated
|| policy == Qt::ScrollBarAlwaysOn
policy == Qt::...ollBarAlwaysOnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1984 && sb->minimum() < sb->maximum()
sb->minimum() < sb->maximum()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
1985 if (needHorizontalScrollBar
needHorizontalScrollBarDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1986 listRect.adjust(0, 0, 0, sb->height());-
1987 }
never executed: end of block
0
1988 container->setGeometry(listRect);-
1989-
1990-
1991 const bool updatesEnabled = container->updatesEnabled();-
1992-
1993-
1994-
1995 bool scrollDown = (listRect.topLeft() == below);-
1996 if (QApplication::isEffectEnabled(Qt::UI_AnimateCombo)
QApplication::..._AnimateCombo)Description
TRUEnever evaluated
FALSEnever evaluated
0
1997 && !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
1998 qScrollEffect(container, scrollDown ? QEffects::DownScroll : QEffects::UpScroll, 150);
never executed: qScrollEffect(container, scrollDown ? QEffects::DownScroll : QEffects::UpScroll, 150);
0
1999 container->setUpdatesEnabled(false);-
2000-
2001-
2002 bool startTimer = !container->isVisible();-
2003 container->raise();-
2004 container->show();-
2005 container->updateScrollers();-
2006 view()->setFocus();-
2007-
2008 view()->scrollTo(view()->currentIndex(),-
2009 style->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)-
2010 ? QAbstractItemView::PositionAtCenter-
2011 : QAbstractItemView::EnsureVisible);-
2012-
2013-
2014 container->setUpdatesEnabled(updatesEnabled);-
2015-
2016-
2017 container->update();-
2018-
2019-
2020-
2021-
2022 if (startTimer
startTimerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2023 container->popupTimer.start();-
2024 container->maybeIgnoreMouseButtonRelease = true;-
2025 }
never executed: end of block
0
2026}
never executed: end of block
0
2027void QComboBox::hidePopup()-
2028{-
2029 QComboBoxPrivate * const d = d_func();-
2030 if (d->container
d->containerDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->container->isVisible()
d->container->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2031-
2032 QSignalBlocker modelBlocker(d->model);-
2033 QSignalBlocker viewBlocker(d->container->itemView());-
2034 QSignalBlocker containerBlocker(d->container);-
2035-
2036 if (style()->styleHint(QStyle::SH_Menu_FlashTriggeredItem)
style()->style...TriggeredItem)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2037 QItemSelectionModel *selectionModel = view()
view()Description
TRUEnever evaluated
FALSEnever evaluated
? view()->selectionModel() : 0;
0
2038 if (selectionModel
selectionModelDescription
TRUEnever evaluated
FALSEnever evaluated
&& selectionModel->hasSelection()
selectionModel->hasSelection()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2039 QEventLoop eventLoop;-
2040 const QItemSelection selection = selectionModel->selection();-
2041-
2042-
2043 selectionModel->select(selection, QItemSelectionModel::Toggle);-
2044 QTimer::singleShot(60, &eventLoop, qFlagLocation("1""quit()" "\0" __FILE__ ":" "2788"));-
2045 eventLoop.exec();-
2046-
2047-
2048 selectionModel->select(selection, QItemSelectionModel::Toggle);-
2049 QTimer::singleShot(20, &eventLoop, qFlagLocation("1""quit()" "\0" __FILE__ ":" "2793"));-
2050 eventLoop.exec();-
2051 }
never executed: end of block
0
2052 }
never executed: end of block
0
2053-
2054-
2055 bool needFade = style()->styleHint(QStyle::SH_Menu_FadeOutOnHide);-
2056 bool didFade = false;-
2057 if (needFade
needFadeDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2058 }
never executed: end of block
0
2059 containerBlocker.unblock();-
2060 viewBlocker.unblock();-
2061 modelBlocker.unblock();-
2062-
2063 if (!didFade
!didFadeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2064-
2065-
2066 d->container->hide();
never executed: d->container->hide();
0
2067 }
never executed: end of block
0
2068-
2069-
2070-
2071-
2072 d->_q_resetButton();-
2073}
never executed: end of block
0
2074-
2075-
2076-
2077-
2078-
2079-
2080-
2081void QComboBox::clear()-
2082{-
2083 QComboBoxPrivate * const d = d_func();-
2084 d->model->removeRows(0, d->model->rowCount(d->root), d->root);-
2085-
2086 QAccessibleValueChangeEvent event(this, QString());-
2087 QAccessible::updateAccessibility(&event);-
2088-
2089}
never executed: end of block
0
2090-
2091-
2092-
2093-
2094void QComboBox::clearEditText()-
2095{-
2096 QComboBoxPrivate * const d = d_func();-
2097 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2098 d->lineEdit->clear();
never executed: d->lineEdit->clear();
0
2099-
2100 QAccessibleValueChangeEvent event(this, QString());-
2101 QAccessible::updateAccessibility(&event);-
2102-
2103}
never executed: end of block
0
2104-
2105-
2106-
2107-
2108void QComboBox::setEditText(const QString &text)-
2109{-
2110 QComboBoxPrivate * const d = d_func();-
2111 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2112 d->lineEdit->setText(text);
never executed: d->lineEdit->setText(text);
0
2113-
2114 QAccessibleValueChangeEvent event(this, text);-
2115 QAccessible::updateAccessibility(&event);-
2116-
2117}
never executed: end of block
0
2118-
2119-
2120-
2121-
2122void QComboBox::focusInEvent(QFocusEvent *e)-
2123{-
2124 QComboBoxPrivate * const d = d_func();-
2125 update();-
2126 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2127 d->lineEdit->event(e);-
2128-
2129 if (d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2130 d->lineEdit->completer()->setWidget(this);
never executed: d->lineEdit->completer()->setWidget(this);
0
2131-
2132 }
never executed: end of block
0
2133}
never executed: end of block
0
2134-
2135-
2136-
2137-
2138void QComboBox::focusOutEvent(QFocusEvent *e)-
2139{-
2140 QComboBoxPrivate * const d = d_func();-
2141 update();-
2142 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2143 d->lineEdit->event(e);
never executed: d->lineEdit->event(e);
0
2144}
never executed: end of block
0
2145-
2146-
2147void QComboBox::changeEvent(QEvent *e)-
2148{-
2149 QComboBoxPrivate * const d = d_func();-
2150 switch (e->type()) {-
2151 case
never executed: case QEvent::StyleChange:
QEvent::StyleChange:
never executed: case QEvent::StyleChange:
0
2152 d->updateDelegate();-
2153-
2154-
2155-
2156 d->sizeHint = QSize();-
2157 d->minimumSizeHint = QSize();-
2158 d->updateLayoutDirection();-
2159 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2160 d->updateLineEditGeometry();
never executed: d->updateLineEditGeometry();
0
2161 d->setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem);-
2162-
2163 if (e->type() == QEvent::MacSizeChange
e->type() == Q...:MacSizeChangeDescription
TRUEnever evaluated
FALSEnever evaluated
){
0
2164 QPlatformTheme::Font f = QPlatformTheme::SystemFont;-
2165 if (testAttribute(Qt::WA_MacSmallSize)
testAttribute(..._MacSmallSize)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2166 f = QPlatformTheme::SmallFont;
never executed: f = QPlatformTheme::SmallFont;
0
2167 else if (testAttribute(Qt::WA_MacMiniSize)
testAttribute(...A_MacMiniSize)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2168 f = QPlatformTheme::MiniFont;
never executed: f = QPlatformTheme::MiniFont;
0
2169 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
2170 QFont f = font();-
2171 f.setPointSizeF(platformFont->pointSizeF());-
2172 setFont(f);-
2173 }
never executed: end of block
0
2174 }
never executed: end of block
0
2175-
2176 break;
never executed: break;
0
2177 case
never executed: case QEvent::EnabledChange:
QEvent::EnabledChange:
never executed: case QEvent::EnabledChange:
0
2178 if (!isEnabled()
!isEnabled()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2179 hidePopup();
never executed: hidePopup();
0
2180 break;
never executed: break;
0
2181 case
never executed: case QEvent::PaletteChange:
QEvent::PaletteChange:
never executed: case QEvent::PaletteChange:
{
0
2182 d->updateViewContainerPaletteAndOpacity();-
2183 break;
never executed: break;
0
2184 }-
2185 case
never executed: case QEvent::FontChange:
QEvent::FontChange:
never executed: case QEvent::FontChange:
0
2186 d->sizeHint = QSize();-
2187 d->viewContainer()->setFont(font());-
2188 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2189 d->updateLineEditGeometry();
never executed: d->updateLineEditGeometry();
0
2190 break;
never executed: break;
0
2191 default
never executed: default:
:
never executed: default:
0
2192 break;
never executed: break;
0
2193 }-
2194 QWidget::changeEvent(e);-
2195}
never executed: end of block
0
2196-
2197-
2198-
2199-
2200void QComboBox::resizeEvent(QResizeEvent *)-
2201{-
2202 QComboBoxPrivate * const d = d_func();-
2203 d->updateLineEditGeometry();-
2204}
never executed: end of block
0
2205-
2206-
2207-
2208-
2209void QComboBox::paintEvent(QPaintEvent *)-
2210{-
2211 QStylePainter painter(this);-
2212 painter.setPen(palette().color(QPalette::Text));-
2213-
2214-
2215 QStyleOptionComboBox opt;-
2216 initStyleOption(&opt);-
2217 painter.drawComplexControl(QStyle::CC_ComboBox, opt);-
2218-
2219-
2220 painter.drawControl(QStyle::CE_ComboBoxLabel, opt);-
2221}
never executed: end of block
0
2222-
2223-
2224-
2225-
2226void QComboBox::showEvent(QShowEvent *e)-
2227{-
2228 QComboBoxPrivate * const d = d_func();-
2229 if (!d->shownOnce
!d->shownOnceDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->sizeAdjustPolicy == QComboBox::AdjustToContentsOnFirstShow
d->sizeAdjustP...ntsOnFirstShowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2230 d->sizeHint = QSize();-
2231 updateGeometry();-
2232 }
never executed: end of block
0
2233 d->shownOnce = true;-
2234 QWidget::showEvent(e);-
2235}
never executed: end of block
0
2236-
2237-
2238-
2239-
2240void QComboBox::hideEvent(QHideEvent *)-
2241{-
2242 hidePopup();-
2243}
never executed: end of block
0
2244-
2245-
2246-
2247-
2248bool QComboBox::event(QEvent *event)-
2249{-
2250 QComboBoxPrivate * const d = d_func();-
2251 switch(event->type()) {-
2252 case
never executed: case QEvent::LayoutDirectionChange:
QEvent::LayoutDirectionChange:
never executed: case QEvent::LayoutDirectionChange:
0
2253 case
never executed: case QEvent::ApplicationLayoutDirectionChange:
QEvent::ApplicationLayoutDirectionChange:
never executed: case QEvent::ApplicationLayoutDirectionChange:
0
2254 d->updateLayoutDirection();-
2255 d->updateLineEditGeometry();-
2256 break;
never executed: break;
0
2257 case
never executed: case QEvent::HoverEnter:
QEvent::HoverEnter:
never executed: case QEvent::HoverEnter:
0
2258 case
never executed: case QEvent::HoverLeave:
QEvent::HoverLeave:
never executed: case QEvent::HoverLeave:
0
2259 case
never executed: case QEvent::HoverMove:
QEvent::HoverMove:
never executed: case QEvent::HoverMove:
0
2260 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
2261 d->updateHoverControl(he->pos());
never executed: d->updateHoverControl(he->pos());
0
2262 break;
never executed: break;
0
2263 case
never executed: case QEvent::ShortcutOverride:
QEvent::ShortcutOverride:
never executed: case QEvent::ShortcutOverride:
0
2264 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2265 return
never executed: return d->lineEdit->event(event);
d->lineEdit->event(event);
never executed: return d->lineEdit->event(event);
0
2266 break;
never executed: break;
0
2267 default
never executed: default:
:
never executed: default:
0
2268 break;
never executed: break;
0
2269 }-
2270 return
never executed: return QWidget::event(event);
QWidget::event(event);
never executed: return QWidget::event(event);
0
2271}-
2272-
2273-
2274-
2275-
2276void QComboBox::mousePressEvent(QMouseEvent *e)-
2277{-
2278 QComboBoxPrivate * const d = d_func();-
2279 if (!QGuiApplication::styleHints()->setFocusOnTouchRelease()
!QGuiApplicati...TouchRelease()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2280 d->showPopupFromMouseEvent(e);
never executed: d->showPopupFromMouseEvent(e);
0
2281}
never executed: end of block
0
2282-
2283void QComboBoxPrivate::showPopupFromMouseEvent(QMouseEvent *e)-
2284{-
2285 QComboBox * const q = q_func();-
2286 QStyleOptionComboBox opt;-
2287 q->initStyleOption(&opt);-
2288 QStyle::SubControl sc = q->style()->hitTestComplexControl(QStyle::CC_ComboBox, &opt, e->pos(), q);-
2289-
2290 if (e->button() == Qt::LeftButton
e->button() == Qt::LeftButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
2291 && !(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
2292 && (sc == QStyle::SC_ComboBoxArrow
sc == QStyle::SC_ComboBoxArrowDescription
TRUEnever evaluated
FALSEnever evaluated
|| !q->isEditable()
!q->isEditable()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2293 && !viewContainer()->isVisible()
!viewContainer()->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2294 if (sc == QStyle::SC_ComboBoxArrow
sc == QStyle::SC_ComboBoxArrowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2295 updateArrow(QStyle::State_Sunken);
never executed: updateArrow(QStyle::State_Sunken);
0
2296-
2297-
2298-
2299-
2300-
2301-
2302 viewContainer()->blockMouseReleaseTimer.start(QApplication::doubleClickInterval());-
2303 viewContainer()->initialClickPosition = q->mapToGlobal(e->pos());-
2304-
2305-
2306-
2307 q->showPopup();-
2308-
2309-
2310-
2311 if (viewContainer()
viewContainer()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2312 viewContainer()->maybeIgnoreMouseButtonRelease = false;
never executed: viewContainer()->maybeIgnoreMouseButtonRelease = false;
0
2313 }
never executed: end of block
else {
0
2314-
2315-
2316-
2317-
2318-
2319-
2320 e->ignore();-
2321 }
never executed: end of block
0
2322}-
2323-
2324-
2325-
2326-
2327void QComboBox::mouseReleaseEvent(QMouseEvent *e)-
2328{-
2329 QComboBoxPrivate * const d = d_func();-
2330 d->updateArrow(QStyle::State_None);-
2331 if (QGuiApplication::styleHints()->setFocusOnTouchRelease()
QGuiApplicatio...TouchRelease()Description
TRUEnever evaluated
FALSEnever evaluated
&& hasFocus()
hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2332 d->showPopupFromMouseEvent(e);
never executed: d->showPopupFromMouseEvent(e);
0
2333}
never executed: end of block
0
2334-
2335-
2336-
2337-
2338void QComboBox::keyPressEvent(QKeyEvent *e)-
2339{-
2340 QComboBoxPrivate * const d = d_func();-
2341-
2342-
2343 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
0
2344 && d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
0
2345 && d->lineEdit->completer()->popup()
d->lineEdit->c...ter()->popup()Description
TRUEnever evaluated
FALSEnever evaluated
0
2346 && d->lineEdit->completer()->popup()->isVisible()
d->lineEdit->c...)->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2347-
2348 d->lineEdit->event(e);-
2349 return;
never executed: return;
0
2350 }-
2351-
2352-
2353 enum Move { NoMove=0 , MoveUp , MoveDown , MoveFirst , MoveLast};-
2354-
2355 Move move = NoMove;-
2356 int newIndex = currentIndex();-
2357 switch (e->key()) {-
2358 case
never executed: case Qt::Key_Up:
Qt::Key_Up:
never executed: case Qt::Key_Up:
0
2359 if (e->modifiers() & Qt::ControlModifier
e->modifiers()...ontrolModifierDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2360 break;
never executed: break;
0
2361-
2362 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
2363-
2364-
2365-
2366-
2367-
2368 move = MoveUp;-
2369 break;
never executed: break;
0
2370 case
never executed: case Qt::Key_Down:
Qt::Key_Down:
never executed: case Qt::Key_Down:
0
2371 if (e->modifiers() & Qt::AltModifier
e->modifiers()...t::AltModifierDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2372 showPopup();-
2373 return;
never executed: return;
0
2374 } else if (e->modifiers() & Qt::ControlModifier
e->modifiers()...ontrolModifierDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2375 break;
never executed: break;
0
2376-
2377 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
2378-
2379-
2380-
2381-
2382-
2383 move = MoveDown;-
2384 break;
never executed: break;
0
2385 case
never executed: case Qt::Key_Home:
Qt::Key_Home:
never executed: case Qt::Key_Home:
0
2386 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2387 move = MoveFirst;
never executed: move = MoveFirst;
0
2388 break;
never executed: break;
0
2389 case
never executed: case Qt::Key_End:
Qt::Key_End:
never executed: case Qt::Key_End:
0
2390 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2391 move = MoveLast;
never executed: move = MoveLast;
0
2392 break;
never executed: break;
0
2393 case
never executed: case Qt::Key_F4:
Qt::Key_F4:
never executed: case Qt::Key_F4:
0
2394 if (!e->modifiers()
!e->modifiers()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2395 showPopup();-
2396 return;
never executed: return;
0
2397 }-
2398 break;
never executed: break;
0
2399 case
never executed: case Qt::Key_Space:
Qt::Key_Space:
never executed: case Qt::Key_Space:
0
2400 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2401 showPopup();-
2402 return;
never executed: return;
0
2403 }-
2404 break;
never executed: break;
0
2405 case
never executed: case Qt::Key_Enter:
Qt::Key_Enter:
never executed: case Qt::Key_Enter:
0
2406 case
never executed: case Qt::Key_Return:
Qt::Key_Return:
never executed: case Qt::Key_Return:
0
2407 case
never executed: case Qt::Key_Escape:
Qt::Key_Escape:
never executed: case Qt::Key_Escape:
0
2408 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2409 e->ignore();
never executed: e->ignore();
0
2410 break;
never executed: break;
0
2411 default
never executed: default:
:
never executed: default:
0
2412 if (!d->lineEdit
!d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2413 if (!e->text().isEmpty()
!e->text().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2414 d->keyboardSearchString(e->text());
never executed: d->keyboardSearchString(e->text());
0
2415 else-
2416 e->ignore();
never executed: e->ignore();
0
2417 }-
2418 }
never executed: end of block
0
2419-
2420 if (move != NoMove
move != NoMoveDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2421 e->accept();-
2422 switch (move) {-
2423 case
never executed: case MoveFirst:
MoveFirst:
never executed: case MoveFirst:
0
2424 newIndex = -1;-
2425-
2426 case
never executed: case MoveDown:
MoveDown:
never executed: case MoveDown:
code before this statement never executed: case MoveDown:
0
2427 newIndex++;-
2428 while ((
(newIndex < count())Description
TRUEnever evaluated
FALSEnever evaluated
newIndex < count())
(newIndex < count())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
2429 newIndex++;
never executed: newIndex++;
0
2430 break;
never executed: break;
0
2431 case
never executed: case MoveLast:
MoveLast:
never executed: case MoveLast:
0
2432 newIndex = count();-
2433-
2434 case
never executed: case MoveUp:
MoveUp:
never executed: case MoveUp:
code before this statement never executed: case MoveUp:
0
2435 newIndex--;-
2436 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
2437 newIndex--;
never executed: newIndex--;
0
2438 break;
never executed: break;
0
2439 default
never executed: default:
:
never executed: default:
0
2440 e->ignore();-
2441 break;
never executed: break;
0
2442 }-
2443-
2444 if (newIndex >= 0
newIndex >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& newIndex < count()
newIndex < count()Description
TRUEnever evaluated
FALSEnever evaluated
&& newIndex != currentIndex()
newIndex != currentIndex()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2445 setCurrentIndex(newIndex);-
2446 d->emitActivated(d->currentIndex);-
2447 }
never executed: end of block
0
2448 }
never executed: end of block
else if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2449 d->lineEdit->event(e);-
2450 }
never executed: end of block
0
2451}
never executed: end of block
0
2452-
2453-
2454-
2455-
2456-
2457void QComboBox::keyReleaseEvent(QKeyEvent *e)-
2458{-
2459 QComboBoxPrivate * const d = d_func();-
2460 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2461 d->lineEdit->event(e);
never executed: d->lineEdit->event(e);
0
2462 else-
2463 QWidget::keyReleaseEvent(e);
never executed: QWidget::keyReleaseEvent(e);
0
2464}-
2465-
2466-
2467-
2468-
2469-
2470void QComboBox::wheelEvent(QWheelEvent *e)-
2471{-
2472-
2473-
2474-
2475 QComboBoxPrivate * const d = d_func();-
2476 if (!d->viewContainer()->isVisible()
!d->viewContai...)->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2477 int newIndex = currentIndex();-
2478-
2479 if (e->delta() > 0
e->delta() > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2480 newIndex--;-
2481 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
2482 newIndex--;
never executed: newIndex--;
0
2483 }
never executed: end of block
else if (e->delta() < 0
e->delta() < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2484 newIndex++;-
2485 while ((
(newIndex < count())Description
TRUEnever evaluated
FALSEnever evaluated
newIndex < count())
(newIndex < count())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
2486 newIndex++;
never executed: newIndex++;
0
2487 }
never executed: end of block
0
2488-
2489 if (newIndex >= 0
newIndex >= 0Description
TRUEnever evaluated
FALSEnever evaluated
&& newIndex < count()
newIndex < count()Description
TRUEnever evaluated
FALSEnever evaluated
&& newIndex != currentIndex()
newIndex != currentIndex()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2490 setCurrentIndex(newIndex);-
2491 d->emitActivated(d->currentIndex);-
2492 }
never executed: end of block
0
2493 e->accept();-
2494 }
never executed: end of block
0
2495-
2496}
never executed: end of block
0
2497-
2498-
2499-
2500-
2501-
2502-
2503void QComboBox::contextMenuEvent(QContextMenuEvent *e)-
2504{-
2505 QComboBoxPrivate * const d = d_func();-
2506 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2507 Qt::ContextMenuPolicy p = d->lineEdit->contextMenuPolicy();-
2508 d->lineEdit->setContextMenuPolicy(Qt::DefaultContextMenu);-
2509 d->lineEdit->event(e);-
2510 d->lineEdit->setContextMenuPolicy(p);-
2511 }
never executed: end of block
0
2512}
never executed: end of block
0
2513-
2514-
2515void QComboBoxPrivate::keyboardSearchString(const QString &text)-
2516{-
2517-
2518 QAbstractItemView *view = viewContainer()->itemView();-
2519 view->setCurrentIndex(currentIndex);-
2520 int currentRow = view->currentIndex().row();-
2521 view->keyboardSearch(text);-
2522 if (currentRow != view->currentIndex().row()
currentRow != ...tIndex().row()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
2523 setCurrentIndex(view->currentIndex());-
2524 emitActivated(currentIndex);-
2525 }
never executed: end of block
0
2526}
never executed: end of block
0
2527-
2528void QComboBoxPrivate::modelChanged()-
2529{-
2530 QComboBox * const q = q_func();-
2531-
2532 if (sizeAdjustPolicy == QComboBox::AdjustToContents
sizeAdjustPoli...justToContentsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2533 sizeHint = QSize();-
2534 adjustComboBoxSize();-
2535 q->updateGeometry();-
2536 }
never executed: end of block
0
2537}
never executed: end of block
0
2538-
2539-
2540-
2541-
2542void QComboBox::inputMethodEvent(QInputMethodEvent *e)-
2543{-
2544 QComboBoxPrivate * const d = d_func();-
2545 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
2546 d->lineEdit->event(e);-
2547 }
never executed: end of block
else {
0
2548 if (!e->commitString().isEmpty()
!e->commitString().isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
2549 d->keyboardSearchString(e->commitString());
never executed: d->keyboardSearchString(e->commitString());
0
2550 else-
2551 e->ignore();
never executed: e->ignore();
0
2552 }-
2553}-
2554-
2555-
2556-
2557-
2558QVariant QComboBox::inputMethodQuery(Qt::InputMethodQuery query) const-
2559{-
2560 const QComboBoxPrivate * const d = d_func();-
2561 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2562 return
never executed: return d->lineEdit->inputMethodQuery(query);
d->lineEdit->inputMethodQuery(query);
never executed: return d->lineEdit->inputMethodQuery(query);
0
2563 return
never executed: return QWidget::inputMethodQuery(query);
QWidget::inputMethodQuery(query);
never executed: return QWidget::inputMethodQuery(query);
0
2564}-
2565bool QComboBox::hasFrame() const-
2566{-
2567 const QComboBoxPrivate * const d = d_func();-
2568 return
never executed: return d->frame;
d->frame;
never executed: return d->frame;
0
2569}-
2570-
2571-
2572void QComboBox::setFrame(bool enable)-
2573{-
2574 QComboBoxPrivate * const d = d_func();-
2575 d->frame = enable;-
2576 update();-
2577 updateGeometry();-
2578}
never executed: end of block
0
2579int QComboBox::modelColumn() const-
2580{-
2581 const QComboBoxPrivate * const d = d_func();-
2582 return
never executed: return d->modelColumn;
d->modelColumn;
never executed: return d->modelColumn;
0
2583}-
2584-
2585void QComboBox::setModelColumn(int visibleColumn)-
2586{-
2587 QComboBoxPrivate * const d = d_func();-
2588 d->modelColumn = visibleColumn;-
2589 QListView *lv = qobject_cast<QListView *>(d->viewContainer()->itemView());-
2590 if (lv
lvDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2591 lv->setModelColumn(visibleColumn);
never executed: lv->setModelColumn(visibleColumn);
0
2592-
2593 if (d->lineEdit
d->lineEditDescription
TRUEnever evaluated
FALSEnever evaluated
&& d->lineEdit->completer()
d->lineEdit->completer()Description
TRUEnever evaluated
FALSEnever evaluated
0
2594 && d->lineEdit->completer() == d->completer
d->lineEdit->c...= d->completerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
2595 d->lineEdit->completer()->setCompletionColumn(visibleColumn);
never executed: d->lineEdit->completer()->setCompletionColumn(visibleColumn);
0
2596-
2597 setCurrentIndex(currentIndex());-
2598}
never executed: end of block
0
2599-
2600-
2601-
Switch to Source codePreprocessed file

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