File indexing completed on 2024-12-15 04:54:44
0001 /****************************************************************************** 0002 * 0003 * SPDX-FileCopyrightText: 2008 Szymon Tomasz Stefanek <pragma@kvirc.net> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 * 0007 *******************************************************************************/ 0008 0009 #pragma once 0010 0011 #include <QPair> 0012 0013 class QComboBox; 0014 0015 namespace MessageList 0016 { 0017 namespace Utils 0018 { 0019 /** 0020 * Namespace containing some helper functions for QComboBox widgets. 0021 */ 0022 namespace ComboBoxUtils 0023 { 0024 /** 0025 * Fills the specified QComboBox with the options available in optionDescriptors. 0026 * Each option descriptor contains a description string and a distinct integer (possibly enum) 0027 * identifier value. 0028 */ 0029 void fillIntegerOptionCombo(QComboBox *combo, const QList<QPair<QString, int>> &optionDescriptors); 0030 0031 /** 0032 * Returns the identifier of the currently selected option in the specified combo. 0033 * If the combo has no current selection or something goes wrong then the defaultValue 0034 * is returned instead. 0035 */ 0036 int getIntegerOptionComboValue(QComboBox *combo, int defaultValue); 0037 0038 /** 0039 * Sets the currently selected option in the specified combo. 0040 */ 0041 void setIntegerOptionComboValue(QComboBox *combo, int value); 0042 } // namespace ComboBoxUtils 0043 } // namespace Utils 0044 } // namespace MessageList