Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QtOhosAppKit::Window Namespace Reference

\inmodule QtOhosAppKit More...

Enumerations

enum class  WindowGeometryPersistenceHint { Disabled , Enabled , FollowSystemSetting }

Functions

void setShowWindowAsFloatWindowHint (QWindow *window, bool showAsFloatWindow)
 Sets or unsets a given window as a floating window according to showAsFloatWindow.
void setShowWindowAsFloatWindowHint (QWidget *widget, bool showAsFloatWindow)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void setWindowPrivacyMode (QWindow *window, bool privacyModeEnabled)
 Changes the privacy mode of window according to privacyModeEnabled.
void setSurfaceBackgroundColor (QWindow *window, const QColor &color)
 Sets a given color as the background color of the window inner native layer.
void setSurfaceBackgroundColor (QWidget *widget, const QColor &color)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets a given color as the background color of the widget inner native layer.
void setWindowCornerRadius (QWindow *window, double radius)
 Sets the corner radius of a window.
void setWindowCornerRadius (QWidget *widget, double radius)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the corner radius of a widget.
void setWindowKeepScreenOn (QWindow *window, bool keepScreenOn)
 Sets or unsets a given window to keep the screen on according to keepScreenOn.
void setWindowKeepScreenOn (QWidget *widget, bool keepScreenOn)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets or unsets a given widget to keep the screen on according to keepScreenOn.
void setWindowDragResizable (QWindow *window, bool dragResizable)
 Enables or disables resizing of window by dragging its edges according to dragResizable.
void setWindowDragResizable (QWidget *widget, bool dragResizable)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Enables or disables resizing of widget by dragging its edges according to dragResizable.
void setMainWindowGeometryPersistenceHint (WindowGeometryPersistenceHint hint)
 Sets whether the application's main window restores its last geometry on startup according to hint.

Detailed Description

\inmodule QtOhosAppKit

Applies OpenHarmony-specific hints to a QWindow or QWidget.

Each hint is recorded on the passed QWindow or QWidget and consumed by the platform plugin. A hint may be set on a QWidget before its window exists; it is carried over to the window once the widget is shown.

Enumeration Type Documentation

◆ WindowGeometryPersistenceHint

Enumerator
Disabled 
Enabled 
FollowSystemSetting 

Definition at line 33 of file qohoswindowutils_p.h.

Function Documentation

◆ setMainWindowGeometryPersistenceHint()

void QtOhosAppKit::Window::setMainWindowGeometryPersistenceHint ( WindowGeometryPersistenceHint hint)

Sets whether the application's main window restores its last geometry on startup according to hint.

WindowGeometryPersistenceHint::FollowSystemSetting defers to the system default. This has to be called before the main window is shown.

Definition at line 167 of file qohoswindowutils.cpp.

References Disabled, Enabled, and FollowSystemSetting.

◆ setShowWindowAsFloatWindowHint() [1/2]

void QtOhosAppKit::Window::setShowWindowAsFloatWindowHint ( QWidget * widget,
bool showAsFloatWindow )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 51 of file qohoswindowutils.cpp.

◆ setShowWindowAsFloatWindowHint() [2/2]

void QtOhosAppKit::Window::setShowWindowAsFloatWindowHint ( QWindow * window,
bool showAsFloatWindow )

Sets or unsets a given window as a floating window according to showAsFloatWindow.

The OpenHarmony window type is fixed at creation, so this has to be called before the window is shown.

auto window = std::make_unique<MainWindow>();
window->show();
void setShowWindowAsFloatWindowHint(QWindow *window, bool showAsFloatWindow)
Sets or unsets a given window as a floating window according to showAsFloatWindow.
self window
[2]

Definition at line 45 of file qohoswindowutils.cpp.

◆ setSurfaceBackgroundColor() [1/2]

void QtOhosAppKit::Window::setSurfaceBackgroundColor ( QWidget * widget,
const QColor & color )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets a given color as the background color of the widget inner native layer.

Definition at line 82 of file qohoswindowutils.cpp.

◆ setSurfaceBackgroundColor() [2/2]

void QtOhosAppKit::Window::setSurfaceBackgroundColor ( QWindow * window,
const QColor & color )

Sets a given color as the background color of the window inner native layer.

Definition at line 71 of file qohoswindowutils.cpp.

◆ setWindowCornerRadius() [1/2]

void QtOhosAppKit::Window::setWindowCornerRadius ( QWidget * widget,
double radius )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the corner radius of a widget.

The widget has to be a window on its own (not embedded in a parent widget). The radius must not be negative.

Definition at line 109 of file qohoswindowutils.cpp.

◆ setWindowCornerRadius() [2/2]

void QtOhosAppKit::Window::setWindowCornerRadius ( QWindow * window,
double radius )

Sets the corner radius of a window.

The window has to be a sub or floating window (for example a window with the Qt::Window, Qt::Popup or Qt::Dialog flags, or one marked with setShowWindowAsFloatWindowHint()). The radius must not be negative; there is no upper limit, though OHOS visually clamps it to the maximum achievable value.

Definition at line 94 of file qohoswindowutils.cpp.

◆ setWindowDragResizable() [1/2]

void QtOhosAppKit::Window::setWindowDragResizable ( QWidget * widget,
bool dragResizable )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Enables or disables resizing of widget by dragging its edges according to dragResizable.

The widget has to be a window on its own (not embedded in a parent widget). Takes effect on sub windows and floating windows, but not on the application's main window.

Definition at line 156 of file qohoswindowutils.cpp.

◆ setWindowDragResizable() [2/2]

void QtOhosAppKit::Window::setWindowDragResizable ( QWindow * window,
bool dragResizable )

Enables or disables resizing of window by dragging its edges according to dragResizable.

Takes effect on sub windows and floating windows, but not on the application's main window.

Definition at line 143 of file qohoswindowutils.cpp.

◆ setWindowKeepScreenOn() [1/2]

void QtOhosAppKit::Window::setWindowKeepScreenOn ( QWidget * widget,
bool keepScreenOn )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets or unsets a given widget to keep the screen on according to keepScreenOn.

Definition at line 133 of file qohoswindowutils.cpp.

◆ setWindowKeepScreenOn() [2/2]

void QtOhosAppKit::Window::setWindowKeepScreenOn ( QWindow * window,
bool keepScreenOn )

Sets or unsets a given window to keep the screen on according to keepScreenOn.

Definition at line 122 of file qohoswindowutils.cpp.

◆ setWindowPrivacyMode()

void QtOhosAppKit::Window::setWindowPrivacyMode ( QWindow * window,
bool privacyModeEnabled )

Changes the privacy mode of window according to privacyModeEnabled.

In privacy mode the window content cannot be captured or recorded. This requires the ohos.permission.PRIVACY_WINDOW permission to be declared in the application's module.json5.

Definition at line 62 of file qohoswindowutils.cpp.