#[repr(C)]pub struct QWindow { /* private fields */ }
Expand description
The QWindow class represents a window in the underlying windowing system.
C++ class: QWindow
.
The QWindow class represents a window in the underlying windowing system.
A window that is supplied a parent becomes a native child window of their parent window.
An application will typically use QWidget or QQuickView for its UI, and not QWindow directly. Still, it is possible to render directly to a QWindow with QBackingStore or QOpenGLContext, when wanting to keep dependencies to a minimum or when wanting to use OpenGL directly. The Raster Window Example and OpenGL Window Example are useful reference examples for how to render to a QWindow using either approach.
Implementations§
source§impl QWindow
impl QWindow
sourcepub fn slot_request_activate(&self) -> Receiver<()>
pub fn slot_request_activate(&self) -> Receiver<()>
Requests the window to be activated, i.e. receive keyboard focus.
Returns a built-in Qt slot QWindow::requestActivate
that can be passed to qt_core::Signal::connect
.
Requests the window to be activated, i.e. receive keyboard focus.
See also isActive(), QGuiApplication::focusWindow(), and QWindowsWindowFunctions::setWindowActivationBehavior().
sourcepub fn slot_set_visible(&self) -> Receiver<(bool,)>
pub fn slot_set_visible(&self) -> Receiver<(bool,)>
This property holds whether the window is visible or not
Returns a built-in Qt slot QWindow::setVisible
that can be passed to qt_core::Signal::connect
.
This property holds whether the window is visible or not
This property controls the visibility of the window in the windowing system.
By default, the window is not visible, you must call setVisible(true), or show() or similar to make it visible.
Access functions:
bool | isVisible() const |
void | setVisible(bool visible) |
Notifier signal:
void | visibleChanged(bool arg) |
See also show().
sourcepub fn slot_show(&self) -> Receiver<()>
pub fn slot_show(&self) -> Receiver<()>
Shows the window.
Returns a built-in Qt slot QWindow::show
that can be passed to qt_core::Signal::connect
.
Shows the window.
This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(), depending on the platform's default behavior for the window type and flags.
See also showFullScreen(), showMaximized(), showNormal(), hide(), QStyleHints::showIsFullScreen(), and flags().
sourcepub fn slot_hide(&self) -> Receiver<()>
pub fn slot_hide(&self) -> Receiver<()>
Hides the window.
Returns a built-in Qt slot QWindow::hide
that can be passed to qt_core::Signal::connect
.
sourcepub fn slot_show_minimized(&self) -> Receiver<()>
pub fn slot_show_minimized(&self) -> Receiver<()>
Shows the window as minimized.
Returns a built-in Qt slot QWindow::showMinimized
that can be passed to qt_core::Signal::connect
.
Shows the window as minimized.
Equivalent to calling setWindowState(Qt::WindowMinimized) and then setVisible(true).
See also setWindowState() and setVisible().
sourcepub fn slot_show_maximized(&self) -> Receiver<()>
pub fn slot_show_maximized(&self) -> Receiver<()>
Shows the window as maximized.
Returns a built-in Qt slot QWindow::showMaximized
that can be passed to qt_core::Signal::connect
.
Shows the window as maximized.
Equivalent to calling setWindowState(Qt::WindowMaximized) and then setVisible(true).
See also setWindowState() and setVisible().
sourcepub fn slot_show_full_screen(&self) -> Receiver<()>
pub fn slot_show_full_screen(&self) -> Receiver<()>
Shows the window as fullscreen.
Returns a built-in Qt slot QWindow::showFullScreen
that can be passed to qt_core::Signal::connect
.
Shows the window as fullscreen.
Equivalent to calling setWindowState(Qt::WindowFullScreen) and then setVisible(true).
See also setWindowState() and setVisible().
sourcepub fn slot_show_normal(&self) -> Receiver<()>
pub fn slot_show_normal(&self) -> Receiver<()>
Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen.
Returns a built-in Qt slot QWindow::showNormal
that can be passed to qt_core::Signal::connect
.
Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen.
Equivalent to calling setWindowState(Qt::WindowNoState) and then setVisible(true).
See also setWindowState() and setVisible().
sourcepub fn slot_close(&self) -> Receiver<()>
pub fn slot_close(&self) -> Receiver<()>
Close the window.
Returns a built-in Qt slot QWindow::close
that can be passed to qt_core::Signal::connect
.
Close the window.
This closes the window, effectively calling destroy(), and potentially quitting the application. Returns true
on success, false if it has a parent window (in which case the top level window should be closed instead).
See also destroy() and QGuiApplication::quitOnLastWindowClosed().
sourcepub fn slot_raise(&self) -> Receiver<()>
pub fn slot_raise(&self) -> Receiver<()>
Raise the window in the windowing system.
Returns a built-in Qt slot QWindow::raise
that can be passed to qt_core::Signal::connect
.
Raise the window in the windowing system.
Requests that the window be raised to appear above other windows.
sourcepub fn slot_lower(&self) -> Receiver<()>
pub fn slot_lower(&self) -> Receiver<()>
Lower the window in the windowing system.
Returns a built-in Qt slot QWindow::lower
that can be passed to qt_core::Signal::connect
.
Lower the window in the windowing system.
Requests that the window be lowered to appear below other windows.
sourcepub fn slot_set_title(&self) -> Receiver<(*const QString,)>
pub fn slot_set_title(&self) -> Receiver<(*const QString,)>
This property holds the window's title in the windowing system
Returns a built-in Qt slot QWindow::setTitle
that can be passed to qt_core::Signal::connect
.
This property holds the window’s title in the windowing system
The window title might appear in the title area of the window decorations, depending on the windowing system and the window flags. It might also be used by the windowing system to identify the window in other contexts, such as in the task switcher.
Access functions:
QString | title() const |
void | setTitle(const QString &) |
Notifier signal:
void | windowTitleChanged(const QString &title) |
See also flags().
sourcepub fn slot_set_x(&self) -> Receiver<(c_int,)>
pub fn slot_set_x(&self) -> Receiver<(c_int,)>
This property holds the x position of the window's geometry
Returns a built-in Qt slot QWindow::setX
that can be passed to qt_core::Signal::connect
.
This property holds the x position of the window’s geometry
Access functions:
int | x() const |
void | setX(int arg) |
Notifier signal:
void | xChanged(int arg) |
sourcepub fn slot_set_y(&self) -> Receiver<(c_int,)>
pub fn slot_set_y(&self) -> Receiver<(c_int,)>
This property holds the y position of the window's geometry
Returns a built-in Qt slot QWindow::setY
that can be passed to qt_core::Signal::connect
.
This property holds the y position of the window’s geometry
Access functions:
int | y() const |
void | setY(int arg) |
Notifier signal:
void | yChanged(int arg) |
sourcepub fn slot_set_width(&self) -> Receiver<(c_int,)>
pub fn slot_set_width(&self) -> Receiver<(c_int,)>
This property holds the width of the window's geometry
Returns a built-in Qt slot QWindow::setWidth
that can be passed to qt_core::Signal::connect
.
This property holds the width of the window’s geometry
Access functions:
int | width() const |
void | setWidth(int arg) |
Notifier signal:
void | widthChanged(int arg) |
sourcepub fn slot_set_height(&self) -> Receiver<(c_int,)>
pub fn slot_set_height(&self) -> Receiver<(c_int,)>
This property holds the height of the window's geometry
Returns a built-in Qt slot QWindow::setHeight
that can be passed to qt_core::Signal::connect
.
This property holds the height of the window’s geometry
Access functions:
int | height() const |
void | setHeight(int arg) |
Notifier signal:
void | heightChanged(int arg) |
sourcepub fn slot_set_minimum_width(&self) -> Receiver<(c_int,)>
pub fn slot_set_minimum_width(&self) -> Receiver<(c_int,)>
This property holds the minimum width of the window's geometry
Returns a built-in Qt slot QWindow::setMinimumWidth
that can be passed to qt_core::Signal::connect
.
This property holds the minimum width of the window’s geometry
Access functions:
int | minimumWidth() const |
void | setMinimumWidth(int w) |
Notifier signal:
void | minimumWidthChanged(int arg) |
sourcepub fn slot_set_minimum_height(&self) -> Receiver<(c_int,)>
pub fn slot_set_minimum_height(&self) -> Receiver<(c_int,)>
This property holds the minimum height of the window's geometry
Returns a built-in Qt slot QWindow::setMinimumHeight
that can be passed to qt_core::Signal::connect
.
This property holds the minimum height of the window’s geometry
Access functions:
int | minimumHeight() const |
void | setMinimumHeight(int h) |
Notifier signal:
void | minimumHeightChanged(int arg) |
sourcepub fn slot_set_maximum_width(&self) -> Receiver<(c_int,)>
pub fn slot_set_maximum_width(&self) -> Receiver<(c_int,)>
This property holds the maximum width of the window's geometry
Returns a built-in Qt slot QWindow::setMaximumWidth
that can be passed to qt_core::Signal::connect
.
This property holds the maximum width of the window’s geometry
Access functions:
int | maximumWidth() const |
void | setMaximumWidth(int w) |
Notifier signal:
void | maximumWidthChanged(int arg) |
sourcepub fn slot_set_maximum_height(&self) -> Receiver<(c_int,)>
pub fn slot_set_maximum_height(&self) -> Receiver<(c_int,)>
This property holds the maximum height of the window's geometry
Returns a built-in Qt slot QWindow::setMaximumHeight
that can be passed to qt_core::Signal::connect
.
This property holds the maximum height of the window’s geometry
Access functions:
int | maximumHeight() const |
void | setMaximumHeight(int h) |
Notifier signal:
void | maximumHeightChanged(int arg) |
sourcepub fn slot_alert(&self) -> Receiver<(c_int,)>
pub fn slot_alert(&self) -> Receiver<(c_int,)>
Causes an alert to be shown for msec miliseconds. If msec is 0
(the default), then the alert is shown indefinitely until the window becomes active again. This function has no effect on an active window.
Returns a built-in Qt slot QWindow::alert
that can be passed to qt_core::Signal::connect
.
Causes an alert to be shown for msec miliseconds. If msec is 0
(the default), then the alert is shown indefinitely until the window becomes active again. This function has no effect on an active window.
In alert state, the window indicates that it demands attention, for example by flashing or bouncing the taskbar entry.
This function was introduced in Qt 5.1.
sourcepub fn slot_request_update(&self) -> Receiver<()>
pub fn slot_request_update(&self) -> Receiver<()>
Schedules a QEvent::UpdateRequest event to be delivered to this window.
Returns a built-in Qt slot QWindow::requestUpdate
that can be passed to qt_core::Signal::connect
.
Schedules a QEvent::UpdateRequest event to be delivered to this window.
The event is delivered in sync with the display vsync on platforms where this is possible. Otherwise, the event is delivered after a delay of 5 ms. The additional time is there to give the event loop a bit of idle time to gather system events, and can be overridden using the QT_QPA_UPDATE_IDLE_TIME environment variable.
When driving animations, this function should be called once after drawing has completed. Calling this function multiple times will result in a single event being delivered to the window.
Subclasses of QWindow should reimplement event(), intercept the event and call the application's rendering code, then call the base class implementation.
Note: The subclass' reimplementation of event() must invoke the base class implementation, unless it is absolutely sure that the event does not need to be handled by the base class. For example, the default implementation of this function relies on QEvent::Timer events. Filtering them away would therefore break the delivery of the update events.
This function was introduced in Qt 5.5.
sourcepub fn screen_changed(&self) -> Signal<(*mut QScreen,)>
pub fn screen_changed(&self) -> Signal<(*mut QScreen,)>
This signal is emitted when a window's screen changes, either by being set explicitly with setScreen(), or automatically when the window's screen is removed.
Returns a built-in Qt signal QWindow::screenChanged
that can be passed to qt_core::Signal::connect
.
This signal is emitted when a window’s screen changes, either by being set explicitly with setScreen(), or automatically when the window’s screen is removed.
sourcepub fn modality_changed(&self) -> Signal<(WindowModality,)>
pub fn modality_changed(&self) -> Signal<(WindowModality,)>
This signal is emitted when the Qwindow::modality property changes to modality.
Returns a built-in Qt signal QWindow::modalityChanged
that can be passed to qt_core::Signal::connect
.
This signal is emitted when the Qwindow::modality property changes to modality.
Note: Notifier signal for property modality.
sourcepub fn window_state_changed(&self) -> Signal<(WindowState,)>
pub fn window_state_changed(&self) -> Signal<(WindowState,)>
This signal is emitted when the windowState changes, either by being set explicitly with setWindowState(), or automatically when the user clicks one of the titlebar buttons or by other means.
Returns a built-in Qt signal QWindow::windowStateChanged
that can be passed to qt_core::Signal::connect
.
This signal is emitted when the windowState changes, either by being set explicitly with setWindowState(), or automatically when the user clicks one of the titlebar buttons or by other means.
sourcepub fn window_title_changed(&self) -> Signal<(*const QString,)>
pub fn window_title_changed(&self) -> Signal<(*const QString,)>
This property holds the window's title in the windowing system
Returns a built-in Qt signal QWindow::windowTitleChanged
that can be passed to qt_core::Signal::connect
.
This property holds the window’s title in the windowing system
The window title might appear in the title area of the window decorations, depending on the windowing system and the window flags. It might also be used by the windowing system to identify the window in other contexts, such as in the task switcher.
Access functions:
QString | title() const |
void | setTitle(const QString &) |
Notifier signal:
void | windowTitleChanged(const QString &title) |
See also flags().
sourcepub fn x_changed(&self) -> Signal<(c_int,)>
pub fn x_changed(&self) -> Signal<(c_int,)>
This property holds the x position of the window's geometry
Returns a built-in Qt signal QWindow::xChanged
that can be passed to qt_core::Signal::connect
.
This property holds the x position of the window’s geometry
Access functions:
int | x() const |
void | setX(int arg) |
Notifier signal:
void | xChanged(int arg) |
sourcepub fn y_changed(&self) -> Signal<(c_int,)>
pub fn y_changed(&self) -> Signal<(c_int,)>
This property holds the y position of the window's geometry
Returns a built-in Qt signal QWindow::yChanged
that can be passed to qt_core::Signal::connect
.
This property holds the y position of the window’s geometry
Access functions:
int | y() const |
void | setY(int arg) |
Notifier signal:
void | yChanged(int arg) |
sourcepub fn width_changed(&self) -> Signal<(c_int,)>
pub fn width_changed(&self) -> Signal<(c_int,)>
This property holds the width of the window's geometry
Returns a built-in Qt signal QWindow::widthChanged
that can be passed to qt_core::Signal::connect
.
This property holds the width of the window’s geometry
Access functions:
int | width() const |
void | setWidth(int arg) |
Notifier signal:
void | widthChanged(int arg) |
sourcepub fn height_changed(&self) -> Signal<(c_int,)>
pub fn height_changed(&self) -> Signal<(c_int,)>
This property holds the height of the window's geometry
Returns a built-in Qt signal QWindow::heightChanged
that can be passed to qt_core::Signal::connect
.
This property holds the height of the window’s geometry
Access functions:
int | height() const |
void | setHeight(int arg) |
Notifier signal:
void | heightChanged(int arg) |
sourcepub fn minimum_width_changed(&self) -> Signal<(c_int,)>
pub fn minimum_width_changed(&self) -> Signal<(c_int,)>
This property holds the minimum width of the window's geometry
Returns a built-in Qt signal QWindow::minimumWidthChanged
that can be passed to qt_core::Signal::connect
.
This property holds the minimum width of the window’s geometry
Access functions:
int | minimumWidth() const |
void | setMinimumWidth(int w) |
Notifier signal:
void | minimumWidthChanged(int arg) |
sourcepub fn minimum_height_changed(&self) -> Signal<(c_int,)>
pub fn minimum_height_changed(&self) -> Signal<(c_int,)>
This property holds the minimum height of the window's geometry
Returns a built-in Qt signal QWindow::minimumHeightChanged
that can be passed to qt_core::Signal::connect
.
This property holds the minimum height of the window’s geometry
Access functions:
int | minimumHeight() const |
void | setMinimumHeight(int h) |
Notifier signal:
void | minimumHeightChanged(int arg) |
sourcepub fn maximum_width_changed(&self) -> Signal<(c_int,)>
pub fn maximum_width_changed(&self) -> Signal<(c_int,)>
This property holds the maximum width of the window's geometry
Returns a built-in Qt signal QWindow::maximumWidthChanged
that can be passed to qt_core::Signal::connect
.
This property holds the maximum width of the window’s geometry
Access functions:
int | maximumWidth() const |
void | setMaximumWidth(int w) |
Notifier signal:
void | maximumWidthChanged(int arg) |
sourcepub fn maximum_height_changed(&self) -> Signal<(c_int,)>
pub fn maximum_height_changed(&self) -> Signal<(c_int,)>
This property holds the maximum height of the window's geometry
Returns a built-in Qt signal QWindow::maximumHeightChanged
that can be passed to qt_core::Signal::connect
.
This property holds the maximum height of the window’s geometry
Access functions:
int | maximumHeight() const |
void | setMaximumHeight(int h) |
Notifier signal:
void | maximumHeightChanged(int arg) |
sourcepub fn visible_changed(&self) -> Signal<(bool,)>
pub fn visible_changed(&self) -> Signal<(bool,)>
This property holds whether the window is visible or not
Returns a built-in Qt signal QWindow::visibleChanged
that can be passed to qt_core::Signal::connect
.
This property holds whether the window is visible or not
This property controls the visibility of the window in the windowing system.
By default, the window is not visible, you must call setVisible(true), or show() or similar to make it visible.
Access functions:
bool | isVisible() const |
void | setVisible(bool visible) |
Notifier signal:
void | visibleChanged(bool arg) |
See also show().
sourcepub fn visibility_changed(&self) -> Signal<(Visibility,)>
pub fn visibility_changed(&self) -> Signal<(Visibility,)>
This property holds the screen-occupation state of the window
Returns a built-in Qt signal QWindow::visibilityChanged
that can be passed to qt_core::Signal::connect
.
This property holds the screen-occupation state of the window
Visibility is whether the window should appear in the windowing system as normal, minimized, maximized, fullscreen or hidden.
To set the visibility to AutomaticVisibility means to give the window a default visible state, which might be fullscreen or windowed depending on the platform. When reading the visibility property you will always get the actual state, never AutomaticVisibility.
This property was introduced in Qt 5.1.
Access functions:
Visibility | visibility() const |
void | setVisibility(Visibility v) |
Notifier signal:
void | visibilityChanged(QWindow::Visibility visibility) |
sourcepub fn active_changed(&self) -> Signal<()>
pub fn active_changed(&self) -> Signal<()>
This property holds the active status of the window
Returns a built-in Qt signal QWindow::activeChanged
that can be passed to qt_core::Signal::connect
.
This property holds the active status of the window
This property was introduced in Qt 5.1.
Access functions:
bool | isActive() const |
Notifier signal:
void | activeChanged() |
See also requestActivate().
sourcepub fn content_orientation_changed(&self) -> Signal<(ScreenOrientation,)>
pub fn content_orientation_changed(&self) -> Signal<(ScreenOrientation,)>
This property holds the orientation of the window's contents
Returns a built-in Qt signal QWindow::contentOrientationChanged
that can be passed to qt_core::Signal::connect
.
This property holds the orientation of the window’s contents
This is a hint to the window manager in case it needs to display additional content like popups, dialogs, status bars, or similar in relation to the window.
The recommended orientation is QScreen::orientation() but an application doesn't have to support all possible orientations, and thus can opt to ignore the current screen orientation.
The difference between the window and the content orientation determines how much to rotate the content by. QScreen::angleBetween(), QScreen::transformBetween(), and QScreen::mapBetween() can be used to compute the necessary transform.
The default value is Qt::PrimaryOrientation
Access functions:
Qt::ScreenOrientation | contentOrientation() const |
void | reportContentOrientationChange(Qt::ScreenOrientation orientation) |
Notifier signal:
void | contentOrientationChanged(Qt::ScreenOrientation orientation) |
sourcepub fn focus_object_changed(&self) -> Signal<(*mut QObject,)>
pub fn focus_object_changed(&self) -> Signal<(*mut QObject,)>
This signal is emitted when the final receiver of events tied to focus is changed to object.
Returns a built-in Qt signal QWindow::focusObjectChanged
that can be passed to qt_core::Signal::connect
.
This signal is emitted when the final receiver of events tied to focus is changed to object.
See also focusObject().
sourcepub fn opacity_changed(&self) -> Signal<(c_double,)>
pub fn opacity_changed(&self) -> Signal<(c_double,)>
This property holds the opacity of the window in the windowing system.
Returns a built-in Qt signal QWindow::opacityChanged
that can be passed to qt_core::Signal::connect
.
This property holds the opacity of the window in the windowing system.
If the windowing system supports window opacity, this can be used to fade the window in and out, or to make it semitransparent.
A value of 1.0 or above is treated as fully opaque, whereas a value of 0.0 or below is treated as fully transparent. Values inbetween represent varying levels of translucency between the two extremes.
The default value is 1.0.
This property was introduced in Qt 5.1.
Access functions:
qreal | opacity() const |
void | setOpacity(qreal level) |
Notifier signal:
void | opacityChanged(qreal opacity) |
sourcepub unsafe fn accessible_root(&self) -> Ptr<QAccessibleInterface>
pub unsafe fn accessible_root(&self) -> Ptr<QAccessibleInterface>
Calls C++ function: virtual QAccessibleInterface* QWindow::accessibleRoot() const
.
sourcepub unsafe fn alert(&self, msec: c_int)
pub unsafe fn alert(&self, msec: c_int)
Causes an alert to be shown for msec miliseconds. If msec is 0
(the default), then the alert is shown indefinitely until the window becomes active again. This function has no effect on an active window.
Calls C++ function: [slot] void QWindow::alert(int msec)
.
Causes an alert to be shown for msec miliseconds. If msec is 0
(the default), then the alert is shown indefinitely until the window becomes active again. This function has no effect on an active window.
In alert state, the window indicates that it demands attention, for example by flashing or bouncing the taskbar entry.
This function was introduced in Qt 5.1.
sourcepub unsafe fn base_size(&self) -> CppBox<QSize>
pub unsafe fn base_size(&self) -> CppBox<QSize>
Returns the base size of the window.
Calls C++ function: QSize QWindow::baseSize() const
.
Returns the base size of the window.
See also setBaseSize().
sourcepub unsafe fn close(&self) -> bool
pub unsafe fn close(&self) -> bool
Close the window.
Calls C++ function: [slot] bool QWindow::close()
.
Close the window.
This closes the window, effectively calling destroy(), and potentially quitting the application. Returns true
on success, false if it has a parent window (in which case the top level window should be closed instead).
See also destroy() and QGuiApplication::quitOnLastWindowClosed().
sourcepub unsafe fn content_orientation(&self) -> ScreenOrientation
pub unsafe fn content_orientation(&self) -> ScreenOrientation
This property holds the orientation of the window's contents
Calls C++ function: Qt::ScreenOrientation QWindow::contentOrientation() const
.
This property holds the orientation of the window’s contents
This is a hint to the window manager in case it needs to display additional content like popups, dialogs, status bars, or similar in relation to the window.
The recommended orientation is QScreen::orientation() but an application doesn't have to support all possible orientations, and thus can opt to ignore the current screen orientation.
The difference between the window and the content orientation determines how much to rotate the content by. QScreen::angleBetween(), QScreen::transformBetween(), and QScreen::mapBetween() can be used to compute the necessary transform.
The default value is Qt::PrimaryOrientation
Access functions:
Qt::ScreenOrientation | contentOrientation() const |
void | reportContentOrientationChange(Qt::ScreenOrientation orientation) |
Notifier signal:
void | contentOrientationChanged(Qt::ScreenOrientation orientation) |
sourcepub unsafe fn create(&self)
pub unsafe fn create(&self)
Allocates the platform resources associated with the window.
Calls C++ function: void QWindow::create()
.
Allocates the platform resources associated with the window.
It is at this point that the surface format set using setFormat() gets resolved into an actual native surface. However, the window remains hidden until setVisible() is called.
Note that it is not usually necessary to call this function directly, as it will be implicitly called by show(), setVisible(), and other functions that require access to the platform resources.
Call destroy() to free the platform resources if necessary.
See also destroy().
sourcepub unsafe fn cursor(&self) -> CppBox<QCursor>
pub unsafe fn cursor(&self) -> CppBox<QCursor>
the cursor shape for this window
Calls C++ function: QCursor QWindow::cursor() const
.
the cursor shape for this window
See also setCursor() and unsetCursor().
sourcepub unsafe fn destroy(&self)
pub unsafe fn destroy(&self)
Releases the native platform resources associated with this window.
Calls C++ function: void QWindow::destroy()
.
Releases the native platform resources associated with this window.
See also create().
sourcepub unsafe fn device_pixel_ratio(&self) -> c_double
pub unsafe fn device_pixel_ratio(&self) -> c_double
Returns the ratio between physical pixels and device-independent pixels for the window. This value is dependent on the screen the window is on, and may change when the window is moved.
Calls C++ function: double QWindow::devicePixelRatio() const
.
Returns the ratio between physical pixels and device-independent pixels for the window. This value is dependent on the screen the window is on, and may change when the window is moved.
Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays.
Note: For windows not backed by a platform window, meaning that create() was not called, the function will fall back to the associated QScreen's device pixel ratio.
See also QScreen::devicePixelRatio().
sourcepub unsafe fn file_path(&self) -> CppBox<QString>
pub unsafe fn file_path(&self) -> CppBox<QString>
the file name this window is representing.
Calls C++ function: QString QWindow::filePath() const
.
the file name this window is representing.
See also setFilePath().
sourcepub unsafe fn flags(&self) -> QFlags<WindowType>
pub unsafe fn flags(&self) -> QFlags<WindowType>
This property holds the window flags of the window
Calls C++ function: QFlags<Qt::WindowType> QWindow::flags() const
.
This property holds the window flags of the window
The window flags control the window's appearance in the windowing system, whether it's a dialog, popup, or a regular window, and whether it should have a title bar, etc.
The actual window flags might differ from the flags set with setFlags() if the requested flags could not be fulfilled.
Access functions:
Qt::WindowFlags | flags() const |
void | setFlags(Qt::WindowFlags flags) |
See also setFlag().
sourcepub unsafe fn focus_object(&self) -> QPtr<QObject>
pub unsafe fn focus_object(&self) -> QPtr<QObject>
sourcepub unsafe fn format(&self) -> CppBox<QSurfaceFormat>
pub unsafe fn format(&self) -> CppBox<QSurfaceFormat>
Reimplemented from QSurface::format().
Calls C++ function: virtual QSurfaceFormat QWindow::format() const
.
Reimplemented from QSurface::format().
Returns the actual format of this window.
After the window has been created, this function will return the actual surface format of the window. It might differ from the requested format if the requested format could not be fulfilled by the platform. It might also be a superset, for example certain buffer sizes may be larger than requested.
Note: Depending on the platform, certain values in this surface format may still contain the requested values, that is, the values that have been passed to setFormat(). Typical examples are the OpenGL version, profile and options. These may not get updated during create() since these are context specific and a single window may be used together with multiple contexts over its lifetime. Use the QOpenGLContext's format() instead to query such values.
See also setFormat(), create(), requestedFormat(), and QOpenGLContext::format().
sourcepub unsafe fn frame_geometry(&self) -> CppBox<QRect>
pub unsafe fn frame_geometry(&self) -> CppBox<QRect>
Returns the geometry of the window, including its window frame.
Calls C++ function: QRect QWindow::frameGeometry() const
.
Returns the geometry of the window, including its window frame.
The geometry is in relation to the virtualGeometry() of its screen.
See also geometry() and frameMargins().
sourcepub unsafe fn frame_margins(&self) -> CppBox<QMargins>
pub unsafe fn frame_margins(&self) -> CppBox<QMargins>
Returns the window frame margins surrounding the window.
Calls C++ function: QMargins QWindow::frameMargins() const
.
Returns the window frame margins surrounding the window.
See also geometry() and frameGeometry().
sourcepub unsafe fn frame_position(&self) -> CppBox<QPoint>
pub unsafe fn frame_position(&self) -> CppBox<QPoint>
Returns the top left position of the window, including its window frame.
Calls C++ function: QPoint QWindow::framePosition() const
.
Returns the top left position of the window, including its window frame.
This returns the same value as frameGeometry().topLeft().
See also setFramePosition(), geometry(), and frameGeometry().
sourcepub unsafe fn from_win_id(id: c_ulonglong) -> QPtr<QWindow>
pub unsafe fn from_win_id(id: c_ulonglong) -> QPtr<QWindow>
Creates a local representation of a window created by another process or by using native libraries below Qt.
Calls C++ function: static QWindow* QWindow::fromWinId(unsigned long long id)
.
Creates a local representation of a window created by another process or by using native libraries below Qt.
Given the handle id to a native window, this method creates a QWindow object which can be used to represent the window when invoking methods like setParent() and setTransientParent().
This can be used, on platforms which support it, to embed a QWindow inside a native window, or to embed a native window inside a QWindow.
If foreign windows are not supported or embedding the native window failed in the platform plugin, this function returns 0.
Note: The resulting QWindow should not be used to manipulate the underlying native window (besides re-parenting), or to observe state changes of the native window. Any support for these kind of operations is incidental, highly platform dependent and untested.
See also setParent() and setTransientParent().
sourcepub unsafe fn geometry(&self) -> CppBox<QRect>
pub unsafe fn geometry(&self) -> CppBox<QRect>
Returns the geometry of the window, excluding its window frame.
Calls C++ function: QRect QWindow::geometry() const
.
Returns the geometry of the window, excluding its window frame.
The geometry is in relation to the virtualGeometry() of its screen.
See also setGeometry(), frameMargins(), and frameGeometry().
sourcepub unsafe fn height(&self) -> c_int
pub unsafe fn height(&self) -> c_int
This property holds the height of the window's geometry
Calls C++ function: int QWindow::height() const
.
This property holds the height of the window’s geometry
Access functions:
int | height() const |
void | setHeight(int arg) |
Notifier signal:
void | heightChanged(int arg) |
sourcepub unsafe fn icon(&self) -> CppBox<QIcon>
pub unsafe fn icon(&self) -> CppBox<QIcon>
Sets the window's icon in the windowing system
Calls C++ function: QIcon QWindow::icon() const
.
Sets the window’s icon in the windowing system
See also setIcon().
sourcepub unsafe fn is_active(&self) -> bool
pub unsafe fn is_active(&self) -> bool
Returns true
if the window should appear active from a style perspective.
Calls C++ function: bool QWindow::isActive() const
.
Returns true
if the window should appear active from a style perspective.
This is the case for the window that has input focus as well as windows that are in the same parent / transient parent chain as the focus window.
To get the window that currently has focus, use QGuiApplication::focusWindow().
Note: Getter function for property active.
sourcepub unsafe fn is_ancestor_of_2a(
&self,
child: impl CastInto<Ptr<QWindow>>,
mode: AncestorMode
) -> bool
pub unsafe fn is_ancestor_of_2a( &self, child: impl CastInto<Ptr<QWindow>>, mode: AncestorMode ) -> bool
Returns true
if the window is an ancestor of the given child. If mode is IncludeTransients, then transient parents are also considered ancestors.
Calls C++ function: bool QWindow::isAncestorOf(const QWindow* child, QWindow::AncestorMode mode = …) const
.
Returns true
if the window is an ancestor of the given child. If mode is IncludeTransients, then transient parents are also considered ancestors.
sourcepub unsafe fn is_ancestor_of_1a(
&self,
child: impl CastInto<Ptr<QWindow>>
) -> bool
pub unsafe fn is_ancestor_of_1a( &self, child: impl CastInto<Ptr<QWindow>> ) -> bool
Returns true
if the window is an ancestor of the given child. If mode is IncludeTransients, then transient parents are also considered ancestors.
Calls C++ function: bool QWindow::isAncestorOf(const QWindow* child) const
.
Returns true
if the window is an ancestor of the given child. If mode is IncludeTransients, then transient parents are also considered ancestors.
sourcepub unsafe fn is_exposed(&self) -> bool
pub unsafe fn is_exposed(&self) -> bool
Returns if this window is exposed in the windowing system.
Calls C++ function: bool QWindow::isExposed() const
.
Returns if this window is exposed in the windowing system.
When the window is not exposed, it is shown by the application but it is still not showing in the windowing system, so the application should minimize rendering and other graphical activities.
An exposeEvent() is sent every time this value changes.
See also exposeEvent().
sourcepub unsafe fn is_modal(&self) -> bool
pub unsafe fn is_modal(&self) -> bool
Returns whether the window is modal.
Calls C++ function: bool QWindow::isModal() const
.
Returns whether the window is modal.
A modal window prevents other windows from getting any input.
See also QWindow::modality.
sourcepub unsafe fn is_top_level(&self) -> bool
pub unsafe fn is_top_level(&self) -> bool
Returns whether the window is top level, i.e. has no parent window.
Calls C++ function: bool QWindow::isTopLevel() const
.
Returns whether the window is top level, i.e. has no parent window.
sourcepub unsafe fn is_visible(&self) -> bool
pub unsafe fn is_visible(&self) -> bool
This property holds whether the window is visible or not
Calls C++ function: bool QWindow::isVisible() const
.
This property holds whether the window is visible or not
This property controls the visibility of the window in the windowing system.
By default, the window is not visible, you must call setVisible(true), or show() or similar to make it visible.
Access functions:
bool | isVisible() const |
void | setVisible(bool visible) |
Notifier signal:
void | visibleChanged(bool arg) |
See also show().
sourcepub unsafe fn lower(&self)
pub unsafe fn lower(&self)
Lower the window in the windowing system.
Calls C++ function: [slot] void QWindow::lower()
.
Lower the window in the windowing system.
Requests that the window be lowered to appear below other windows.
sourcepub unsafe fn map_from_global(
&self,
pos: impl CastInto<Ref<QPoint>>
) -> CppBox<QPoint>
pub unsafe fn map_from_global( &self, pos: impl CastInto<Ref<QPoint>> ) -> CppBox<QPoint>
Translates the global screen coordinate pos to window coordinates.
Calls C++ function: QPoint QWindow::mapFromGlobal(const QPoint& pos) const
.
Translates the global screen coordinate pos to window coordinates.
See also mapToGlobal().
sourcepub unsafe fn map_to_global(
&self,
pos: impl CastInto<Ref<QPoint>>
) -> CppBox<QPoint>
pub unsafe fn map_to_global( &self, pos: impl CastInto<Ref<QPoint>> ) -> CppBox<QPoint>
Translates the window coordinate pos to global screen coordinates. For example, mapToGlobal(QPoint(0,0))
would give the global coordinates of the top-left pixel of the window.
Calls C++ function: QPoint QWindow::mapToGlobal(const QPoint& pos) const
.
Translates the window coordinate pos to global screen coordinates. For example, mapToGlobal(QPoint(0,0))
would give the global coordinates of the top-left pixel of the window.
See also mapFromGlobal().
sourcepub unsafe fn mask(&self) -> CppBox<QRegion>
pub unsafe fn mask(&self) -> CppBox<QRegion>
Returns the mask set on the window.
Calls C++ function: QRegion QWindow::mask() const
.
Returns the mask set on the window.
The mask is a hint to the windowing system that the application does not want to receive mouse or touch input outside the given region.
See also setMask().
sourcepub unsafe fn maximum_height(&self) -> c_int
pub unsafe fn maximum_height(&self) -> c_int
This property holds the maximum height of the window's geometry
Calls C++ function: int QWindow::maximumHeight() const
.
This property holds the maximum height of the window’s geometry
Access functions:
int | maximumHeight() const |
void | setMaximumHeight(int h) |
Notifier signal:
void | maximumHeightChanged(int arg) |
sourcepub unsafe fn maximum_size(&self) -> CppBox<QSize>
pub unsafe fn maximum_size(&self) -> CppBox<QSize>
Returns the maximum size of the window.
Calls C++ function: QSize QWindow::maximumSize() const
.
Returns the maximum size of the window.
See also setMaximumSize().
sourcepub unsafe fn maximum_width(&self) -> c_int
pub unsafe fn maximum_width(&self) -> c_int
This property holds the maximum width of the window's geometry
Calls C++ function: int QWindow::maximumWidth() const
.
This property holds the maximum width of the window’s geometry
Access functions:
int | maximumWidth() const |
void | setMaximumWidth(int w) |
Notifier signal:
void | maximumWidthChanged(int arg) |
sourcepub unsafe fn meta_object(&self) -> Ptr<QMetaObject>
pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>
Calls C++ function: virtual const QMetaObject* QWindow::metaObject() const
.
sourcepub unsafe fn minimum_height(&self) -> c_int
pub unsafe fn minimum_height(&self) -> c_int
This property holds the minimum height of the window's geometry
Calls C++ function: int QWindow::minimumHeight() const
.
This property holds the minimum height of the window’s geometry
Access functions:
int | minimumHeight() const |
void | setMinimumHeight(int h) |
Notifier signal:
void | minimumHeightChanged(int arg) |
sourcepub unsafe fn minimum_size(&self) -> CppBox<QSize>
pub unsafe fn minimum_size(&self) -> CppBox<QSize>
Returns the minimum size of the window.
Calls C++ function: QSize QWindow::minimumSize() const
.
Returns the minimum size of the window.
See also setMinimumSize().
sourcepub unsafe fn minimum_width(&self) -> c_int
pub unsafe fn minimum_width(&self) -> c_int
This property holds the minimum width of the window's geometry
Calls C++ function: int QWindow::minimumWidth() const
.
This property holds the minimum width of the window’s geometry
Access functions:
int | minimumWidth() const |
void | setMinimumWidth(int w) |
Notifier signal:
void | minimumWidthChanged(int arg) |
sourcepub unsafe fn modality(&self) -> WindowModality
pub unsafe fn modality(&self) -> WindowModality
This property holds the modality of the window
Calls C++ function: Qt::WindowModality QWindow::modality() const
.
This property holds the modality of the window
A modal window prevents other windows from receiving input events. Qt supports two types of modality: Qt::WindowModal and Qt::ApplicationModal.
By default, this property is Qt::NonModal
Access functions:
Qt::WindowModality | modality() const |
void | setModality(Qt::WindowModality modality) |
Notifier signal:
void | modalityChanged(Qt::WindowModality modality) |
See also Qt::WindowModality.
sourcepub unsafe fn from_q_screen(
screen: impl CastInto<Ptr<QScreen>>
) -> QBox<QWindow>
pub unsafe fn from_q_screen( screen: impl CastInto<Ptr<QScreen>> ) -> QBox<QWindow>
Creates a window as a top level on the targetScreen.
Calls C++ function: [constructor] void QWindow::QWindow(QScreen* screen = …)
.
Creates a window as a top level on the targetScreen.
The window is not shown until setVisible(true), show(), or similar is called.
See also setScreen().
sourcepub unsafe fn from_q_window(
parent: impl CastInto<Ptr<QWindow>>
) -> QBox<QWindow>
pub unsafe fn from_q_window( parent: impl CastInto<Ptr<QWindow>> ) -> QBox<QWindow>
Creates a window as a child of the given parent window.
Calls C++ function: [constructor] void QWindow::QWindow(QWindow* parent)
.
Creates a window as a child of the given parent window.
The window will be embedded inside the parent window, its coordinates relative to the parent.
The screen is inherited from the parent.
See also setParent().
sourcepub unsafe fn new() -> QBox<QWindow>
pub unsafe fn new() -> QBox<QWindow>
The QWindow class represents a window in the underlying windowing system.
Calls C++ function: [constructor] void QWindow::QWindow()
.
The QWindow class represents a window in the underlying windowing system.
A window that is supplied a parent becomes a native child window of their parent window.
An application will typically use QWidget or QQuickView for its UI, and not QWindow directly. Still, it is possible to render directly to a QWindow with QBackingStore or QOpenGLContext, when wanting to keep dependencies to a minimum or when wanting to use OpenGL directly. The Raster Window Example and OpenGL Window Example are useful reference examples for how to render to a QWindow using either approach.
sourcepub unsafe fn opacity(&self) -> c_double
pub unsafe fn opacity(&self) -> c_double
This property holds the opacity of the window in the windowing system.
Calls C++ function: double QWindow::opacity() const
.
This property holds the opacity of the window in the windowing system.
If the windowing system supports window opacity, this can be used to fade the window in and out, or to make it semitransparent.
A value of 1.0 or above is treated as fully opaque, whereas a value of 0.0 or below is treated as fully transparent. Values inbetween represent varying levels of translucency between the two extremes.
The default value is 1.0.
This property was introduced in Qt 5.1.
Access functions:
qreal | opacity() const |
void | setOpacity(qreal level) |
Notifier signal:
void | opacityChanged(qreal opacity) |
sourcepub unsafe fn parent_1a(&self, mode: AncestorMode) -> QPtr<QWindow>
pub unsafe fn parent_1a(&self, mode: AncestorMode) -> QPtr<QWindow>
Returns the parent window, if any.
Calls C++ function: QWindow* QWindow::parent(QWindow::AncestorMode mode) const
.
Returns the parent window, if any.
If mode is IncludeTransients, then the transient parent is returned if there is no parent.
A window without a parent is known as a top level window.
This function was introduced in Qt 5.9.
See also setParent().
sourcepub unsafe fn parent_0a(&self) -> QPtr<QWindow>
pub unsafe fn parent_0a(&self) -> QPtr<QWindow>
Returns the parent window, if any.
Calls C++ function: QWindow* QWindow::parent() const
.
Returns the parent window, if any.
A window without a parent is known as a top level window.
sourcepub unsafe fn position(&self) -> CppBox<QPoint>
pub unsafe fn position(&self) -> CppBox<QPoint>
Returns the position of the window on the desktop excluding any window frame
Calls C++ function: QPoint QWindow::position() const
.
Returns the position of the window on the desktop excluding any window frame
See also setPosition().
sourcepub unsafe fn qt_metacall(
&self,
arg1: Call,
arg2: c_int,
arg3: *mut *mut c_void
) -> c_int
pub unsafe fn qt_metacall( &self, arg1: Call, arg2: c_int, arg3: *mut *mut c_void ) -> c_int
Calls C++ function: virtual int QWindow::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3)
.
sourcepub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void
pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void
Calls C++ function: virtual void* QWindow::qt_metacast(const char* arg1)
.
sourcepub unsafe fn raise(&self)
pub unsafe fn raise(&self)
Raise the window in the windowing system.
Calls C++ function: [slot] void QWindow::raise()
.
Raise the window in the windowing system.
Requests that the window be raised to appear above other windows.
sourcepub unsafe fn report_content_orientation_change(
&self,
orientation: ScreenOrientation
)
pub unsafe fn report_content_orientation_change( &self, orientation: ScreenOrientation )
This property holds the orientation of the window's contents
Calls C++ function: void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation)
.
This property holds the orientation of the window’s contents
This is a hint to the window manager in case it needs to display additional content like popups, dialogs, status bars, or similar in relation to the window.
The recommended orientation is QScreen::orientation() but an application doesn't have to support all possible orientations, and thus can opt to ignore the current screen orientation.
The difference between the window and the content orientation determines how much to rotate the content by. QScreen::angleBetween(), QScreen::transformBetween(), and QScreen::mapBetween() can be used to compute the necessary transform.
The default value is Qt::PrimaryOrientation
Access functions:
Qt::ScreenOrientation | contentOrientation() const |
void | reportContentOrientationChange(Qt::ScreenOrientation orientation) |
Notifier signal:
void | contentOrientationChanged(Qt::ScreenOrientation orientation) |
sourcepub unsafe fn request_activate(&self)
pub unsafe fn request_activate(&self)
Requests the window to be activated, i.e. receive keyboard focus.
Calls C++ function: [slot] void QWindow::requestActivate()
.
Requests the window to be activated, i.e. receive keyboard focus.
See also isActive(), QGuiApplication::focusWindow(), and QWindowsWindowFunctions::setWindowActivationBehavior().
sourcepub unsafe fn request_update(&self)
pub unsafe fn request_update(&self)
Schedules a QEvent::UpdateRequest event to be delivered to this window.
Calls C++ function: [slot] void QWindow::requestUpdate()
.
Schedules a QEvent::UpdateRequest event to be delivered to this window.
The event is delivered in sync with the display vsync on platforms where this is possible. Otherwise, the event is delivered after a delay of 5 ms. The additional time is there to give the event loop a bit of idle time to gather system events, and can be overridden using the QT_QPA_UPDATE_IDLE_TIME environment variable.
When driving animations, this function should be called once after drawing has completed. Calling this function multiple times will result in a single event being delivered to the window.
Subclasses of QWindow should reimplement event(), intercept the event and call the application's rendering code, then call the base class implementation.
Note: The subclass' reimplementation of event() must invoke the base class implementation, unless it is absolutely sure that the event does not need to be handled by the base class. For example, the default implementation of this function relies on QEvent::Timer events. Filtering them away would therefore break the delivery of the update events.
This function was introduced in Qt 5.5.
sourcepub unsafe fn requested_format(&self) -> CppBox<QSurfaceFormat>
pub unsafe fn requested_format(&self) -> CppBox<QSurfaceFormat>
Returns the requested surface format of this window.
Calls C++ function: QSurfaceFormat QWindow::requestedFormat() const
.
sourcepub unsafe fn resize_1a(&self, new_size: impl CastInto<Ref<QSize>>)
pub unsafe fn resize_1a(&self, new_size: impl CastInto<Ref<QSize>>)
set the size of the window, excluding any window frame, to newSize
Calls C++ function: void QWindow::resize(const QSize& newSize)
.
sourcepub unsafe fn resize_2a(&self, w: c_int, h: c_int)
pub unsafe fn resize_2a(&self, w: c_int, h: c_int)
set the size of the window, excluding any window frame, to a QSize constructed from width w and height h
Calls C++ function: void QWindow::resize(int w, int h)
.
sourcepub unsafe fn screen(&self) -> QPtr<QScreen>
pub unsafe fn screen(&self) -> QPtr<QScreen>
Returns the screen on which the window is shown, or null if there is none.
Calls C++ function: QScreen* QWindow::screen() const
.
Returns the screen on which the window is shown, or null if there is none.
For child windows, this returns the screen of the corresponding top level window.
See also setScreen() and QScreen::virtualSiblings().
sourcepub unsafe fn set_base_size(&self, size: impl CastInto<Ref<QSize>>)
pub unsafe fn set_base_size(&self, size: impl CastInto<Ref<QSize>>)
Sets the base size of the window.
Calls C++ function: void QWindow::setBaseSize(const QSize& size)
.
Sets the base size of the window.
The base size is used to calculate a proper window size if the window defines sizeIncrement().
See also setMinimumSize(), setMaximumSize(), setSizeIncrement(), and baseSize().
sourcepub unsafe fn set_cursor(&self, arg1: impl CastInto<Ref<QCursor>>)
pub unsafe fn set_cursor(&self, arg1: impl CastInto<Ref<QCursor>>)
set the cursor shape for this window
Calls C++ function: void QWindow::setCursor(const QCursor& arg1)
.
set the cursor shape for this window
The mouse cursor will assume this shape when it is over this window, unless an override cursor is set. See the list of predefined cursor objects for a range of useful shapes.
If no cursor has been set, or after a call to unsetCursor(), the parent window's cursor is used.
By default, the cursor has the Qt::ArrowCursor shape.
Some underlying window implementations will reset the cursor if it leaves a window even if the mouse is grabbed. If you want to have a cursor set for all windows, even when outside the window, consider QGuiApplication::setOverrideCursor().
See also cursor() and QGuiApplication::setOverrideCursor().
sourcepub unsafe fn set_file_path(&self, file_path: impl CastInto<Ref<QString>>)
pub unsafe fn set_file_path(&self, file_path: impl CastInto<Ref<QString>>)
set the file name this window is representing.
Calls C++ function: void QWindow::setFilePath(const QString& filePath)
.
set the file name this window is representing.
The windowing system might use filePath to display the path of the document this window is representing in the tile bar.
See also filePath().
sourcepub unsafe fn set_flag_2a(&self, arg1: WindowType, on: bool)
pub unsafe fn set_flag_2a(&self, arg1: WindowType, on: bool)
Sets the window flag flag on this window if on is true; otherwise clears the flag.
Calls C++ function: void QWindow::setFlag(Qt::WindowType arg1, bool on = …)
.
sourcepub unsafe fn set_flag_1a(&self, arg1: WindowType)
pub unsafe fn set_flag_1a(&self, arg1: WindowType)
Sets the window flag flag on this window if on is true; otherwise clears the flag.
Calls C++ function: void QWindow::setFlag(Qt::WindowType arg1)
.
sourcepub unsafe fn set_flags(&self, flags: QFlags<WindowType>)
pub unsafe fn set_flags(&self, flags: QFlags<WindowType>)
This property holds the window flags of the window
Calls C++ function: void QWindow::setFlags(QFlags<Qt::WindowType> flags)
.
This property holds the window flags of the window
The window flags control the window's appearance in the windowing system, whether it's a dialog, popup, or a regular window, and whether it should have a title bar, etc.
The actual window flags might differ from the flags set with setFlags() if the requested flags could not be fulfilled.
Access functions:
Qt::WindowFlags | flags() const |
void | setFlags(Qt::WindowFlags flags) |
See also setFlag().
sourcepub unsafe fn set_format(&self, format: impl CastInto<Ref<QSurfaceFormat>>)
pub unsafe fn set_format(&self, format: impl CastInto<Ref<QSurfaceFormat>>)
Sets the window's surface format.
Calls C++ function: void QWindow::setFormat(const QSurfaceFormat& format)
.
Sets the window’s surface format.
The format determines properties such as color depth, alpha, depth and stencil buffer size, etc. For example, to give a window a transparent background (provided that the window system supports compositing, and provided that other content in the window does not make it opaque again):
QSurfaceFormat format; format.setAlphaBufferSize(8); window.setFormat(format);
The surface format will be resolved in the create() function. Calling this function after create() has been called will not re-resolve the surface format of the native surface.
When the format is not explicitly set via this function, the format returned by QSurfaceFormat::defaultFormat() will be used. This means that when having multiple windows, individual calls to this function can be replaced by one single call to QSurfaceFormat::setDefaultFormat() before creating the first window.
See also format(), create(), destroy(), and QSurfaceFormat::setDefaultFormat().
sourcepub unsafe fn set_frame_position(&self, point: impl CastInto<Ref<QPoint>>)
pub unsafe fn set_frame_position(&self, point: impl CastInto<Ref<QPoint>>)
Sets the upper left position of the window (point) including its window frame.
Calls C++ function: void QWindow::setFramePosition(const QPoint& point)
.
Sets the upper left position of the window (point) including its window frame.
The position is in relation to the virtualGeometry() of its screen.
See also framePosition(), setGeometry(), and frameGeometry().
sourcepub unsafe fn set_geometry_4a(
&self,
posx: c_int,
posy: c_int,
w: c_int,
h: c_int
)
pub unsafe fn set_geometry_4a( &self, posx: c_int, posy: c_int, w: c_int, h: c_int )
Sets the geometry of the window, excluding its window frame, to a rectangle constructed from posx, posy, w and h.
Calls C++ function: void QWindow::setGeometry(int posx, int posy, int w, int h)
.
Sets the geometry of the window, excluding its window frame, to a rectangle constructed from posx, posy, w and h.
The geometry is in relation to the virtualGeometry() of its screen.
See also geometry().
sourcepub unsafe fn set_geometry_1a(&self, rect: impl CastInto<Ref<QRect>>)
pub unsafe fn set_geometry_1a(&self, rect: impl CastInto<Ref<QRect>>)
Sets the geometry of the window, excluding its window frame, to rect.
Calls C++ function: void QWindow::setGeometry(const QRect& rect)
.
Sets the geometry of the window, excluding its window frame, to rect.
The geometry is in relation to the virtualGeometry() of its screen.
See also geometry().
sourcepub unsafe fn set_height(&self, arg: c_int)
pub unsafe fn set_height(&self, arg: c_int)
This property holds the height of the window's geometry
Calls C++ function: [slot] void QWindow::setHeight(int arg)
.
This property holds the height of the window’s geometry
Access functions:
int | height() const |
void | setHeight(int arg) |
Notifier signal:
void | heightChanged(int arg) |
sourcepub unsafe fn set_icon(&self, icon: impl CastInto<Ref<QIcon>>)
pub unsafe fn set_icon(&self, icon: impl CastInto<Ref<QIcon>>)
Sets the window's icon in the windowing system
Calls C++ function: void QWindow::setIcon(const QIcon& icon)
.
Sets the window’s icon in the windowing system
The window icon might be used by the windowing system for example to decorate the window, and/or in the task switcher.
See also icon().
sourcepub unsafe fn set_keyboard_grab_enabled(&self, grab: bool) -> bool
pub unsafe fn set_keyboard_grab_enabled(&self, grab: bool) -> bool
Sets whether keyboard grab should be enabled or not (grab).
Calls C++ function: bool QWindow::setKeyboardGrabEnabled(bool grab)
.
Sets whether keyboard grab should be enabled or not (grab).
If the return value is true, the window receives all key events until setKeyboardGrabEnabled(false) is called; other windows get no key events at all. Mouse events are not affected. Use setMouseGrabEnabled() if you want to grab that.
See also setMouseGrabEnabled().
sourcepub unsafe fn set_mask(&self, region: impl CastInto<Ref<QRegion>>)
pub unsafe fn set_mask(&self, region: impl CastInto<Ref<QRegion>>)
Sets the mask of the window.
Calls C++ function: void QWindow::setMask(const QRegion& region)
.
Sets the mask of the window.
The mask is a hint to the windowing system that the application does not want to receive mouse or touch input outside the given region.
The window manager may or may not choose to display any areas of the window not included in the mask, thus it is the application's responsibility to clear to transparent the areas that are not part of the mask.
Setting the mask before the window has been created has no effect.
See also mask().
sourcepub unsafe fn set_maximum_height(&self, h: c_int)
pub unsafe fn set_maximum_height(&self, h: c_int)
This property holds the maximum height of the window's geometry
Calls C++ function: [slot] void QWindow::setMaximumHeight(int h)
.
This property holds the maximum height of the window’s geometry
Access functions:
int | maximumHeight() const |
void | setMaximumHeight(int h) |
Notifier signal:
void | maximumHeightChanged(int arg) |
sourcepub unsafe fn set_maximum_size(&self, size: impl CastInto<Ref<QSize>>)
pub unsafe fn set_maximum_size(&self, size: impl CastInto<Ref<QSize>>)
Sets the maximum size of the window.
Calls C++ function: void QWindow::setMaximumSize(const QSize& size)
.
Sets the maximum size of the window.
This is a hint to the window manager to prevent resizing above the specified size.
See also setMinimumSize() and maximumSize().
sourcepub unsafe fn set_maximum_width(&self, w: c_int)
pub unsafe fn set_maximum_width(&self, w: c_int)
This property holds the maximum width of the window's geometry
Calls C++ function: [slot] void QWindow::setMaximumWidth(int w)
.
This property holds the maximum width of the window’s geometry
Access functions:
int | maximumWidth() const |
void | setMaximumWidth(int w) |
Notifier signal:
void | maximumWidthChanged(int arg) |
sourcepub unsafe fn set_minimum_height(&self, h: c_int)
pub unsafe fn set_minimum_height(&self, h: c_int)
This property holds the minimum height of the window's geometry
Calls C++ function: [slot] void QWindow::setMinimumHeight(int h)
.
This property holds the minimum height of the window’s geometry
Access functions:
int | minimumHeight() const |
void | setMinimumHeight(int h) |
Notifier signal:
void | minimumHeightChanged(int arg) |
sourcepub unsafe fn set_minimum_size(&self, size: impl CastInto<Ref<QSize>>)
pub unsafe fn set_minimum_size(&self, size: impl CastInto<Ref<QSize>>)
Sets the minimum size of the window.
Calls C++ function: void QWindow::setMinimumSize(const QSize& size)
.
Sets the minimum size of the window.
This is a hint to the window manager to prevent resizing below the specified size.
See also setMaximumSize() and minimumSize().
sourcepub unsafe fn set_minimum_width(&self, w: c_int)
pub unsafe fn set_minimum_width(&self, w: c_int)
This property holds the minimum width of the window's geometry
Calls C++ function: [slot] void QWindow::setMinimumWidth(int w)
.
This property holds the minimum width of the window’s geometry
Access functions:
int | minimumWidth() const |
void | setMinimumWidth(int w) |
Notifier signal:
void | minimumWidthChanged(int arg) |
sourcepub unsafe fn set_modality(&self, modality: WindowModality)
pub unsafe fn set_modality(&self, modality: WindowModality)
This property holds the modality of the window
Calls C++ function: void QWindow::setModality(Qt::WindowModality modality)
.
This property holds the modality of the window
A modal window prevents other windows from receiving input events. Qt supports two types of modality: Qt::WindowModal and Qt::ApplicationModal.
By default, this property is Qt::NonModal
Access functions:
Qt::WindowModality | modality() const |
void | setModality(Qt::WindowModality modality) |
Notifier signal:
void | modalityChanged(Qt::WindowModality modality) |
See also Qt::WindowModality.
sourcepub unsafe fn set_mouse_grab_enabled(&self, grab: bool) -> bool
pub unsafe fn set_mouse_grab_enabled(&self, grab: bool) -> bool
Sets whether mouse grab should be enabled or not (grab).
Calls C++ function: bool QWindow::setMouseGrabEnabled(bool grab)
.
Sets whether mouse grab should be enabled or not (grab).
If the return value is true, the window receives all mouse events until setMouseGrabEnabled(false) is called; other windows get no mouse events at all. Keyboard events are not affected. Use setKeyboardGrabEnabled() if you want to grab that.
See also setKeyboardGrabEnabled().
sourcepub unsafe fn set_opacity(&self, level: c_double)
pub unsafe fn set_opacity(&self, level: c_double)
This property holds the opacity of the window in the windowing system.
Calls C++ function: void QWindow::setOpacity(double level)
.
This property holds the opacity of the window in the windowing system.
If the windowing system supports window opacity, this can be used to fade the window in and out, or to make it semitransparent.
A value of 1.0 or above is treated as fully opaque, whereas a value of 0.0 or below is treated as fully transparent. Values inbetween represent varying levels of translucency between the two extremes.
The default value is 1.0.
This property was introduced in Qt 5.1.
Access functions:
qreal | opacity() const |
void | setOpacity(qreal level) |
Notifier signal:
void | opacityChanged(qreal opacity) |
sourcepub unsafe fn set_parent(&self, parent: impl CastInto<Ptr<QWindow>>)
pub unsafe fn set_parent(&self, parent: impl CastInto<Ptr<QWindow>>)
Sets the parent Window. This will lead to the windowing system managing the clip of the window, so it will be clipped to the parent window.
Calls C++ function: void QWindow::setParent(QWindow* parent)
.
Sets the parent Window. This will lead to the windowing system managing the clip of the window, so it will be clipped to the parent window.
Setting parent to be 0 will make the window become a top level window.
If parent is a window created by fromWinId(), then the current window will be embedded inside parent, if the platform supports it.
See also parent().
sourcepub unsafe fn set_position_1a(&self, pt: impl CastInto<Ref<QPoint>>)
pub unsafe fn set_position_1a(&self, pt: impl CastInto<Ref<QPoint>>)
set the position of the window on the desktop to pt
Calls C++ function: void QWindow::setPosition(const QPoint& pt)
.
set the position of the window on the desktop to pt
The position is in relation to the virtualGeometry() of its screen.
See also position().
sourcepub unsafe fn set_position_2a(&self, posx: c_int, posy: c_int)
pub unsafe fn set_position_2a(&self, posx: c_int, posy: c_int)
set the position of the window on the desktop to posx, posy
Calls C++ function: void QWindow::setPosition(int posx, int posy)
.
set the position of the window on the desktop to posx, posy
The position is in relation to the virtualGeometry() of its screen.
See also position().
sourcepub unsafe fn set_screen(&self, screen: impl CastInto<Ptr<QScreen>>)
pub unsafe fn set_screen(&self, screen: impl CastInto<Ptr<QScreen>>)
Sets the screen on which the window should be shown.
Calls C++ function: void QWindow::setScreen(QScreen* screen)
.
Sets the screen on which the window should be shown.
If the window has been created, it will be recreated on the newScreen.
Note: If the screen is part of a virtual desktop of multiple screens, the window will not move automatically to newScreen. To place the window relative to the screen, use the screen's topLeft() position.
This function only works for top level windows.
See also screen() and QScreen::virtualSiblings().
sourcepub unsafe fn set_size_increment(&self, size: impl CastInto<Ref<QSize>>)
pub unsafe fn set_size_increment(&self, size: impl CastInto<Ref<QSize>>)
Sets the size increment (size) of the window.
Calls C++ function: void QWindow::setSizeIncrement(const QSize& size)
.
Sets the size increment (size) of the window.
When the user resizes the window, the size will move in steps of sizeIncrement().width() pixels horizontally and sizeIncrement().height() pixels vertically, with baseSize() as the basis.
By default, this property contains a size with zero width and height.
The windowing system might not support size increments.
See also sizeIncrement(), setBaseSize(), setMinimumSize(), and setMaximumSize().
sourcepub unsafe fn set_surface_type(&self, surface_type: SurfaceType)
pub unsafe fn set_surface_type(&self, surface_type: SurfaceType)
Sets the surfaceType of the window.
Calls C++ function: void QWindow::setSurfaceType(QSurface::SurfaceType surfaceType)
.
Sets the surfaceType of the window.
Specifies whether the window is meant for raster rendering with QBackingStore, or OpenGL rendering with QOpenGLContext.
The surfaceType will be used when the native surface is created in the create() function. Calling this function after the native surface has been created requires calling destroy() and create() to release the old native surface and create a new one.
See also surfaceType(), QBackingStore, QOpenGLContext, create(), and destroy().
sourcepub unsafe fn set_title(&self, arg1: impl CastInto<Ref<QString>>)
pub unsafe fn set_title(&self, arg1: impl CastInto<Ref<QString>>)
This property holds the window's title in the windowing system
Calls C++ function: [slot] void QWindow::setTitle(const QString& arg1)
.
This property holds the window’s title in the windowing system
The window title might appear in the title area of the window decorations, depending on the windowing system and the window flags. It might also be used by the windowing system to identify the window in other contexts, such as in the task switcher.
Access functions:
QString | title() const |
void | setTitle(const QString &) |
Notifier signal:
void | windowTitleChanged(const QString &title) |
See also flags().
sourcepub unsafe fn set_transient_parent(&self, parent: impl CastInto<Ptr<QWindow>>)
pub unsafe fn set_transient_parent(&self, parent: impl CastInto<Ptr<QWindow>>)
Sets the transient parent
Calls C++ function: void QWindow::setTransientParent(QWindow* parent)
.
Sets the transient parent
This is a hint to the window manager that this window is a dialog or pop-up on behalf of the given window.
In order to cause the window to be centered above its transient parent by default, depending on the window manager, it may also be necessary to call setFlags() with a suitable Qt::WindowType (such as Qt::Dialog
).
See also transientParent() and parent().
sourcepub unsafe fn set_visibility(&self, v: Visibility)
pub unsafe fn set_visibility(&self, v: Visibility)
This property holds the screen-occupation state of the window
Calls C++ function: void QWindow::setVisibility(QWindow::Visibility v)
.
This property holds the screen-occupation state of the window
Visibility is whether the window should appear in the windowing system as normal, minimized, maximized, fullscreen or hidden.
To set the visibility to AutomaticVisibility means to give the window a default visible state, which might be fullscreen or windowed depending on the platform. When reading the visibility property you will always get the actual state, never AutomaticVisibility.
This property was introduced in Qt 5.1.
Access functions:
Visibility | visibility() const |
void | setVisibility(Visibility v) |
Notifier signal:
void | visibilityChanged(QWindow::Visibility visibility) |
sourcepub unsafe fn set_visible(&self, visible: bool)
pub unsafe fn set_visible(&self, visible: bool)
This property holds whether the window is visible or not
Calls C++ function: [slot] void QWindow::setVisible(bool visible)
.
This property holds whether the window is visible or not
This property controls the visibility of the window in the windowing system.
By default, the window is not visible, you must call setVisible(true), or show() or similar to make it visible.
Access functions:
bool | isVisible() const |
void | setVisible(bool visible) |
Notifier signal:
void | visibleChanged(bool arg) |
See also show().
sourcepub unsafe fn set_width(&self, arg: c_int)
pub unsafe fn set_width(&self, arg: c_int)
This property holds the width of the window's geometry
Calls C++ function: [slot] void QWindow::setWidth(int arg)
.
This property holds the width of the window’s geometry
Access functions:
int | width() const |
void | setWidth(int arg) |
Notifier signal:
void | widthChanged(int arg) |
sourcepub unsafe fn set_window_state(&self, state: WindowState)
pub unsafe fn set_window_state(&self, state: WindowState)
set the screen-occupation state of the window
Calls C++ function: void QWindow::setWindowState(Qt::WindowState state)
.
set the screen-occupation state of the window
The window state represents whether the window appears in the windowing system as maximized, minimized, fullscreen, or normal.
The enum value Qt::WindowActive is not an accepted parameter.
See also windowState(), showNormal(), showFullScreen(), showMinimized(), and showMaximized().
sourcepub unsafe fn set_window_states(&self, states: QFlags<WindowState>)
Available on cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn set_window_states(&self, states: QFlags<WindowState>)
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.set the screen-occupation state of the window
Calls C++ function: void QWindow::setWindowStates(QFlags<Qt::WindowState> states)
.
set the screen-occupation state of the window
The window state represents whether the window appears in the windowing system as maximized, minimized and/or fullscreen.
The window can be in a combination of several states. For example, if the window is both minimized and maximized, the window will appear minimized, but clicking on the task bar entry will restore it to the maximized state.
The enum value Qt::WindowActive should not be set.
This function was introduced in Qt 5.10.
See also windowStates(), showNormal(), showFullScreen(), showMinimized(), and showMaximized().
sourcepub unsafe fn set_x(&self, arg: c_int)
pub unsafe fn set_x(&self, arg: c_int)
This property holds the x position of the window's geometry
Calls C++ function: [slot] void QWindow::setX(int arg)
.
This property holds the x position of the window’s geometry
Access functions:
int | x() const |
void | setX(int arg) |
Notifier signal:
void | xChanged(int arg) |
sourcepub unsafe fn set_y(&self, arg: c_int)
pub unsafe fn set_y(&self, arg: c_int)
This property holds the y position of the window's geometry
Calls C++ function: [slot] void QWindow::setY(int arg)
.
This property holds the y position of the window’s geometry
Access functions:
int | y() const |
void | setY(int arg) |
Notifier signal:
void | yChanged(int arg) |
sourcepub unsafe fn show(&self)
pub unsafe fn show(&self)
Shows the window.
Calls C++ function: [slot] void QWindow::show()
.
Shows the window.
This is equivalent to calling showFullScreen(), showMaximized(), or showNormal(), depending on the platform's default behavior for the window type and flags.
See also showFullScreen(), showMaximized(), showNormal(), hide(), QStyleHints::showIsFullScreen(), and flags().
sourcepub unsafe fn show_full_screen(&self)
pub unsafe fn show_full_screen(&self)
Shows the window as fullscreen.
Calls C++ function: [slot] void QWindow::showFullScreen()
.
Shows the window as fullscreen.
Equivalent to calling setWindowState(Qt::WindowFullScreen) and then setVisible(true).
See also setWindowState() and setVisible().
sourcepub unsafe fn show_maximized(&self)
pub unsafe fn show_maximized(&self)
Shows the window as maximized.
Calls C++ function: [slot] void QWindow::showMaximized()
.
Shows the window as maximized.
Equivalent to calling setWindowState(Qt::WindowMaximized) and then setVisible(true).
See also setWindowState() and setVisible().
sourcepub unsafe fn show_minimized(&self)
pub unsafe fn show_minimized(&self)
Shows the window as minimized.
Calls C++ function: [slot] void QWindow::showMinimized()
.
Shows the window as minimized.
Equivalent to calling setWindowState(Qt::WindowMinimized) and then setVisible(true).
See also setWindowState() and setVisible().
sourcepub unsafe fn show_normal(&self)
pub unsafe fn show_normal(&self)
Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen.
Calls C++ function: [slot] void QWindow::showNormal()
.
Shows the window as normal, i.e. neither maximized, minimized, nor fullscreen.
Equivalent to calling setWindowState(Qt::WindowNoState) and then setVisible(true).
See also setWindowState() and setVisible().
sourcepub unsafe fn size(&self) -> CppBox<QSize>
pub unsafe fn size(&self) -> CppBox<QSize>
Reimplemented from QSurface::size().
Calls C++ function: virtual QSize QWindow::size() const
.
Reimplemented from QSurface::size().
Returns the size of the window excluding any window frame
See also resize().
sourcepub unsafe fn size_increment(&self) -> CppBox<QSize>
pub unsafe fn size_increment(&self) -> CppBox<QSize>
Returns the size increment of the window.
Calls C++ function: QSize QWindow::sizeIncrement() const
.
Returns the size increment of the window.
See also setSizeIncrement().
sourcepub unsafe fn static_meta_object() -> Ref<QMetaObject>
pub unsafe fn static_meta_object() -> Ref<QMetaObject>
Returns a reference to the staticMetaObject
field.
sourcepub unsafe fn surface_type(&self) -> SurfaceType
pub unsafe fn surface_type(&self) -> SurfaceType
Reimplemented from QSurface::surfaceType().
Calls C++ function: virtual QSurface::SurfaceType QWindow::surfaceType() const
.
Reimplemented from QSurface::surfaceType().
Returns the surface type of the window.
See also setSurfaceType().
sourcepub unsafe fn title(&self) -> CppBox<QString>
pub unsafe fn title(&self) -> CppBox<QString>
This property holds the window's title in the windowing system
Calls C++ function: QString QWindow::title() const
.
This property holds the window’s title in the windowing system
The window title might appear in the title area of the window decorations, depending on the windowing system and the window flags. It might also be used by the windowing system to identify the window in other contexts, such as in the task switcher.
Access functions:
QString | title() const |
void | setTitle(const QString &) |
Notifier signal:
void | windowTitleChanged(const QString &title) |
See also flags().
sourcepub unsafe fn tr(
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
pub unsafe fn tr( s: *const c_char, c: *const c_char, n: c_int ) -> CppBox<QString>
Calls C++ function: static QString QWindow::tr(const char* s, const char* c, int n)
.
sourcepub unsafe fn tr_utf8(
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
pub unsafe fn tr_utf8( s: *const c_char, c: *const c_char, n: c_int ) -> CppBox<QString>
Calls C++ function: static QString QWindow::trUtf8(const char* s, const char* c, int n)
.
sourcepub unsafe fn transient_parent(&self) -> QPtr<QWindow>
pub unsafe fn transient_parent(&self) -> QPtr<QWindow>
Returns the transient parent of the window.
Calls C++ function: QWindow* QWindow::transientParent() const
.
Returns the transient parent of the window.
See also setTransientParent() and parent().
sourcepub unsafe fn transient_parent_changed(
&self,
transient_parent: impl CastInto<Ptr<QWindow>>
)
Available on cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn transient_parent_changed( &self, transient_parent: impl CastInto<Ptr<QWindow>> )
cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.Calls C++ function: void QWindow::transientParentChanged(QWindow* transientParent)
.
sourcepub unsafe fn type_(&self) -> WindowType
pub unsafe fn type_(&self) -> WindowType
Returns the type of the window.
Calls C++ function: Qt::WindowType QWindow::type() const
.
sourcepub unsafe fn unset_cursor(&self)
pub unsafe fn unset_cursor(&self)
Restores the default arrow cursor for this window.
Calls C++ function: void QWindow::unsetCursor()
.
Restores the default arrow cursor for this window.
sourcepub unsafe fn visibility(&self) -> Visibility
pub unsafe fn visibility(&self) -> Visibility
This property holds the screen-occupation state of the window
Calls C++ function: QWindow::Visibility QWindow::visibility() const
.
This property holds the screen-occupation state of the window
Visibility is whether the window should appear in the windowing system as normal, minimized, maximized, fullscreen or hidden.
To set the visibility to AutomaticVisibility means to give the window a default visible state, which might be fullscreen or windowed depending on the platform. When reading the visibility property you will always get the actual state, never AutomaticVisibility.
This property was introduced in Qt 5.1.
Access functions:
Visibility | visibility() const |
void | setVisibility(Visibility v) |
Notifier signal:
void | visibilityChanged(QWindow::Visibility visibility) |
sourcepub unsafe fn width(&self) -> c_int
pub unsafe fn width(&self) -> c_int
This property holds the width of the window's geometry
Calls C++ function: int QWindow::width() const
.
This property holds the width of the window’s geometry
Access functions:
int | width() const |
void | setWidth(int arg) |
Notifier signal:
void | widthChanged(int arg) |
sourcepub unsafe fn win_id(&self) -> c_ulonglong
pub unsafe fn win_id(&self) -> c_ulonglong
Returns the window's platform id.
Calls C++ function: unsigned long long QWindow::winId() const
.
Returns the window’s platform id.
For platforms where this id might be useful, the value returned will uniquely represent the window inside the corresponding screen.
See also screen().
sourcepub unsafe fn window_state(&self) -> WindowState
pub unsafe fn window_state(&self) -> WindowState
the screen-occupation state of the window
Calls C++ function: Qt::WindowState QWindow::windowState() const
.
the screen-occupation state of the window
See also setWindowState().
sourcepub unsafe fn window_states(&self) -> QFlags<WindowState>
Available on cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.
pub unsafe fn window_states(&self) -> QFlags<WindowState>
cpp_lib_version="5.11.3"
or cpp_lib_version="5.12.2"
or cpp_lib_version="5.13.0"
or cpp_lib_version="5.14.0"
only.the screen-occupation state of the window
Calls C++ function: QFlags<Qt::WindowState> QWindow::windowStates() const
.
the screen-occupation state of the window
The window can be in a combination of several states. For example, if the window is both minimized and maximized, the window will appear minimized, but clicking on the task bar entry will restore it to the maximized state.
This function was introduced in Qt 5.10.
See also setWindowStates().
sourcepub unsafe fn x(&self) -> c_int
pub unsafe fn x(&self) -> c_int
This property holds the x position of the window's geometry
Calls C++ function: int QWindow::x() const
.
This property holds the x position of the window’s geometry
Access functions:
int | x() const |
void | setX(int arg) |
Notifier signal:
void | xChanged(int arg) |
Methods from Deref<Target = QObject>§
sourcepub unsafe fn find_child<T>(
&self,
name: &str
) -> Result<QPtr<T>, FindChildError>
pub unsafe fn find_child<T>( &self, name: &str ) -> Result<QPtr<T>, FindChildError>
Finds a child of self
with the specified object name
and casts it to type T
.
The search is performed recursively. If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct ancestors, it is undefined which one will be returned.
Returns an error if there is no child object with object name name
or
the found object cannot be cast to T
.
sourcepub fn destroyed(&self) -> Signal<(*mut QObject,)>
pub fn destroyed(&self) -> Signal<(*mut QObject,)>
This signal is emitted immediately before the object obj is destroyed, and can not be blocked.
Returns a built-in Qt signal QObject::destroyed
that can be passed to qt_core::Signal::connect
.
This signal is emitted immediately before the object obj is destroyed, and can not be blocked.
All the objects's children are destroyed immediately after this signal is emitted.
See also deleteLater() and QPointer.
sourcepub fn object_name_changed(&self) -> Signal<(*const QString,)>
pub fn object_name_changed(&self) -> Signal<(*const QString,)>
This signal is emitted after the object's name has been changed. The new object name is passed as objectName.
Returns a built-in Qt signal QObject::objectNameChanged
that can be passed to qt_core::Signal::connect
.
This signal is emitted after the object’s name has been changed. The new object name is passed as objectName.
Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.
Note: Notifier signal for property objectName.
See also QObject::objectName.
sourcepub fn slot_delete_later(&self) -> Receiver<()>
pub fn slot_delete_later(&self) -> Receiver<()>
Schedules this object for deletion.
Returns a built-in Qt slot QObject::deleteLater
that can be passed to qt_core::Signal::connect
.
Schedules this object for deletion.
The object will be deleted when control returns to the event loop. If the event loop is not running when this function is called (e.g. deleteLater() is called on an object before QCoreApplication::exec()), the object will be deleted once the event loop is started. If deleteLater() is called after the main event loop has stopped, the object will not be deleted. Since Qt 4.8, if deleteLater() is called on an object that lives in a thread with no running event loop, the object will be destroyed when the thread finishes.
Note that entering and leaving a new event loop (e.g., by opening a modal dialog) will not perform the deferred deletion; for the object to be deleted, the control must return to the event loop from which deleteLater() was called.
Note: It is safe to call this function more than once; when the first deferred deletion event is delivered, any pending events for the object are removed from the event queue.
sourcepub unsafe fn block_signals(&self, b: bool) -> bool
pub unsafe fn block_signals(&self, b: bool) -> bool
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). If block is false, no such blocking will occur.
Calls C++ function: bool QObject::blockSignals(bool b)
.
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). If block is false, no such blocking will occur.
The return value is the previous value of signalsBlocked().
Note that the destroyed() signal will be emitted even if the signals for this object have been blocked.
Signals emitted while being blocked are not buffered.
See also signalsBlocked() and QSignalBlocker.
sourcepub unsafe fn children(&self) -> Ref<QListOfQObject>
pub unsafe fn children(&self) -> Ref<QListOfQObject>
Returns a list of child objects. The QObjectList class is defined in the <QObject>
header file as the following:
Calls C++ function: const QList<QObject*>& QObject::children() const
.
Returns a list of child objects. The QObjectList class is defined in the <QObject>
header file as the following:
typedef QList<QObject*> QObjectList;
The first child added is the first object in the list and the last child added is the last object in the list, i.e. new children are appended at the end.
Note that the list order changes when QWidget children are raised or lowered. A widget that is raised becomes the last object in the list, and a widget that is lowered becomes the first object in the list.
See also findChild(), findChildren(), parent(), and setParent().
sourcepub unsafe fn delete_later(&self)
pub unsafe fn delete_later(&self)
Schedules this object for deletion.
Calls C++ function: [slot] void QObject::deleteLater()
.
Schedules this object for deletion.
The object will be deleted when control returns to the event loop. If the event loop is not running when this function is called (e.g. deleteLater() is called on an object before QCoreApplication::exec()), the object will be deleted once the event loop is started. If deleteLater() is called after the main event loop has stopped, the object will not be deleted. Since Qt 4.8, if deleteLater() is called on an object that lives in a thread with no running event loop, the object will be destroyed when the thread finishes.
Note that entering and leaving a new event loop (e.g., by opening a modal dialog) will not perform the deferred deletion; for the object to be deleted, the control must return to the event loop from which deleteLater() was called.
Note: It is safe to call this function more than once; when the first deferred deletion event is delivered, any pending events for the object are removed from the event queue.
sourcepub unsafe fn disconnect_char_q_object_char(
&self,
signal: *const i8,
receiver: impl CastInto<Ptr<QObject>>,
member: *const i8
) -> bool
pub unsafe fn disconnect_char_q_object_char( &self, signal: *const i8, receiver: impl CastInto<Ptr<QObject>>, member: *const i8 ) -> bool
This function overloads disconnect().
Calls C++ function: bool QObject::disconnect(const char* signal = …, const QObject* receiver = …, const char* member = …) const
.
This function overloads disconnect().
Disconnects signal from method of receiver.
A signal-slot connection is removed when either of the objects involved are destroyed.
Note: This function is thread-safe.
sourcepub unsafe fn disconnect_q_object_char(
&self,
receiver: impl CastInto<Ptr<QObject>>,
member: *const i8
) -> bool
pub unsafe fn disconnect_q_object_char( &self, receiver: impl CastInto<Ptr<QObject>>, member: *const i8 ) -> bool
This function overloads disconnect().
Calls C++ function: bool QObject::disconnect(const QObject* receiver, const char* member = …) const
.
This function overloads disconnect().
Disconnects all signals in this object from receiver's method.
A signal-slot connection is removed when either of the objects involved are destroyed.
sourcepub unsafe fn disconnect_char_q_object(
&self,
signal: *const i8,
receiver: impl CastInto<Ptr<QObject>>
) -> bool
pub unsafe fn disconnect_char_q_object( &self, signal: *const i8, receiver: impl CastInto<Ptr<QObject>> ) -> bool
This function overloads disconnect().
Calls C++ function: bool QObject::disconnect(const char* signal = …, const QObject* receiver = …) const
.
This function overloads disconnect().
Disconnects signal from method of receiver.
A signal-slot connection is removed when either of the objects involved are destroyed.
Note: This function is thread-safe.
sourcepub unsafe fn disconnect_char(&self, signal: *const i8) -> bool
pub unsafe fn disconnect_char(&self, signal: *const i8) -> bool
This function overloads disconnect().
Calls C++ function: bool QObject::disconnect(const char* signal = …) const
.
This function overloads disconnect().
Disconnects signal from method of receiver.
A signal-slot connection is removed when either of the objects involved are destroyed.
Note: This function is thread-safe.
sourcepub unsafe fn disconnect(&self) -> bool
pub unsafe fn disconnect(&self) -> bool
This function overloads disconnect().
Calls C++ function: bool QObject::disconnect() const
.
This function overloads disconnect().
Disconnects signal from method of receiver.
A signal-slot connection is removed when either of the objects involved are destroyed.
Note: This function is thread-safe.
sourcepub unsafe fn disconnect_q_object(
&self,
receiver: impl CastInto<Ptr<QObject>>
) -> bool
pub unsafe fn disconnect_q_object( &self, receiver: impl CastInto<Ptr<QObject>> ) -> bool
This function overloads disconnect().
Calls C++ function: bool QObject::disconnect(const QObject* receiver) const
.
This function overloads disconnect().
Disconnects all signals in this object from receiver's method.
A signal-slot connection is removed when either of the objects involved are destroyed.
sourcepub unsafe fn dump_object_info_mut(&self)
pub unsafe fn dump_object_info_mut(&self)
Dumps information about signal connections, etc. for this object to the debug output.
Calls C++ function: void QObject::dumpObjectInfo()
.
Dumps information about signal connections, etc. for this object to the debug output.
Note: before Qt 5.9, this function was not const.
See also dumpObjectTree().
sourcepub unsafe fn dump_object_info(&self)
pub unsafe fn dump_object_info(&self)
Dumps information about signal connections, etc. for this object to the debug output.
Calls C++ function: void QObject::dumpObjectInfo() const
.
Dumps information about signal connections, etc. for this object to the debug output.
Note: before Qt 5.9, this function was not const.
See also dumpObjectTree().
sourcepub unsafe fn dump_object_tree_mut(&self)
pub unsafe fn dump_object_tree_mut(&self)
Dumps a tree of children to the debug output.
Calls C++ function: void QObject::dumpObjectTree()
.
Dumps a tree of children to the debug output.
Note: before Qt 5.9, this function was not const.
See also dumpObjectInfo().
sourcepub unsafe fn dump_object_tree(&self)
pub unsafe fn dump_object_tree(&self)
Dumps a tree of children to the debug output.
Calls C++ function: void QObject::dumpObjectTree() const
.
Dumps a tree of children to the debug output.
Note: before Qt 5.9, this function was not const.
See also dumpObjectInfo().
sourcepub unsafe fn dynamic_property_names(&self) -> CppBox<QListOfQByteArray>
pub unsafe fn dynamic_property_names(&self) -> CppBox<QListOfQByteArray>
Returns the names of all properties that were dynamically added to the object using setProperty().
Calls C++ function: QList<QByteArray> QObject::dynamicPropertyNames() const
.
Returns the names of all properties that were dynamically added to the object using setProperty().
This function was introduced in Qt 4.2.
sourcepub unsafe fn eq(&self, p: impl CastInto<Ref<QPointerOfQObject>>) -> bool
pub unsafe fn eq(&self, p: impl CastInto<Ref<QPointerOfQObject>>) -> bool
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
Calls C++ function: bool operator==(QObject* o, const QPointer<QObject>& p)
.
Warning: no exact match found in C++ documentation. Below is the C++ documentation for bool operator==(QChar c1, QChar c2)
:
Returns true
if c1 and c2 are the same Unicode character; otherwise returns false
.
sourcepub unsafe fn event(&self, event: impl CastInto<Ptr<QEvent>>) -> bool
pub unsafe fn event(&self, event: impl CastInto<Ptr<QEvent>>) -> bool
This virtual function receives events to an object and should return true if the event e was recognized and processed.
Calls C++ function: virtual bool QObject::event(QEvent* event)
.
This virtual function receives events to an object and should return true if the event e was recognized and processed.
The event() function can be reimplemented to customize the behavior of an object.
Make sure you call the parent event class implementation for all the events you did not handle.
Example:
class MyClass : public QWidget { Q_OBJECT
public: MyClass(QWidget *parent = 0); ~MyClass();
bool event(QEvent* ev) { if (ev->type() == QEvent::PolishRequest) { // overwrite handling of PolishRequest if any doThings(); return true; } else if (ev->type() == QEvent::Show) { // complement handling of Show if any doThings2(); QWidget::event(ev); return true; } // Make sure the rest of events are handled return QWidget::event(ev); } };
See also installEventFilter(), timerEvent(), QCoreApplication::sendEvent(), and QCoreApplication::postEvent().
sourcepub unsafe fn event_filter(
&self,
watched: impl CastInto<Ptr<QObject>>,
event: impl CastInto<Ptr<QEvent>>
) -> bool
pub unsafe fn event_filter( &self, watched: impl CastInto<Ptr<QObject>>, event: impl CastInto<Ptr<QEvent>> ) -> bool
Filters events if this object has been installed as an event filter for the watched object.
Calls C++ function: virtual bool QObject::eventFilter(QObject* watched, QEvent* event)
.
Filters events if this object has been installed as an event filter for the watched object.
In your reimplementation of this function, if you want to filter the event out, i.e. stop it being handled further, return true; otherwise return false.
Example:
class MainWindow : public QMainWindow { public: MainWindow();
protected: bool eventFilter(QObject obj, QEvent ev);
private: QTextEdit *textEdit; };
MainWindow::MainWindow() { textEdit = new QTextEdit; setCentralWidget(textEdit);
textEdit->installEventFilter(this); }
bool MainWindow::eventFilter(QObject obj, QEvent event) { if (obj == textEdit) { if (event->type() == QEvent::KeyPress) { QKeyEvent keyEvent = static_cast<QKeyEvent>(event); qDebug() << “Ate key press” << keyEvent->key(); return true; } else { return false; } } else { // pass the event on to the parent class return QMainWindow::eventFilter(obj, event); } }
Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.
Warning: If you delete the receiver object in this function, be sure to return true. Otherwise, Qt will forward the event to the deleted object and the program might crash.
See also installEventFilter().
sourcepub unsafe fn find_child_q_object_2a(
&self,
a_name: impl CastInto<Ref<QString>>,
options: QFlags<FindChildOption>
) -> QPtr<QObject>
pub unsafe fn find_child_q_object_2a( &self, a_name: impl CastInto<Ref<QString>>, options: QFlags<FindChildOption> ) -> QPtr<QObject>
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
Calls C++ function: QObject* QObject::findChild<QObject*>(const QString& aName = …, QFlags<Qt::FindChildOption> options = …) const
.
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct ancestors, it is undefined which one will be returned. In that case, findChildren() should be used.
This example returns a child QPushButton
of parentWidget
named "button1"
, even if the button isn't a direct child of the parent:
QPushButton button = parentWidget->findChild<QPushButton >(“button1”);
This example returns a QListWidget
child of parentWidget
:
QListWidget list = parentWidget->findChild<QListWidget >();
This example returns a child QPushButton
of parentWidget
(its direct parent) named "button1"
:
QPushButton button = parentWidget->findChild<QPushButton >(“button1”, Qt::FindDirectChildrenOnly);
This example returns a QListWidget
child of parentWidget
, its direct parent:
QListWidget list = parentWidget->findChild<QListWidget >(QString(), Qt::FindDirectChildrenOnly);
See also findChildren().
sourcepub unsafe fn find_child_q_object_1a(
&self,
a_name: impl CastInto<Ref<QString>>
) -> QPtr<QObject>
pub unsafe fn find_child_q_object_1a( &self, a_name: impl CastInto<Ref<QString>> ) -> QPtr<QObject>
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
Calls C++ function: QObject* QObject::findChild<QObject*>(const QString& aName = …) const
.
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct ancestors, it is undefined which one will be returned. In that case, findChildren() should be used.
This example returns a child QPushButton
of parentWidget
named "button1"
, even if the button isn't a direct child of the parent:
QPushButton button = parentWidget->findChild<QPushButton >(“button1”);
This example returns a QListWidget
child of parentWidget
:
QListWidget list = parentWidget->findChild<QListWidget >();
This example returns a child QPushButton
of parentWidget
(its direct parent) named "button1"
:
QPushButton button = parentWidget->findChild<QPushButton >(“button1”, Qt::FindDirectChildrenOnly);
This example returns a QListWidget
child of parentWidget
, its direct parent:
QListWidget list = parentWidget->findChild<QListWidget >(QString(), Qt::FindDirectChildrenOnly);
See also findChildren().
sourcepub unsafe fn find_child_q_object_0a(&self) -> QPtr<QObject>
pub unsafe fn find_child_q_object_0a(&self) -> QPtr<QObject>
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
Calls C++ function: QObject* QObject::findChild<QObject*>() const
.
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
If there is more than one child matching the search, the most direct ancestor is returned. If there are several direct ancestors, it is undefined which one will be returned. In that case, findChildren() should be used.
This example returns a child QPushButton
of parentWidget
named "button1"
, even if the button isn't a direct child of the parent:
QPushButton button = parentWidget->findChild<QPushButton >(“button1”);
This example returns a QListWidget
child of parentWidget
:
QListWidget list = parentWidget->findChild<QListWidget >();
This example returns a child QPushButton
of parentWidget
(its direct parent) named "button1"
:
QPushButton button = parentWidget->findChild<QPushButton >(“button1”, Qt::FindDirectChildrenOnly);
This example returns a QListWidget
child of parentWidget
, its direct parent:
QListWidget list = parentWidget->findChild<QListWidget >(QString(), Qt::FindDirectChildrenOnly);
See also findChildren().
sourcepub unsafe fn find_children_q_object_q_string_q_flags_find_child_option(
&self,
a_name: impl CastInto<Ref<QString>>,
options: QFlags<FindChildOption>
) -> CppBox<QListOfQObject>
pub unsafe fn find_children_q_object_q_string_q_flags_find_child_option( &self, a_name: impl CastInto<Ref<QString>>, options: QFlags<FindChildOption> ) -> CppBox<QListOfQObject>
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QString& aName = …, QFlags<Qt::FindChildOption> options = …) const
.
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
The following example shows how to find a list of child QWidget
s of the specified parentWidget
named widgetname
:
QList<QWidget > widgets = parentWidget.findChildren<QWidget >(“widgetname”);
This example returns all QPushButton
s that are children of parentWidget
:
QList<QPushButton > allPButtons = parentWidget.findChildren<QPushButton >();
This example returns all QPushButton
s that are immediate children of parentWidget
:
QList<QPushButton > childButtons = parentWidget.findChildren<QPushButton >(QString(), Qt::FindDirectChildrenOnly);
See also findChild().
sourcepub unsafe fn find_children_q_object_q_reg_exp_q_flags_find_child_option(
&self,
re: impl CastInto<Ref<QRegExp>>,
options: QFlags<FindChildOption>
) -> CppBox<QListOfQObject>
pub unsafe fn find_children_q_object_q_reg_exp_q_flags_find_child_option( &self, re: impl CastInto<Ref<QRegExp>>, options: QFlags<FindChildOption> ) -> CppBox<QListOfQObject>
This function overloads findChildren().
Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QRegExp& re, QFlags<Qt::FindChildOption> options = …) const
.
This function overloads findChildren().
Returns the children of this object that can be cast to type T and that have names matching the regular expression regExp, or an empty list if there are no such objects. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
sourcepub unsafe fn find_children_q_object_q_regular_expression_q_flags_find_child_option(
&self,
re: impl CastInto<Ref<QRegularExpression>>,
options: QFlags<FindChildOption>
) -> CppBox<QListOfQObject>
pub unsafe fn find_children_q_object_q_regular_expression_q_flags_find_child_option( &self, re: impl CastInto<Ref<QRegularExpression>>, options: QFlags<FindChildOption> ) -> CppBox<QListOfQObject>
This function overloads findChildren().
Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QRegularExpression& re, QFlags<Qt::FindChildOption> options = …) const
.
This function overloads findChildren().
Returns the children of this object that can be cast to type T and that have names matching the regular expression re, or an empty list if there are no such objects. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
This function was introduced in Qt 5.0.
sourcepub unsafe fn find_children_q_object_q_string(
&self,
a_name: impl CastInto<Ref<QString>>
) -> CppBox<QListOfQObject>
pub unsafe fn find_children_q_object_q_string( &self, a_name: impl CastInto<Ref<QString>> ) -> CppBox<QListOfQObject>
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QString& aName = …) const
.
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
The following example shows how to find a list of child QWidget
s of the specified parentWidget
named widgetname
:
QList<QWidget > widgets = parentWidget.findChildren<QWidget >(“widgetname”);
This example returns all QPushButton
s that are children of parentWidget
:
QList<QPushButton > allPButtons = parentWidget.findChildren<QPushButton >();
This example returns all QPushButton
s that are immediate children of parentWidget
:
QList<QPushButton > childButtons = parentWidget.findChildren<QPushButton >(QString(), Qt::FindDirectChildrenOnly);
See also findChild().
sourcepub unsafe fn find_children_q_object(&self) -> CppBox<QListOfQObject>
pub unsafe fn find_children_q_object(&self) -> CppBox<QListOfQObject>
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>() const
.
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. Omitting the name argument causes all object names to be matched. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
The following example shows how to find a list of child QWidget
s of the specified parentWidget
named widgetname
:
QList<QWidget > widgets = parentWidget.findChildren<QWidget >(“widgetname”);
This example returns all QPushButton
s that are children of parentWidget
:
QList<QPushButton > allPButtons = parentWidget.findChildren<QPushButton >();
This example returns all QPushButton
s that are immediate children of parentWidget
:
QList<QPushButton > childButtons = parentWidget.findChildren<QPushButton >(QString(), Qt::FindDirectChildrenOnly);
See also findChild().
sourcepub unsafe fn find_children_q_object_q_reg_exp(
&self,
re: impl CastInto<Ref<QRegExp>>
) -> CppBox<QListOfQObject>
pub unsafe fn find_children_q_object_q_reg_exp( &self, re: impl CastInto<Ref<QRegExp>> ) -> CppBox<QListOfQObject>
This function overloads findChildren().
Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QRegExp& re) const
.
This function overloads findChildren().
Returns the children of this object that can be cast to type T and that have names matching the regular expression regExp, or an empty list if there are no such objects. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
sourcepub unsafe fn find_children_q_object_q_regular_expression(
&self,
re: impl CastInto<Ref<QRegularExpression>>
) -> CppBox<QListOfQObject>
pub unsafe fn find_children_q_object_q_regular_expression( &self, re: impl CastInto<Ref<QRegularExpression>> ) -> CppBox<QListOfQObject>
This function overloads findChildren().
Calls C++ function: QList<QObject*> QObject::findChildren<QObject*>(const QRegularExpression& re) const
.
This function overloads findChildren().
Returns the children of this object that can be cast to type T and that have names matching the regular expression re, or an empty list if there are no such objects. The search is performed recursively, unless options specifies the option FindDirectChildrenOnly.
This function was introduced in Qt 5.0.
sourcepub unsafe fn inherits(&self, classname: *const i8) -> bool
pub unsafe fn inherits(&self, classname: *const i8) -> bool
Returns true
if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false
.
Calls C++ function: bool QObject::inherits(const char* classname) const
.
Returns true
if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false
.
A class is considered to inherit itself.
Example:
QTimer *timer = new QTimer; // QTimer inherits QObject timer->inherits(“QTimer”); // returns true timer->inherits(“QObject”); // returns true timer->inherits(“QAbstractButton”); // returns false
// QVBoxLayout inherits QObject and QLayoutItem QVBoxLayout *layout = new QVBoxLayout; layout->inherits(“QObject”); // returns true layout->inherits(“QLayoutItem”); // returns true (even though QLayoutItem is not a QObject)
If you need to determine whether an object is an instance of a particular class for the purpose of casting it, consider using qobject_cast<Type *>(object) instead.
See also metaObject() and qobject_cast().
sourcepub unsafe fn install_event_filter(
&self,
filter_obj: impl CastInto<Ptr<QObject>>
)
pub unsafe fn install_event_filter( &self, filter_obj: impl CastInto<Ptr<QObject>> )
Installs an event filter filterObj on this object. For example:
Calls C++ function: void QObject::installEventFilter(QObject* filterObj)
.
Installs an event filter filterObj on this object. For example:
monitoredObj->installEventFilter(filterObj);
An event filter is an object that receives all events that are sent to this object. The filter can either stop the event or forward it to this object. The event filter filterObj receives events via its eventFilter() function. The eventFilter() function must return true if the event should be filtered, (i.e. stopped); otherwise it must return false.
If multiple event filters are installed on a single object, the filter that was installed last is activated first.
Here's a KeyPressEater
class that eats the key presses of its monitored objects:
class KeyPressEater : public QObject { Q_OBJECT ...
protected: bool eventFilter(QObject obj, QEvent event); };
bool KeyPressEater::eventFilter(QObject obj, QEvent event) { if (event->type() == QEvent::KeyPress) { QKeyEvent keyEvent = static_cast<QKeyEvent >(event); qDebug(“Ate key press %d”, keyEvent->key()); return true; } else { // standard event processing return QObject::eventFilter(obj, event); } }
And here's how to install it on two widgets:
KeyPressEater keyPressEater = new KeyPressEater(this); QPushButton pushButton = new QPushButton(this); QListView *listView = new QListView(this);
pushButton->installEventFilter(keyPressEater); listView->installEventFilter(keyPressEater);
The QShortcut class, for example, uses this technique to intercept shortcut key presses.
Warning: If you delete the receiver object in your eventFilter() function, be sure to return true. If you return false, Qt sends the event to the deleted object and the program will crash.
Note that the filtering object must be in the same thread as this object. If filterObj is in a different thread, this function does nothing. If either filterObj or this object are moved to a different thread after calling this function, the event filter will not be called until both objects have the same thread affinity again (it is not removed).
See also removeEventFilter(), eventFilter(), and event().
sourcepub unsafe fn is_widget_type(&self) -> bool
pub unsafe fn is_widget_type(&self) -> bool
Returns true
if the object is a widget; otherwise returns false
.
Calls C++ function: bool QObject::isWidgetType() const
.
Returns true
if the object is a widget; otherwise returns false
.
Calling this function is equivalent to calling inherits("QWidget")
, except that it is much faster.
sourcepub unsafe fn is_window_type(&self) -> bool
pub unsafe fn is_window_type(&self) -> bool
Returns true
if the object is a window; otherwise returns false
.
Calls C++ function: bool QObject::isWindowType() const
.
Returns true
if the object is a window; otherwise returns false
.
Calling this function is equivalent to calling inherits("QWindow")
, except that it is much faster.
sourcepub unsafe fn kill_timer(&self, id: i32)
pub unsafe fn kill_timer(&self, id: i32)
Kills the timer with timer identifier, id.
Calls C++ function: void QObject::killTimer(int id)
.
Kills the timer with timer identifier, id.
The timer identifier is returned by startTimer() when a timer event is started.
See also timerEvent() and startTimer().
sourcepub unsafe fn meta_object(&self) -> Ptr<QMetaObject>
pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>
Returns a pointer to the meta-object of this object.
Calls C++ function: virtual const QMetaObject* QObject::metaObject() const
.
Returns a pointer to the meta-object of this object.
A meta-object contains information about a class that inherits QObject, e.g. class name, superclass name, properties, signals and slots. Every QObject subclass that contains the Q_OBJECT macro will have a meta-object.
The meta-object information is required by the signal/slot connection mechanism and the property system. The inherits() function also makes use of the meta-object.
If you have no pointer to an actual object instance but still want to access the meta-object of a class, you can use staticMetaObject.
Example:
QObject *obj = new QPushButton; obj->metaObject()->className(); // returns “QPushButton”
QPushButton::staticMetaObject.className(); // returns “QPushButton”
See also staticMetaObject.
sourcepub unsafe fn move_to_thread(&self, thread: impl CastInto<Ptr<QThread>>)
pub unsafe fn move_to_thread(&self, thread: impl CastInto<Ptr<QThread>>)
Changes the thread affinity for this object and its children. The object cannot be moved if it has a parent. Event processing will continue in the targetThread.
Calls C++ function: void QObject::moveToThread(QThread* thread)
.
Changes the thread affinity for this object and its children. The object cannot be moved if it has a parent. Event processing will continue in the targetThread.
To move an object to the main thread, use QApplication::instance() to retrieve a pointer to the current application, and then use QApplication::thread() to retrieve the thread in which the application lives. For example:
myObject->moveToThread(QApplication::instance()->thread());
If targetThread is zero, all event processing for this object and its children stops.
Note that all active timers for the object will be reset. The timers are first stopped in the current thread and restarted (with the same interval) in the targetThread. As a result, constantly moving an object between threads can postpone timer events indefinitely.
A QEvent::ThreadChange event is sent to this object just before the thread affinity is changed. You can handle this event to perform any special processing. Note that any new events that are posted to this object will be handled in the targetThread.
Warning: This function is not thread-safe; the current thread must be same as the current thread affinity. In other words, this function can only "push" an object from the current thread to another thread, it cannot "pull" an object from any arbitrary thread to the current thread.
See also thread().
sourcepub unsafe fn object_name(&self) -> CppBox<QString>
pub unsafe fn object_name(&self) -> CppBox<QString>
This property holds the name of this object
Calls C++ function: QString QObject::objectName() const
.
This property holds the name of this object
You can find an object by name (and type) using findChild(). You can find a set of objects with findChildren().
qDebug(“MyClass::setPrecision(): (%s) invalid precision %f”, qPrintable(objectName()), newPrecision);
By default, this property contains an empty string.
Access functions:
QString | objectName() const |
void | setObjectName(const QString &name) |
Notifier signal:
void | objectNameChanged(const QString &objectName) | [see note below] |
Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.
See also metaObject() and QMetaObject::className().
sourcepub unsafe fn parent(&self) -> QPtr<QObject>
pub unsafe fn parent(&self) -> QPtr<QObject>
Returns a pointer to the parent object.
Calls C++ function: QObject* QObject::parent() const
.
sourcepub unsafe fn property(&self, name: *const i8) -> CppBox<QVariant>
pub unsafe fn property(&self, name: *const i8) -> CppBox<QVariant>
Returns the value of the object's name property.
Calls C++ function: QVariant QObject::property(const char* name) const
.
Returns the value of the object’s name property.
If no such property exists, the returned variant is invalid.
Information about all available properties is provided through the metaObject() and dynamicPropertyNames().
See also setProperty(), QVariant::isValid(), metaObject(), and dynamicPropertyNames().
sourcepub unsafe fn qt_metacall(
&self,
arg1: Call,
arg2: i32,
arg3: *mut *mut c_void
) -> i32
pub unsafe fn qt_metacall( &self, arg1: Call, arg2: i32, arg3: *mut *mut c_void ) -> i32
Calls C++ function: virtual int QObject::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3)
.
sourcepub unsafe fn qt_metacast(&self, arg1: *const i8) -> *mut c_void
pub unsafe fn qt_metacast(&self, arg1: *const i8) -> *mut c_void
Calls C++ function: virtual void* QObject::qt_metacast(const char* arg1)
.
sourcepub unsafe fn remove_event_filter(&self, obj: impl CastInto<Ptr<QObject>>)
pub unsafe fn remove_event_filter(&self, obj: impl CastInto<Ptr<QObject>>)
Removes an event filter object obj from this object. The request is ignored if such an event filter has not been installed.
Calls C++ function: void QObject::removeEventFilter(QObject* obj)
.
Removes an event filter object obj from this object. The request is ignored if such an event filter has not been installed.
All event filters for this object are automatically removed when this object is destroyed.
It is always safe to remove an event filter, even during event filter activation (i.e. from the eventFilter() function).
See also installEventFilter(), eventFilter(), and event().
sourcepub unsafe fn set_object_name(&self, name: impl CastInto<Ref<QString>>)
pub unsafe fn set_object_name(&self, name: impl CastInto<Ref<QString>>)
This property holds the name of this object
Calls C++ function: void QObject::setObjectName(const QString& name)
.
This property holds the name of this object
You can find an object by name (and type) using findChild(). You can find a set of objects with findChildren().
qDebug(“MyClass::setPrecision(): (%s) invalid precision %f”, qPrintable(objectName()), newPrecision);
By default, this property contains an empty string.
Access functions:
QString | objectName() const |
void | setObjectName(const QString &name) |
Notifier signal:
void | objectNameChanged(const QString &objectName) | [see note below] |
Note: This is a private signal. It can be used in signal connections but cannot be emitted by the user.
See also metaObject() and QMetaObject::className().
sourcepub unsafe fn set_parent(&self, parent: impl CastInto<Ptr<QObject>>)
pub unsafe fn set_parent(&self, parent: impl CastInto<Ptr<QObject>>)
Makes the object a child of parent.
Calls C++ function: void QObject::setParent(QObject* parent)
.
sourcepub unsafe fn set_property(
&self,
name: *const i8,
value: impl CastInto<Ref<QVariant>>
) -> bool
pub unsafe fn set_property( &self, name: *const i8, value: impl CastInto<Ref<QVariant>> ) -> bool
Sets the value of the object's name property to value.
Calls C++ function: bool QObject::setProperty(const char* name, const QVariant& value)
.
Sets the value of the object’s name property to value.
If the property is defined in the class using Q_PROPERTY then true is returned on success and false otherwise. If the property is not defined using Q_PROPERTY, and therefore not listed in the meta-object, it is added as a dynamic property and false is returned.
Information about all available properties is provided through the metaObject() and dynamicPropertyNames().
Dynamic properties can be queried again using property() and can be removed by setting the property value to an invalid QVariant. Changing the value of a dynamic property causes a QDynamicPropertyChangeEvent to be sent to the object.
Note: Dynamic properties starting with "_q_" are reserved for internal purposes.
See also property(), metaObject(), dynamicPropertyNames(), and QMetaProperty::write().
sourcepub unsafe fn signals_blocked(&self) -> bool
pub unsafe fn signals_blocked(&self) -> bool
Returns true
if signals are blocked; otherwise returns false
.
Calls C++ function: bool QObject::signalsBlocked() const
.
Returns true
if signals are blocked; otherwise returns false
.
Signals are not blocked by default.
See also blockSignals() and QSignalBlocker.
sourcepub unsafe fn start_timer_2a(&self, interval: i32, timer_type: TimerType) -> i32
pub unsafe fn start_timer_2a(&self, interval: i32, timer_type: TimerType) -> i32
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer.
Calls C++ function: int QObject::startTimer(int interval, Qt::TimerType timerType = …)
.
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer.
A timer event will occur every interval milliseconds until killTimer() is called. If interval is 0, then the timer event occurs once every time there are no more window system events to process.
The virtual timerEvent() function is called with the QTimerEvent event parameter class when a timer event occurs. Reimplement this function to get timer events.
If multiple timers are running, the QTimerEvent::timerId() can be used to find out which timer was activated.
Example:
class MyObject : public QObject { Q_OBJECT
public: MyObject(QObject *parent = 0);
protected: void timerEvent(QTimerEvent *event); };
MyObject::MyObject(QObject *parent) : QObject(parent) { startTimer(50); // 50-millisecond timer startTimer(1000); // 1-second timer startTimer(60000); // 1-minute timer
using namespace std::chrono; startTimer(milliseconds(50)); startTimer(seconds(1)); startTimer(minutes(1));
// since C++14 we can use std::chrono::duration literals, e.g.: startTimer(100ms); startTimer(5s); startTimer(2min); startTimer(1h); }
void MyObject::timerEvent(QTimerEvent *event) { qDebug() << “Timer ID:” << event->timerId(); }
Note that QTimer's accuracy depends on the underlying operating system and hardware. The timerType argument allows you to customize the accuracy of the timer. See Qt::TimerType for information on the different timer types. Most platforms support an accuracy of 20 milliseconds; some provide more. If Qt is unable to deliver the requested number of timer events, it will silently discard some.
The QTimer class provides a high-level programming interface with single-shot timers and timer signals instead of events. There is also a QBasicTimer class that is more lightweight than QTimer and less clumsy than using timer IDs directly.
See also timerEvent(), killTimer(), and QTimer::singleShot().
sourcepub unsafe fn start_timer_1a(&self, interval: i32) -> i32
pub unsafe fn start_timer_1a(&self, interval: i32) -> i32
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer.
Calls C++ function: int QObject::startTimer(int interval)
.
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer.
A timer event will occur every interval milliseconds until killTimer() is called. If interval is 0, then the timer event occurs once every time there are no more window system events to process.
The virtual timerEvent() function is called with the QTimerEvent event parameter class when a timer event occurs. Reimplement this function to get timer events.
If multiple timers are running, the QTimerEvent::timerId() can be used to find out which timer was activated.
Example:
class MyObject : public QObject { Q_OBJECT
public: MyObject(QObject *parent = 0);
protected: void timerEvent(QTimerEvent *event); };
MyObject::MyObject(QObject *parent) : QObject(parent) { startTimer(50); // 50-millisecond timer startTimer(1000); // 1-second timer startTimer(60000); // 1-minute timer
using namespace std::chrono; startTimer(milliseconds(50)); startTimer(seconds(1)); startTimer(minutes(1));
// since C++14 we can use std::chrono::duration literals, e.g.: startTimer(100ms); startTimer(5s); startTimer(2min); startTimer(1h); }
void MyObject::timerEvent(QTimerEvent *event) { qDebug() << “Timer ID:” << event->timerId(); }
Note that QTimer's accuracy depends on the underlying operating system and hardware. The timerType argument allows you to customize the accuracy of the timer. See Qt::TimerType for information on the different timer types. Most platforms support an accuracy of 20 milliseconds; some provide more. If Qt is unable to deliver the requested number of timer events, it will silently discard some.
The QTimer class provides a high-level programming interface with single-shot timers and timer signals instead of events. There is also a QBasicTimer class that is more lightweight than QTimer and less clumsy than using timer IDs directly.
See also timerEvent(), killTimer(), and QTimer::singleShot().
sourcepub unsafe fn thread(&self) -> QPtr<QThread>
pub unsafe fn thread(&self) -> QPtr<QThread>
Returns the thread in which the object lives.
Calls C++ function: QThread* QObject::thread() const
.
Returns the thread in which the object lives.
See also moveToThread().
Trait Implementations§
source§impl CppDeletable for QWindow
impl CppDeletable for QWindow
source§impl DynamicCast<QOpenGLWindow> for QWindow
impl DynamicCast<QOpenGLWindow> for QWindow
source§unsafe fn dynamic_cast(ptr: Ptr<QWindow>) -> Ptr<QOpenGLWindow>
unsafe fn dynamic_cast(ptr: Ptr<QWindow>) -> Ptr<QOpenGLWindow>
Calls C++ function: QOpenGLWindow* dynamic_cast<QOpenGLWindow*>(QWindow* ptr)
.
source§impl DynamicCast<QPaintDeviceWindow> for QWindow
impl DynamicCast<QPaintDeviceWindow> for QWindow
source§unsafe fn dynamic_cast(ptr: Ptr<QWindow>) -> Ptr<QPaintDeviceWindow>
unsafe fn dynamic_cast(ptr: Ptr<QWindow>) -> Ptr<QPaintDeviceWindow>
Calls C++ function: QPaintDeviceWindow* dynamic_cast<QPaintDeviceWindow*>(QWindow* ptr)
.
source§impl DynamicCast<QRasterWindow> for QWindow
impl DynamicCast<QRasterWindow> for QWindow
source§unsafe fn dynamic_cast(ptr: Ptr<QWindow>) -> Ptr<QRasterWindow>
unsafe fn dynamic_cast(ptr: Ptr<QWindow>) -> Ptr<QRasterWindow>
Calls C++ function: QRasterWindow* dynamic_cast<QRasterWindow*>(QWindow* ptr)
.
source§impl DynamicCast<QWindow> for QObject
impl DynamicCast<QWindow> for QObject
source§impl DynamicCast<QWindow> for QSurface
impl DynamicCast<QWindow> for QSurface
source§impl Size for QWindow
impl Size for QWindow
source§unsafe fn size(&self) -> usize
unsafe fn size(&self) -> usize
Reimplemented from QSurface::size().
Calls C++ function: virtual QSize QWindow::size() const
.
Reimplemented from QSurface::size().
Returns the size of the window excluding any window frame
See also resize().
source§impl StaticDowncast<QOpenGLWindow> for QWindow
impl StaticDowncast<QOpenGLWindow> for QWindow
source§unsafe fn static_downcast(ptr: Ptr<QWindow>) -> Ptr<QOpenGLWindow>
unsafe fn static_downcast(ptr: Ptr<QWindow>) -> Ptr<QOpenGLWindow>
Calls C++ function: QOpenGLWindow* static_cast<QOpenGLWindow*>(QWindow* ptr)
.
source§impl StaticDowncast<QPaintDeviceWindow> for QWindow
impl StaticDowncast<QPaintDeviceWindow> for QWindow
source§unsafe fn static_downcast(ptr: Ptr<QWindow>) -> Ptr<QPaintDeviceWindow>
unsafe fn static_downcast(ptr: Ptr<QWindow>) -> Ptr<QPaintDeviceWindow>
Calls C++ function: QPaintDeviceWindow* static_cast<QPaintDeviceWindow*>(QWindow* ptr)
.
source§impl StaticDowncast<QRasterWindow> for QWindow
impl StaticDowncast<QRasterWindow> for QWindow
source§unsafe fn static_downcast(ptr: Ptr<QWindow>) -> Ptr<QRasterWindow>
unsafe fn static_downcast(ptr: Ptr<QWindow>) -> Ptr<QRasterWindow>
Calls C++ function: QRasterWindow* static_cast<QRasterWindow*>(QWindow* ptr)
.
source§impl StaticDowncast<QWindow> for QObject
impl StaticDowncast<QWindow> for QObject
source§impl StaticDowncast<QWindow> for QSurface
impl StaticDowncast<QWindow> for QSurface
source§impl StaticUpcast<QObject> for QWindow
impl StaticUpcast<QObject> for QWindow
source§impl StaticUpcast<QSurface> for QWindow
impl StaticUpcast<QSurface> for QWindow
source§impl StaticUpcast<QWindow> for QOpenGLWindow
impl StaticUpcast<QWindow> for QOpenGLWindow
source§unsafe fn static_upcast(ptr: Ptr<QOpenGLWindow>) -> Ptr<QWindow>
unsafe fn static_upcast(ptr: Ptr<QOpenGLWindow>) -> Ptr<QWindow>
Calls C++ function: QWindow* static_cast<QWindow*>(QOpenGLWindow* ptr)
.
source§impl StaticUpcast<QWindow> for QPaintDeviceWindow
impl StaticUpcast<QWindow> for QPaintDeviceWindow
source§unsafe fn static_upcast(ptr: Ptr<QPaintDeviceWindow>) -> Ptr<QWindow>
unsafe fn static_upcast(ptr: Ptr<QPaintDeviceWindow>) -> Ptr<QWindow>
Calls C++ function: QWindow* static_cast<QWindow*>(QPaintDeviceWindow* ptr)
.
source§impl StaticUpcast<QWindow> for QRasterWindow
impl StaticUpcast<QWindow> for QRasterWindow
source§unsafe fn static_upcast(ptr: Ptr<QRasterWindow>) -> Ptr<QWindow>
unsafe fn static_upcast(ptr: Ptr<QRasterWindow>) -> Ptr<QWindow>
Calls C++ function: QWindow* static_cast<QWindow*>(QRasterWindow* ptr)
.