PacMaster 2.0(r200)
Controls digital PAC measurements and collects the results

PacVariantManager.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008-2010 by Matthias Nagl                              *
00003  *   mnagl@uni-goettingen.de                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #ifndef PACVARIANTMANAGER_H
00022 #define PACVARIANTMANAGER_H
00023 
00024 #include <QtVariantPropertyManager>
00025 #include <QtProperty>
00026 #include <limits>
00027 
00035 class PacVariantManager : public QtVariantPropertyManager
00036 {
00037     Q_OBJECT
00038   public:
00039     PacVariantManager(QObject *parent = 0);
00040     ~PacVariantManager();
00041 
00042     virtual QVariant value(const QtProperty *property) const;
00043     virtual QVariant attributeValue ( const QtProperty * property, const QString & attribute ) const;
00044     virtual int attributeType ( int propertyType, const QString & attribute ) const;
00045     virtual QStringList attributes ( int propertyType ) const;
00046     int valueType ( const QtProperty * property ) const;
00047     int propertyType ( const QtProperty * property ) const;
00048     virtual QString valueText(const QtProperty *property) const;
00049 
00050   public slots:
00051     virtual void setValue(QtProperty *property, const QVariant &val);
00052     virtual void setAttribute (QtProperty * property, const QString & attribute, const QVariant & value);
00053 
00054   protected:
00055     virtual void initializeProperty(QtProperty *property);
00056     virtual void uninitializeProperty(QtProperty *property);
00057 
00058   private:
00059     struct AuxPropertyData
00060     {
00061       AuxPropertyData()
00062         : val(0.0),
00063           min(-std::numeric_limits<double>::max()), max(std::numeric_limits<double>::max()),
00064           step(1), decimals(2), exponentialview(false), voltageselector(false)
00065       {}
00066       double val;
00067       double min;
00068       double max;
00069       double step;
00070       int decimals;
00071       bool exponentialview;
00072       bool voltageselector;
00073     };
00074     struct Decoration
00075     {
00076       QString prefix;
00077       QString suffix;
00078     };
00079     QMap<const QtProperty *, AuxPropertyData> propertyToData;
00080     QMap<const QtProperty *, Decoration> propertyToDecoration;
00081 };
00082 
00083 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends Defines