From f0bd39c55103969c3e30df88f51846f70cd6d56f Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Mon, 9 Nov 2015 20:42:12 +0200 Subject: modeldelegates: remove printing related delegates Remove HTMLDelegate and ProfilePrintDelagate as these are obosolete. The print related rendering at the moment happens via QWebView. Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- desktop-widgets/modeldelegates.cpp | 66 -------------------------------------- 1 file changed, 66 deletions(-) (limited to 'desktop-widgets/modeldelegates.cpp') 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) { } -- cgit v1.2.3-70-g09d2