refactor: rename ProxyShell/FloatingWindow to Shell/FloatingWindow

also make ProxyWindowBase visible in docs
This commit is contained in:
outfoxxed 2024-02-17 05:14:15 -08:00
parent 083fff57be
commit dc616923aa
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
5 changed files with 26 additions and 18 deletions

View file

@ -75,9 +75,9 @@ Q_ENUM_NS(Enum);
} // namespace Layer
/// Type of keyboard focus that will be accepted by a [ProxyShellWindow]
/// Type of keyboard focus that will be accepted by a [ShellWindow]
///
/// [ProxyShellWindow]: ../proxyshellwindow
/// [ShellWindow]: ../shellwindow
namespace KeyboardFocus { // NOLINT
Q_NAMESPACE;
QML_ELEMENT;
@ -117,7 +117,7 @@ Q_ENUM_NS(Enum);
/// The following snippet creates a white bar attached to the bottom of [TODO] screen.
///
/// ```qml
/// ProxyShellWindow {
/// ShellWindow {
/// anchors {
/// left: true
/// bottom: true
@ -162,7 +162,7 @@ class ProxyShellWindow: public ProxyWindowBase {
/// The degree of keyboard focus taken. Defaults to `KeyboardFocus.None`.
Q_PROPERTY(KeyboardFocus::Enum keyboardFocus READ keyboardFocus WRITE setKeyboardFocus NOTIFY keyboardFocusChanged);
Q_PROPERTY(ScreenConfiguration::Enum screenConfiguration READ screenConfiguration WRITE setScreenConfiguration);
QML_ELEMENT;
QML_NAMED_ELEMENT(ShellWindow);
// clang-format on
public:

View file

@ -17,10 +17,12 @@
// Proxy to an actual window exposing a limited property set with the ability to
// transfer it to a new window.
// Detaching a window and touching any property is a use after free.
//
// NOTE: setting an `id` in qml will point to the proxy window and not the real window so things
// like anchors must use `item`.
///! Base class for reloadable windows
/// Base class for reloadable windows. See [ShellWindow] and [FloatingWindow]
///
/// [ShellWindow]: ../shellwindow
/// [FloatingWindow]: ../floatingwindow
class ProxyWindowBase: public Reloadable {
Q_OBJECT;
/// The QtQuick window backing this window.
@ -58,7 +60,7 @@ class ProxyWindowBase: public Reloadable {
/// If non null then the clickable areas of the window will be determined by the provided region.
///
/// ```qml
/// ProxyShellWindow {
/// ShellWindow {
/// // The mask region is set to `rect`, meaning only `rect` is clickable.
/// // All other clicks pass through the window to ones behind it.
/// mask: Region { item: rect }
@ -80,7 +82,7 @@ class ProxyWindowBase: public Reloadable {
/// the mask region not clickable and pass through clicks inside it through the window.
///
/// ```qml
/// ProxyShellWindow {
/// ShellWindow {
/// // The mask region is set to `rect`, but the intersection mode is set to `Xor`.
/// // This inverts the mask causing all clicks inside `rect` to be passed to the window
/// // behind this one.
@ -98,6 +100,8 @@ class ProxyWindowBase: public Reloadable {
Q_PROPERTY(PendingRegion* mask READ mask WRITE setMask NOTIFY maskChanged);
Q_PROPERTY(QQmlListProperty<QObject> data READ data);
Q_CLASSINFO("DefaultProperty", "data");
QML_ELEMENT;
QML_UNCREATABLE("use ShellWindow or FloatingWindow");
public:
explicit ProxyWindowBase(QObject* parent = nullptr);
@ -162,9 +166,11 @@ private:
// qt attempts to resize the window but fails because wayland
// and only resizes the graphics context which looks terrible.
///! Standard floating window.
class ProxyFloatingWindow: public ProxyWindowBase {
Q_OBJECT;
QML_ELEMENT;
QML_NAMED_ELEMENT(FloatingWindow);
public:
// Setting geometry while the window is visible makes the content item shrink but not the window

View file

@ -19,7 +19,7 @@ class QuickShellGlobal: public QObject {
/// ```qml
/// ShellRoot {
/// Variants {
/// ProxyShellWindow {
/// ShellWindow {
/// // ...
/// }
///

View file

@ -9,7 +9,7 @@
// unfortunately QQuickScreenInfo is private.
/// Monitor object useful for setting the monitor for a [ProxyShellWindow]
/// Monitor object useful for setting the monitor for a [ShellWindow]
/// or querying information about the monitor.
///
/// > [!WARNING] If the monitor is disconnected than any stored copies of its ShellMonitor will
@ -18,7 +18,7 @@
///
/// Due to some technical limitations, it was not possible to reuse the native qml [Screen] type.
///
/// [ProxyShellWindow]: ../proxyshellwindow
/// [ShellWindow]: ../shellwindow
/// [Screen]: https://doc.qt.io/qt-6/qml-qtquick-screen.html
class QuickShellScreenInfo: public QObject {
Q_OBJECT;

View file

@ -9,8 +9,10 @@
///! The base class of all types that can be reloaded.
/// Reloadables will attempt to take specific state from previous config revisions if possible.
/// Some examples are `ProxyShellWindow` and `ProxyFloatingWindow` which will attempt to find the
/// windows assigned to them in the previous configuration.
/// Some examples are [ProxyWindowBase] and [PersistentProperties]
///
/// [ProxyWindowBase]: ../proxywindowbase
/// [PersistentProperties]: ../persistentproperties
class Reloadable: public QObject, public QQmlParserStatus {
Q_OBJECT;
Q_INTERFACES(QQmlParserStatus);
@ -32,8 +34,8 @@ class Reloadable: public QObject, public QQmlParserStatus {
///
/// // any non `Reloadable` object
/// QtObject {
/// ProxyFloatingWindow {
/// // this ProxyFloatingWindow will now be matched to the same one in the previous
/// FloatingWindow {
/// // this FloatingWindow will now be matched to the same one in the previous
/// // widget tree for its variant. "myFloatingWindow" refers to both the variant in
/// // `foo: 1` and `foo: 2` for each tree.
/// reloadableId: "myFloatingWindow"