#[repr(C)]
pub struct QDesktopServices { /* private fields */ }
Expand description

The QDesktopServices class provides methods for accessing common desktop services.

C++ class: QDesktopServices.

C++ documentation:

The QDesktopServices class provides methods for accessing common desktop services.

Many desktop environments provide services that can be used by applications to perform common tasks, such as opening a web page, in a way that is both consistent and takes into account the user's application preferences.

This class contains functions that provide simple interfaces to these services that indicate whether they succeeded or failed.

The openUrl() function is used to open files located at arbitrary URLs in external applications. For URLs that correspond to resources on the local filing system (where the URL scheme is "file"), a suitable application will be used to open the file; otherwise, a web browser will be used to fetch and display the file.

The user's desktop settings control whether certain executable file types are opened for browsing, or if they are executed instead. Some desktop environments are configured to prevent users from executing files obtained from non-local URLs, or to ask the user's permission before doing so.

Implementations§

source§

impl QDesktopServices

source

pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QDesktopServices>> ) -> Ref<QDesktopServices>

The QDesktopServices class provides methods for accessing common desktop services.

Calls C++ function: QDesktopServices& QDesktopServices::operator=(const QDesktopServices& other).

C++ documentation:

The QDesktopServices class provides methods for accessing common desktop services.

Many desktop environments provide services that can be used by applications to perform common tasks, such as opening a web page, in a way that is both consistent and takes into account the user's application preferences.

This class contains functions that provide simple interfaces to these services that indicate whether they succeeded or failed.

The openUrl() function is used to open files located at arbitrary URLs in external applications. For URLs that correspond to resources on the local filing system (where the URL scheme is "file"), a suitable application will be used to open the file; otherwise, a web browser will be used to fetch and display the file.

The user's desktop settings control whether certain executable file types are opened for browsing, or if they are executed instead. Some desktop environments are configured to prevent users from executing files obtained from non-local URLs, or to ask the user's permission before doing so.

source

pub unsafe fn new() -> CppBox<QDesktopServices>

The QDesktopServices class provides methods for accessing common desktop services.

Calls C++ function: [constructor] void QDesktopServices::QDesktopServices().

C++ documentation:

The QDesktopServices class provides methods for accessing common desktop services.

Many desktop environments provide services that can be used by applications to perform common tasks, such as opening a web page, in a way that is both consistent and takes into account the user's application preferences.

This class contains functions that provide simple interfaces to these services that indicate whether they succeeded or failed.

The openUrl() function is used to open files located at arbitrary URLs in external applications. For URLs that correspond to resources on the local filing system (where the URL scheme is "file"), a suitable application will be used to open the file; otherwise, a web browser will be used to fetch and display the file.

The user's desktop settings control whether certain executable file types are opened for browsing, or if they are executed instead. Some desktop environments are configured to prevent users from executing files obtained from non-local URLs, or to ask the user's permission before doing so.

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QDesktopServices>> ) -> CppBox<QDesktopServices>

The QDesktopServices class provides methods for accessing common desktop services.

Calls C++ function: [constructor] void QDesktopServices::QDesktopServices(const QDesktopServices& other).

C++ documentation:

The QDesktopServices class provides methods for accessing common desktop services.

Many desktop environments provide services that can be used by applications to perform common tasks, such as opening a web page, in a way that is both consistent and takes into account the user's application preferences.

This class contains functions that provide simple interfaces to these services that indicate whether they succeeded or failed.

The openUrl() function is used to open files located at arbitrary URLs in external applications. For URLs that correspond to resources on the local filing system (where the URL scheme is "file"), a suitable application will be used to open the file; otherwise, a web browser will be used to fetch and display the file.

The user's desktop settings control whether certain executable file types are opened for browsing, or if they are executed instead. Some desktop environments are configured to prevent users from executing files obtained from non-local URLs, or to ask the user's permission before doing so.

source

pub unsafe fn open_url(url: impl CastInto<Ref<QUrl>>) -> bool

Opens the given url in the appropriate Web browser for the user's desktop environment, and returns true if successful; otherwise returns false.

Calls C++ function: static bool QDesktopServices::openUrl(const QUrl& url).

C++ documentation:

Opens the given url in the appropriate Web browser for the user’s desktop environment, and returns true if successful; otherwise returns false.

If the URL is a reference to a local file (i.e., the URL scheme is "file") then it will be opened with a suitable application instead of a Web browser.

The following example opens a file on the Windows file system residing on a path that contains spaces:

QDesktopServices::openUrl(QUrl(“file:///C:/Documents and Settings/All Users/Desktop”, QUrl::TolerantMode));

If a mailto URL is specified, the user's e-mail client will be used to open a composer window containing the options specified in the URL, similar to the way mailto links are handled by a Web browser.

For example, the following URL contains a recipient (user@foo.com), a subject (Test), and a message body (Just a test):

mailto:user@foo.com?subject=Test&body=Just a test

Warning: Although many e-mail clients can send attachments and are Unicode-aware, the user may have configured their client without these features. Also, certain e-mail clients (e.g., Lotus Notes) have problems with long URLs.

Warning: A return value of true indicates that the application has successfully requested the operating system to open the URL in an external application. The external application may still fail to launch or fail to open the requested URL. This result will not be reported back to the application.

See also setUrlHandler().

source

pub unsafe fn set_url_handler( scheme: impl CastInto<Ref<QString>>, receiver: impl CastInto<Ptr<QObject>>, method: *const c_char )

Sets the handler for the given scheme to be the handler method provided by the receiver object.

Calls C++ function: static void QDesktopServices::setUrlHandler(const QString& scheme, QObject* receiver, const char* method).

C++ documentation:

Sets the handler for the given scheme to be the handler method provided by the receiver object.

This function provides a way to customize the behavior of openUrl(). If openUrl() is called with a URL with the specified scheme then the given method on the receiver object is called instead of QDesktopServices launching an external application.

The provided method must be implemented as a slot that only accepts a single QUrl argument.

If setUrlHandler() is used to set a new handler for a scheme which already has a handler, the existing handler is simply replaced with the new one. Since QDesktopServices does not take ownership of handlers, no objects are deleted when a handler is replaced.

Note that the handler will always be called from within the same thread that calls QDesktopServices::openUrl().

See also openUrl() and unsetUrlHandler().

source

pub unsafe fn unset_url_handler(scheme: impl CastInto<Ref<QString>>)

Removes a previously set URL handler for the specified scheme.

Calls C++ function: static void QDesktopServices::unsetUrlHandler(const QString& scheme).

C++ documentation:

Removes a previously set URL handler for the specified scheme.

See also setUrlHandler().

Trait Implementations§

source§

impl CppDeletable for QDesktopServices

source§

unsafe fn delete(&self)

The QDesktopServices class provides methods for accessing common desktop services.

Calls C++ function: [destructor] void QDesktopServices::~QDesktopServices().

C++ documentation:

The QDesktopServices class provides methods for accessing common desktop services.

Many desktop environments provide services that can be used by applications to perform common tasks, such as opening a web page, in a way that is both consistent and takes into account the user's application preferences.

This class contains functions that provide simple interfaces to these services that indicate whether they succeeded or failed.

The openUrl() function is used to open files located at arbitrary URLs in external applications. For URLs that correspond to resources on the local filing system (where the URL scheme is "file"), a suitable application will be used to open the file; otherwise, a web browser will be used to fetch and display the file.

The user's desktop settings control whether certain executable file types are opened for browsing, or if they are executed instead. Some desktop environments are configured to prevent users from executing files obtained from non-local URLs, or to ask the user's permission before doing so.

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, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. 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> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

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

§

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

§

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.