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 using the default QtInstallation (currently uses QtInstallationQMake) and specify which Qt modules you are linking, ommitting the Qt prefix ("Core" rather than "QtCore").

Currently this function is only available when the qmake feature is enabled. Use Self::with_installation to create a QtBuild with a custom QtInstallation.

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 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

Auto Trait Implementations§

§

impl Freeze for QtBuild

§

impl !RefUnwindSafe for QtBuild

§

impl !Send for QtBuild

§

impl !Sync for QtBuild

§

impl Unpin for QtBuild

§

impl !UnwindSafe for QtBuild

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.