| 1 | // Copyright (C) 2020 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "qquickstyleoption.h" |
| 5 | |
| 6 | #include <QtGui/private/qguiapplication_p.h> |
| 7 | #include <QtCore/qdebug.h> |
| 8 | #include <QtCore/qmath.h> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | namespace QQC2 { |
| 13 | |
| 14 | QStyleOption::QStyleOption(int version, int type) |
| 15 | : version(version), type(type), state(QStyle::State_None), |
| 16 | direction(QGuiApplication::layoutDirection()), fontMetrics(QFont()), |
| 17 | styleObject(nullptr), control(nullptr), window(nullptr) |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | /*! |
| 22 | Destroys this style option object. |
| 23 | */ |
| 24 | QStyleOption::~QStyleOption() |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | /*! |
| 29 | Constructs a copy of \a other. |
| 30 | */ |
| 31 | QStyleOption::QStyleOption(const QStyleOption &other) |
| 32 | : version(Version), type(Type), state(other.state), |
| 33 | direction(other.direction), rect(other.rect), fontMetrics(other.fontMetrics), |
| 34 | palette(other.palette), styleObject(other.styleObject), |
| 35 | control(other.control), window(other.window) |
| 36 | { |
| 37 | } |
| 38 | |
| 39 | /*! |
| 40 | Assign \a other to this QStyleOption. |
| 41 | */ |
| 42 | QStyleOption &QStyleOption::operator=(const QStyleOption &other) |
| 43 | { |
| 44 | control = other.control; |
| 45 | window = other.window; |
| 46 | state = other.state; |
| 47 | direction = other.direction; |
| 48 | rect = other.rect; |
| 49 | fontMetrics = other.fontMetrics; |
| 50 | palette = other.palette; |
| 51 | styleObject = other.styleObject; |
| 52 | return *this; |
| 53 | } |
| 54 | |
| 55 | /*! |
| 56 | Constructs a QStyleOptionFocusRect, initializing the members |
| 57 | variables to their default values. |
| 58 | */ |
| 59 | QStyleOptionFocusRect::QStyleOptionFocusRect() |
| 60 | : QStyleOption(Version, SO_FocusRect) |
| 61 | { |
| 62 | state |= QStyle::State_KeyboardFocusChange; // assume we had one, will be corrected in initFrom() |
| 63 | } |
| 64 | |
| 65 | /*! |
| 66 | \internal |
| 67 | */ |
| 68 | QStyleOptionFocusRect::QStyleOptionFocusRect(int versionIn) |
| 69 | : QStyleOption(versionIn, SO_FocusRect) |
| 70 | { |
| 71 | state |= QStyle::State_KeyboardFocusChange; // assume we had one, will be corrected in initFrom() |
| 72 | } |
| 73 | |
| 74 | /*! |
| 75 | Constructs a QStyleOptionFrame, initializing the members |
| 76 | variables to their default values. |
| 77 | */ |
| 78 | QStyleOptionFrame::QStyleOptionFrame() |
| 79 | : QStyleOption(Version, SO_Frame), lineWidth(0), midLineWidth(0), |
| 80 | features(None), frameShape(NoFrame) |
| 81 | { |
| 82 | } |
| 83 | |
| 84 | /*! |
| 85 | \internal |
| 86 | */ |
| 87 | QStyleOptionFrame::QStyleOptionFrame(int versionIn) |
| 88 | : QStyleOption(versionIn, SO_Frame), lineWidth(0), midLineWidth(0), |
| 89 | features(None) |
| 90 | { |
| 91 | } |
| 92 | |
| 93 | /*! |
| 94 | Constructs a QStyleOptionGroupBox, initializing the members |
| 95 | variables to their default values. |
| 96 | */ |
| 97 | QStyleOptionGroupBox::QStyleOptionGroupBox() |
| 98 | : QStyleOptionComplex(Version, Type), features(QStyleOptionFrame::None), |
| 99 | textAlignment(Qt::AlignLeft), lineWidth(0), midLineWidth(0) |
| 100 | { |
| 101 | } |
| 102 | |
| 103 | QStyleOptionGroupBox::QStyleOptionGroupBox(int versionIn) |
| 104 | : QStyleOptionComplex(versionIn, Type), features(QStyleOptionFrame::None), |
| 105 | textAlignment(Qt::AlignLeft), lineWidth(0), midLineWidth(0) |
| 106 | { |
| 107 | } |
| 108 | |
| 109 | /*! |
| 110 | Constructs a QStyleOptionHeader, initializing the members |
| 111 | variables to their default values. |
| 112 | */ |
| 113 | QStyleOptionHeader::() |
| 114 | : QStyleOption(QStyleOptionHeader::Version, SO_Header), |
| 115 | section(0), textAlignment(Qt::AlignLeft), iconAlignment(Qt::AlignLeft), |
| 116 | position(QStyleOptionHeader::Beginning), |
| 117 | selectedPosition(QStyleOptionHeader::NotAdjacent), sortIndicator(None), |
| 118 | orientation(Qt::Horizontal) |
| 119 | { |
| 120 | } |
| 121 | |
| 122 | /*! |
| 123 | \internal |
| 124 | */ |
| 125 | QStyleOptionHeader::(int versionIn) |
| 126 | : QStyleOption(versionIn, SO_Header), |
| 127 | section(0), textAlignment(Qt::AlignLeft), iconAlignment(Qt::AlignLeft), |
| 128 | position(QStyleOptionHeader::Beginning), |
| 129 | selectedPosition(QStyleOptionHeader::NotAdjacent), sortIndicator(None), |
| 130 | orientation(Qt::Horizontal) |
| 131 | { |
| 132 | } |
| 133 | |
| 134 | /*! |
| 135 | Constructs a QStyleOptionButton, initializing the members |
| 136 | variables to their default values. |
| 137 | */ |
| 138 | QStyleOptionButton::QStyleOptionButton() |
| 139 | : QStyleOption(QStyleOptionButton::Version, SO_Button), features(None) |
| 140 | { |
| 141 | } |
| 142 | |
| 143 | /*! |
| 144 | \internal |
| 145 | */ |
| 146 | QStyleOptionButton::QStyleOptionButton(int versionIn) |
| 147 | : QStyleOption(versionIn, SO_Button), features(None) |
| 148 | { |
| 149 | } |
| 150 | |
| 151 | /*! |
| 152 | Constructs a QStyleOptionToolBar, initializing the members |
| 153 | variables to their default values. |
| 154 | */ |
| 155 | QStyleOptionToolBar::QStyleOptionToolBar() |
| 156 | : QStyleOption(Version, SO_ToolBar), positionOfLine(OnlyOne), positionWithinLine(OnlyOne), |
| 157 | toolBarArea(Qt::TopToolBarArea), features(None), lineWidth(0), midLineWidth(0) |
| 158 | { |
| 159 | } |
| 160 | |
| 161 | /*! |
| 162 | \fn QStyleOptionToolBar::QStyleOptionToolBar(const QStyleOptionToolBar &other) |
| 163 | |
| 164 | Constructs a copy of the \a other style option. |
| 165 | */ |
| 166 | QStyleOptionToolBar::QStyleOptionToolBar(int versionIn) |
| 167 | : QStyleOption(versionIn, SO_ToolBar), positionOfLine(OnlyOne), positionWithinLine(OnlyOne), |
| 168 | toolBarArea(Qt::TopToolBarArea), features(None), lineWidth(0), midLineWidth(0) |
| 169 | { |
| 170 | |
| 171 | } |
| 172 | |
| 173 | /*! |
| 174 | Constructs a QStyleOptionTab object, initializing the members |
| 175 | variables to their default values. |
| 176 | */ |
| 177 | QStyleOptionTab::QStyleOptionTab() |
| 178 | : QStyleOption(QStyleOptionTab::Version, SO_Tab), |
| 179 | row(0), |
| 180 | position(Beginning), |
| 181 | selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets), |
| 182 | documentMode(false), |
| 183 | features(QStyleOptionTab::None) |
| 184 | { |
| 185 | } |
| 186 | |
| 187 | QStyleOptionTab::QStyleOptionTab(int versionIn) |
| 188 | : QStyleOption(versionIn, SO_Tab), |
| 189 | row(0), |
| 190 | position(Beginning), |
| 191 | selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets), |
| 192 | documentMode(false), |
| 193 | features(QStyleOptionTab::None) |
| 194 | { |
| 195 | } |
| 196 | |
| 197 | /*! |
| 198 | Constructs a QStyleOptionTabV4 object, initializing the members |
| 199 | variables to their default values. |
| 200 | */ |
| 201 | QStyleOptionTabV4::QStyleOptionTabV4() : QStyleOptionTab(QStyleOptionTabV4::Version) |
| 202 | { |
| 203 | } |
| 204 | |
| 205 | /*! |
| 206 | Constructs a QStyleOptionProgressBar, initializing the members |
| 207 | variables to their default values. |
| 208 | */ |
| 209 | QStyleOptionProgressBar::QStyleOptionProgressBar() |
| 210 | : QStyleOption(QStyleOptionProgressBar::Version, SO_ProgressBar), |
| 211 | minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false), |
| 212 | invertedAppearance(false), bottomToTop(false) |
| 213 | { |
| 214 | } |
| 215 | |
| 216 | QStyleOptionProgressBar::QStyleOptionProgressBar(int versionIn) |
| 217 | : QStyleOption(versionIn, SO_ProgressBar), |
| 218 | minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false), |
| 219 | invertedAppearance(false), bottomToTop(false) |
| 220 | { |
| 221 | } |
| 222 | |
| 223 | /*! |
| 224 | Constructs a QStyleOptionMenuItem, initializing the members |
| 225 | variables to their default values. |
| 226 | */ |
| 227 | QStyleOptionMenuItem::() |
| 228 | : QStyleOption(QStyleOptionMenuItem::Version, SO_MenuItem), menuItemType(Normal), |
| 229 | checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0), tabWidth(0) |
| 230 | { |
| 231 | } |
| 232 | |
| 233 | /*! |
| 234 | \internal |
| 235 | */ |
| 236 | QStyleOptionMenuItem::(int versionIn) |
| 237 | : QStyleOption(versionIn, SO_MenuItem), menuItemType(Normal), |
| 238 | checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0), tabWidth(0) |
| 239 | { |
| 240 | } |
| 241 | |
| 242 | /*! |
| 243 | Constructs a QStyleOptionComplex of the specified \a type and \a |
| 244 | version, initializing the member variables to their default |
| 245 | values. This constructor is usually called by subclasses. |
| 246 | */ |
| 247 | QStyleOptionComplex::QStyleOptionComplex(int versionIn, int typeIn) |
| 248 | : QStyleOption(versionIn, typeIn), subControls(QStyle::SC_All), activeSubControls(QStyle::SC_None) |
| 249 | { |
| 250 | } |
| 251 | |
| 252 | |
| 253 | /*! |
| 254 | Constructs a QStyleOptionSlider, initializing the members |
| 255 | variables to their default values. |
| 256 | */ |
| 257 | QStyleOptionSlider::QStyleOptionSlider() |
| 258 | : QStyleOptionComplex(Version, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0), |
| 259 | tickPosition(NoTicks), tickInterval(0), upsideDown(false), |
| 260 | sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0), |
| 261 | dialWrapping(false) |
| 262 | { |
| 263 | } |
| 264 | |
| 265 | /*! |
| 266 | \internal |
| 267 | */ |
| 268 | QStyleOptionSlider::QStyleOptionSlider(int versionIn) |
| 269 | : QStyleOptionComplex(versionIn, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0), |
| 270 | tickPosition(NoTicks), tickInterval(0), upsideDown(false), |
| 271 | sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0), |
| 272 | dialWrapping(false) |
| 273 | { |
| 274 | } |
| 275 | |
| 276 | /*! |
| 277 | Constructs a QStyleOptionSpinBox, initializing the members |
| 278 | variables to their default values. |
| 279 | */ |
| 280 | QStyleOptionSpinBox::QStyleOptionSpinBox() |
| 281 | : QStyleOptionComplex(Version, SO_SpinBox), buttonSymbols(UpDownArrows), |
| 282 | stepEnabled(StepNone), frame(false) |
| 283 | { |
| 284 | } |
| 285 | |
| 286 | /*! |
| 287 | \internal |
| 288 | */ |
| 289 | QStyleOptionSpinBox::QStyleOptionSpinBox(int versionIn) |
| 290 | : QStyleOptionComplex(versionIn, SO_SpinBox), buttonSymbols(UpDownArrows), |
| 291 | stepEnabled(StepNone), frame(false) |
| 292 | { |
| 293 | } |
| 294 | |
| 295 | /*! |
| 296 | Constructs a QStyleOptionDockWidget, initializing the member |
| 297 | variables to their default values. |
| 298 | */ |
| 299 | QStyleOptionDockWidget::QStyleOptionDockWidget() |
| 300 | : QStyleOption(Version, SO_DockWidget), closable(false), |
| 301 | movable(false), floatable(false), verticalTitleBar(false) |
| 302 | { |
| 303 | } |
| 304 | |
| 305 | /*! |
| 306 | \internal |
| 307 | */ |
| 308 | QStyleOptionDockWidget::QStyleOptionDockWidget(int versionIn) |
| 309 | : QStyleOption(versionIn, SO_DockWidget), closable(false), |
| 310 | movable(false), floatable(false), verticalTitleBar(false) |
| 311 | { |
| 312 | } |
| 313 | |
| 314 | /*! |
| 315 | Constructs a QStyleOptionToolButton, initializing the members |
| 316 | variables to their default values. |
| 317 | */ |
| 318 | QStyleOptionToolButton::QStyleOptionToolButton() |
| 319 | : QStyleOptionComplex(Version, SO_ToolButton), features(None), arrowType(Qt::DownArrow) |
| 320 | , toolButtonStyle(Qt::ToolButtonIconOnly) |
| 321 | { |
| 322 | } |
| 323 | |
| 324 | QStyleOptionToolButton::QStyleOptionToolButton(int versionIn) |
| 325 | : QStyleOptionComplex(versionIn, SO_ToolButton), features(None), arrowType(Qt::DownArrow) |
| 326 | , toolButtonStyle(Qt::ToolButtonIconOnly) |
| 327 | |
| 328 | { |
| 329 | } |
| 330 | |
| 331 | /*! |
| 332 | Creates a QStyleOptionComboBox, initializing the members variables |
| 333 | to their default values. |
| 334 | */ |
| 335 | QStyleOptionComboBox::QStyleOptionComboBox() |
| 336 | : QStyleOptionComplex(Version, SO_ComboBox), editable(false), frame(true) |
| 337 | { |
| 338 | } |
| 339 | |
| 340 | QStyleOptionComboBox::QStyleOptionComboBox(int versionIn) |
| 341 | : QStyleOptionComplex(versionIn, SO_ComboBox), editable(false), frame(true) |
| 342 | { |
| 343 | } |
| 344 | |
| 345 | /*! |
| 346 | Creates a QStyleOptionToolBox, initializing the members variables |
| 347 | to their default values. |
| 348 | */ |
| 349 | QStyleOptionToolBox::QStyleOptionToolBox() |
| 350 | : QStyleOption(Version, SO_ToolBox), position(Beginning), selectedPosition(NotAdjacent) |
| 351 | { |
| 352 | } |
| 353 | |
| 354 | QStyleOptionToolBox::QStyleOptionToolBox(int versionIn) |
| 355 | : QStyleOption(versionIn, SO_ToolBox), position(Beginning), selectedPosition(NotAdjacent) |
| 356 | { |
| 357 | } |
| 358 | |
| 359 | |
| 360 | /*! |
| 361 | Creates a QStyleOptionRubberBand, initializing the members |
| 362 | variables to their default values. |
| 363 | */ |
| 364 | QStyleOptionRubberBand::QStyleOptionRubberBand() |
| 365 | : QStyleOption(Version, SO_RubberBand), opaque(false), shape(Line) |
| 366 | { |
| 367 | } |
| 368 | |
| 369 | QStyleOptionRubberBand::QStyleOptionRubberBand(int versionIn) |
| 370 | : QStyleOption(versionIn, SO_RubberBand), opaque(false) |
| 371 | { |
| 372 | } |
| 373 | |
| 374 | /*! |
| 375 | Constructs a QStyleOptionTitleBar, initializing the members |
| 376 | variables to their default values. |
| 377 | */ |
| 378 | QStyleOptionTitleBar::QStyleOptionTitleBar() |
| 379 | : QStyleOptionComplex(Version, SO_TitleBar), titleBarState(0) |
| 380 | { |
| 381 | } |
| 382 | |
| 383 | QStyleOptionTitleBar::QStyleOptionTitleBar(int versionIn) |
| 384 | : QStyleOptionComplex(versionIn, SO_TitleBar), titleBarState(0) |
| 385 | { |
| 386 | } |
| 387 | |
| 388 | #if QT_CONFIG(quick_itemview) |
| 389 | /*! |
| 390 | Constructs a QStyleOptionViewItem, initializing the members |
| 391 | variables to their default values. |
| 392 | */ |
| 393 | QStyleOptionViewItem::QStyleOptionViewItem() |
| 394 | : QStyleOption(Version, SO_ViewItem), |
| 395 | displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft), |
| 396 | textElideMode(Qt::ElideMiddle), decorationPosition(Left), |
| 397 | showDecorationSelected(false), features(None), |
| 398 | checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid) |
| 399 | { |
| 400 | } |
| 401 | |
| 402 | QStyleOptionViewItem::QStyleOptionViewItem(int versionIn) |
| 403 | : QStyleOption(versionIn, SO_ViewItem), |
| 404 | displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft), |
| 405 | textElideMode(Qt::ElideMiddle), decorationPosition(Left), |
| 406 | showDecorationSelected(false), features(None), |
| 407 | checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid) |
| 408 | { |
| 409 | } |
| 410 | #endif // QT_CONFIG(quick_itemview) |
| 411 | |
| 412 | /*! |
| 413 | Constructs a QStyleOptionTabWidgetFrame, initializing the members |
| 414 | variables to their default values. |
| 415 | */ |
| 416 | QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame() |
| 417 | : QStyleOption(Version, SO_TabWidgetFrame), lineWidth(0), midLineWidth(0), shape(QStyleOptionTab::RoundedNorth) |
| 418 | { |
| 419 | } |
| 420 | |
| 421 | QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int versionIn) |
| 422 | : QStyleOption(versionIn, SO_TabWidgetFrame), lineWidth(0), midLineWidth(0) |
| 423 | { |
| 424 | } |
| 425 | |
| 426 | /*! |
| 427 | Construct a QStyleOptionTabBarBase, initializing the members |
| 428 | vaiables to their default values. |
| 429 | */ |
| 430 | QStyleOptionTabBarBase::QStyleOptionTabBarBase() |
| 431 | : QStyleOption(Version, SO_TabBarBase), documentMode(false), shape(QStyleOptionTab::RoundedNorth) |
| 432 | { |
| 433 | } |
| 434 | |
| 435 | QStyleOptionTabBarBase::QStyleOptionTabBarBase(int versionIn) |
| 436 | : QStyleOption(versionIn, SO_TabBarBase), documentMode(false) |
| 437 | { |
| 438 | } |
| 439 | |
| 440 | /*! |
| 441 | Constructs a QStyleOptionSizeGrip. |
| 442 | */ |
| 443 | QStyleOptionSizeGrip::QStyleOptionSizeGrip() |
| 444 | : QStyleOptionComplex(Version, Type), corner(Qt::BottomRightCorner) |
| 445 | { |
| 446 | } |
| 447 | |
| 448 | QStyleOptionSizeGrip::QStyleOptionSizeGrip(int versionIn) |
| 449 | : QStyleOptionComplex(versionIn, Type), corner(Qt::BottomRightCorner) |
| 450 | { |
| 451 | } |
| 452 | |
| 453 | /*! |
| 454 | Constructs a QStyleOptionGraphicsItem. |
| 455 | */ |
| 456 | QStyleOptionGraphicsItem::QStyleOptionGraphicsItem() |
| 457 | : QStyleOption(Version, Type), levelOfDetail(1) |
| 458 | { |
| 459 | } |
| 460 | |
| 461 | QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int versionIn) |
| 462 | : QStyleOption(versionIn, Type), levelOfDetail(1) |
| 463 | { |
| 464 | } |
| 465 | |
| 466 | /*! |
| 467 | \since 4.6 |
| 468 | |
| 469 | Returns the level of detail from the \a worldTransform. |
| 470 | |
| 471 | Its value represents the maximum value of the height and |
| 472 | width of a unity rectangle, mapped using the \a worldTransform |
| 473 | of the painter used to draw the item. By default, if no |
| 474 | transformations are applied, its value is 1. If zoomed out 1:2, the level |
| 475 | of detail will be 0.5, and if zoomed in 2:1, its value is 2. |
| 476 | |
| 477 | \sa QGraphicsScene::minimumRenderSize() |
| 478 | */ |
| 479 | qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &worldTransform) |
| 480 | { |
| 481 | if (worldTransform.type() <= QTransform::TxTranslate) |
| 482 | return 1; // Translation only? The LOD is 1. |
| 483 | |
| 484 | // Two unit vectors. |
| 485 | QLineF v1(0, 0, 1, 0); |
| 486 | QLineF v2(0, 0, 0, 1); |
| 487 | // LOD is the transformed area of a 1x1 rectangle. |
| 488 | return qSqrt(v: worldTransform.map(l: v1).length() * worldTransform.map(l: v2).length()); |
| 489 | } |
| 490 | |
| 491 | /*! |
| 492 | Constructs a QStyleHintReturn with version \a version and type \a |
| 493 | type. |
| 494 | |
| 495 | The version has no special meaning for QStyleHintReturn; it can be |
| 496 | used by subclasses to distinguish between different version of |
| 497 | the same hint type. |
| 498 | |
| 499 | \sa QStyleOption::version, QStyleOption::type |
| 500 | */ |
| 501 | QStyleHintReturn::QStyleHintReturn(int versionIn, int type) |
| 502 | : version(versionIn), type(type) |
| 503 | { |
| 504 | } |
| 505 | |
| 506 | /*! |
| 507 | \internal |
| 508 | */ |
| 509 | |
| 510 | QStyleHintReturn::~QStyleHintReturn() |
| 511 | { |
| 512 | } |
| 513 | |
| 514 | /*! |
| 515 | Constructs a QStyleHintReturnMask. The member variables are |
| 516 | initialized to default values. |
| 517 | */ |
| 518 | QStyleHintReturnMask::QStyleHintReturnMask() : QStyleHintReturn(Version, Type) |
| 519 | { |
| 520 | } |
| 521 | |
| 522 | QStyleHintReturnMask::~QStyleHintReturnMask() |
| 523 | { |
| 524 | } |
| 525 | |
| 526 | /*! |
| 527 | Constructs a QStyleHintReturnVariant. The member variables are |
| 528 | initialized to default values. |
| 529 | */ |
| 530 | QStyleHintReturnVariant::QStyleHintReturnVariant() : QStyleHintReturn(Version, Type) |
| 531 | { |
| 532 | } |
| 533 | |
| 534 | QStyleHintReturnVariant::~QStyleHintReturnVariant() |
| 535 | { |
| 536 | } |
| 537 | |
| 538 | #if !defined(QT_NO_DEBUG_STREAM) |
| 539 | QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType) |
| 540 | { |
| 541 | #if !defined(QT_NO_DEBUG) |
| 542 | switch (optionType) { |
| 543 | case QStyleOption::SO_Default: |
| 544 | debug << "SO_Default" ; break; |
| 545 | case QStyleOption::SO_FocusRect: |
| 546 | debug << "SO_FocusRect" ; break; |
| 547 | case QStyleOption::SO_Button: |
| 548 | debug << "SO_Button" ; break; |
| 549 | case QStyleOption::SO_Tab: |
| 550 | debug << "SO_Tab" ; break; |
| 551 | case QStyleOption::SO_MenuItem: |
| 552 | debug << "SO_MenuItem" ; break; |
| 553 | case QStyleOption::SO_Frame: |
| 554 | debug << "SO_Frame" ; break; |
| 555 | case QStyleOption::SO_ProgressBar: |
| 556 | debug << "SO_ProgressBar" ; break; |
| 557 | case QStyleOption::SO_ToolBox: |
| 558 | debug << "SO_ToolBox" ; break; |
| 559 | case QStyleOption::SO_Header: |
| 560 | debug << "SO_Header" ; break; |
| 561 | case QStyleOption::SO_DockWidget: |
| 562 | debug << "SO_DockWidget" ; break; |
| 563 | case QStyleOption::SO_ViewItem: |
| 564 | debug << "SO_ViewItem" ; break; |
| 565 | case QStyleOption::SO_TabWidgetFrame: |
| 566 | debug << "SO_TabWidgetFrame" ; break; |
| 567 | case QStyleOption::SO_TabBarBase: |
| 568 | debug << "SO_TabBarBase" ; break; |
| 569 | case QStyleOption::SO_RubberBand: |
| 570 | debug << "SO_RubberBand" ; break; |
| 571 | case QStyleOption::SO_Complex: |
| 572 | debug << "SO_Complex" ; break; |
| 573 | case QStyleOption::SO_Slider: |
| 574 | debug << "SO_Slider" ; break; |
| 575 | case QStyleOption::SO_SpinBox: |
| 576 | debug << "SO_SpinBox" ; break; |
| 577 | case QStyleOption::SO_ToolButton: |
| 578 | debug << "SO_ToolButton" ; break; |
| 579 | case QStyleOption::SO_ComboBox: |
| 580 | debug << "SO_ComboBox" ; break; |
| 581 | case QStyleOption::SO_TitleBar: |
| 582 | debug << "SO_TitleBar" ; break; |
| 583 | case QStyleOption::SO_CustomBase: |
| 584 | debug << "SO_CustomBase" ; break; |
| 585 | case QStyleOption::SO_GroupBox: |
| 586 | debug << "SO_GroupBox" ; break; |
| 587 | case QStyleOption::SO_ToolBar: |
| 588 | debug << "SO_ToolBar" ; break; |
| 589 | case QStyleOption::SO_ComplexCustomBase: |
| 590 | debug << "SO_ComplexCustomBase" ; break; |
| 591 | case QStyleOption::SO_SizeGrip: |
| 592 | debug << "SO_SizeGrip" ; break; |
| 593 | case QStyleOption::SO_GraphicsItem: |
| 594 | debug << "SO_GraphicsItem" ; break; |
| 595 | } |
| 596 | #else |
| 597 | Q_UNUSED(optionType); |
| 598 | #endif |
| 599 | return debug; |
| 600 | } |
| 601 | |
| 602 | QDebug operator<<(QDebug debug, const QStyleOption &option) |
| 603 | { |
| 604 | #if !defined(QT_NO_DEBUG) |
| 605 | debug << "QStyleOption(" ; |
| 606 | debug << QStyleOption::OptionType(option.type); |
| 607 | debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight" ); |
| 608 | debug << ',' << option.state; |
| 609 | debug << ',' << option.rect; |
| 610 | debug << ',' << option.styleObject; |
| 611 | debug << ')'; |
| 612 | #else |
| 613 | Q_UNUSED(option); |
| 614 | #endif |
| 615 | return debug; |
| 616 | } |
| 617 | #endif |
| 618 | |
| 619 | } // namespace QQC2 |
| 620 | |
| 621 | QT_END_NAMESPACE |
| 622 | |