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// Qt-Security score:significant reason:default
4
6
7#include <QtCore/qabstractitemmodel.h>
8#include <QtWidgets/qtreeview.h>
9#include <QtWidgets/qstyle.h>
10#include <QtGui/qpainter.h>
11
13
14namespace qdesigner_internal {
15
21
23{
26
27 if (!model->parent(index).isValid()) {
28 // this is a top-level item.
30
32#ifdef Q_OS_MACOS
34#endif
36
40
41 painter->save();
42 QColor buttonColor(230, 230, 230);
48
49 // Only draw topline if the previous item is expanded
52 int highlightOffset = drawTopline ? 1 : 0;
53
57
65 if (drawTopline)
69
71 static const int i = 9; // ### hardcoded in qcommonstyle.cpp
73 branchOption.rect = QRect(r.left() + i/2, r.top() + (r.height() - i)/2, i, i);
76
79
81
82 // draw text
83 QRect textrect = QRect(r.left() + i*2, r.top(), r.width() - ((5*i)/2), r.height());
86 textrect.width());
89
90 } else {
92 }
93}
94
100
101} // namespace qdesigner_internal
102
103QT_END_NAMESPACE
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.