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
Score 50.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
product-maker Count: 4 Rating: 5.0
File (click to download) MD5SUM Version Description Downloads Date Filesize DL OCS-Install
*Needs ocs-url or ocs-store to install things
Pling
Details
license
version
0.1
updated Jul 05 2014
added Jul 05 2014
downloads 24h
0
page views 24h 1
System Tags