Skip to content

Instantly share code, notes, and snippets.

@danie1k
Last active February 4, 2020 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danie1k/1d16624b75c170ccefa5c9bbe78d1785 to your computer and use it in GitHub Desktop.
Save danie1k/1d16624b75c170ccefa5c9bbe78d1785 to your computer and use it in GitHub Desktop.
Simplest Rust Qt5 "Hello World" example

Linux Requirements:

  • rust
  • qt5-base
  • gcc
  • cmake
[package]
name = "hello_world"
version = "0.1.0"
edition = "2018"
[dependencies]
qt_core = "*"
qt_gui = "*"
qt_widgets = "*"
#![windows_subsystem = "windows"]
use qt_widgets::{
qt_core::QString,
QApplication,
QLabel,
};
fn main() {
QApplication::init(|_| unsafe {
let mut label = QLabel::from_q_string(&QString::from_std_str("Hello World"));
label.show();
QApplication::exec()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment