Changeset 561 for trunk/src/gui/kernel/qtooltip.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/kernel/qtooltip.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 74 74 75 75 \ingroup helpsystem 76 \mainclass 76 77 77 78 78 The tip is a short piece of text reminding the user of the … … 127 127 bool eventFilter(QObject *, QEvent *); 128 128 129 QBasicTimer hideTimer; 129 QBasicTimer hideTimer, expireTimer; 130 130 131 bool fadingOut; 131 132 … … 134 135 void hideTipImmediately(); 135 136 void setTipRect(QWidget *w, const QRect &r); 136 void restart HideTimer();137 void restartExpireTimer(); 137 138 bool tipChanged(const QPoint &pos, const QString &text, QObject *o); 138 139 void placeTip(const QPoint &pos, QWidget *w); … … 183 184 setAlignment(Qt::AlignLeft); 184 185 setIndent(1); 185 setWordWrap(Qt::mightBeRichText(text));186 186 qApp->installEventFilter(this); 187 187 setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0); … … 191 191 } 192 192 193 void QTipLabel::restart HideTimer()193 void QTipLabel::restartExpireTimer() 194 194 { 195 195 int time = 10000 + 40 * qMax(0, text().length()-100); 196 hideTimer.start(time, this); 196 expireTimer.start(time, this); 197 hideTimer.stop(); 197 198 } 198 199 … … 200 201 { 201 202 #ifndef QT_NO_STYLE_STYLESHEET 202 if (styleSheetParent) 203 if (styleSheetParent){ 203 204 disconnect(styleSheetParent, SIGNAL(destroyed()), 204 205 QTipLabel::instance, SLOT(styleSheetParentDestroyed())); … … 207 208 #endif 208 209 210 setWordWrap(Qt::mightBeRichText(text)); 209 211 setText(text); 210 212 QFontMetrics fm(font()); … … 214 216 ++extra.rheight(); 215 217 resize(sizeHint() + extra); 216 restart HideTimer();218 restartExpireTimer(); 217 219 } 218 220 … … 258 260 void QTipLabel::hideTip() 259 261 { 260 hideTimer.start(300, this); 262 if (!hideTimer.isActive()) 263 hideTimer.start(300, this); 261 264 } 262 265 … … 279 282 void QTipLabel::timerEvent(QTimerEvent *e) 280 283 { 281 if (e->timerId() == hideTimer.timerId()){ 284 if (e->timerId() == hideTimer.timerId() 285 || e->timerId() == expireTimer.timerId()){ 282 286 hideTimer.stop(); 287 expireTimer.stop(); 283 288 #if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS) 284 289 if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){ … … 286 291 // The tip will not be deleted until a new tip is shown. 287 292 288 289 293 // DRSWAT - Cocoa 294 macWindowFade(qt_mac_window_for(this)); 290 295 QTipLabel::instance->fadingOut = true; // will never be false again. 291 296 } … … 427 432 void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect) 428 433 { 429 if (QTipLabel::instance ){ // a tip does already exist434 if (QTipLabel::instance && QTipLabel::instance->isVisible()){ // a tip does already exist 430 435 if (text.isEmpty()){ // empty text means hide current tip 431 436 QTipLabel::instance->hideTip();
Note:
See TracChangeset
for help on using the changeset viewer.