Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
sheet_delegate.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
5
6#include <QtCore/qabstractitemmodel.h>
7#include <QtWidgets/qtreeview.h>
8#include <QtWidgets/qstyle.h>
9#include <QtGui/qpainter.h>
10
12
13namespace qdesigner_internal {
14
20
22{
25
26 if (!model->parent(index).isValid()) {
27 // this is a top-level item.
29
31#ifdef Q_OS_MACOS
33#endif
35
39
40 painter->save();
41 QColor buttonColor(230, 230, 230);
47
48 // Only draw topline if the previous item is expanded
51 int highlightOffset = drawTopline ? 1 : 0;
52
56
64 if (drawTopline)
68
70 static const int i = 9; // ### hardcoded in qcommonstyle.cpp
72 branchOption.rect = QRect(r.left() + i/2, r.top() + (r.height() - i)/2, i, i);
75
78
80
81 // draw text
82 QRect textrect = QRect(r.left() + i*2, r.top(), r.width() - ((5*i)/2), r.height());
85 textrect.width());
88
89 } else {
91 }
92}
93
95{
97 return sz;
98}
99
100} // namespace qdesigner_internal
101
102QT_END_NAMESPACE
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.