KWindowShadow Class
The KWindowShadow class represents a drop-shadow that is drawn by the compositor. More...
Header: | #include <KWindowShadow> |
CMake: | find_package(KF6 REQUIRED COMPONENTS KWindowSystem) target_link_libraries(mytarget PRIVATE KF6::KWindowSystem) |
Inherits: | QObject |
Public Functions
KWindowShadowTile::Ptr | bottomLeftTile() const |
KWindowShadowTile::Ptr | bottomRightTile() const |
KWindowShadowTile::Ptr | bottomTile() const |
bool | create() |
void | destroy() |
bool | isCreated() const |
KWindowShadowTile::Ptr | leftTile() const |
QMargins | padding() const |
KWindowShadowTile::Ptr | rightTile() const |
void | setBottomLeftTile(KWindowShadowTile::Ptr tile) |
void | setBottomRightTile(KWindowShadowTile::Ptr tile) |
void | setBottomTile(KWindowShadowTile::Ptr tile) |
void | setLeftTile(KWindowShadowTile::Ptr tile) |
void | setPadding(const QMargins &padding) |
void | setRightTile(KWindowShadowTile::Ptr tile) |
void | setTopLeftTile(KWindowShadowTile::Ptr tile) |
void | setTopRightTile(KWindowShadowTile::Ptr tile) |
void | setTopTile(KWindowShadowTile::Ptr tile) |
void | setWindow(QWindow *window) |
KWindowShadowTile::Ptr | topLeftTile() const |
KWindowShadowTile::Ptr | topRightTile() const |
KWindowShadowTile::Ptr | topTile() const |
QWindow * | window() const |
Detailed Description
The KWindowShadow is composed of multiple tiles. The top left tile, the top right tile, the bottom left tile, and the bottom right tile are rendered as they are. The top tile and the bottom tile are stretched in x direction; the left tile and the right tile are stretched in y direction. Several KWindowShadow objects can share shadow tiles to reduce memory usage. You have to specify padding() along the shadow tiles. The padding values indicate how much the KWindowShadow sticks outside the decorated window.
Once the KWindowShadow is created, you're not allowed to attach or detach any shadow tiles, change padding(), or change window(). In order to do so, you have to destroy() the shadow first, update relevant properties, and create() the shadow again.
Member Function Documentation
KWindowShadowTile::Ptr KWindowShadow::bottomLeftTile() const
Returns the bottom-left tile attached to the KWindowShadow.
See also setBottomLeftTile().
KWindowShadowTile::Ptr KWindowShadow::bottomRightTile() const
Returns the bottom-right tile attached to the KWindowShadow.
See also setBottomRightTile().
KWindowShadowTile::Ptr KWindowShadow::bottomTile() const
Returns the bottom tile attached to the KWindowShadow.
See also setBottomTile().
bool KWindowShadow::create()
Allocates the platform resources associated with the KWindowShadow.
Once the native platform resources have been allocated, you're not allowed to attach or detach shadow tiles, change the padding or the target window. If you want to do so, you must destroy() the shadow, change relevant attributes and call create() again.
Returns true
if the creation succeeded, otherwise returns false
.
void KWindowShadow::destroy()
Releases the platform resources associated with the KWindowShadow.
Calling destroy() after window() had been destroyed will result in a no-op.
bool KWindowShadow::isCreated() const
Returns true
if the platform resources associated with the shadow have been allocated.
KWindowShadowTile::Ptr KWindowShadow::leftTile() const
Returns the left tile attached to the KWindowShadow.
See also setLeftTile().
QMargins KWindowShadow::padding() const
Returns the padding of the KWindowShadow.
The padding values specify the visible extents of the shadow. The top left tile is rendered with an offset of -padding().left() and -padding().top().
See also setPadding().
KWindowShadowTile::Ptr KWindowShadow::rightTile() const
Returns the right tile attached to the KWindowShadow.
See also setRightTile().
void KWindowShadow::setBottomLeftTile(KWindowShadowTile::Ptr tile)
Attaches the bottom-left tile to the KWindowShadow.
See also bottomLeftTile().
void KWindowShadow::setBottomRightTile(KWindowShadowTile::Ptr tile)
Attaches the bottom-right tile to the KWindowShadow.
See also bottomRightTile().
void KWindowShadow::setBottomTile(KWindowShadowTile::Ptr tile)
Attaches the bottom tile to the KWindowShadow.
See also bottomTile().
void KWindowShadow::setLeftTile(KWindowShadowTile::Ptr tile)
Attaches the left tile to the KWindowShadow.
See also leftTile().
void KWindowShadow::setPadding(const QMargins &padding)
Sets the padding on the KWindowShadow.
If the padding values are smaller than the sizes of the shadow tiles, then the shadow will overlap with the window() and will be rendered behind window(). E.g. if all padding values are set to 0, then the shadow will be completely occluded by the window().
See also padding().
void KWindowShadow::setRightTile(KWindowShadowTile::Ptr tile)
Attaches the right tile to the KWindowShadow.
See also rightTile().
void KWindowShadow::setTopLeftTile(KWindowShadowTile::Ptr tile)
Attaches the top-left tile to the KWindowShadow.
See also topLeftTile().
void KWindowShadow::setTopRightTile(KWindowShadowTile::Ptr tile)
Attaches the top-right tile to the KWindowShadow.
See also topRightTile().
void KWindowShadow::setTopTile(KWindowShadowTile::Ptr tile)
Attaches the top tile to the KWindowShadow.
See also topTile().
void KWindowShadow::setWindow(QWindow *window)
Sets the window behind which the KWindowShadow will be rendered.
Note that the KWindowShadow does not track the platform surface. If for whatever reason the native platform surface is deleted and then created, you must to destroy() the shadow and create() it again yourself.
See also window().
KWindowShadowTile::Ptr KWindowShadow::topLeftTile() const
Returns the top-left tile attached to the KWindowShadow.
See also setTopLeftTile().
KWindowShadowTile::Ptr KWindowShadow::topRightTile() const
Returns the top-right tile attached to the KWindowShadow.
See also setTopRightTile().
KWindowShadowTile::Ptr KWindowShadow::topTile() const
Returns the top tile attached to the KWindowShadow.
See also setTopTile().
QWindow *KWindowShadow::window() const
Returns the window behind which the KWindowShadow will be rendered.
See also setWindow().