Changeset 10475


Ignore:
Timestamp:
Apr 28, 2011, 11:06:24 AM (9 years ago)
Author:
tbretz
Message:
Changed the QTextDocument to be of a fixed size so that no horizontal scroll bars are needed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/gui/HtmlDelegate.cc

    r10398 r10475  
    77{
    88    QTextDocument doc;
     9    doc.setPageSize(option.rect.size());
    910    doc.setHtml(index.data().toString());
     11
     12    // === This can be used if a scrolling is needed ===
     13    // painter->save();
     14    // painter->translate(option.rect.topLeft());
     15    // QRect r(QPoint(0, 0), option.rect.size());
     16    // doc.drawContents(painter, r);
     17    // painter->restore();
     18    // drawFocus(painter, option, option.rect);
     19
    1020    doc.drawContents(painter, option.rect);
    1121}
    1222
    13 QSize HtmlDelegate::sizeHint(const QStyleOptionViewItem &/*option*/, const QModelIndex &index) const
     23QSize HtmlDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
    1424{
    1525    QTextDocument doc;
     26    doc.setPageSize(option.rect.size());
    1627    doc.setHtml(index.data().toString());
    1728    return doc.size().toSize();
Note: See TracChangeset for help on using the changeset viewer.