-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c481d0
commit db51492
Showing
5 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
# SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
[package] | ||
name = "widgets-minimal-no-cmake" | ||
version = "0.1.0" | ||
authors = [ | ||
"Andrew Hayzen <[email protected]>", | ||
"Be Wilson <[email protected]>", | ||
"Gerhard de Clercq <[email protected]>", | ||
"Leon Matthes <[email protected]>" | ||
] | ||
edition = "2021" | ||
license = "MIT OR Apache-2.0" | ||
|
||
[dependencies] | ||
cxx.workspace = true | ||
cxx-qt.workspace = true | ||
cxx-qt-lib.workspace = true | ||
cxx-qt-lib-extras.workspace = true | ||
|
||
[build-dependencies] | ||
# The link_qt_object_files feature is required for statically linking Qt 6. | ||
cxx-qt-build = { workspace = true, features = [ "link_qt_object_files" ] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
use cxx_qt_build::CxxQtBuilder; | ||
|
||
fn main() { | ||
CxxQtBuilder::new() | ||
// Link Qt's Network library | ||
.qt_module("Network") | ||
.build(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-FileCopyrightText: 2024 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
//! This example provides demostrations of building a Qt Widgets CXX-Qt application | ||
use cxx_qt_lib::QString; | ||
use cxx_qt_lib_extras::{QApplication, QPushButton}; | ||
|
||
fn main() { | ||
let mut app = QApplication::new(); | ||
|
||
// TODO: we should really pass a parent in here | ||
let mut push_button = QPushButton::new(); | ||
|
||
if let Some(mut push_button) = push_button.as_mut() { | ||
push_button | ||
.as_mut() | ||
.set_text(&QString::from("Hello World!")); | ||
|
||
push_button | ||
.as_mut() | ||
.on_clicked(|_, _| { | ||
println!("Button Clicked!"); | ||
}) | ||
.release(); | ||
|
||
push_button.show(); | ||
} | ||
|
||
if let Some(app) = app.as_mut() { | ||
app.exec(); | ||
} | ||
} |