Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ASCIISIGNALRULESWIDGET_H
00029 #define ASCIISIGNALRULESWIDGET_H
00030
00031 #include <QtGui>
00032
00033 #include <GeopsyCore.h>
00034
00035 #include "ui_AsciiSignalRulesWidget.h"
00036
00037 namespace GeopsyGui {
00038
00039 class AsciiSignalRulesWidget : public QWidget, private Ui::AsciiSignalRulesWidget
00040 {
00041 Q_OBJECT
00042 public:
00043 AsciiSignalRulesWidget(QWidget * parent=0, Qt::WindowFlags f=0);
00044 ~AsciiSignalRulesWidget();
00045
00046 void setFormat(AsciiSignalFormat * f);
00047 void setHeader(const QString& h);
00048 private slots:
00049 void on_addButton_clicked();
00050 void on_removeButton_clicked();
00051 void on_downButton_clicked();
00052 void on_upButton_clicked();
00053 };
00054
00055 class AsciiSignalRulesItem : public QAbstractTableModel
00056 {
00057 public:
00058 AsciiSignalRulesItem(QObject * parent) : QAbstractTableModel(parent) {_format=0;}
00059
00060 void setFormat(AsciiSignalFormat * f);
00061 void setHeader(const QString& h);
00062
00063 virtual int rowCount(const QModelIndex &) const {return _format ? _format->ruleCount() : 0;}
00064 virtual int columnCount(const QModelIndex &) const {return 9;}
00065 virtual QVariant data(const QModelIndex & index, int role=Qt::DisplayRole) const;
00066 virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const;
00067 virtual bool setData (const QModelIndex & index, const QVariant & value, int role=Qt::EditRole);
00068 virtual bool insertRows(int row, int count, const QModelIndex & parent=QModelIndex());
00069 virtual bool removeRows(int row, int count, const QModelIndex & parent=QModelIndex());
00070 virtual Qt::ItemFlags flags (const QModelIndex & index) const;
00071 private:
00072 void updateValue(const QModelIndex & index);
00073
00074 AsciiSignalFormat * _format;
00075 QString _header;
00076 };
00077
00078 class AsciiSignalRulesDelegate : public QItemDelegate
00079 {
00080 Q_OBJECT
00081 public:
00082 AsciiSignalRulesDelegate(QObject *parent=0);
00083
00084 QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
00085 const QModelIndex &index) const;
00086 void setEditorData(QWidget *editor, const QModelIndex &index) const;
00087 void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
00088 private slots:
00089 void commitWidget(QWidget * w=0);
00090 private:
00091 QStringList _tableFieldList;
00092 };
00093
00094 }
00095
00096 #endif // ASCIISIGNALRULESWIDGET_H