1 /* This file is part of KDevelop
2 Copyright 2007 Dukju Ahn <dukjuahn@gmail.com>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
19 #ifndef ENVIRONMENTSELECTIONWIDGET_H
20 #define ENVIRONMENTSELECTIONWIDGET_H
22 #include <kcombobox.h>
23 #include "utilexport.h"
29 * Simple compobox which allows each plugin to decide which environment
30 * variable group to use.
32 * Can be used just like a KComboBox in Configuration dialogs including usage
35 * Example code to populate the list:
37 * EnvironmentGroupList envlist( PluginSettings::self()->config() );
38 * ui->kcfg_environmentGroup->addItems( envlist.groups()) );
41 * The .kcfg file for that would include an entry like this:
43 * <entry name="environmentGroup" key="Make Environment Group" type="string">
44 * <default>default</default>
48 * Its important to list "default" as the default value, because thats currently
49 * the only way to avoid an empty entry in the combo box.
52 class KDEVPLATFORMUTIL_EXPORT EnvironmentSelectionWidget
: public KComboBox
55 Q_PROPERTY( QString currentProfile READ currentProfile WRITE setCurrentProfile USER
true )
58 explicit EnvironmentSelectionWidget( QWidget
*parent
= 0 );
59 ~EnvironmentSelectionWidget();
62 * Return the currently selected text as special property so this widget
63 * works with KConfigXT
64 * @returns the currently selected items text
66 QString
currentProfile() const;
69 * Setter for the KConfigXT property
70 * @param text the item text which should be set as current.
72 void setCurrentProfile( const QString
& text
);
75 class EnvironmentSelectionWidgetPrivate
* const d
;
76 friend class EnvironmentSelectionWidgetPrivate
;