src/gui/styles/qstyleoption.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    43 #include "qapplication.h"
    43 #include "qapplication.h"
    44 #ifdef Q_WS_MAC
    44 #ifdef Q_WS_MAC
    45 # include "private/qt_mac_p.h"
    45 # include "private/qt_mac_p.h"
    46 # include "qmacstyle_mac.h"
    46 # include "qmacstyle_mac.h"
    47 #endif
    47 #endif
    48 #ifndef QT_NO_DEBUG
       
    49 #include <qdebug.h>
    48 #include <qdebug.h>
    50 #endif
       
    51 #include <QtCore/qmath.h>
    49 #include <QtCore/qmath.h>
    52 
    50 
    53 QT_BEGIN_NAMESPACE
    51 QT_BEGIN_NAMESPACE
    54 
    52 
    55 /*!
    53 /*!
  1252 /*!
  1250 /*!
  1253     \variable QStyleOptionGroupBox::features
  1251     \variable QStyleOptionGroupBox::features
  1254     \brief the features of the group box frame
  1252     \brief the features of the group box frame
  1255 
  1253 
  1256     The frame is flat by default.
  1254     The frame is flat by default.
  1257     
  1255 
  1258     \sa QStyleOptionFrameV2::FrameFeature
  1256     \sa QStyleOptionFrameV2::FrameFeature
  1259 */
  1257 */
  1260 
  1258 
  1261 /*!
  1259 /*!
  1262     \variable QStyleOptionGroupBox::textColor
  1260     \variable QStyleOptionGroupBox::textColor
  4654 /*! \variable QStyleOptionTabWidgetFrame::leftCornerWidgetSize
  4652 /*! \variable QStyleOptionTabWidgetFrame::leftCornerWidgetSize
  4655     \brief the size of the left-corner widget
  4653     \brief the size of the left-corner widget
  4656 
  4654 
  4657     The default value is QSize(-1, -1), i.e. an invalid size.
  4655     The default value is QSize(-1, -1), i.e. an invalid size.
  4658 */
  4656 */
       
  4657 
       
  4658 
       
  4659 /*!
       
  4660 
       
  4661     \class QStyleOptionTabWidgetFrameV2
       
  4662     \brief The QStyleOptionTabWidgetFrameV2 class is used to describe the
       
  4663     parameters for drawing the frame around a tab widget.
       
  4664 
       
  4665     QStyleOptionTabWidgetFrameV2 contains all the information that
       
  4666     QStyle functions need to draw the frame around QTabWidget.
       
  4667 
       
  4668     For performance reasons, the access to the member variables is
       
  4669     direct (i.e., using the \c . or \c -> operator). This low-level feel
       
  4670     makes the structures straightforward to use and emphasizes that
       
  4671     these are simply parameters used by the style functions.
       
  4672 
       
  4673     For an example demonstrating how style options can be used, see
       
  4674     the \l {widgets/styles}{Styles} example.
       
  4675 
       
  4676     \sa QStyleOption, QTabWidget
       
  4677 */
       
  4678 
       
  4679 
       
  4680 /*!
       
  4681     \variable QStyleOptionTabWidgetFrameV2::tabBarRect
       
  4682     \brief the rectangle containing all the tabs
       
  4683 
       
  4684     The default value is a null rectangle, i.e. a rectangle with both
       
  4685     the width and the height set to 0.
       
  4686 */
       
  4687 
       
  4688 /*!
       
  4689     \variable QStyleOptionTabWidgetFrameV2::selectedTabRect
       
  4690     \brief the rectangle containing the selected tab
       
  4691 
       
  4692     This rectangle is contained within the tabBarRect. The default
       
  4693     value is a null rectangle, i.e. a rectangle with both the width
       
  4694     and the height set to 0.
       
  4695 */
       
  4696 
       
  4697 
       
  4698 /*!
       
  4699     Constructs a QStyleOptionTabWidgetFrameV2, initializing the members
       
  4700     variables to their default values.
       
  4701 */
       
  4702 
       
  4703 QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2()
       
  4704     : QStyleOptionTabWidgetFrame(Version)
       
  4705 {
       
  4706 }
       
  4707 
       
  4708 
       
  4709 /*! \internal */
       
  4710 QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(int version)
       
  4711     : QStyleOptionTabWidgetFrame(version)
       
  4712 {
       
  4713 }
       
  4714 
       
  4715 
       
  4716 /*! \fn QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other)
       
  4717     Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option.
       
  4718 
       
  4719     If the \a other style option's version is 1, the new style option's \l
       
  4720     selectedTabRect and tabBarRect will contain null rects
       
  4721 
       
  4722     \sa version
       
  4723 */
       
  4724 
       
  4725 /*!
       
  4726     Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option.
       
  4727 
       
  4728     If the \a other style option's version is 1, the new style option's \l
       
  4729     selectedTabRect and tabBarRect will contain null rects
       
  4730 
       
  4731     \sa version
       
  4732 */
       
  4733 QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other)
       
  4734 {
       
  4735     QStyleOptionTabWidgetFrameV2::operator=(other);
       
  4736 
       
  4737 }
       
  4738 
       
  4739 
       
  4740 /*!
       
  4741     Assigns the \a other style option to this style option. The \a
       
  4742     other style option can be either of the QStyleOptionFrameV2 or
       
  4743     QStyleOptionFrame types.
       
  4744 
       
  4745     If the \a{other} style option's version is 1, this style option's
       
  4746     QStyleOptionFrameV2::FrameFeature value is set to
       
  4747     QStyleOptionFrameV2::None. If its version is 2, its
       
  4748     \l{QStyleOptionFrameV2::}{FrameFeature} value is simply copied to
       
  4749     this style option.
       
  4750 */
       
  4751 QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QStyleOptionTabWidgetFrame &other)
       
  4752 {
       
  4753     QStyleOptionTabWidgetFrame::operator=(other);
       
  4754     if (const QStyleOptionTabWidgetFrameV2 *f2 = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2 *>(&other)) {
       
  4755         selectedTabRect = f2->selectedTabRect;
       
  4756         tabBarRect = f2->tabBarRect;
       
  4757     }
       
  4758     return *this;
       
  4759 }
       
  4760 
       
  4761 
       
  4762 /*!
       
  4763     \enum QStyleOptionTabWidgetFrameV2::StyleOptionVersion
       
  4764 
       
  4765     This enum is used to hold information about the version of the style option, and
       
  4766     is defined for each QStyleOption subclass.
       
  4767 
       
  4768     \value Version 2
       
  4769 
       
  4770     The version is used by QStyleOption subclasses to implement
       
  4771     extensions without breaking compatibility. If you use
       
  4772     qstyleoption_cast(), you normally do not need to check it.
       
  4773 
       
  4774     \sa StyleOptionType
       
  4775 */
       
  4776 
       
  4777 
  4659 #endif // QT_NO_TABWIDGET
  4778 #endif // QT_NO_TABWIDGET
  4660 
  4779 
  4661 #ifndef QT_NO_TABBAR
  4780 #ifndef QT_NO_TABBAR
  4662 
  4781 
  4663 /*!
  4782 /*!
  5296     \relates QStyleHintReturn
  5415     \relates QStyleHintReturn
  5297 
  5416 
  5298     Returns a T or 0 depending on the type of \a hint.
  5417     Returns a T or 0 depending on the type of \a hint.
  5299 */
  5418 */
  5300 
  5419 
       
  5420 QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
       
  5421 {
  5301 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
  5422 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
  5302 QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
       
  5303 {
       
  5304     switch (optionType) {
  5423     switch (optionType) {
  5305     case QStyleOption::SO_Default:
  5424     case QStyleOption::SO_Default:
  5306         debug << "SO_Default"; break;
  5425         debug << "SO_Default"; break;
  5307     case QStyleOption::SO_FocusRect:
  5426     case QStyleOption::SO_FocusRect:
  5308         debug << "SO_FocusRect"; break;
  5427         debug << "SO_FocusRect"; break;
  5359     case QStyleOption::SO_SizeGrip:
  5478     case QStyleOption::SO_SizeGrip:
  5360         debug << "SO_SizeGrip"; break;
  5479         debug << "SO_SizeGrip"; break;
  5361     case QStyleOption::SO_GraphicsItem:
  5480     case QStyleOption::SO_GraphicsItem:
  5362         debug << "SO_GraphicsItem"; break;
  5481         debug << "SO_GraphicsItem"; break;
  5363     }
  5482     }
       
  5483 #endif
  5364     return debug;
  5484     return debug;
  5365 }
  5485 }
  5366 
  5486 
  5367 QDebug operator<<(QDebug debug, const QStyleOption &option)
  5487 QDebug operator<<(QDebug debug, const QStyleOption &option)
  5368 {
  5488 {
       
  5489 #if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
  5369     debug << "QStyleOption(";
  5490     debug << "QStyleOption(";
  5370     debug << QStyleOption::OptionType(option.type);
  5491     debug << QStyleOption::OptionType(option.type);
  5371     debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
  5492     debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
  5372     debug << ',' << option.state;
  5493     debug << ',' << option.state;
  5373     debug << ',' << option.rect;
  5494     debug << ',' << option.rect;
  5374     debug << ')';
  5495     debug << ')';
       
  5496 #endif
  5375     return debug;
  5497     return debug;
  5376 }
  5498 }
  5377 #endif
       
  5378 
  5499 
  5379 QT_END_NAMESPACE
  5500 QT_END_NAMESPACE