mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 22:06:25 +00:00
chore(Storybok): Inspection tool - more readable component names
This commit is contained in:
parent
2663d4a4c2
commit
75e2fff7c0
@ -9,9 +9,9 @@ ListView {
|
|||||||
readonly property color nonVisualItemColor: "black"
|
readonly property color nonVisualItemColor: "black"
|
||||||
readonly property color selectionColor: "red"
|
readonly property color selectionColor: "red"
|
||||||
|
|
||||||
delegate: Text {
|
delegate: Label {
|
||||||
width: ListView.view.width
|
width: ListView.view.width
|
||||||
height: 30
|
height: implicitHeight * 1.5
|
||||||
|
|
||||||
text: " ".repeat(model.level * 4) + " " + model.name
|
text: " ".repeat(model.level * 4) + " " + model.name
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ pragma Singleton
|
|||||||
|
|
||||||
import QtQml 2.15
|
import QtQml 2.15
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
|
import QtQuick.Controls 2.15
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
function isVisual(item) {
|
function isVisual(item) {
|
||||||
@ -28,7 +29,7 @@ QtObject {
|
|||||||
return fullName
|
return fullName
|
||||||
}
|
}
|
||||||
|
|
||||||
function simpleName(item) {
|
function baseTypeName(item) {
|
||||||
if (item instanceof Text)
|
if (item instanceof Text)
|
||||||
return "Text"
|
return "Text"
|
||||||
if (item instanceof Rectangle)
|
if (item instanceof Rectangle)
|
||||||
@ -42,14 +43,29 @@ QtObject {
|
|||||||
if (item instanceof SpriteSequence)
|
if (item instanceof SpriteSequence)
|
||||||
return "SpriteSequence"
|
return "SpriteSequence"
|
||||||
|
|
||||||
const name = baseName(item)
|
if (item instanceof Control)
|
||||||
|
return "Control"
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
function trimQQuickPrefix(name) {
|
||||||
if (name.startsWith("QQuick"))
|
if (name.startsWith("QQuick"))
|
||||||
return name.substring(6)
|
return name.substring(6)
|
||||||
|
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function simpleName(item) {
|
||||||
|
const name = trimQQuickPrefix(baseName(item))
|
||||||
|
const base = baseTypeName(item)
|
||||||
|
|
||||||
|
if (base)
|
||||||
|
return `${name} [${base}]`
|
||||||
|
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
|
||||||
function findItemsByTypeName(root, typeName) {
|
function findItemsByTypeName(root, typeName) {
|
||||||
const items = []
|
const items = []
|
||||||
const stack = [root]
|
const stack = [root]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user