EnumComboBox

Qt Widgets

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

0
5.0
Description:

Overview:
Let's say you have an enumeration like this

class ExampleClass : public QObject
{
Q_OBJECT
public:
enum Type { Apple, Pear, Banana, Pineapple }
}

The following source code will generated a combobox with items, {"Apple", "Pear", "Banana", Pineapple"}

QComboBox *c = NEMO_NEW_ENUM_QCOMBOBOX(ExampleClass, Type, /*parent=*/NULL);

Explanation:
The widget is actually a macro that generates a new class derived from QComboBox.
The macro uses the QMetaEnum and MetaObject system to add items to this combobox that are corresponding to the enum. Using this widget is actually a little bit more refined that in the overview above: Since the MetaObject system is used, only enums declared in QObjects will work (See example included in the source code, main.h and main.cpp).
Be the first to comment
12345678910
Be the first to comment
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
0.1
updated Jul 05 2014
added Jul 05 2014
downloads 24h
0
mediaviews 24h 0
pageviews 24h 0
System Tags