KPIM::KCheckComboBox Class

Header: #include <KPIM/KCheckComboBox>
CMake: find_package(KPim6Libkdepim REQUIRED)
target_link_libraries(mytarget PRIVATE KPim6::Libkdepim)

Public Functions

KCheckComboBox(QWidget *parent = nullptr)
virtual ~KCheckComboBox() override
bool alwaysShowDefaultText() const
QStringList checkedItems(int role = Qt::DisplayRole) const
QString defaultText() const
Qt::CheckState itemCheckState(int index) const
bool itemEnabled(int index) const
QString separator() const
void setAlwaysShowDefaultText(bool always)
void setDefaultText(const QString &text)
void setItemCheckState(int index, Qt::CheckState state)
void setItemEnabled(int index, bool enabled = true)
void setSeparator(const QString &separator)
void setSqueezeText(bool squeeze)
bool squeezeText() const

Reimplemented Public Functions

virtual void hidePopup() override

Public Slots

void setCheckedItems(const QStringList &items, int role = Qt::DisplayRole)

Signals

void checkedItemsChanged(const QStringList &items)

Detailed Description

A combobox that shows its items in such a way that they can be checked in the drop menu. It provides methods to set the default text when no items are selected and the separator that is used to show the items that are selected in the line edit.

Member Function Documentation

[explicit] KCheckComboBox::KCheckComboBox(QWidget *parent = nullptr)

Constructor for KCheckComboBox. parent the parent widget

[override virtual noexcept] KCheckComboBox::~KCheckComboBox()

Destructor for KCheckComboBox.

bool KCheckComboBox::alwaysShowDefaultText() const

Returns whether the default text is always shown. Returns true if default text is always shown

See also setAlwaysShowDefaultText().

QStringList KCheckComboBox::checkedItems(int role = Qt::DisplayRole) const

Returns the list of currently checked items. role the data role to retrieve (default is Qt::DisplayRole) Returns list of checked item strings

See also setCheckedItems().

[signal] void KCheckComboBox::checkedItemsChanged(const QStringList &items)

Signal emitted when the checked items have changed. items the new list of checked items

QString KCheckComboBox::defaultText() const

Returns the default text shown when no items are selected. Returns the default text

See also setDefaultText().

[override virtual] void KCheckComboBox::hidePopup()

Hides the dropdown popup.

Qt::CheckState KCheckComboBox::itemCheckState(int index) const

Returns the check state of the item at the given index. index the item index Returns the Qt::CheckState of the item

See also setItemCheckState().

bool KCheckComboBox::itemEnabled(int index) const

Returns whether the item at the given index is enabled. index the item index Returns true if the item is enabled (can be checked/unchecked)

See also setItemEnabled().

QString KCheckComboBox::separator() const

Returns the separator string used between checked items. Returns the separator string

See also setSeparator().

void KCheckComboBox::setAlwaysShowDefaultText(bool always)

Sets whether the default text should always be shown. always true to always show default text, false to hide when items are checked

See also alwaysShowDefaultText().

[slot] void KCheckComboBox::setCheckedItems(const QStringList &items, int role = Qt::DisplayRole)

Sets which items should be checked. items the list of items to check role the data role (default is Qt::DisplayRole)

See also checkedItems().

void KCheckComboBox::setDefaultText(const QString &text)

Sets the default text to show when no items are selected. text the new default text

See also defaultText().

void KCheckComboBox::setItemCheckState(int index, Qt::CheckState state)

Sets the check state of the item at the given index. index the item index state the new Qt::CheckState

See also itemCheckState().

void KCheckComboBox::setItemEnabled(int index, bool enabled = true)

Sets whether the item at the given index is enabled. index the item index enabled true to enable the item, false to disable it

See also itemEnabled().

void KCheckComboBox::setSeparator(const QString &separator)

Sets the separator string used between checked items. separator the new separator string

See also separator().

void KCheckComboBox::setSqueezeText(bool squeeze)

Sets whether the display text should be squeezed to fit. squeeze true to squeeze text, false otherwise

See also squeezeText().

bool KCheckComboBox::squeezeText() const

Returns whether the text is squeezed to fit. Returns true if text is squeezed

See also setSqueezeText().