Skip to main content

QtBuild

Struct QtBuild 

Source
pub struct QtBuild { /* private fields */ }
Expand description

Helper for build.rs scripts using Qt

let qt_modules = vec!["Core", "Gui"]
    .iter()
    .map(|m| String::from(*m))
    .collect();
let qtbuild = qt_build_utils::QtBuild::new(qt_modules).expect("Could not find Qt installation");

Implementations§

Source§

impl QtBuild

Source

pub fn new(qt_modules: Vec<String>) -> Result<Self>

Create a QtBuild automatically determining the QtInstallation depending on enable features and specify which Qt modules you are linking, ommitting the Qt prefix ("Core" rather than "QtCore").

Source

pub fn with_installation( qt_installation: Box<dyn QtInstallation>, qt_modules: Vec<String>, ) -> Self

Create a QtBuild using the given QtInstallation and specify which Qt modules you are linking, ommitting the Qt prefix ("Core" rather than "QtCore").

Source

pub fn autorcc_options( self, options: impl IntoIterator<Item = impl AsRef<OsStr>>, ) -> Self

Add custom arguments to be passed to the end of the rcc invocation when converting qrc files.

Tell Cargo to link each Qt module.

Source

pub fn framework_paths(&self) -> Vec<PathBuf>

Get the frmaework paths for Qt. This is intended to be passed to whichever tool you are using to invoke the C++ compiler.

Source

pub fn include_paths(&self) -> Vec<PathBuf>

Get the include paths for Qt, including Qt module subdirectories. This is intended to be passed to whichever tool you are using to invoke the C++ compiler.

Source

pub fn installation(&self) -> &dyn QtInstallation

Get the inner QtInstallation implementation

Source

pub fn version(&self) -> Version

Version of the detected Qt installation

Source

pub fn moc(&mut self) -> QtToolMoc

Create a QtToolMoc for this QtBuild

This allows for using moc

Source

pub fn register_qml_module( &mut self, metatypes_json: &[impl AsRef<Path>], uri: &QmlUri, version_major: usize, version_minor: usize, plugin_name: &str, qml_files: &[QmlFile], depends: impl IntoIterator<Item = impl Into<QmlUri>>, plugin_type: PluginType, ) -> QmlModuleRegistrationFiles

Generate C++ files to automatically register a QML module at build time using the JSON output from moc.

This generates a qmldir file for the QML module. The qml_files and qrc_files are registered with the Qt Resource System in the default QML import path qrc:/qt/qml/uri/of/module/.

When using Qt 6, this will run qmlcachegen to compile the specified .qml files ahead-of-time.

Source

pub fn rcc(&self) -> QtToolRcc

Create a QtToolRcc for this QtBuild

This allows for using rcc

Source

pub fn qmltyperegistrar(&self) -> QtToolQmlTypeRegistrar

Create a QtToolQmlTypeRegistrar for this QtBuild

Source

pub fn qtpaths(&self) -> QtToolQtPaths

Create a QtToolQtPaths for this QtBuild

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.