mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
widgets/wrapper: fix margin wrapper reactvity and margins
Fixed reactivity of the paren't actual size not working before child had been assigned. Fixed incorrect margins when actual size is less than implicit size.
This commit is contained in:
1 file changed
+11
-4
@@ -20,6 +20,8 @@ MarginWrapperManager::MarginWrapperManager(QObject* parent): WrapperManager(pare
|
||||
}
|
||||
|
||||
void MarginWrapperManager::componentComplete() {
|
||||
this->WrapperManager::componentComplete();
|
||||
|
||||
if (this->mWrapper) {
|
||||
QObject::connect(
|
||||
this->mWrapper,
|
||||
@@ -36,8 +38,6 @@ void MarginWrapperManager::componentComplete() {
|
||||
);
|
||||
}
|
||||
|
||||
this->WrapperManager::componentComplete();
|
||||
|
||||
if (!this->mChild) this->updateGeometry();
|
||||
}
|
||||
|
||||
@@ -97,12 +97,19 @@ qreal MarginWrapperManager::targetChildHeight() const {
|
||||
|
||||
qreal MarginWrapperManager::targetChildX() const {
|
||||
if (this->mResizeChild) return this->mMargin;
|
||||
else return this->mWrapper->width() / 2 - this->mChild->implicitWidth() / 2;
|
||||
else {
|
||||
return std::max(this->mMargin, this->mWrapper->width() / 2 - this->mChild->implicitWidth() / 2);
|
||||
}
|
||||
}
|
||||
|
||||
qreal MarginWrapperManager::targetChildY() const {
|
||||
if (this->mResizeChild) return this->mMargin;
|
||||
else return this->mWrapper->height() / 2 - this->mChild->implicitHeight() / 2;
|
||||
else {
|
||||
return std::max(
|
||||
this->mMargin,
|
||||
this->mWrapper->height() / 2 - this->mChild->implicitHeight() / 2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void MarginWrapperManager::onWrapperWidthChanged() {
|
||||
|
||||
Reference in new issue
Block a user