-
Notifications
You must be signed in to change notification settings - Fork 89
Span inspector #1296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Span inspector #1296
Changes from all commits
cd9338d
413c826
00455e4
f412e4c
386c5fb
20787bc
89e8125
1e54b35
4b4a197
fd1c551
8b86bb5
eb779ba
027ec18
3e1cd66
4d2d09d
382d5b0
61f40bd
1f9acfd
c9e5422
791cb56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# SPDX-FileCopyrightText: 2022 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
# SPDX-FileContributor: Leon Matthes <[email protected]> | ||
# SPDX-FileContributor: Quentin Weber <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
[package] | ||
name = "span-inspector" | ||
edition.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
version.workspace = true | ||
rust-version.workspace = true | ||
|
||
[dependencies] | ||
cxx.workspace = true | ||
cxx-qt.workspace = true | ||
cxx-qt-lib = { workspace = true, features = ["full"] } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please take a look at which features of cxx-qt-lib you really need, as compiling cxx-qt-lib fully can take a lot of time. |
||
cxx-qt-macro = { workspace = true } | ||
cxx-qt-gen = { workspace = true } | ||
proc-macro2.workspace = true | ||
prettyplease = { version = "0.2", features = ["verbatim"] } | ||
syn.workspace=true | ||
|
||
[build-dependencies] | ||
cxx-qt-build = { workspace = true, features = [ "link_qt_object_files" ] } | ||
|
||
[lints] | ||
workspace = true |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,25 @@ | ||||||
// SPDX-FileCopyrightText: 2025 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||||||
// SPDX-FileContributor: Leon Matthes <[email protected]> | ||||||
// | ||||||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||||||
|
||||||
use cxx_qt_build::{CxxQtBuilder, QmlModule}; | ||||||
|
||||||
fn main() { | ||||||
let qml_module: QmlModule<'static, &str, &str> = QmlModule { | ||||||
uri: "com.kdab.cxx_qt.demo", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I copied this from our demos, but this could actually use a useful name (remember to update the according QML import). |
||||||
rust_files: &["src/inspector.rs"], | ||||||
qml_files: &["qml/main.qml"], | ||||||
..Default::default() | ||||||
}; | ||||||
CxxQtBuilder::new() | ||||||
// Link Qt's Network library | ||||||
// - Qt Core is always linked | ||||||
// - Qt Gui is linked by enabling the qt_gui Cargo feature of cxx-qt-lib. | ||||||
// - Qt Qml is linked by enabling the qt_qml Cargo feature of cxx-qt-lib. | ||||||
// - Qt Qml requires linking Qt Network on macOS | ||||||
.qt_module("Network") | ||||||
.qt_module("Quick") | ||||||
.qml_module(qml_module) | ||||||
.build(); | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// SPDX-FileCopyrightText: 2025 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// SPDX-FileContributor: Leon Matthes <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
import QtQuick | ||
import QtQuick.Controls | ||
import QtQuick.Window | ||
import QtQuick.Layouts | ||
|
||
import com.kdab.cxx_qt.demo 1.0 | ||
|
||
ApplicationWindow { | ||
id: appWindow | ||
color: palette.window | ||
property color textColor: color.lightness < 128 * "black" , "white" | ||
height: 480 | ||
title: qsTr("Span Inspector") | ||
visible: true | ||
width: 640 | ||
|
||
SpanInspector { | ||
id: inspector | ||
} | ||
|
||
SplitView { | ||
anchors.fill: parent | ||
Item { | ||
SplitView.preferredWidth: parent.width / 2 | ||
TextArea { | ||
SplitView.preferredWidth: parent.width / 2 | ||
wrapMode: TextArea.Wrap | ||
id: inputEdit | ||
anchors.fill: parent | ||
clip: true | ||
color: appWindow.textColor | ||
Component.onCompleted: { | ||
inspector.input = textDocument | ||
inspector.rebuildOutput(cursorPosition) | ||
} | ||
|
||
onCursorPositionChanged: { | ||
inspector.rebuildOutput(cursorPosition) | ||
} | ||
|
||
onTextChanged: { | ||
inspector.rebuildOutput(cursorPosition) | ||
} | ||
} | ||
} | ||
|
||
ScrollView { | ||
SplitView.preferredWidth: parent.width / 2 | ||
TextEdit { | ||
clip: true | ||
color: appWindow.textColor | ||
text: "Hello World" | ||
readOnly: true; | ||
Component.onCompleted: inspector.output = textDocument | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this line up to the other examples.