[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    qt-copy/src/widgets
From:       Simon Hausmann <hausmann () kde ! org>
Date:       2004-02-06 12:48:36
Message-ID: 20040206124836.DB40C991F () office ! kde ! org
[Download RAW message or body]

CVS commit by hausmann: 

- don't call text().length() twice, in QTextEdit::createPopupMenu. It's
  terribly inefficient to do that when the content is large and gets
  converted to html. Instead now length() gets called instead, and only
  once. Patch will be in next release.

CCMAIL: 72830-done@bugs.kde.org


  M +3 -6      qtextedit.cpp   1.44


--- qt-copy/src/widgets/qtextedit.cpp  #1.43:1.44
@@ -5479,10 +5479,7 @@ QPopupMenu *QTextEdit::createPopupMenu( 
     popup->setItemEnabled( d->id[ IdPaste ], !isReadOnly() && \
!QApplication::clipboard()->text( d->clipboard_mode ).isEmpty() );  #endif
-    popup->setItemEnabled( d->id[ IdClear ], !isReadOnly() && !text().isEmpty() );
-#ifdef QT_TEXTEDIT_OPTIMIZATION
-    popup->setItemEnabled( d->id[ IdSelectAll ], d->optimMode ? d->od->len : \
                (bool)text().length() );
-#else
-    popup->setItemEnabled( d->id[ IdSelectAll ], (bool)text().length() );
-#endif
+    const bool isEmptyDocument = (length() == 0);
+    popup->setItemEnabled( d->id[ IdClear ], !isReadOnly() && !isEmptyDocument );
+    popup->setItemEnabled( d->id[ IdSelectAll ], !isEmptyDocument );
     return popup;
 #else


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic