diff options
-rw-r--r-- | desktop-widgets/modeldelegates.cpp | 66 | ||||
-rw-r--r-- | desktop-widgets/modeldelegates.h | 18 |
2 files changed, 0 insertions, 84 deletions
diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index 1b1a31c0b..02b5838ec 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -388,40 +388,6 @@ AirTypesDelegate::AirTypesDelegate(QObject *parent) : ComboBoxDelegate(GasSelect { } -ProfilePrintDelegate::ProfilePrintDelegate(QObject *parent) : QStyledItemDelegate(parent) -{ -} - -static void paintRect(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) -{ - const QRect rect(option.rect); - const int row = index.row(); - const int col = index.column(); - - painter->save(); - // grid color - painter->setPen(QPen(QColor(0xff999999))); - // horizontal lines - if (row == 2 || row == 4 || row == 6) - painter->drawLine(rect.topLeft(), rect.topRight()); - if (row == 7) - painter->drawLine(rect.bottomLeft(), rect.bottomRight()); - // vertical lines - if (row > 1) { - painter->drawLine(rect.topLeft(), rect.bottomLeft()); - if (col == 4 || (col == 0 && row > 5)) - painter->drawLine(rect.topRight(), rect.bottomRight()); - } - painter->restore(); -} - -/* this method overrides the default table drawing method and places grid lines only at certain rows and columns */ -void ProfilePrintDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - paintRect(painter, option, index); - QStyledItemDelegate::paint(painter, option, index); -} - SpinBoxDelegate::SpinBoxDelegate(int min, int max, int step, QObject *parent): QStyledItemDelegate(parent), min(min), @@ -454,38 +420,6 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption return w; } -HTMLDelegate::HTMLDelegate(QObject *parent) : ProfilePrintDelegate(parent) -{ -} - -void HTMLDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const -{ - paintRect(painter, option, index); - QStyleOptionViewItemV4 options = option; - initStyleOption(&options, index); - painter->save(); - QTextDocument doc; - doc.setHtml(options.text); - doc.setTextWidth(options.rect.width()); - doc.setDefaultFont(options.font); - options.text.clear(); - options.widget->style()->drawControl(QStyle::CE_ItemViewItem, &options, painter); - painter->translate(options.rect.left(), options.rect.top()); - QRect clip(0, 0, options.rect.width(), options.rect.height()); - doc.drawContents(painter, clip); - painter->restore(); -} - -QSize HTMLDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const -{ - QStyleOptionViewItemV4 options = option; - initStyleOption(&options, index); - QTextDocument doc; - doc.setHtml(options.text); - doc.setTextWidth(options.rect.width()); - return QSize(doc.idealWidth(), doc.size().height()); -} - LocationFilterDelegate::LocationFilterDelegate(QObject *parent) { } diff --git a/desktop-widgets/modeldelegates.h b/desktop-widgets/modeldelegates.h index 95701775a..34012aa2a 100644 --- a/desktop-widgets/modeldelegates.h +++ b/desktop-widgets/modeldelegates.h @@ -90,16 +90,6 @@ slots: void revertModelData(QWidget *widget, QAbstractItemDelegate::EndEditHint hint); }; -/* ProfilePrintDelagate: - * this delegate is used to modify the look of the table that is printed - * bellow profiles. - */ -class ProfilePrintDelegate : public QStyledItemDelegate { -public: - explicit ProfilePrintDelegate(QObject *parent = 0); - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; -}; - class SpinBoxDelegate : public QStyledItemDelegate { Q_OBJECT public: @@ -122,14 +112,6 @@ private: double step; }; -class HTMLDelegate : public ProfilePrintDelegate { - Q_OBJECT -public: - explicit HTMLDelegate(QObject *parent = 0); - virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; -}; - class LocationFilterDelegate : public QStyledItemDelegate { Q_OBJECT public: |