File indexing completed on 2024-04-28 04:49:51
0001 /* 0002 SPDX-FileCopyrightText: 1998-2008 Sebastian Trueg <trueg@k3b.org> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef _K3B_INT_MAP_COMBOBOX_H_ 0007 #define _K3B_INT_MAP_COMBOBOX_H_ 0008 0009 #include "k3b_export.h" 0010 0011 #include <QComboBox> 0012 0013 namespace K3b { 0014 /** 0015 * The IntMapComboBox allows a simple selection of integer 0016 * values. 0017 * 0018 * The IntMapComboBox will create a WhatsThis help automatically from 0019 * the description texts (if all are set). The ToolTip has to be set manually. 0020 */ 0021 class LIBK3B_EXPORT IntMapComboBox : public QComboBox 0022 { 0023 Q_OBJECT 0024 0025 public: 0026 explicit IntMapComboBox( QWidget* parent = 0 ); 0027 ~IntMapComboBox() override; 0028 0029 int selectedValue() const; 0030 0031 bool hasValue( int value ) const; 0032 0033 Q_SIGNALS: 0034 /** 0035 * Emitted if the selected value changes by user interaction. 0036 */ 0037 void valueChanged( int ); 0038 0039 /** 0040 * Emitted if the current highlighted value changed by user interaction. 0041 */ 0042 void valueHighlighted( int ); 0043 0044 public Q_SLOTS: 0045 /** 0046 * If \a v has not been added via insertItem the selection will not be changed 0047 */ 0048 void setSelectedValue( int v ); 0049 0050 void clear(); 0051 0052 /** 0053 * Insert a new item 0054 * \param value The integer value to insert 0055 * \param text The text to be displayed in the combobox 0056 * \param description The text to be used to describe the item in the whatsthis help 0057 * \param index The position where to inserts the item. The item will be appended if index is negative. 0058 * 0059 * \return true if the item could be inserted. False if the value had already been inserted. 0060 */ 0061 bool insertItem( int value, const QString& text, const QString& description = QString(), int index = -1 ); 0062 0063 void addGlobalWhatsThisText( const QString& top, const QString& bottom ); 0064 0065 private Q_SLOTS: 0066 void slotItemActivated( int ); 0067 void slotItemHighlighted( int ); 0068 0069 private: 0070 class Private; 0071 Private* d; 0072 }; 0073 } 0074 0075 #endif