aboutsummaryrefslogtreecommitdiffstats
path: root/examples/treeview
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2022-01-04 13:41:28 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2022-01-06 13:21:46 +0100
commit08485cf0525544ca88775b77f41778f6b4760afe (patch)
treeacf668353328f42cbd6a8c39ca98c6c6c7290da7 /examples/treeview
parentb5824378500594377d113d5b11bc220fdfe4cc1b (diff)
Avoid conflict between TreeView in QtQuick and Marketplace
Both QtQuick and QtQuick.TreeView exports a TreeView item in Qt 6.3. In order to avoid conflict, all usage of the marketplace version in Qt 6.3 will need to either: 1. import it into a namespace 2. use TreeViewTemplate instead of TreeView as a prefix for enums 3. Create a custom subclass of TreeViewTemplate that is named something else than "TreeView" (e.g "CustomTreeView"). Change-Id: I74f04eea4e279ccbef713b1894d9fb09cbd94dc8 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'examples/treeview')
-rw-r--r--examples/treeview/customdelegate/CustomTreeView.qml18
-rw-r--r--examples/treeview/customdelegate/main.qml2
-rw-r--r--examples/treeview/standard/main.qml8
3 files changed, 14 insertions, 14 deletions
diff --git a/examples/treeview/customdelegate/CustomTreeView.qml b/examples/treeview/customdelegate/CustomTreeView.qml
index 94823cd..d063717 100644
--- a/examples/treeview/customdelegate/CustomTreeView.qml
+++ b/examples/treeview/customdelegate/CustomTreeView.qml
@@ -54,7 +54,7 @@ TreeViewTemplate {
styleHints.backgroundCurrent: "#C2E2FE"
styleHints.foregroundHovered: "black"
styleHints.backgroundHovered: "#C2E2FE"
- styleHints.overlay: navigationMode === TreeView.Table ? Qt.rgba(0, 0, 0, 0.5) : "transparent"
+ styleHints.overlay: navigationMode === TreeViewTemplate.Table ? Qt.rgba(0, 0, 0, 0.5) : "transparent"
styleHints.overlayHovered: "transparent"
styleHints.indicator: "black"
styleHints.indicatorHovered: "transparent"
@@ -68,7 +68,7 @@ TreeViewTemplate {
function bgColor(column, row) {
if (row === d.hoveredRow
- && (column === d.hoveredColumn || navigationMode === TreeView.List)
+ && (column === d.hoveredColumn || navigationMode === TreeViewTemplate.List)
&& styleHints.backgroundHovered.a > 0)
return styleHints.backgroundHovered
else if (row === currentIndex.row)
@@ -81,7 +81,7 @@ TreeViewTemplate {
function fgColor(column, row) {
if (row === d.hoveredRow
- && (column === d.hoveredColumn || navigationMode === TreeView.List)
+ && (column === d.hoveredColumn || navigationMode === TreeViewTemplate.List)
&& styleHints.foregroundHovered.a > 0)
return styleHints.foregroundHovered
else if (row === currentIndex.row)
@@ -94,7 +94,7 @@ TreeViewTemplate {
function indicatorColor(column, row) {
if (row === d.hoveredRow
- && (column === d.hoveredColumn || navigationMode === TreeView.List)
+ && (column === d.hoveredColumn || navigationMode === TreeViewTemplate.List)
&& styleHints.indicatorHovered.a > 0)
return styleHints.indicatorHovered
else
@@ -103,7 +103,7 @@ TreeViewTemplate {
function overlayColor() {
if (d.hoveredRow === currentIndex.row
- && (d.hoveredColumn === currentIndex.column || navigationMode === TreeView.List)
+ && (d.hoveredColumn === currentIndex.column || navigationMode === TreeViewTemplate.List)
&& styleHints.overlayHovered.a > 0)
return styleHints.overlayHovered
else
@@ -144,10 +144,10 @@ TreeViewTemplate {
implicitHeight: Math.max(indicator.height, treeNodeLabel.height)
color: d.bgColor(column, row)
- property CustomTreeView view: TreeView.view
- property bool hasChildren: TreeView.hasChildren
- property bool isExpanded: TreeView.isExpanded
- property int depth: TreeView.depth
+ property TreeViewTemplate view: TreeViewTemplate.view
+ property bool hasChildren: TreeViewTemplate.hasChildren
+ property bool isExpanded: TreeViewTemplate.isExpanded
+ property int depth: TreeViewTemplate.depth
Image {
id: indicator
diff --git a/examples/treeview/customdelegate/main.qml b/examples/treeview/customdelegate/main.qml
index 093590d..5174337 100644
--- a/examples/treeview/customdelegate/main.qml
+++ b/examples/treeview/customdelegate/main.qml
@@ -55,7 +55,7 @@ Window {
model: fileSystemModel
clip: true
focus: true
- navigationMode: TreeView.List
+ navigationMode: CustomTreeView.List
// Install pointer handlers to override the
// default actions taken upon mouse press
diff --git a/examples/treeview/standard/main.qml b/examples/treeview/standard/main.qml
index 565bc0a..f78e551 100644
--- a/examples/treeview/standard/main.qml
+++ b/examples/treeview/standard/main.qml
@@ -35,7 +35,7 @@ import QtQuick.Controls 2.15
import QtQuick.Window 2.1
import QtQuick.Layouts 1.14
-import QtQuick.TreeView 2.15
+import QtQuick.TreeView 2.15 as QtMarketplace
Window {
id: root
@@ -71,14 +71,14 @@ Window {
anchors.margins: 20
border.width: 1
- TreeView {
+ QtMarketplace.TreeView {
id: treeView
anchors.fill:parent
anchors.margins: 1
model: fileSystemModel
clip: true
focus: true
- navigationMode: navigationModeBox.checked ? TreeView.Table : TreeView.List
+ navigationMode: navigationModeBox.checked ? QtMarketplace.TreeView.Table : QtMarketplace.TreeView.List
states: State {
when: plainModeBox.checked == false
@@ -98,7 +98,7 @@ Window {
styleHints.indicator: styleHints.backgroundCurrent
styleHints.indicatorCurrent: styleHints.foregroundCurrent
styleHints.indicatorHovered: styleHints.foregroundCurrent
- styleHints.overlay: navigationMode === TreeView.Table ? Qt.rgba(1, 1, 1) : "transparent"
+ styleHints.overlay: navigationMode === QtMarketplace.TreeView.Table ? Qt.rgba(1, 1, 1) : "transparent"
}
}