mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	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 <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									36314a86f8
								
							
						
					
					
						commit
						f0bd39c551
					
				
					 2 changed files with 0 additions and 84 deletions
				
			
		| 
						 | 
					@ -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):
 | 
					SpinBoxDelegate::SpinBoxDelegate(int min, int max, int step, QObject *parent):
 | 
				
			||||||
	QStyledItemDelegate(parent),
 | 
						QStyledItemDelegate(parent),
 | 
				
			||||||
	min(min),
 | 
						min(min),
 | 
				
			||||||
| 
						 | 
					@ -454,38 +420,6 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption
 | 
				
			||||||
	return w;
 | 
						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)
 | 
					LocationFilterDelegate::LocationFilterDelegate(QObject *parent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -90,16 +90,6 @@ slots:
 | 
				
			||||||
	void revertModelData(QWidget *widget, QAbstractItemDelegate::EndEditHint hint);
 | 
						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 {
 | 
					class SpinBoxDelegate : public QStyledItemDelegate {
 | 
				
			||||||
	Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
| 
						 | 
					@ -122,14 +112,6 @@ private:
 | 
				
			||||||
	double step;
 | 
						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 {
 | 
					class LocationFilterDelegate : public QStyledItemDelegate {
 | 
				
			||||||
	Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue