8#include <QtWidgets/qtwidgetsglobal.h>
9#include <QtWidgets/qabstractitemview.h>
10#include <QtCore/qlist.h>
18class QHeaderViewPrivate;
19class QStyleOptionHeader;
24 Q_PROPERTY(
bool firstSectionMovable READ isFirstSectionMovable WRITE setFirstSectionMovable)
25 Q_PROPERTY(
bool showSortIndicator READ isSortIndicatorShown WRITE setSortIndicatorShown)
26 Q_PROPERTY(
bool sectionsMovable READ sectionsMovable WRITE setSectionsMovable)
27 Q_PROPERTY(
bool sectionsClickable READ sectionsClickable WRITE setSectionsClickable)
28 Q_PROPERTY(
bool highlightSections READ highlightSections WRITE setHighlightSections)
29 Q_PROPERTY(
bool stretchLastSection READ stretchLastSection WRITE setStretchLastSection)
30 Q_PROPERTY(
bool cascadingSectionResizes READ cascadingSectionResizes
31 WRITE setCascadingSectionResizes)
32 Q_PROPERTY(
int defaultSectionSize READ defaultSectionSize WRITE setDefaultSectionSize
33 RESET resetDefaultSectionSize)
34 Q_PROPERTY(
int minimumSectionSize READ minimumSectionSize WRITE setMinimumSectionSize)
35 Q_PROPERTY(
int maximumSectionSize READ maximumSectionSize WRITE setMaximumSectionSize)
36 Q_PROPERTY(Qt::Alignment defaultAlignment READ defaultAlignment WRITE setDefaultAlignment)
37 Q_PROPERTY(
bool sortIndicatorClearable READ isSortIndicatorClearable
38 WRITE setSortIndicatorClearable NOTIFY sortIndicatorClearableChanged)
52 explicit QHeaderView(Qt::Orientation orientation, QWidget *parent =
nullptr);
53 virtual ~QHeaderView();
55 void setModel(QAbstractItemModel *model) override;
57 Qt::Orientation orientation()
const;
60 QSize sizeHint()
const override;
61 void setVisible(
bool v) override;
62 int sectionSizeHint(
int logicalIndex)
const;
64 int visualIndexAt(
int position)
const;
65 int logicalIndexAt(
int position)
const;
67 inline int logicalIndexAt(
int x,
int y)
const;
68 inline int logicalIndexAt(
const QPoint &pos)
const;
70 int sectionSize(
int logicalIndex)
const;
71 int sectionPosition(
int logicalIndex)
const;
72 int sectionViewportPosition(
int logicalIndex)
const;
74 void moveSection(
int from,
int to);
75 void swapSections(
int first,
int second);
76 void resizeSection(
int logicalIndex,
int size);
77 void resizeSections(QHeaderView::ResizeMode mode);
79 bool isSectionHidden(
int logicalIndex)
const;
80 void setSectionHidden(
int logicalIndex,
bool hide);
81 int hiddenSectionCount()
const;
83 inline void hideSection(
int logicalIndex);
84 inline void showSection(
int logicalIndex);
87 int visualIndex(
int logicalIndex)
const;
88 int logicalIndex(
int visualIndex)
const;
90 void setSectionsMovable(
bool movable);
91 bool sectionsMovable()
const;
92 void setFirstSectionMovable(
bool movable);
93 bool isFirstSectionMovable()
const;
95 void setSectionsClickable(
bool clickable);
96 bool sectionsClickable()
const;
98 void setHighlightSections(
bool highlight);
99 bool highlightSections()
const;
101 ResizeMode sectionResizeMode(
int logicalIndex)
const;
102 void setSectionResizeMode(ResizeMode mode);
103 void setSectionResizeMode(
int logicalIndex, ResizeMode mode);
105 void setResizeContentsPrecision(
int precision);
106 int resizeContentsPrecision()
const;
108 int stretchSectionCount()
const;
110 void setSortIndicatorShown(
bool show);
111 bool isSortIndicatorShown()
const;
113 void setSortIndicator(
int logicalIndex, Qt::SortOrder order);
114 int sortIndicatorSection()
const;
115 Qt::SortOrder sortIndicatorOrder()
const;
117 void setSortIndicatorClearable(
bool clearable);
118 bool isSortIndicatorClearable()
const;
120 bool stretchLastSection()
const;
121 void setStretchLastSection(
bool stretch);
123 bool cascadingSectionResizes()
const;
124 void setCascadingSectionResizes(
bool enable);
126 int defaultSectionSize()
const;
127 void setDefaultSectionSize(
int size);
128 void resetDefaultSectionSize();
130 int minimumSectionSize()
const;
131 void setMinimumSectionSize(
int size);
132 int maximumSectionSize()
const;
133 void setMaximumSectionSize(
int size);
135 Qt::Alignment defaultAlignment()
const;
136 void setDefaultAlignment(Qt::Alignment alignment);
138 void doItemsLayout() override;
139 bool sectionsMoved()
const;
140 bool sectionsHidden()
const;
142#ifndef QT_NO_DATASTREAM
143 QByteArray saveState()
const;
144 bool restoreState(
const QByteArray &state);
147 void reset() override;
150 void setOffset(
int offset);
151 void setOffsetToSectionPosition(
int visualIndex);
152 void setOffsetToLastSection();
153 void headerDataChanged(Qt::Orientation orientation,
int logicalFirst,
int logicalLast);
156 void sectionMoved(
int logicalIndex,
int oldVisualIndex,
int newVisualIndex);
157 void sectionResized(
int logicalIndex,
int oldSize,
int newSize);
158 void sectionPressed(
int logicalIndex);
159 void sectionClicked(
int logicalIndex);
160 void sectionEntered(
int logicalIndex);
161 void sectionDoubleClicked(
int logicalIndex);
162 void sectionCountChanged(
int oldCount,
int newCount);
163 void sectionHandleDoubleClicked(
int logicalIndex);
164 void geometriesChanged();
165 void sortIndicatorChanged(
int logicalIndex, Qt::SortOrder order);
166 void sortIndicatorClearableChanged(
bool clearable);
169 void updateSection(
int logicalIndex);
170 void resizeSections();
171 void sectionsInserted(
const QModelIndex &parent,
int logicalFirst,
int logicalLast);
172 void sectionsAboutToBeRemoved(
const QModelIndex &parent,
int logicalFirst,
int logicalLast);
175 QHeaderView(QHeaderViewPrivate &dd, Qt::Orientation orientation, QWidget *parent =
nullptr);
178 void initializeSections();
179 void initializeSections(
int start,
int end);
180 void currentChanged(
const QModelIndex ¤t,
const QModelIndex &old) override;
182 bool event(QEvent *e) override;
183 void paintEvent(QPaintEvent *e) override;
184 void mousePressEvent(QMouseEvent *e) override;
185 void mouseMoveEvent(QMouseEvent *e) override;
186 void mouseReleaseEvent(QMouseEvent *e) override;
187 void mouseDoubleClickEvent(QMouseEvent *e) override;
188 bool viewportEvent(QEvent *e) override;
190 virtual void paintSection(QPainter *painter,
const QRect &rect,
int logicalIndex)
const;
191 virtual QSize sectionSizeFromContents(
int logicalIndex)
const;
193 int horizontalOffset()
const override;
194 int verticalOffset()
const override;
195 void updateGeometries() override;
196 void scrollContentsBy(
int dx,
int dy) override;
198 void dataChanged(
const QModelIndex &topLeft,
const QModelIndex &bottomRight,
199 const QList<
int> &roles = QList<
int>()) override;
200 void rowsInserted(
const QModelIndex &parent,
int start,
int end) override;
202 QRect visualRect(
const QModelIndex &index)
const override;
203 void scrollTo(
const QModelIndex &index, ScrollHint hint) override;
205 QModelIndex indexAt(
const QPoint &p)
const override;
206 bool isIndexHidden(
const QModelIndex &index)
const override;
208 QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers) override;
209 void setSelection(
const QRect& rect, QItemSelectionModel::SelectionFlags flags) override;
210 QRegion visualRegionForSelection(
const QItemSelection &selection)
const override;
211 virtual void initStyleOptionForIndex(QStyleOptionHeader *option,
int logicalIndex)
const;
212 virtual void initStyleOption(QStyleOptionHeader *option)
const;
214 friend class QTableView;
215 friend class QTreeView;
216 friend class ::tst_QHeaderView;
219 void initStyleOption(QStyleOptionFrame *option)
const override;
221 Q_DECLARE_PRIVATE(QHeaderView)
222 Q_DISABLE_COPY(QHeaderView)
225inline int QHeaderView::logicalIndexAt(
int ax,
int ay)
const
226{
return orientation() == Qt::Horizontal ? logicalIndexAt(ax) : logicalIndexAt(ay); }
227inline int QHeaderView::logicalIndexAt(
const QPoint &apos)
const
228{
return logicalIndexAt(apos.x(), apos.y()); }
229inline void QHeaderView::hideSection(
int alogicalIndex)
230{ setSectionHidden(alogicalIndex,
true); }
231inline void QHeaderView::showSection(
int alogicalIndex)
232{ setSectionHidden(alogicalIndex,
false); }
The QApplication class manages the GUI application's control flow and main settings.
The QGroupBox widget provides a group box frame with a title.
The QLabel widget provides a text or image display.
The QMessageBox class provides a modal dialog for informing the user or for asking the user a questio...
The QPaintEngineState class provides information about the active paint engine's current state....
virtual QPixmap createPixmap(QSize size)
void setSystemRect(const QRect &rect)
void setActive(bool newState)
Sets the active state of the paint engine to state.
virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
This is an overloaded member function, provided for convenience. It differs from the above function o...
virtual QPixmap createPixmapFromImage(QImage image, Qt::ImageConversionFlags flags=Qt::AutoColor)
friend class QWidgetPrivate
QPaintEngine(PaintEngineFeatures features=PaintEngineFeatures())
Creates a paint engine with the featureset specified by caps.
friend class QFontEngineQPF2
friend class QMacCGContext
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
virtual void drawLines(const QLineF *lines, int lineCount)
The default implementation splits the list of lines in lines into lineCount separate calls to drawPat...
PolygonDrawMode
\value OddEvenMode The polygon should be drawn using OddEven fill rule.
virtual void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
virtual void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount rectangles in the buffer rects.
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
QPainter * painter() const
Returns the paint engine's painter.
void fix_neg_rect(int *x, int *y, int *w, int *h)
void setPaintDevice(QPaintDevice *device)
virtual QPoint coordinateOffset() const
virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
void setDirty(DirtyFlags df)
void setSystemClip(const QRegion &baseClip)
QPaintEngineState * state
friend class QPainterReplayer
friend class QX11GLPlatformPixmap
PaintEngineFeatures gccaps
void clearDirty(DirtyFlags df)
bool hasFeature(PaintEngineFeatures feature) const
Returns true if the paint engine supports the specified feature; otherwise returns false.
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
QRegion systemClip() const
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr...
bool testDirty(DirtyFlags df)
virtual void updateState(const QPaintEngineState &state)=0
Reimplement this function to update the state of a paint engine.
DirtyFlag
\value DirtyPen The pen is dirty and needs to be updated.
Type
\value X11 \value Windows \value MacPrinter \value CoreGraphics \macos's Quartz2D (CoreGraphics) \val...
virtual Type type() const =0
Reimplement this function to return the paint engine \l{Type}.
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling.
bool begin(QPaintDevice *)
Begins painting the paint device and returns true if successful; otherwise returns false.
void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount of the given rectangles using the current pen and brush.
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
friend class QFontEngineMac
friend class QWin32PaintEngine
friend class QWin32PaintEnginePrivate
friend class QFontEngineWin
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the array points using the current pen's color.
bool isActive() const
Returns true if begin() has been called and end() has not yet been called; otherwise returns false.
\inmodule QtCore\reentrant
The QPolygonF class provides a list of points using floating point precision.
The QStyleHintReturnMask class provides style hints that return a QRegion.
The QStyleHintReturnVariant class provides style hints that return a QVariant.
\variable QStyleOptionGraphicsItem::exposedRect
\variable QStyleOptionDockWidget::title
\variable QStyleOptionMenuItem::menuItemType
\variable QStyleOption::palette
\variable QStyleOptionFocusRect::backgroundColor
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem.
\variable QStyleOptionFrame::features
\variable QStyleOptionToolBox::selectedPosition
The QStyleOption class stores the parameters used by QStyle functions.
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
The QWindows11Style class provides a look and feel suitable for applications on Microsoft Windows 11.
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override
void unpolish(QWidget *widget) override
void polish(QWidget *widget) override
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const override
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const override
QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const override
QWindows11Style(QWindows11StylePrivate &dd)
void polish(QPalette &pal) override
int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
int styleHint(StyleHint hint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const override
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override
QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget=nullptr) const override
~QWindows11Style() override
Destructor.
HBITMAP buffer(int w=0, int h=0)
static int fixedPixelMetric(QStyle::PixelMetric pm)
static HDC hdcForWidgetBackingStore(const QWidget *widget)
static QBackingStore * backingStoreForWidget(const QWidget *widget)
bool swapAlphaChannel(const QRect &rect, bool allPixels=false)
bool drawBackgroundThruNativeBuffer(QWindowsThemeData &QWindowsThemeData, qreal aditionalDevicePixelRatio, qreal correctionFactor)
static HWND winId(const QWidget *widget)
void init(bool force=false)
static bool isLineEditBaseColorSet(const QStyleOption *option, const QWidget *widget)
bool transitionsEnabled() const
bool drawBackgroundDirectly(HDC dc, QWindowsThemeData &QWindowsThemeData, qreal aditionalDevicePixelRatio)
static bool isItemViewDelegateLineEdit(const QWidget *widget)
static bool useVista(bool update=false)
QRgb groupBoxTextColorDisabled
bool fixAlphaChannel(const QRect &rect)
QIcon m_titleBarCloseIcon
void cleanup(bool force=false)
QWindowsVistaStylePrivate()
bool isTransparent(QWindowsThemeData &QWindowsThemeData)
bool hasAlphaChannel(const QRect &rect)
QIcon m_titleBarNormalIcon
QRegion region(QWindowsThemeData &QWindowsThemeData)
QTime animationTime() const
~QWindowsVistaStylePrivate()
bool drawBackground(QWindowsThemeData &QWindowsThemeData, qreal correctionFactor=1)
static HTHEME createTheme(int theme, const QWidget *widget)
static int pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option=nullptr, const QWidget *widget=nullptr)
static QString themeName(int theme)
The QWindowsVistaStyle class provides a look and feel suitable for applications on Microsoft Windows ...
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const override
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const override
int styleHint(StyleHint hint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const override
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget=nullptr) const override
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const override
void polish(QWidget *widget) override
int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=nullptr) const override
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
\reimp
~QWindowsVistaStyle() override
Destructor.
void polish(QPalette &pal) override
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=nullptr) const override
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const override
QWindowsVistaStyle(QWindowsVistaStylePrivate &dd)
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const override
void unpolish(QWidget *widget) override
QString string() const override
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override
Uses the given painter to paint the icon with the required mode and state into the rectangle rect.
QString key() const override
\variable QIconEngine::ScaledPixmapArgument::size
QIconEngine * clone() const override
Reimplement this method to return a clone of this icon engine.
WinFontIconEngine(const QChar &glyph, const QFont &font)
Q_DECLARE_TYPEINFO(QByteArrayView, Q_PRIMITIVE_TYPE)
Q_CORE_EXPORT QDebug operator<<(QDebug debug, QDir::Filters filters)
QT_REQUIRE_CONFIG(thread)
T qstyleoption_cast(const QStyleOption *opt)
T qstyleoption_cast(QStyleOption *opt)
@ fillControlAltSecondary
@ frameColorStrongDisabled
@ controlStrokeOnAccentSecondary
@ fillControlAltQuarternary
bool operator==(const ThemeMapKey &k1, const ThemeMapKey &k2)
size_t qHash(const ThemeMapKey &key)
AlphaChannelType alphaType
ThemeMapKey(const QWindowsThemeData &data)