From fc937a3cd2211727d39416ce6b37fd3df48f088e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Wed, 26 Aug 2015 12:24:04 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/libs@31 a8b55f48-bf90-11e4-a774-851b48703e85 --- qad_blockview/blockitem.cpp | 16 +++ qad_blockview/blockitem.h | 1 + qad_graphic/graphic.cpp | 19 ++++ qad_graphic/graphic.h | 18 ++++ qad_utils/qpiconfig.h | 200 +++++++++++++++++------------------- qglview/gltypes.h | 2 +- 6 files changed, 148 insertions(+), 108 deletions(-) diff --git a/qad_blockview/blockitem.cpp b/qad_blockview/blockitem.cpp index 2055ab6..97d88ca 100644 --- a/qad_blockview/blockitem.cpp +++ b/qad_blockview/blockitem.cpp @@ -176,6 +176,22 @@ void BlockItem::addDecor(QGraphicsItem * item) { } +void BlockItem::addDecor(QGraphicsItem & item) { + if (decors_.contains(&item)) return; + if (qgraphicsitem_cast(&item)) + qgraphicsitem_cast(&item)->setTransformationMode(Qt::SmoothTransformation); + if (qgraphicsitem_cast(&item)) + qgraphicsitem_cast(&item)->setData(1010, qgraphicsitem_cast(&item)->text()); + if (qgraphicsitem_cast(&item)) + qgraphicsitem_cast(&item)->setData(1010, qgraphicsitem_cast(&item)->text()); + item.setData(1002, true); + item.setData(1011, "decor"); + item.setData(1011, "decor"); + //decors_ << &item; + item.setParentItem(this); +} + + void BlockItem::removeDecor(QGraphicsItem * item) { if (scene() && item) scene()->sendEvent(item, new QGraphicsSceneEvent(QEvent::Close)); diff --git a/qad_blockview/blockitem.h b/qad_blockview/blockitem.h index 69e2a48..aaf2fbc 100644 --- a/qad_blockview/blockitem.h +++ b/qad_blockview/blockitem.h @@ -123,6 +123,7 @@ public: BlockItemPin * addPin(Qt::Alignment align, int bus_type, const QString & text, bool update_ = true); void removePin(BlockItemPin * pin); void addDecor(QGraphicsItem * item); + void addDecor(QGraphicsItem & item); void removeDecor(QGraphicsItem * item); QVector takePins(); void clearPins(); diff --git a/qad_graphic/graphic.cpp b/qad_graphic/graphic.cpp index 2fb5348..7bb4152 100644 --- a/qad_graphic/graphic.cpp +++ b/qad_graphic/graphic.cpp @@ -3,6 +3,8 @@ #include "ui_graphic_conf.h" +__GraphicRegistrator__ __graphic_registrator__; + ELineEdit::ELineEdit(QWidget * parent): CLineEdit(parent) { last_ret = complexd_0; @@ -487,6 +489,23 @@ void Graphic::setOnlyExpandX(bool yes) { } +Graphic::GraphicsData Graphic::graphicsData() const { + GraphicsData ret; + ret.resize(graphics.size()); + for (int i = 0; i < graphics.size(); ++i) + ret[i] = graphics[i].polyline; + return ret; +} + + +void Graphic::setGraphicsData(const Graphic::GraphicsData & gd) { + setGraphicsCount(gd.size()); + for (int i = 0; i < gd.size(); ++i) + setGraphicData(gd[i], i, false); + updateGraphics(); +} + + void Graphic::setButtons(Graphic::Buttons b) { buttons_ = b; ui->buttonAutofit->setVisible(b.testFlag(Autofit)); diff --git a/qad_graphic/graphic.h b/qad_graphic/graphic.h index 9757295..24a5f78 100644 --- a/qad_graphic/graphic.h +++ b/qad_graphic/graphic.h @@ -115,11 +115,14 @@ class Graphic: public QFrame Q_PROPERTY(int histogramMinIntervals READ histogramMinIntervals WRITE setHistogramMinIntervals) Q_PROPERTY(int histogramMaxIntervals READ histogramMaxIntervals WRITE setHistogramMaxIntervals) Q_PROPERTY(double histogramMinDeltaMultiplier READ histogramMinDeltaMultiplier WRITE setHistogramMinDeltaMultiplier) + + Q_PROPERTY(Graphic::GraphicsData graphicsData READ graphicsData WRITE setGraphicsData) public: Graphic(QWidget * parent = 0); ~Graphic(); + typedef QVector > GraphicsData; enum GraphicAction {gaNone, gaZoomInRect, gaZoomRangeX, gaZoomRangeY, gaMove}; enum Button {NoButtons = 0x0, AllButtons = 0xFFFFFFFF, @@ -195,6 +198,7 @@ public: Graduation graduationY() const {return grad_y;} double graduationStepX() const {return gridx;} double graduationStepY() const {return gridy;} + GraphicsData graphicsData() const; QWidget * viewport() const {return canvas;} QByteArray save(); void load(QByteArray ba); @@ -264,6 +268,7 @@ public slots: void setHistogramMinIntervals(int value) {min_int = value; updateGraphics();} void setHistogramMaxIntervals(int value) {max_int = value; updateGraphics();} void setHistogramMinDeltaMultiplier(double value) {mdm = value; updateGraphics();} + void setGraphicsData(const GraphicsData & gd); void setGridNumbersMultiplierX(double value) {grid_numbers_x = value; updateGraphics();} void setGridNumbersMultiplierY(double value) {grid_numbers_y = value; updateGraphics();} @@ -409,8 +414,21 @@ signals: }; +Q_DECLARE_METATYPE(Graphic::GraphicsData) + Q_DECLARE_OPERATORS_FOR_FLAGS(Graphic::Buttons) +//inline QDataStream & operator <<(QDataStream & s, const Graphic::GraphicsData & v) {s << v; return s;} +//inline QDataStream & operator >>(QDataStream & s, Graphic::GraphicsData & v) {s >> v; return s;} + +class __GraphicRegistrator__ { +public: + __GraphicRegistrator__() { + qRegisterMetaType("Graphic::GraphicsData"); + qRegisterMetaTypeStreamOperators("Graphic::GraphicsData"); + } +}; + QT_END_NAMESPACE QT_END_HEADER diff --git a/qad_utils/qpiconfig.h b/qad_utils/qpiconfig.h index 4d3ee23..618c5b9 100644 --- a/qad_utils/qpiconfig.h +++ b/qad_utils/qpiconfig.h @@ -13,21 +13,9 @@ #include - - - - inline QByteArray QString2QByteArray(const QString & string) {return qUncompress(QByteArray::fromBase64(string.toLatin1()));} int QString2int(const QString & string); -inline QColor QString2QColor(const QString & string) { - QColor col; - if (string.left(1) == "#") - col = QColor(string.right(string.length() - 1).toInt(0, 16)); - else - col = QColor(QString2int(string)); - return col; - -} +inline QColor QString2QColor(const QString & string) {return (string.left(1) == "#" ? QColor(string.right(string.length() - 1).toInt(0, 16)) : QColor(QString2int(string)));} QRect QString2QRect(const QString & string); QRectF QString2QRectF(const QString & string); QPoint QString2QPoint(const QString & string); @@ -41,25 +29,25 @@ QString QRect2QString(const QRect & rect); QString QRectF2QString(const QRectF & rect); #define QPICONFIG_GET_VALUE \ - inline Entry & getValue(const QString & vname, const char * def, bool * exist = 0) {return getValue(vname, QString(def), exist);} \ - inline Entry & getValue(const QString & vname, const QStringList & def, bool * exist = 0) {return getValue(vname, def.join("%|%"), exist);} \ - inline Entry & getValue(const QString & vname, const bool def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ - inline Entry & getValue(const QString & vname, const short def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ - inline Entry & getValue(const QString & vname, const int def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ - inline Entry & getValue(const QString & vname, const long def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ - inline Entry & getValue(const QString & vname, const uchar def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ - inline Entry & getValue(const QString & vname, const ushort def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ - inline Entry & getValue(const QString & vname, const uint def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ - inline Entry & getValue(const QString & vname, const ulong def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ - inline Entry & getValue(const QString & vname, const float def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ - inline Entry & getValue(const QString & vname, const double def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ - inline Entry & getValue(const QString & vname, const QColor & def, bool * exist = 0) {return getValue(vname, QColor2QString(def), exist);} \ - inline Entry & getValue(const QString & vname, const Qt::GlobalColor def, bool * exist = 0) {return getValue(vname, QColor(def), exist);} \ - inline Entry & getValue(const QString & vname, const QRect & def, bool * exist = 0) {return getValue(vname, QRect2QString(def), exist);} \ - inline Entry & getValue(const QString & vname, const QRectF & def, bool * exist = 0) {return getValue(vname, QRectF2QString(def), exist);} \ - inline Entry & getValue(const QString & vname, const QPoint & def, bool * exist = 0) {return getValue(vname, QPoint2QString(def), exist);} \ - inline Entry & getValue(const QString & vname, const QPointF & def, bool * exist = 0) {return getValue(vname, QPointF2QString(def), exist);} \ - inline Entry & getValue(const QString & vname, const QByteArray & def, bool * exist = 0) {return getValue(vname, QByteArray2QString(def), exist);} + Entry & getValue(const QString & vname, const char * def, bool * exist = 0) {return getValue(vname, QString(def), exist);} \ + Entry & getValue(const QString & vname, const QStringList & def, bool * exist = 0) {return getValue(vname, def.join("%|%"), exist);} \ + Entry & getValue(const QString & vname, const bool def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ + Entry & getValue(const QString & vname, const short def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ + Entry & getValue(const QString & vname, const int def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ + Entry & getValue(const QString & vname, const long def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ + Entry & getValue(const QString & vname, const uchar def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ + Entry & getValue(const QString & vname, const ushort def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ + Entry & getValue(const QString & vname, const uint def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ + Entry & getValue(const QString & vname, const ulong def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ + Entry & getValue(const QString & vname, const float def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ + Entry & getValue(const QString & vname, const double def, bool * exist = 0) {return getValue(vname, QString::number(def), exist);} \ + Entry & getValue(const QString & vname, const QColor & def, bool * exist = 0) {return getValue(vname, QColor2QString(def), exist);} \ + Entry & getValue(const QString & vname, const Qt::GlobalColor def, bool * exist = 0) {return getValue(vname, QColor(def), exist);} \ + Entry & getValue(const QString & vname, const QRect & def, bool * exist = 0) {return getValue(vname, QRect2QString(def), exist);} \ + Entry & getValue(const QString & vname, const QRectF & def, bool * exist = 0) {return getValue(vname, QRectF2QString(def), exist);} \ + Entry & getValue(const QString & vname, const QPoint & def, bool * exist = 0) {return getValue(vname, QPoint2QString(def), exist);} \ + Entry & getValue(const QString & vname, const QPointF & def, bool * exist = 0) {return getValue(vname, QPointF2QString(def), exist);} \ + Entry & getValue(const QString & vname, const QByteArray & def, bool * exist = 0) {return getValue(vname, QByteArray2QString(def), exist);} class QPIConfig: public QFile { @@ -84,7 +72,7 @@ public: friend class QPIConfig; friend class Entry; public: - inline Branch() {;} + Branch() {;} Entry & getValue(const QString & vname, const QString & def = QString(), bool * exist = 0); QPICONFIG_GET_VALUE @@ -94,15 +82,14 @@ public: Branch getLeaves(); Branch getBranches(); Branch & filter(const QString & f); - inline bool isEntryExists(const QString & name) const {foreach (const Entry * i, *this) if (entryExists(i, name)) return true; return false;} - inline int indexOf(const Entry * e) {for (int i = 0; i < size(); ++i) if (at(i) == e) return i; return -1;} + bool isEntryExists(const QString & name) const {foreach (const Entry * i, *this) if (entryExists(i, name)) return true; return false;} + int indexOf(const Entry * e) {for (int i = 0; i < size(); ++i) if (at(i) == e) return i; return -1;} - //inline void clear() {foreach (Entry * i, *this) delete i; QVector::clear();} + //void clear() {foreach (Entry * i, *this) delete i; QVector::clear();} private: bool entryExists(const Entry * e, const QString & name) const; - inline void allLeaves(Branch & b, Entry * e) {foreach (Entry * i, e->_children) {if (i->isLeaf()) b << i; else allLeaves(b, i);}} - //inline void coutt(std::ostream & s, const QString & p) const {foreach (const Entry * i, *this) i->coutt(s, p);} + void allLeaves(Branch & b, Entry * e) {foreach (Entry * i, e->_children) {if (i->isLeaf()) b << i; else allLeaves(b, i);}} static Entry _empty; QString delim; @@ -115,52 +102,52 @@ public: friend class QPIConfigWidget; friend class ConfigValueWidget; public: - inline Entry() {_parent = 0;} + Entry() {_parent = 0;} - inline Entry * parent() const {return _parent;} - inline int childCount() {return _children.size();} - inline Branch & children() {_children.delim = delim; return _children;} - inline Entry * child(const int index) const {return _children[index];} - inline const Entry * findChild(const QString & name) const {foreach (const Entry * i, _children) if (i->_name == name) return i; return 0;} - inline Entry * findChild(const QString & name) {foreach (Entry * i, _children) if (i->_name == name) return i; return 0;} - inline bool isLeaf() const {return _children.empty();} + Entry * parent() const {return _parent;} + int childCount() {return _children.size();} + Branch & children() {_children.delim = delim; return _children;} + Entry * child(const int index) const {return _children[index];} + const Entry * findChild(const QString & name) const {foreach (const Entry * i, _children) if (i->_name == name) return i; return 0;} + Entry * findChild(const QString & name) {foreach (Entry * i, _children) if (i->_name == name) return i; return 0;} + bool isLeaf() const {return _children.empty();} - inline const QString & name() const {return _name;} - inline const QString & value() const {return _value;} - inline const QString & type() const {return _type;} - inline const QString & comment() const {return _comment;} + const QString & name() const {return _name;} + const QString & value() const {return _value;} + const QString & type() const {return _type;} + const QString & comment() const {return _comment;} - inline Entry & setName(const QString & value) {_name = value; return *this;} - inline Entry & setType(const QString & value) {_type = value; return *this;} - inline Entry & setComment(const QString & value) {_comment = value; return *this;} - inline Entry & setValue(const QString & value) {_value = value; return *this;} - inline Entry & setValue(const QStringList & value) {setValue(value.join("%|%")); setType("l"); return *this;} - inline Entry & setValue(const char * value) {setValue(QString(value)); setType("s"); return *this;} - inline Entry & setValue(const bool value) {setValue(QString::number(value)); setType("b"); return *this;} - inline Entry & setValue(const short value) {setValue(QString::number(value)); setType("n"); return *this;} - inline Entry & setValue(const int value) {setValue(QString::number(value)); setType("n"); return *this;} - inline Entry & setValue(const long value) {setValue(QString::number(value)); setType("n"); return *this;} - inline Entry & setValue(const uchar value) {setValue(QString::number(value)); setType("n"); return *this;} - inline Entry & setValue(const ushort value) {setValue(QString::number(value)); setType("n"); return *this;} - inline Entry & setValue(const uint value) {setValue(QString::number(value)); setType("n"); return *this;} - inline Entry & setValue(const ulong value) {setValue(QString::number(value)); setType("n"); return *this;} - inline Entry & setValue(const float value) {setValue(QString::number(value)); setType("f"); return *this;} - inline Entry & setValue(const double value) {setValue(QString::number(value)); setType("f"); return *this;} - inline Entry & setValue(const QColor & value) {setValue(QColor2QString(value)); setType("c"); return *this;} - inline Entry & setValue(const Qt::GlobalColor & value) {setValue(QColor(value)); return *this;} - inline Entry & setValue(const QRect & value) {setValue(QRect2QString(value)); setType("r"); return *this;} - inline Entry & setValue(const QRectF & value) {setValue(QRectF2QString(value)); setType("a"); return *this;} - inline Entry & setValue(const QPoint & value) {setValue(QPoint2QString(value)); setType("p"); return *this;} - inline Entry & setValue(const QPointF & value) {setValue(QPointF2QString(value)); setType("v"); return *this;} - inline Entry & setValue(const QByteArray & value) {setValue(QByteArray2QString(value)); setType("s"); return *this;} + Entry & setName(const QString & value) {_name = value; return *this;} + Entry & setType(const QString & value) {_type = value; return *this;} + Entry & setComment(const QString & value) {_comment = value; return *this;} + Entry & setValue(const QString & value) {_value = value; return *this;} + Entry & setValue(const QStringList & value) {setValue(value.join("%|%")); setType("l"); return *this;} + Entry & setValue(const char * value) {setValue(QString(value)); setType("s"); return *this;} + Entry & setValue(const bool value) {setValue(QString::number(value)); setType("b"); return *this;} + Entry & setValue(const short value) {setValue(QString::number(value)); setType("n"); return *this;} + Entry & setValue(const int value) {setValue(QString::number(value)); setType("n"); return *this;} + Entry & setValue(const long value) {setValue(QString::number(value)); setType("n"); return *this;} + Entry & setValue(const uchar value) {setValue(QString::number(value)); setType("n"); return *this;} + Entry & setValue(const ushort value) {setValue(QString::number(value)); setType("n"); return *this;} + Entry & setValue(const uint value) {setValue(QString::number(value)); setType("n"); return *this;} + Entry & setValue(const ulong value) {setValue(QString::number(value)); setType("n"); return *this;} + Entry & setValue(const float value) {setValue(QString::number(value)); setType("f"); return *this;} + Entry & setValue(const double value) {setValue(QString::number(value)); setType("f"); return *this;} + Entry & setValue(const QColor & value) {setValue(QColor2QString(value)); setType("c"); return *this;} + Entry & setValue(const Qt::GlobalColor & value) {setValue(QColor(value)); return *this;} + Entry & setValue(const QRect & value) {setValue(QRect2QString(value)); setType("r"); return *this;} + Entry & setValue(const QRectF & value) {setValue(QRectF2QString(value)); setType("a"); return *this;} + Entry & setValue(const QPoint & value) {setValue(QPoint2QString(value)); setType("p"); return *this;} + Entry & setValue(const QPointF & value) {setValue(QPointF2QString(value)); setType("v"); return *this;} + Entry & setValue(const QByteArray & value) {setValue(QByteArray2QString(value)); setType("s"); return *this;} Entry & getValue(const QString & vname, const QString & def = QString(), bool * exist = 0); QPICONFIG_GET_VALUE Branch getValues(const QString & vname); - inline bool isEntryExists(const QString & name) const {return entryExists(this, name);} - inline const QString & stringValue() const {return _value;} + bool isEntryExists(const QString & name) const {return entryExists(this, name);} + const QString & stringValue() const {return _value;} operator bool() {return (_value.toLower().trimmed() == "true" || _value.toInt() > 0);} operator char() {return (_value.isEmpty() ? 0 : _value[0].toLatin1());} @@ -183,11 +170,10 @@ public: operator QByteArray() {return QString2QByteArray(_value);} private: - inline static bool compare(const QPIConfig::Entry * f, const QPIConfig::Entry * s) {return f->_line < s->_line;} + static bool compare(const QPIConfig::Entry * f, const QPIConfig::Entry * s) {return f->_line < s->_line;} bool entryExists(const Entry * e, const QString & name) const; - inline void buildLine() {_all = _tab + _full_name + " = " + _value + " #" + _type + " " + _comment;} - inline void clear() {_children.clear(); _name = _value = _type = _comment = _all = QString(); _line = 0; _parent = 0;} - //inline void coutt(std::ostream & s, const QString & p) const {QString nl = p + " "; if (!_value.isEmpty()) s << p << _name << " = " << _value << endl; else cout << p << _name << endl; piForeachCA (i, _children) i->coutt(s, nl);} + void buildLine() {_all = _tab + _full_name + " = " + _value + " #" + _type + " " + _comment;} + void clear() {_children.clear(); _name = _value = _type = _comment = _all = QString(); _line = 0; _parent = 0;} void deleteBranch() {foreach (Entry * i, _children) {i->deleteBranch(); delete i;}} static Entry _empty; @@ -210,38 +196,38 @@ public: Branch getValues(const QString & vname); void setValue(const QString & name, const QString & value, const QString & type = "s", bool write = true); - inline void setValue(const QString & name, const QStringList & value, bool write = true) {setValue(name, value.join("%|%"), "l", write);} - inline void setValue(const QString & name, const char * value, bool write = true) {setValue(name, QString(value), "s", write);} - inline void setValue(const QString & name, const bool value, bool write = true) {setValue(name, QString::number(value), "b", write);} - inline void setValue(const QString & name, const short value, bool write = true) {setValue(name, QString::number(value), "n", write);} - inline void setValue(const QString & name, const int value, bool write = true) {setValue(name, QString::number(value), "n", write);} - inline void setValue(const QString & name, const long value, bool write = true) {setValue(name, QString::number(value), "n", write);} - inline void setValue(const QString & name, const uchar value, bool write = true) {setValue(name, QString::number(value), "n", write);} - inline void setValue(const QString & name, const ushort value, bool write = true) {setValue(name, QString::number(value), "n", write);} - inline void setValue(const QString & name, const uint value, bool write = true) {setValue(name, QString::number(value), "n", write);} - inline void setValue(const QString & name, const ulong value, bool write = true) {setValue(name, QString::number(value), "n", write);} - inline void setValue(const QString & name, const float value, bool write = true) {setValue(name, QString::number(value), "f", write);} - inline void setValue(const QString & name, const double value, bool write = true) {setValue(name, QString::number(value), "f", write);} - inline void setValue(const QString & name, const QColor & value, bool write = true) {setValue(name, QColor2QString(value), "c", write);} - inline void setValue(const QString & name, const Qt::GlobalColor & value, bool write = true) {setValue(name, QColor(value), write);} - inline void setValue(const QString & name, const QRect & value, bool write = true) {setValue(name, QRect2QString(value), "r", write);} - inline void setValue(const QString & name, const QRectF & value, bool write = true) {setValue(name, QRectF2QString(value), "a", write);} - inline void setValue(const QString & name, const QPoint & value, bool write = true) {setValue(name, QPoint2QString(value), "p", write);} - inline void setValue(const QString & name, const QPointF & value, bool write = true) {setValue(name, QPointF2QString(value), "v", write);} - inline void setValue(const QString & name, const QByteArray & value, bool write = true) {setValue(name, QByteArray2QString(value), "s", write);} + void setValue(const QString & name, const QStringList & value, bool write = true) {setValue(name, value.join("%|%"), "l", write);} + void setValue(const QString & name, const char * value, bool write = true) {setValue(name, QString(value), "s", write);} + void setValue(const QString & name, const bool value, bool write = true) {setValue(name, QString::number(value), "b", write);} + void setValue(const QString & name, const short value, bool write = true) {setValue(name, QString::number(value), "n", write);} + void setValue(const QString & name, const int value, bool write = true) {setValue(name, QString::number(value), "n", write);} + void setValue(const QString & name, const long value, bool write = true) {setValue(name, QString::number(value), "n", write);} + void setValue(const QString & name, const uchar value, bool write = true) {setValue(name, QString::number(value), "n", write);} + void setValue(const QString & name, const ushort value, bool write = true) {setValue(name, QString::number(value), "n", write);} + void setValue(const QString & name, const uint value, bool write = true) {setValue(name, QString::number(value), "n", write);} + void setValue(const QString & name, const ulong value, bool write = true) {setValue(name, QString::number(value), "n", write);} + void setValue(const QString & name, const float value, bool write = true) {setValue(name, QString::number(value), "f", write);} + void setValue(const QString & name, const double value, bool write = true) {setValue(name, QString::number(value), "f", write);} + void setValue(const QString & name, const QColor & value, bool write = true) {setValue(name, QColor2QString(value), "c", write);} + void setValue(const QString & name, const Qt::GlobalColor & value, bool write = true) {setValue(name, QColor(value), write);} + void setValue(const QString & name, const QRect & value, bool write = true) {setValue(name, QRect2QString(value), "r", write);} + void setValue(const QString & name, const QRectF & value, bool write = true) {setValue(name, QRectF2QString(value), "a", write);} + void setValue(const QString & name, const QPoint & value, bool write = true) {setValue(name, QPoint2QString(value), "p", write);} + void setValue(const QString & name, const QPointF & value, bool write = true) {setValue(name, QPointF2QString(value), "v", write);} + void setValue(const QString & name, const QByteArray & value, bool write = true) {setValue(name, QByteArray2QString(value), "s", write);} - inline Entry & rootEntry() {return root;} - inline int entriesCount() const {return childCount(&root);} - inline bool isEntryExists(const QString & name) const {return entryExists(&root, name);} + Entry & rootEntry() {return root;} + int entriesCount() const {return childCount(&root);} + bool isEntryExists(const QString & name) const {return entryExists(&root, name);} - inline Branch allTree() {Branch b; foreach (Entry * i, root._children) b << i; return b;} - inline Branch allLeaves() {Branch b; allLeaves(b, &root); qSort(b.begin(), b.end(), Entry::compare); return b;} + Branch allTree() {Branch b; foreach (Entry * i, root._children) b << i; return b;} + Branch allLeaves() {Branch b; allLeaves(b, &root); qSort(b.begin(), b.end(), Entry::compare); return b;} int entryIndex(const QString & name); - inline QString getName(uint number) {return entryByIndex(number)._name;} - inline QString getValue(uint number) {return entryByIndex(number)._value;} - inline QChar getType(uint number) {return entryByIndex(number)._type[0];} - inline QString getComment(uint number) {return entryByIndex(number)._comment;} + QString getName(uint number) {return entryByIndex(number)._name;} + QString getValue(uint number) {return entryByIndex(number)._value;} + QChar getType(uint number) {return entryByIndex(number)._type[0];} + QString getComment(uint number) {return entryByIndex(number)._comment;} QPIConfig::Entry & addEntry(const QString & name, const QString & value, const QString & type = "s", bool write = true, bool node = false); void setName(uint number, const QString & name, bool write = true); diff --git a/qglview/gltypes.h b/qglview/gltypes.h index 11edf8b..7548a0b 100644 --- a/qglview/gltypes.h +++ b/qglview/gltypes.h @@ -58,7 +58,7 @@ #include #include #include -#include +//#include #include #include #include