Messagelib

comboboxutils.h
1/******************************************************************************
2 *
3 * SPDX-FileCopyrightText: 2008 Szymon Tomasz Stefanek <pragma@kvirc.net>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 *
7 *******************************************************************************/
8
9#pragma once
10
11#include <QPair>
12
13class QComboBox;
14
15namespace MessageList
16{
17namespace Utils
18{
19/**
20 * Namespace containing some helper functions for QComboBox widgets.
21 */
22namespace 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 */
29void fillIntegerOptionCombo(QComboBox *combo, const QList<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 */
36int getIntegerOptionComboValue(QComboBox *combo, int defaultValue);
37
38/**
39 * Sets the currently selected option in the specified combo.
40 */
41void setIntegerOptionComboValue(QComboBox *combo, int value);
42} // namespace ComboBoxUtils
43} // namespace Utils
44} // namespace MessageList
void fillIntegerOptionCombo(QComboBox *combo, const QList< QPair< QString, int > > &optionDescriptors)
Fills the specified QComboBox with the options available in optionDescriptors.
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.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:37:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.