mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add the HTML Delegate to printing.
This patch just adds the HTML Delegate to print the text. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
30499fdb30
commit
7a70f15f9b
3 changed files with 7 additions and 1 deletions
|
@ -403,6 +403,10 @@ 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
|
void HTMLDelegate::paint(QPainter* painter, const QStyleOptionViewItem & option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QStyleOptionViewItemV4 options = option;
|
QStyleOptionViewItemV4 options = option;
|
||||||
|
|
|
@ -113,6 +113,7 @@ private:
|
||||||
class HTMLDelegate : public ProfilePrintDelegate {
|
class HTMLDelegate : public ProfilePrintDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
explicit HTMLDelegate(QObject *parent = 0);
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -261,7 +261,6 @@ QTableView *PrintLayout::createProfileTable(ProfilePrintModel *model, const int
|
||||||
// notes
|
// notes
|
||||||
table->setSpan(6, 0, 1, 5);
|
table->setSpan(6, 0, 1, 5);
|
||||||
table->setSpan(7, 0, 5, 5);
|
table->setSpan(7, 0, 5, 5);
|
||||||
|
|
||||||
/* resize row heights to the 'profilePrintRowHeights' indexes.
|
/* resize row heights to the 'profilePrintRowHeights' indexes.
|
||||||
* profilePrintTableMaxH will then hold the table height. */
|
* profilePrintTableMaxH will then hold the table height. */
|
||||||
int i;
|
int i;
|
||||||
|
@ -284,6 +283,8 @@ QTableView *PrintLayout::createProfileTable(ProfilePrintModel *model, const int
|
||||||
table->resize(tableW, profilePrintTableMaxH);
|
table->resize(tableW, profilePrintTableMaxH);
|
||||||
// hide the grid and set a stylesheet
|
// hide the grid and set a stylesheet
|
||||||
table->setItemDelegate(new ProfilePrintDelegate(table));
|
table->setItemDelegate(new ProfilePrintDelegate(table));
|
||||||
|
table->setItemDelegateForRow(7, new HTMLDelegate(table));
|
||||||
|
|
||||||
table->setShowGrid(false);
|
table->setShowGrid(false);
|
||||||
table->setStyleSheet(
|
table->setStyleSheet(
|
||||||
"QTableView { border: none }"
|
"QTableView { border: none }"
|
||||||
|
|
Loading…
Add table
Reference in a new issue