Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qcolumnview_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 QCOLUMNVIEW_P_H
5#define QCOLUMNVIEW_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of other Qt classes. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include "qcolumnview.h"
20
21#include <private/qabstractitemview_p.h>
22
23#include <QtCore/qabstractitemmodel.h>
24#if QT_CONFIG(animation)
25#include <QtCore/qpropertyanimation.h>
26#endif
27#include <QtWidgets/qabstractitemdelegate.h>
28#include <QtWidgets/qabstractitemview.h>
29#include <QtWidgets/qstyleditemdelegate.h>
30#include <qlistview.h>
31#include <qevent.h>
32#include <qscrollbar.h>
33
35
37
39
40public:
42 }
43
45 previewWidget = widget;
46 setMinimumWidth(previewWidget->minimumWidth());
47 }
48
49 void resizeEvent(QResizeEvent * event) override{
50 if (!previewWidget)
51 return;
52 previewWidget->resize(
53 qMax(previewWidget->minimumWidth(), event->size().width()),
54 previewWidget->height());
55 QSize p = viewport()->size();
56 QSize v = previewWidget->size();
57 horizontalScrollBar()->setRange(0, v.width() - p.width());
58 horizontalScrollBar()->setPageStep(p.width());
59 verticalScrollBar()->setRange(0, v.height() - p.height());
60 verticalScrollBar()->setPageStep(p.height());
61
62 QAbstractScrollArea::resizeEvent(event);
63 }
64
65 void scrollContentsBy(int dx, int dy) override
66 {
67 if (!previewWidget)
68 return;
69 scrollDirtyRegion(dx, dy);
70 viewport()->scroll(dx, dy);
71
72 QAbstractItemView::scrollContentsBy(dx, dy);
73 }
74
75 QRect visualRect(const QModelIndex &) const override
76 {
77 return QRect();
78 }
79 void scrollTo(const QModelIndex &, ScrollHint) override
80 {
81 }
82 QModelIndex indexAt(const QPoint &) const override
83 {
84 return QModelIndex();
85 }
86 QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers) override
87 {
88 return QModelIndex();
89 }
90 int horizontalOffset () const override {
91 return 0;
92 }
93 int verticalOffset () const override {
94 return 0;
95 }
97 {
98 return QRegion();
99 }
100 bool isIndexHidden(const QModelIndex &) const override
101 {
102 return false;
103 }
104 void setSelection(const QRect &, QItemSelectionModel::SelectionFlags) override
105 {
106 }
107private:
108 QWidget *previewWidget;
109};
110
112{
113 Q_DECLARE_PUBLIC(QColumnView)
114
115public:
119
121
123 void closeColumns(const QModelIndex &parent = QModelIndex(), bool build = false);
124 void doLayout();
127
128
132 void _q_columnsInserted(const QModelIndex &parent, int start, int end) override;
133
135 QList<int> columnSizes; // used during init and corner moving
138#if QT_CONFIG(animation)
139 QPropertyAnimation currentAnimation;
140#endif
143};
144
149{
150
151public:
154
156 const QStyleOptionViewItem &option,
157 const QModelIndex &index) const override;
158};
159
161
162#endif //QCOLUMNVIEW_P_H
The QAbstractItemView class provides the basic functionality for item view classes.
void scrollDirtyRegion(int dx, int dy)
Prepares the view for scrolling by ({dx},{dy}) pixels by moving the dirty regions in the opposite dir...
CursorAction
This enum describes the different ways to navigate between items,.
ScrollHint
\value EnsureVisible Scroll to ensure that the item is visible.
This is a delegate that will paint the triangle.
QColumnViewDelegate(QObject *parent=nullptr)
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
This pure abstract function must be reimplemented if you want to provide custom rendering.
QRegion visualRegionForSelection(const QItemSelection &) const override
Returns the region from the viewport of the items in the given selection.
QColumnViewPreviewColumn(QWidget *parent)
int verticalOffset() const override
Returns the vertical offset of the view.
bool isIndexHidden(const QModelIndex &) const override
Returns true if the item referred to by the given index is hidden in the view, otherwise returns fals...
QRect visualRect(const QModelIndex &) const override
Returns the rectangle on the viewport occupied by the item at index.
void setPreviewWidget(QWidget *widget)
void scrollContentsBy(int dx, int dy) override
QModelIndex indexAt(const QPoint &) const override
Returns the model index of the item at the viewport coordinates point.
void scrollTo(const QModelIndex &, ScrollHint) override
Scrolls the view if necessary to ensure that the item at index is visible.
void setSelection(const QRect &, QItemSelectionModel::SelectionFlags) override
Applies the selection flags to the items in or touched by the rectangle, rect.
void resizeEvent(QResizeEvent *event) override
int horizontalOffset() const override
Returns the horizontal offset of the view.
QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers) override
Returns a QModelIndex object pointing to the next object in the view, based on the given cursorAction...
void _q_gripMoved(int offset)
QAbstractItemView * createColumn(const QModelIndex &index, bool show)
void setPreviewWidget(QWidget *widget)
void _q_changeCurrentColumn()
QAbstractItemView * previewColumn
void _q_clicked(const QModelIndex &index)
QList< QAbstractItemView * > columns
void closeColumns(const QModelIndex &parent=QModelIndex(), bool build=false)
void checkColumnCreation(const QModelIndex &parent)
QList< int > columnSizes
void _q_columnsInserted(const QModelIndex &parent, int start, int end) override
\inmodule QtCore
Definition qlist.h:74
\inmodule QtCore
\inmodule QtCore
Definition qobject.h:90
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:311
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qpoint.h:23
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:547
\inmodule QtCore
Definition qsize.h:25
The QStyledItemDelegate class provides display and editing facilities for data items from a model.
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QSize size
the size of the widget excluding any window frame
Definition qwidget.h:113
int minimumWidth
the widget's minimum width in pixels
Definition qwidget.h:123
int height
the height of the widget excluding any window frame
Definition qwidget.h:115
void resize(int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qwidget.h:883
QOpenGLWidget * widget
[1]
Combined button and popup list for selecting options.
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLsizei const GLfloat * v
[13]
GLuint index
[2]
GLuint GLuint end
GLuint start
GLenum GLuint GLintptr offset
struct _cl_event * event
GLfloat GLfloat p
[1]
GLuint GLenum option
#define Q_AUTOTEST_EXPORT
#define QT_REQUIRE_CONFIG(feature)
view show()
[18] //! [19]
QObject::connect nullptr
view viewport() -> scroll(dx, dy, deviceRect)
QPainter painter(this)
[7]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent