Changeset 561 for trunk/src/gui/widgets/qtoolbutton.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/widgets/qtoolbutton.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 ** … … 105 105 bool QToolButtonPrivate::hasMenu() const 106 106 { 107 Q_Q(const QToolButton);108 107 return ((defaultAction && defaultAction->menu()) 109 108 || (menuAction && menuAction->menu()) 110 || q->actions().size() > (defaultAction ? 1 : 0));109 || actions.size() > (defaultAction ? 1 : 0)); 111 110 } 112 111 #endif … … 118 117 119 118 \ingroup basicwidgets 120 \mainclass 119 121 120 122 121 A tool button is a special button that provides quick-access to … … 279 278 defaultAction = 0; 280 279 #ifndef QT_NO_TOOLBAR 281 if (qobject_cast<QToolBar*>( q->parentWidget()))280 if (qobject_cast<QToolBar*>(parent)) 282 281 autoRaise = true; 283 282 else … … 380 379 option->features |= QStyleOptionToolButton::HasMenu; 381 380 #endif 382 option->toolButtonStyle = d->toolButtonStyle; 381 if (d->toolButtonStyle == Qt::ToolButtonFollowStyle) { 382 option->toolButtonStyle = Qt::ToolButtonStyle(style()->styleHint(QStyle::SH_ToolButtonStyle, option, this)); 383 } else 384 option->toolButtonStyle = d->toolButtonStyle; 385 386 if (option->toolButtonStyle == Qt::ToolButtonTextBesideIcon) { 387 // If the action is not prioritized, remove the text label to save space 388 if (d->defaultAction && d->defaultAction->priority() < QAction::NormalPriority) 389 option->toolButtonStyle = Qt::ToolButtonIconOnly; 390 } 391 383 392 if (d->icon.isNull() && d->arrowType == Qt::NoArrow && !forceNoText) { 384 393 if (!d->text.isEmpty()) … … 478 487 The default is Qt::ToolButtonIconOnly. 479 488 489 To have the style of toolbuttons follow the system settings (as available 490 in GNOME and KDE desktop environments), set this property to Qt::ToolButtonFollowStyle. 491 480 492 QToolButton automatically connects this slot to the relevant 481 493 signal in the QMainWindow in which is resides. … … 860 872 if (!hasMenu()) 861 873 return; // no menu to show 862 863 if (delay > 0 && popupMode == QToolButton::DelayedPopup) 874 if (popupMode == QToolButton::MenuButtonPopup) 875 return; 876 else if (delay > 0 && !popupTimer.isActive() && popupMode == QToolButton::DelayedPopup) 864 877 popupTimer.start(delay, q); 865 878 else if (delay == 0 || popupMode == QToolButton::InstantPopup) … … 884 897 actualMenu = new QMenu(q); 885 898 mustDeleteActualMenu = true; 886 QList<QAction*> actions = q->actions();887 899 for(int i = 0; i < actions.size(); i++) 888 900 actualMenu->addAction(actions.at(i)); … … 892 904 bool horizontal = true; 893 905 #if !defined(QT_NO_TOOLBAR) 894 QToolBar *tb = qobject_cast<QToolBar*>( q->parentWidget());906 QToolBar *tb = qobject_cast<QToolBar*>(parent); 895 907 if (tb && tb->orientation() == Qt::Vertical) 896 908 horizontal = false; 897 909 #endif 898 910 QPoint p; 899 QRect screen = qApp->desktop()->availableGeometry(q);911 QRect screen = QApplication::desktop()->availableGeometry(q); 900 912 QSize sh = ((QToolButton*)(QMenu*)actualMenu)->receivers(SIGNAL(aboutToShow()))? QSize() : actualMenu->sizeHint(); 901 913 QRect rect = q->rect();
Note:
See TracChangeset
for help on using the changeset viewer.