forked from quickshell/quickshell
widgets/cliprect: pass user input to contained items
This commit is contained in:
parent
b6a79fe99c
commit
fd87be1355
1 changed files with 15 additions and 13 deletions
|
@ -13,20 +13,20 @@ Item {
|
||||||
/// If content should be displayed underneath the border.
|
/// If content should be displayed underneath the border.
|
||||||
///
|
///
|
||||||
/// Defaults to false, does nothing if the border is opaque.
|
/// Defaults to false, does nothing if the border is opaque.
|
||||||
property bool contentUnderBorder: false;
|
property bool contentUnderBorder: false
|
||||||
/// If the content item should be resized to fit inside the border.
|
/// If the content item should be resized to fit inside the border.
|
||||||
///
|
///
|
||||||
/// Defaults to `!contentUnderBorder`. Most useful when combined with
|
/// Defaults to `!contentUnderBorder`. Most useful when combined with
|
||||||
/// `anchors.fill: parent` on an item passed to the ClippingRectangle.
|
/// `anchors.fill: parent` on an item passed to the ClippingRectangle.
|
||||||
property bool contentInsideBorder: !root.contentUnderBorder;
|
property bool contentInsideBorder: !root.contentUnderBorder
|
||||||
/// If the rectangle should be antialiased.
|
/// If the rectangle should be antialiased.
|
||||||
///
|
///
|
||||||
/// Defaults to true if any corner has a non-zero radius, otherwise false.
|
/// Defaults to true if any corner has a non-zero radius, otherwise false.
|
||||||
property /*bool*/alias antialiasing: rectangle.antialiasing;
|
property /*bool*/alias antialiasing: rectangle.antialiasing
|
||||||
/// The background color of the rectangle, which goes under its content.
|
/// The background color of the rectangle, which goes under its content.
|
||||||
property /*color*/alias color: shader.backgroundColor;
|
property /*color*/alias color: shader.backgroundColor
|
||||||
/// See @@QtQuick.Rectangle.border.
|
/// See @@QtQuick.Rectangle.border.
|
||||||
property clippingRectangleBorder border;
|
property clippingRectangleBorder border
|
||||||
/// Radius of all corners. Defaults to 0.
|
/// Radius of all corners. Defaults to 0.
|
||||||
property /*real*/alias radius: rectangle.radius
|
property /*real*/alias radius: rectangle.radius
|
||||||
/// Radius of the top left corner. Defaults to @@radius.
|
/// Radius of the top left corner. Defaults to @@radius.
|
||||||
|
@ -41,10 +41,10 @@ Item {
|
||||||
/// Visual children of the ClippingRectangle's @@contentItem. (`list<Item>`).
|
/// Visual children of the ClippingRectangle's @@contentItem. (`list<Item>`).
|
||||||
///
|
///
|
||||||
/// See @@QtQuick.Item.children for details.
|
/// See @@QtQuick.Item.children for details.
|
||||||
default property alias children: contentItem.children;
|
default property alias children: contentItem.children
|
||||||
/// The item containing the rectangle's content.
|
/// The item containing the rectangle's content.
|
||||||
/// There is usually no reason to use this directly.
|
/// There is usually no reason to use this directly.
|
||||||
readonly property alias contentItem: contentItem;
|
readonly property alias contentItem: contentItem
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: rectangle
|
id: rectangle
|
||||||
|
@ -60,8 +60,6 @@ Item {
|
||||||
Item {
|
Item {
|
||||||
id: contentItemContainer
|
id: contentItemContainer
|
||||||
anchors.fill: root
|
anchors.fill: root
|
||||||
layer.enabled: true
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: contentItem
|
id: contentItem
|
||||||
|
@ -74,9 +72,13 @@ Item {
|
||||||
id: shader
|
id: shader
|
||||||
anchors.fill: root
|
anchors.fill: root
|
||||||
fragmentShader: `qrc:/Quickshell/Widgets/shaders/cliprect${root.contentUnderBorder ? "-ub" : ""}.frag.qsb`
|
fragmentShader: `qrc:/Quickshell/Widgets/shaders/cliprect${root.contentUnderBorder ? "-ub" : ""}.frag.qsb`
|
||||||
property Rectangle rect: rectangle;
|
property Rectangle rect: rectangle
|
||||||
property color backgroundColor;
|
property color backgroundColor
|
||||||
property color borderColor: root.border.color;
|
property color borderColor: root.border.color
|
||||||
property Item content: contentItemContainer;
|
|
||||||
|
property ShaderEffectSource content: ShaderEffectSource {
|
||||||
|
hideSource: true
|
||||||
|
sourceItem: contentItemContainer
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue