/* * Copyright 2009 Ben Boeckel * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program. If not, see . */ #ifndef SIGTOOLS_BASEMODEL #define SIGTOOLS_BASEMODEL // Sigtools includes #include "Global.h" // Qt includes #include #include #include // Forward declarations class QPainter; class QStyleOptionViewItem; namespace Sigtools { class SIGTOOLS_NO_EXPORT BaseModel : public QObject { Q_OBJECT public: BaseModel(BaseModel* parent); virtual ~BaseModel(); BaseModel* parent(); virtual int rowCount() const = 0; virtual Qt::ItemFlags flags() const = 0; void paint(QPainter* painter, const QStyleOptionViewItem& option) const; QSize sizeHint(const QStyleOptionViewItem& option) const; virtual BaseModel* childItem(const int row) = 0; int indexNumber() const; protected: virtual int findChild(BaseModel* model) const = 0; virtual void redraw(const int width) const = 0; static const int borderWidth; static const int vertSpacing; static const int horizSpacing; BaseModel* m_parent; mutable QPixmap m_pixmap; }; } #endif