MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / setCurrentSelection

Method setCurrentSelection

ElaWidgetTools/ElaMultiSelectComboBox.cpp:84–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84void ElaMultiSelectComboBox::setCurrentSelection(const QString& selection)
85{
86 Q_D(ElaMultiSelectComboBox);
87 d->_itemSelection.fill(false);
88 d->_comboView->selectionModel()->clearSelection();
89 for (int i = 0; i < this->count(); i++)
90 {
91 if (selection == itemText(i))
92 {
93 QModelIndex index = model()->index(i, 0);
94 d->_comboView->selectionModel()->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
95 d->_itemSelection[index.row()] = true;
96 }
97 }
98 d->_refreshCurrentIndexs();
99}
100
101void ElaMultiSelectComboBox::setCurrentSelection(const QStringList& selection)
102{

Callers 1

T_BaseComponentsMethod · 0.80

Calls 3

countMethod · 0.80
_refreshCurrentIndexsMethod · 0.80
indexMethod · 0.45

Tested by

no test coverage detected