mirror of
https://github.com/eosswedenorg/antelope-keygen
synced 2026-07-03 11:53:41 +02:00
gui/MultiSelect: add variable for default state for addItem() and addItems()
This commit is contained in:
parent
c14a453f01
commit
925ef7e8ad
2 changed files with 6 additions and 6 deletions
|
|
@ -54,19 +54,19 @@ QPushButton (text + ": none", parent)
|
||||||
QObject::connect(m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(listItemClicked(QListWidgetItem*)));
|
QObject::connect(m_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(listItemClicked(QListWidgetItem*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiSelect::addItem(const QString& text)
|
void MultiSelect::addItem(const QString& text, bool checked)
|
||||||
{
|
{
|
||||||
QListWidgetItem* item = new QListWidgetItem(text, m_list);
|
QListWidgetItem* item = new QListWidgetItem(text, m_list);
|
||||||
item->setFlags(Qt::ItemIsEnabled);
|
item->setFlags(Qt::ItemIsEnabled);
|
||||||
item->setCheckState(Qt::Unchecked);
|
item->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiSelect::addItems(const QStringList& list)
|
void MultiSelect::addItems(const QStringList& list, bool checked)
|
||||||
{
|
{
|
||||||
QStringList::const_iterator it;
|
QStringList::const_iterator it;
|
||||||
|
|
||||||
for(it = list.cbegin(); it != list.cend(); it++) {
|
for(it = list.cbegin(); it != list.cend(); it++) {
|
||||||
addItem(*it);
|
addItem(*it, checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,9 @@ public:
|
||||||
|
|
||||||
// Items.
|
// Items.
|
||||||
|
|
||||||
void addItem(const QString& text);
|
void addItem(const QString& text, bool checked = false);
|
||||||
|
|
||||||
void addItems(const QStringList& list);
|
void addItems(const QStringList& list, bool checked = false);
|
||||||
|
|
||||||
void clearItems();
|
void clearItems();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue