Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickcommonstyle_p.h
Go to the documentation of this file.
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#ifndef QCOMMONSTYLE_P_H
5#define QCOMMONSTYLE_P_H
6
7#include "qquickcommonstyle.h"
8#include "qquickstyle_p.h"
9#include "qquickstyleoption.h"
10
12
13//
14// W A R N I N G
15// -------------
16//
17// This file is not part of the Qt API. It exists for the convenience
18// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
19// file may change from version to version without notice, or even be removed.
20//
21// We mean it.
22//
23
24class QTextOption;
25
26namespace QQC2 {
27
29{
30 Q_DECLARE_PUBLIC(QCommonStyle)
31public:
32
33#if QT_CONFIG(quick_itemview)
35 {
36 delete cachedOption;
37 }
38#endif // QT_CONFIG(quick_itemview)
39
40 QString calculateElidedText(const QString &text, const QTextOption &textOption,
41 const QFont &font, const QRect &textRect, const Qt::Alignment valign,
42 Qt::TextElideMode textElideMode, int flags,
43 bool lastVisibleLineShouldBeElided, QPointF *paintStartPosition) const;
44#if QT_CONFIG(quick_itemview)
45 void viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect) const;
46 void viewItemLayout(const QStyleOptionViewItem *opt, QRect *checkRect,
47 QRect *pixmapRect, QRect *textRect, bool sizehint) const;
48 QSize viewItemSize(const QStyleOptionViewItem *option, int role) const;
49
50 mutable QRect decorationRect, displayRect, checkRect;
51 mutable QStyleOptionViewItem *cachedOption = nullptr;
52 bool isViewItemCached(const QStyleOptionViewItem &option) const {
53 return cachedOption
54 && option.index == cachedOption->index
55 && option.state == cachedOption->state
56 && option.rect == cachedOption->rect
57 && option.text == cachedOption->text
58 && option.direction == cachedOption->direction
59 && option.displayAlignment == cachedOption->displayAlignment
60 && option.decorationAlignment == cachedOption->decorationAlignment
61 && option.decorationPosition == cachedOption->decorationPosition
62 && option.decorationSize == cachedOption->decorationSize
63 && option.features == cachedOption->features
64 && option.icon.isNull() == cachedOption->icon.isNull()
65 && option.font == cachedOption->font
66 && option.viewItemPosition == cachedOption->viewItemPosition;
67 }
68#endif // QT_CONFIG(quick_itemview)
70 const QRect &textRect, int flags) const;
71
73 virtual void tabLayout(const QStyleOptionTab *opt, QRect *textRect, QRect *pixmapRect) const;
74};
75
76} // namespace QQC2
77
79
80#endif //QCOMMONSTYLE_P_H
\reentrant
Definition qfont.h:22
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qpoint.h:217
QString calculateElidedText(const QString &text, const QTextOption &textOption, const QFont &font, const QRect &textRect, const Qt::Alignment valign, Qt::TextElideMode textElideMode, int flags, bool lastVisibleLineShouldBeElided, QPointF *paintStartPosition) const
QString toolButtonElideText(const QStyleOptionToolButton *toolbutton, const QRect &textRect, int flags) const
virtual void tabLayout(const QStyleOptionTab *opt, QRect *textRect, QRect *pixmapRect) const
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition qrect.h:164
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\reentrant
Definition qtextoption.h:18
QString text
rect
[4]
QStyleOptionButton opt
QRect textRect
Combined button and popup list for selecting options.
TextElideMode
Definition qnamespace.h:188
GLbitfield flags
GLfloat GLfloat p
[1]
GLuint GLenum option