00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_SEQUENCE_VIEWER_SEQUENCE_TABLE_VIEW
00020 #define OST_SEQUENCE_VIEWER_SEQUENCE_TABLE_VIEW
00021
00022
00023
00024
00025
00026
00027 #include <ost/gui/module_config.hh>
00028
00029 #include "sequence_delegate.hh"
00030
00031 #include <QTableView>
00032 #include <QWheelEvent>
00033 namespace ost { namespace gui {
00034
00036 class DLLEXPORT_OST_GUI SequenceTableView : public QTableView {
00037 Q_OBJECT
00038 public:
00039 SequenceTableView(QAbstractItemModel * model);
00040 QTableView* GetStaticRow();
00041 QTableView* GetStaticColumn();
00042 QTableView* GetStaticField();
00043 ~SequenceTableView();
00044
00045
00046 void SetSingleAlignment(bool flag) { single_alignment_=flag; }
00047
00048 bool IsSingleAlignment() const { return single_alignment_; }
00049 signals:
00050 void MouseWheelEvent(QWheelEvent* event);
00051 void CopyEvent(QKeyEvent* event);
00052 void AlignmentChanged();
00053 public slots:
00054 void columnCountChanged(const QModelIndex& index, int old_count, int new_count);
00055 void rowCountChanged(const QModelIndex& index, int old_count, int new_count);
00056 void resizeColumnsToContents();
00057 void resizeRowsToContents();
00058
00059 protected:
00060 virtual void mouseDoubleClickEvent(QMouseEvent* event);
00061 virtual void mouseReleaseEvent(QMouseEvent* event);
00062 virtual void resizeEvent(QResizeEvent* event);
00063 virtual void wheelEvent(QWheelEvent* event);
00064 virtual void keyPressEvent(QKeyEvent* event);
00065 virtual QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
00066 void scrollTo (const QModelIndex & index, ScrollHint hint = EnsureVisible);
00067 virtual int sizeHintForColumn(int column) const;
00068 virtual int sizeHintForRow(int row) const;
00069
00070 private slots:
00071 void InitStaticColumn();
00072 void InitStaticRow();
00073 void InitStaticField();
00074 void ResizeWidth(int index, int, int size);
00075 void ResizeHeight(int index, int, int size);
00076
00077 private:
00078 std::pair<int, int> GetSimpleSelection(int row);
00079 QTableView* static_column_;
00080 QTableView* static_row_;
00081 QTableView* static_field_;
00082 SequenceDelegate* delegate_;
00083 QModelIndex last_double_click_;
00084 bool single_alignment_;
00085 void updateStaticColumn();
00086 void updateStaticRow();
00087 void updateStaticField();
00088 };
00089
00090 }}
00091
00092 #endif