#ifndef BITSTRING_H #define BITSTRING_H #include #include #include #include #include #include #include #include "Field.h" class BitString : public Field { Q_OBJECT public: BitString(QWidget *parent, int db_id, int PropId, QString label = QString(), QGridLayout *layout = NULL, int row = 0, int col = 0); BitString(QWidget *parent, int db_id, int PropId, int value, QString label = QString(), QGridLayout *layout = NULL, int row = 0, int col = 0); void SetValue(QVariant value); protected: int calculateLength() { return (bs < 256 ? 1 : (bs < 65536 ? 2 : 3)); } int height; virtual void addChecks() = 0; void addCheck(QString text, int bit); private slots: void flipBit(int bit); private: QGroupBox *box; std::map checks; QSignalMapper *sigmap; QGridLayout *checkLayout; unsigned int bs; // Since there are only 23 bits to support, we can use a uint as a bitstring int checkCount; }; #endif