git-svn-id: svn://db.shs.com.ru/libs@515 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "qad_types.h"
|
||||
#include <QApplication>
|
||||
#include <QFontMetrics>
|
||||
#include <QMetaEnum>
|
||||
#include <QWidget>
|
||||
#if QT_VERSION >= 0x050000
|
||||
# include <QWindow>
|
||||
@@ -57,6 +58,15 @@ __QADTypesRegistrator__::__QADTypesRegistrator__() {
|
||||
__QADTypesRegistrator__ __registrator__(1);
|
||||
|
||||
|
||||
QAD::Enum::Enum(const QMetaEnum & meta, int selected) {
|
||||
enum_name = meta.enumName();
|
||||
for (int i = 0; i < meta.keyCount(); ++i) {
|
||||
enum_list << QAD::Enumerator(meta.value(i), meta.key(i));
|
||||
}
|
||||
selectValue(selected);
|
||||
}
|
||||
|
||||
|
||||
int QAD::Enum::selectedValue() const {
|
||||
foreach (const Enumerator & e, enum_list)
|
||||
if (e.name == selected)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "propertystorage.h"
|
||||
|
||||
class QMetaEnum;
|
||||
|
||||
namespace QAD {
|
||||
|
||||
@@ -14,6 +15,7 @@ namespace QAD {
|
||||
|
||||
struct Enum {
|
||||
Enum(const QString & n = QString()): enum_name(n) {}
|
||||
Enum(const QMetaEnum & meta, int selected = 0);
|
||||
QString toString() const {return selected;} // obsolete, use selectedName()
|
||||
int selectedValue() const;
|
||||
QString selectedName() const {return selected;}
|
||||
|
||||
Reference in New Issue
Block a user