Messagelib

comboboxutils.h
1 /******************************************************************************
2  *
3  * SPDX-FileCopyrightText: 2008 Szymon Tomasz Stefanek <[email protected]>
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  *
7  *******************************************************************************/
8 
9 #pragma once
10 
11 #include <QPair>
12 
13 class QComboBox;
14 
15 namespace MessageList
16 {
17 namespace Utils
18 {
19 /**
20  * Namespace containing some helper functions for QComboBox widgets.
21  */
22 namespace ComboBoxUtils
23 {
24 /**
25  * Fills the specified QComboBox with the options available in optionDescriptors.
26  * Each option descriptor contains a description string and a distinct integer (possibly enum)
27  * identifier value.
28  */
29 void fillIntegerOptionCombo(QComboBox *combo, const QVector<QPair<QString, int>> &optionDescriptors);
30 
31 /**
32  * Returns the identifier of the currently selected option in the specified combo.
33  * If the combo has no current selection or something goes wrong then the defaultValue
34  * is returned instead.
35  */
36 int getIntegerOptionComboValue(QComboBox *combo, int defaultValue);
37 
38 /**
39  * Sets the currently selected option in the specified combo.
40  */
41 void setIntegerOptionComboValue(QComboBox *combo, int value);
42 } // namespace ComboBoxUtils
43 } // namespace Utils
44 } // namespace MessageList
45 
void setIntegerOptionComboValue(QComboBox *combo, int value)
Sets the currently selected option in the specified combo.
int getIntegerOptionComboValue(QComboBox *combo, int defaultValue)
Returns the identifier of the currently selected option in the specified combo.
void fillIntegerOptionCombo(QComboBox *combo, const QVector< QPair< QString, int >> &optionDescriptors)
Fills the specified QComboBox with the options available in optionDescriptors.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Nov 30 2021 23:05:46 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.