
BlinCTSept. 15, 2023, 12:35 p.m.
Размеры полей в TreeView
Всем привет.
Пытаюсь сделать дерево вот такого вида
Пытаюсь организовать делегат для каждой строки в дереве. ТО есть отступ какого то размера и если при открытии есть подсписок то увеличивать наверное с каждым шагом по 2.
Но что-то не моуг правильно выстроить данные для строки.
Может кто поправить меня где ошибка у меня?
Вот часть кода:
Rectangle { SplitView.minimumWidth: root.width * 0.1 // SplitView.maximumWidth: root.width * 0.25 width: root.width * 0.5 color: "#5a5a5a" // TODO: need from C++ TreeView { id: treeViewBookmark anchors.fill: parent clip: true delegate: Item { id: treeDelegate required property int page required property point location required property real zoom // color: "yellow" // implicitWidth: padding + label.x + label.implicitWidth + padding implicitHeight: label.implicitHeight * 1.5 readonly property real indent: 20 readonly property real padding: 5 // // Assigned to by TreeView: required property TreeView treeView required property bool isTreeNode required property bool expanded required property int hasChildren required property int depth RowLayout { spacing: treeViewBookmark.width * 0.03 anchors.fill: parent Rectangle { id: name Layout.fillHeight: true width: treeDelegate.padding + (treeDelegate.depth * indicator.width) color: "yellow" // Layout.width: treeDelegate.padding + (treeDelegate.depth * treeDelegate.indent) } Rectangle { id: rectIndicator width: childrenRect.width Text { id: indicator visible: treeDelegate.isTreeNode && treeDelegate.hasChildren // x: padding + (treeDelegate.depth * treeDelegate.indent) anchors.verticalCenter: label.verticalCenter text: "▸" rotation: treeDelegate.expanded ? 90 : 0 } } Rectangle { id: rectTabel Text { id: label anchors.fill: parent clip: true text: model.display color: "#b7b7b7" } } } TapHandler { onTapped: { treeView.toggleExpanded(row) var qi = treeViewBookmark.index(row, 0) } } } model: PdfBookmarkModel { document: docPdf } ScrollBar.vertical: ScrollBar { } } }
Заранее благодарю

We recommend hosting TIMEWEB
Stable hosting, on which the social network EVILEG is located. For projects on Django we recommend VDS hosting.Do you like it? Share on social networks!
ОН
- Оленька Не важно
- Sept. 17, 2023, 12:02 p.m.
- Result:10points,
- Rating points-10
K
- KiRi4
- Sept. 7, 2023, 2:49 p.m.
C++ - Test 001. The first program and data types
- Result:66points,
- Rating points-1
Last comments

IscanderCheSept. 13, 2023, 4:11 p.m.

Evgenii LegotckoiSept. 6, 2023, 2:18 p.m.
AC
Qt/C++ - Lesson 048. QThread — How to work with threads using moveToThread Я поясню свой вопрос. Выше я писал "Почему же в методе MainWindow::on_write_1_clicked() Можно обращаться к методам exampleObject_1? Разве могут взаимодействовать объекты из разных…
Andrei CherniaevSept. 5, 2023, 10:37 a.m.
QML - Lesson 004. Signals and Slots in Qt QML Здравствуйте! Прекрасный сайт, отличные статьи. Не хватает только готовых проектов для скачивания. Многих комментариев типа appCore != AppCore просто бы не было )))

NSProjectAug. 24, 2023, 8:40 p.m.
Now discuss on the forum

IscanderCheSept. 17, 2023, 4:24 p.m.

NSProjectSept. 17, 2023, 3:49 p.m.

BlinCTSept. 15, 2023, 7:35 p.m.

IscanderCheSept. 8, 2023, 7:07 p.m.

Evgenii LegotckoiSept. 6, 2023, 1:35 p.m.