File indexing completed on 2025-03-09 04:09:46

0001 /** ===========================================================
0002  * @file
0003  *
0004  * This file is a part of digiKam project
0005  * <a href="https://www.digikam.org">https://www.digikam.org</a>
0006  *
0007  * @date   2008-08-16
0008  * @brief  a combo box widget re-implemented with a
0009  *         reset button to switch to a default item
0010  *
0011  * @author Copyright (C) 2008-2015 by Gilles Caulier
0012  *         <a href="mailto:caulier dot gilles at gmail dot com">caulier dot gilles at gmail dot com</a>
0013  *
0014  * This program is free software; you can redistribute it
0015  * and/or modify it under the terms of the GNU General
0016  * Public License as published by the Free Software Foundation;
0017  * either version 2, or (at your option)
0018  * any later version.
0019  *
0020  * This program is distributed in the hope that it will be useful,
0021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0023  * GNU General Public License for more details.
0024  *
0025  * ============================================================ */
0026 
0027 #ifndef RCOMBOBOX_H
0028 #define RCOMBOBOX_H
0029 
0030 // Qt includes
0031 
0032 #include <QWidget>
0033 #include <QComboBox>
0034 
0035 // Local includes
0036 
0037 
0038 
0039 namespace KDcrawIface
0040 {
0041 
0042 class  RComboBox : public QWidget
0043 {
0044 
0045     Q_OBJECT
0046 
0047 public:
0048 
0049     RComboBox(QWidget* const parent=0);
0050     ~RComboBox() override;
0051 
0052     void setCurrentIndex(int d);
0053     int  currentIndex() const;
0054 
0055     void setDefaultIndex(int d);
0056     int  defaultIndex() const;
0057 
0058     QComboBox* combo() const;
0059 
0060     void addItem(const QString& t, int index = -1);
0061     void insertItem(int index, const QString& t);
0062 
0063 Q_SIGNALS:
0064 
0065     void reset();
0066     void activated(int);
0067     void currentIndexChanged(int);
0068 
0069 public Q_SLOTS:
0070 
0071     void slotReset();
0072 
0073 private Q_SLOTS:
0074 
0075     void slotItemActivated(int);
0076     void slotCurrentIndexChanged(int);
0077 
0078 private:
0079 
0080     class Private;
0081     Private* const d;
0082 };
0083 
0084 }  // namespace KDcrawIface
0085 
0086 #endif /* RCOMBOBOX_H */