Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1:kernel-2.6.32
kdepim4
r903452.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File r903452.diff of Package kdepim4
Subject: korganizer: todo rich text speedup From: wstephenson@suse.de Bug: Patch-upstream: 903452 --- korganizer/views/todoview/kotododelegates.cpp (revision 903451) +++ korganizer/views/todoview/kotododelegates.cpp (revision 903452) @@ -399,6 +399,7 @@ void KOTodoCategoriesDelegate::setCalend KOTodoRichTextDelegate::KOTodoRichTextDelegate( QObject *parent ) : QStyledItemDelegate( parent ) { + m_textDoc = new QTextDocument( this ); } KOTodoRichTextDelegate::~KOTodoRichTextDelegate() @@ -442,16 +443,15 @@ void KOTodoRichTextDelegate::paint( QPai painter->drawRect( textRect.adjusted( 0, 0, -1, -1 ) ); } - QTextDocument tmp; - tmp.setHtml( index.data().toString() ); + m_textDoc->setHtml( index.data().toString() ); painter->save(); painter->translate( textRect.topLeft() ); QRect tmpRect = textRect; tmpRect.moveTo( 0, 0 ); - tmp.setTextWidth( tmpRect.width() ); - tmp.drawContents( painter, tmpRect ); + m_textDoc->setTextWidth( tmpRect.width() ); + m_textDoc->drawContents( painter, tmpRect ); painter->restore(); } else { @@ -464,9 +464,8 @@ QSize KOTodoRichTextDelegate::sizeHint( { QSize ret = QStyledItemDelegate::sizeHint( option, index ); if ( index.data( KOTodoModel::IsRichTextRole ).toBool() ) { - QTextDocument tmp; - tmp.setHtml( index.data().toString() ); - ret = ret.expandedTo( tmp.size().toSize() ); + m_textDoc->setHtml( index.data().toString() ); + ret = ret.expandedTo( m_textDoc->size().toSize() ); } // limit height to max. 2 lines // TODO add graphical hint when truncating! make configurable height? --- korganizer/views/todoview/kotododelegates.h (revision 903451) +++ korganizer/views/todoview/kotododelegates.h (revision 903452) @@ -38,6 +38,7 @@ class QStyleOptionViewItem; class QStyleOptionProgressBar; class QSize; class QEvent; +class QTextDocument; /** This delegate is responsible for displaying progress bars for the completion @@ -181,6 +182,8 @@ class KOTodoRichTextDelegate : public QS const QModelIndex &index ) const; QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const; + private: + QTextDocument *m_textDoc; }; #endif Index: korganizer/views/todoview/kotododelegates.cpp =================================================================== Index: korganizer/views/todoview/kotododelegates.h ===================================================================
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor