Changeset 561 for trunk/src/gui/styles/qstyleoption.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/styles/qstyleoption.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 ** … … 46 46 # include "qmacstyle_mac.h" 47 47 #endif 48 #ifndef QT_NO_DEBUG49 48 #include <qdebug.h> 50 # endif49 #include <QtCore/qmath.h> 51 50 52 51 QT_BEGIN_NAMESPACE … … 657 656 \enum QStyleOptionFrameV2::FrameFeature 658 657 659 This enum describ les the different types of features a frame can have.658 This enum describes the different types of features a frame can have. 660 659 661 660 \value None Indicates a normal frame. … … 712 711 */ 713 712 QStyleOptionFrameV3::QStyleOptionFrameV3() 714 : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame) 713 : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame), unused(0) 715 714 { 716 715 } … … 726 725 */ 727 726 QStyleOptionFrameV3::QStyleOptionFrameV3(int version) 728 : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame) 727 : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame), unused(0) 729 728 { 730 729 } … … 899 898 \enum QStyleOptionViewItemV2::ViewItemFeature 900 899 901 This enum describ les the different types of features an item can have.900 This enum describes the different types of features an item can have. 902 901 903 902 \value None Indicates a normal item. … … 954 953 */ 955 954 QStyleOptionViewItemV3::QStyleOptionViewItemV3() 956 : QStyleOptionViewItemV2(Version) 955 : QStyleOptionViewItemV2(Version), widget(0) 957 956 { 958 957 } … … 962 961 */ 963 962 QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItem &other) 964 : QStyleOptionViewItemV2(Version) 963 : QStyleOptionViewItemV2(Version), widget(0) 965 964 { 966 965 (void)QStyleOptionViewItemV3::operator=(other); … … 991 990 */ 992 991 QStyleOptionViewItemV3::QStyleOptionViewItemV3(int version) 993 : QStyleOptionViewItemV2(version) 992 : QStyleOptionViewItemV2(version), widget(0) 994 993 { 995 994 } … … 1254 1253 1255 1254 The frame is flat by default. 1256 1255 1257 1256 \sa QStyleOptionFrameV2::FrameFeature 1258 1257 */ … … 2828 2827 /*! 2829 2828 \variable QStyleOptionComplex::subControls 2830 \brief a bitwise OR of the various sub-controls that need to be 2831 drawn for the complex control 2829 2830 This variable holds a bitwise OR of the \l{QStyle::SubControl} 2831 {sub-controls} to be drawn for the complex control. 2832 2832 2833 2833 The default value is QStyle::SC_All. … … 2838 2838 /*! 2839 2839 \variable QStyleOptionComplex::activeSubControls 2840 \brief a bitwise OR of the various sub-controls that are active 2841 (pressed) for the complex control 2840 2841 This variable holds a bitwise OR of the \l{QStyle::SubControl} 2842 {sub-controls} that are active for the complex control. 2842 2843 2843 2844 The default value is QStyle::SC_None. … … 3542 3543 3543 3544 QStyleOptionDockWidget::QStyleOptionDockWidget() 3544 : QStyleOption(Version, SO_DockWidget), movable(false) 3545 : QStyleOption(Version, SO_DockWidget), closable(false), 3546 movable(false), floatable(false) 3545 3547 { 3546 3548 } … … 4257 4259 4258 4260 QStyleOptionTitleBar contains all the information that QStyle 4259 functions need to draw the title bars of QWorkspace's MDI 4260 children. 4261 functions need to draw the title bar of a QMdiSubWindow. 4261 4262 4262 4263 For performance reasons, the access to the member variables is … … 4268 4269 the \l {widgets/styles}{Styles} example. 4269 4270 4270 \sa QStyleOption, QStyleOptionComplex, Q Workspace4271 \sa QStyleOption, QStyleOptionComplex, QMdiSubWindow 4271 4272 */ 4272 4273 … … 4656 4657 The default value is QSize(-1, -1), i.e. an invalid size. 4657 4658 */ 4659 4660 4661 /*! 4662 4663 \class QStyleOptionTabWidgetFrameV2 4664 \brief The QStyleOptionTabWidgetFrameV2 class is used to describe the 4665 parameters for drawing the frame around a tab widget. 4666 4667 QStyleOptionTabWidgetFrameV2 contains all the information that 4668 QStyle functions need to draw the frame around QTabWidget. 4669 4670 For performance reasons, the access to the member variables is 4671 direct (i.e., using the \c . or \c -> operator). This low-level feel 4672 makes the structures straightforward to use and emphasizes that 4673 these are simply parameters used by the style functions. 4674 4675 For an example demonstrating how style options can be used, see 4676 the \l {widgets/styles}{Styles} example. 4677 4678 \sa QStyleOption, QTabWidget 4679 */ 4680 4681 4682 /*! 4683 \variable QStyleOptionTabWidgetFrameV2::tabBarRect 4684 \brief the rectangle containing all the tabs 4685 4686 The default value is a null rectangle, i.e. a rectangle with both 4687 the width and the height set to 0. 4688 */ 4689 4690 /*! 4691 \variable QStyleOptionTabWidgetFrameV2::selectedTabRect 4692 \brief the rectangle containing the selected tab 4693 4694 This rectangle is contained within the tabBarRect. The default 4695 value is a null rectangle, i.e. a rectangle with both the width 4696 and the height set to 0. 4697 */ 4698 4699 4700 /*! 4701 Constructs a QStyleOptionTabWidgetFrameV2, initializing the members 4702 variables to their default values. 4703 */ 4704 4705 QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2() 4706 : QStyleOptionTabWidgetFrame(Version) 4707 { 4708 } 4709 4710 4711 /*! \internal */ 4712 QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(int version) 4713 : QStyleOptionTabWidgetFrame(version) 4714 { 4715 } 4716 4717 4718 /*! \fn QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other) 4719 Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option. 4720 4721 If the \a other style option's version is 1, the new style option's \l 4722 selectedTabRect and tabBarRect will contain null rects 4723 4724 \sa version 4725 */ 4726 4727 /*! 4728 Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option. 4729 4730 If the \a other style option's version is 1, the new style option's \l 4731 selectedTabRect and tabBarRect will contain null rects 4732 4733 \sa version 4734 */ 4735 QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other) 4736 { 4737 QStyleOptionTabWidgetFrameV2::operator=(other); 4738 4739 } 4740 4741 4742 /*! 4743 Assigns the \a other style option to this style option. The \a 4744 other style option can be either of the QStyleOptionFrameV2 or 4745 QStyleOptionFrame types. 4746 4747 If the \a{other} style option's version is 1, this style option's 4748 QStyleOptionFrameV2::FrameFeature value is set to 4749 QStyleOptionFrameV2::None. If its version is 2, its 4750 \l{QStyleOptionFrameV2::}{FrameFeature} value is simply copied to 4751 this style option. 4752 */ 4753 QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QStyleOptionTabWidgetFrame &other) 4754 { 4755 QStyleOptionTabWidgetFrame::operator=(other); 4756 if (const QStyleOptionTabWidgetFrameV2 *f2 = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2 *>(&other)) { 4757 selectedTabRect = f2->selectedTabRect; 4758 tabBarRect = f2->tabBarRect; 4759 } 4760 return *this; 4761 } 4762 4763 4764 /*! 4765 \enum QStyleOptionTabWidgetFrameV2::StyleOptionVersion 4766 4767 This enum is used to hold information about the version of the style option, and 4768 is defined for each QStyleOption subclass. 4769 4770 \value Version 2 4771 4772 The version is used by QStyleOption subclasses to implement 4773 extensions without breaking compatibility. If you use 4774 qstyleoption_cast(), you normally do not need to check it. 4775 4776 \sa StyleOptionType 4777 */ 4778 4779 4658 4780 #endif // QT_NO_TABWIDGET 4659 4781 … … 4845 4967 /*! \internal */ 4846 4968 QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(int version) 4847 : QStyleOptionTabBarBase(version) 4969 : QStyleOptionTabBarBase(version), documentMode(false) 4848 4970 { 4849 4971 } … … 4937 5059 the parameters needed to draw a QGraphicsItem. 4938 5060 \since 4.2 4939 \ingroup multimedia5061 \ingroup graphicsview-api 4940 5062 4941 5063 For performance reasons, the access to the member variables is … … 4982 5104 4983 5105 /*! 4984 Constructs a QStyleOptionGraphicsItem. The levelOfDetail parameter is 4985 initialized to 1. 5106 Constructs a QStyleOptionGraphicsItem. 4986 5107 */ 4987 5108 QStyleOptionGraphicsItem::QStyleOptionGraphicsItem() … … 4996 5117 : QStyleOption(version, Type), levelOfDetail(1) 4997 5118 { 5119 } 5120 5121 /*! 5122 \since 4.6 5123 5124 Returns the level of detail from the \a worldTransform. 5125 5126 Its value represents the maximum value of the height and 5127 width of a unity rectangle, mapped using the \a worldTransform 5128 of the painter used to draw the item. By default, if no 5129 transformations are applied, its value is 1. If zoomed out 1:2, the level 5130 of detail will be 0.5, and if zoomed in 2:1, its value is 2. 5131 */ 5132 qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &worldTransform) 5133 { 5134 if (worldTransform.type() <= QTransform::TxTranslate) 5135 return 1; // Translation only? The LOD is 1. 5136 5137 // Two unit vectors. 5138 QLineF v1(0, 0, 1, 0); 5139 QLineF v2(0, 0, 0, 1); 5140 // LOD is the transformed area of a 1x1 rectangle. 5141 return qSqrt(worldTransform.map(v1).length() * worldTransform.map(v2).length()); 4998 5142 } 4999 5143 … … 5011 5155 item are exposed. If the whole item is exposed, this rectangle will be the 5012 5156 same as QGraphicsItem::boundingRect(). 5157 5158 This member is only initialized for items that have the 5159 QGraphicsItem::ItemUsesExtendedStyleOption flag set. 5013 5160 */ 5014 5161 … … 5016 5163 \variable QStyleOptionGraphicsItem::matrix 5017 5164 \brief the complete transformation matrix for the item 5018 5019 This matrix is the sum of the item's scene matrix and the matrix of the 5020 painter used for drawing the item. It is provided for convenience, 5165 \obsolete 5166 5167 The QMatrix provided through this member does include information about 5168 any perspective transformations applied to the view or item. To get the 5169 correct transformation matrix, use QPainter::transform() on the painter 5170 passed into the QGraphicsItem::paint() implementation. 5171 5172 This matrix is the combination of the item's scene matrix and the matrix 5173 of the painter used for drawing the item. It is provided for convenience, 5021 5174 allowing anvanced level-of-detail metrics that can be used to speed up 5022 5175 item drawing. 5023 5176 5024 To find the dimen tions of an item in screen coordinates (i.e., pixels),5177 To find the dimensions of an item in screen coordinates (i.e., pixels), 5025 5178 you can use the mapping functions of QMatrix, such as QMatrix::map(). 5026 5179 5027 \sa QStyleOptionGraphicsItem::levelOfDetail 5180 This member is only initialized for items that have the 5181 QGraphicsItem::ItemUsesExtendedStyleOption flag set. 5182 5183 \sa QStyleOptionGraphicsItem::levelOfDetailFromTransform() 5028 5184 */ 5029 5185 5030 5186 /*! 5031 5187 \variable QStyleOptionGraphicsItem::levelOfDetail 5032 \brief a simple metric for determining an item's level of detail 5033 5034 This simple metric provides an easy way to determine the level of detail 5035 for an item. Its value represents the maximum value of the height and 5036 width of a unity rectangle, mapped using the complete transformation 5037 matrix of the painter used to draw the item. By default, if no 5038 transformations are applied, its value is 1. If zoomed out 1:2, the level 5039 of detail will be 0.5, and if zoomed in 2:1, its value is 2. 5040 5041 For more advanced level-of-detail metrics, use 5042 QStyleOptionGraphicsItem::matrix directly. 5043 5044 \sa QStyleOptionGraphicsItem::matrix 5188 \obsolete 5189 5190 Use QStyleOptionGraphicsItem::levelOfDetailFromTransform() 5191 together with QPainter::worldTransform() instead. 5045 5192 */ 5046 5193 … … 5273 5420 */ 5274 5421 5422 QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType) 5423 { 5275 5424 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM) 5276 QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)5277 {5278 5425 switch (optionType) { 5279 5426 case QStyleOption::SO_Default: … … 5336 5483 debug << "SO_GraphicsItem"; break; 5337 5484 } 5485 #endif 5338 5486 return debug; 5339 5487 } … … 5341 5489 QDebug operator<<(QDebug debug, const QStyleOption &option) 5342 5490 { 5491 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM) 5343 5492 debug << "QStyleOption("; 5344 5493 debug << QStyleOption::OptionType(option.type); 5345 debug << "," << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight"); 5346 debug << "," << option.state; 5347 debug << "," << option.rect; 5348 debug << ")"; 5494 debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight"); 5495 debug << ',' << option.state; 5496 debug << ',' << option.rect; 5497 debug << ')'; 5498 #endif 5349 5499 return debug; 5350 5500 } 5351 #endif5352 5501 5353 5502 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.