diff --git a/modules/gui/src/CMakeLists.txt b/modules/gui/src/CMakeLists.txt index 4bba75bb2ad46deb25a55db2670d07f760f6873f..b8443780cb107591dabc42a9673dd059a39bedd7 100644 --- a/modules/gui/src/CMakeLists.txt +++ b/modules/gui/src/CMakeLists.txt @@ -22,7 +22,7 @@ sequence_search_bar.hh set(OST_GUI_SEQUENCE_VIEW_HEADERS painter.hh -row.hh +base_row.hh seq_secstr_painter.hh seq_selection_painter.hh seq_text_painter.hh @@ -206,7 +206,7 @@ sequence_viewer/sequence_viewer_base.cc sequence_viewer/sequence_viewer.cc sequence_viewer/sequence_scene.cc sequence_viewer/sequence_search_bar.cc -sequence/row.cc +sequence/base_row.cc sequence/seq_secstr_painter.cc sequence/seq_selection_painter.cc sequence/seq_text_painter.cc @@ -332,7 +332,7 @@ sequence_viewer/sequence_viewer.hh sequence_viewer/sequence_scene.hh sequence_viewer/sequence_search_bar.hh sequence/painter.hh -sequence/row.hh +sequence/base_row.hh sequence/seq_secstr_painter.hh sequence/seq_selection_painter.hh sequence/seq_text_painter.hh diff --git a/modules/gui/src/sequence/row.cc b/modules/gui/src/sequence/base_row.cc similarity index 67% rename from modules/gui/src/sequence/row.cc rename to modules/gui/src/sequence/base_row.cc index a109fe98c9c5f8466177c7024635d2b93ab436a2..823b4f86ba239ab11b9606c3b8497b38bd93ad72 100644 --- a/modules/gui/src/sequence/row.cc +++ b/modules/gui/src/sequence/base_row.cc @@ -24,42 +24,42 @@ #include <QtGui> -#include "row.hh" +#include "base_row.hh" namespace ost { namespace gui { -Row::Row(QObject *parent) : QObject(parent) +BaseRow::BaseRow(QObject *parent) : QObject(parent) { } -void Row::InsertPainter(Painter* painter, int pos) +void BaseRow::InsertPainter(Painter* painter, int pos) { if(pos == -1 || pos == painter_.size()){ painter_.append(painter); } - else if(this->IsPosValid(pos)){ + else if(this->IsPainterPosValid(pos)){ painter_.insert(pos, painter); } } -void Row::RemovePainter(Painter* painter) +void BaseRow::RemovePainter(Painter* painter) { painter_.removeAll(painter); } -Painter* Row::GetPainter(int pos) +Painter* BaseRow::GetPainter(int pos) { - if(this->IsPosValid(pos)){ + if(this->IsPainterPosValid(pos)){ return painter_[pos]; } return NULL; } -int Row::GetPainterCount() +int BaseRow::GetPainterCount() { return painter_.size(); } -bool Row::IsPosValid(int pos) +bool BaseRow::IsPainterPosValid(int pos) { if(pos >= 0 && pos < painter_.size()){ return true; @@ -67,9 +67,27 @@ bool Row::IsPosValid(int pos) return false; } -const PainterList& Row::GetPainters() const +const PainterList& BaseRow::GetPainters() const { return painter_; } +QVariant BaseRow::GetData(int column, int role) const +{ + return QVariant(); +} + +bool BaseRow::SetData(int column, const QVariant& value, int role) +{ + return false; +} + +Qt::ItemFlags BaseRow::Flags(int column) const +{ + return Qt::NoItemFlags; +} + +void BaseRow::DoubleClicked(int column) +{ } + }} diff --git a/modules/gui/src/sequence/row.hh b/modules/gui/src/sequence/base_row.hh similarity index 81% rename from modules/gui/src/sequence/row.hh rename to modules/gui/src/sequence/base_row.hh index 794a48db9818855a307a88bd09c017b4e6c1b600..9ed545fe00820dc5a84aa084198bd844bc34191b 100644 --- a/modules/gui/src/sequence/row.hh +++ b/modules/gui/src/sequence/base_row.hh @@ -31,12 +31,12 @@ namespace ost { namespace gui { -class Row : public QObject +class BaseRow : public QObject { Q_OBJECT public: - Row(QObject *parent = 0); + BaseRow(QObject *parent = 0); void InsertPainter(Painter* painter, int pos = -1); void RemovePainter(Painter* painter); @@ -46,12 +46,17 @@ public: const PainterList& GetPainters() const; + virtual QVariant GetData(int column, int role) const; + virtual bool SetData(int column, const QVariant& value, int role); + virtual Qt::ItemFlags Flags(int column) const; + virtual void DoubleClicked(int column); + private: - bool IsPosValid(int pos); + bool IsPainterPosValid(int pos); PainterList painter_; }; -typedef QList<Row*> RowList; +typedef QList<BaseRow*> BaseRowList; }} diff --git a/modules/gui/src/sequence/view_object.cc b/modules/gui/src/sequence/view_object.cc index ecbfc43f6d9815874ffd1f9fb89321c34f51ad17..dba4df1dcb14ba9dba871a4c0d58c46ba079eab9 100644 --- a/modules/gui/src/sequence/view_object.cc +++ b/modules/gui/src/sequence/view_object.cc @@ -81,7 +81,7 @@ void ViewObject::Init() default_cell_size_ = QSize(metrics.boundingRect('W').width()+2,metrics.boundingRect('|').height()*2); } -void ViewObject::InsertRow(int pos, Row* row) +void ViewObject::InsertRow(int pos, BaseRow* row) { if(pos >= 0 && pos <= rows_.size()){ ListEntry entry(row); @@ -89,7 +89,7 @@ void ViewObject::InsertRow(int pos, Row* row) } } -void ViewObject::RemoveRow(Row* row) +void ViewObject::RemoveRow(BaseRow* row) { QList<int> rows_to_delete; for (int i = 0; i < rows_.size(); ++i){ @@ -102,7 +102,7 @@ void ViewObject::RemoveRow(Row* row) } } -Row* ViewObject::GetRow(int pos) +BaseRow* ViewObject::GetRow(int pos) { if(pos >= 0 && pos < rows_.size()){ return rows_[pos].row; @@ -117,7 +117,7 @@ int ViewObject::GetRowCount() void ViewObject::AddSequence(seq::SequenceHandle& sequence, const QString& name) { - Row* new_row = new Row(this); + BaseRow* new_row = new BaseRow(this); Painter* p = new SeqSelectionPainter(this); new_row->InsertPainter(p); p = new SeqTextPainter(this); @@ -141,7 +141,7 @@ void ViewObject::AddChain(mol::ChainView& chain, const QString& name) v_one_chain.AddChain(chain, mol::ViewAddFlag::INCLUDE_ALL); sequence.AttachView(v_one_chain); - Row* new_row = new Row(this); + BaseRow* new_row = new BaseRow(this); Painter* p = new SeqSelectionPainter(this); new_row->InsertPainter(p); p = new SeqSecStrPainter(this); diff --git a/modules/gui/src/sequence/view_object.hh b/modules/gui/src/sequence/view_object.hh index d1e959fe750c13829c992ef9008fa3dd2b64f3cb..640f261bacd4c0aacc97134f886f513c201a9d47 100644 --- a/modules/gui/src/sequence/view_object.hh +++ b/modules/gui/src/sequence/view_object.hh @@ -37,27 +37,27 @@ #include <ost/seq/sequence_list.hh> -#include "row.hh" +#include "base_row.hh" namespace ost { namespace gui { struct ListEntry { - Row* row; + BaseRow* row; QString name; seq::SequenceHandle seq; mol::ChainView chain; QVarLengthArray<mol::SecStructure> secstr; ListEntry(): row(NULL) {} - ListEntry(Row* r): row(r) + ListEntry(BaseRow* r): row(r) {} - ListEntry(Row* r, const QString& n): row(r), name(n) + ListEntry(BaseRow* r, const QString& n): row(r), name(n) {} - ListEntry(Row* r, const QString& n, + ListEntry(BaseRow* r, const QString& n, seq::SequenceHandle& sequence): row(r), name(n), seq(sequence) {} - ListEntry(Row* r, const QString& n, + ListEntry(BaseRow* r, const QString& n, const seq::SequenceHandle& sequence, const mol::ChainView& c, const QVarLengthArray<mol::SecStructure>& sec): row(r), name(n), seq(sequence), chain(c), secstr(sec) {} @@ -75,10 +75,10 @@ public: ViewObject(mol::ChainView& chain, const QString& name, QObject* parent = 0); ViewObject(gfx::EntityP& entity, QObject* parent = 0); - void InsertRow(int pos, Row* row); - void RemoveRow(Row* row); + void InsertRow(int pos, BaseRow* row); + void RemoveRow(BaseRow* row); - Row* GetRow(int pos); + BaseRow* GetRow(int pos); int GetRowCount(); int GetMaxColumnCount() const;