|
Last change
on this file since 10442 was 10398, checked in by tbretz, 15 years ago |
|
Fixed a warning due to an unused argument.
|
|
File size:
513 bytes
|
| Line | |
|---|
| 1 | #include "HtmlDelegate.h"
|
|---|
| 2 |
|
|---|
| 3 | #include <QtGui/QPainter>
|
|---|
| 4 | #include <QtGui/QTextDocument>
|
|---|
| 5 |
|
|---|
| 6 | void HtmlDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
|---|
| 7 | {
|
|---|
| 8 | QTextDocument doc;
|
|---|
| 9 | doc.setHtml(index.data().toString());
|
|---|
| 10 | doc.drawContents(painter, option.rect);
|
|---|
| 11 | }
|
|---|
| 12 |
|
|---|
| 13 | QSize HtmlDelegate::sizeHint(const QStyleOptionViewItem &/*option*/, const QModelIndex &index) const
|
|---|
| 14 | {
|
|---|
| 15 | QTextDocument doc;
|
|---|
| 16 | doc.setHtml(index.data().toString());
|
|---|
| 17 | return doc.size().toSize();
|
|---|
| 18 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.