UI: Improve macOS properties tooltip spacing workaround

QMacStyle appears to have an issue where it messes up the positions of
some widgets. The previous workaround added extra spacing to force the
icon further to the right. Forcing the widget rectangle to be used
instead of the one made by the style also fixes this, arguably in a
nicer way.
See also b760b24ff0 which does this for
checkboxes in the source tree.
This commit is contained in:
gxalpha 2024-06-08 17:46:07 +02:00 committed by Lain
parent 7a4cb085ba
commit 298e858f63

View file

@ -1640,18 +1640,15 @@ void OBSPropertiesView::AddProperty(obs_property_t *property,
QHBoxLayout *boxLayout = new QHBoxLayout(newWidget);
boxLayout->setContentsMargins(0, 0, 0, 0);
boxLayout->setAlignment(Qt::AlignLeft);
#ifdef __APPLE__
/* TODO: This fixes the issue of tooltip not aligning
* correcty on macOS, the root cause needs further
* investigation. */
boxLayout->setSpacing(10);
#else
boxLayout->setSpacing(0);
#endif
QCheckBox *check = qobject_cast<QCheckBox *>(widget);
check->setText(desc);
check->setToolTip(
obs_property_long_description(property));
#ifdef __APPLE__
check->setAttribute(Qt::WA_LayoutUsesWidgetRect);
#endif
QLabel *help = new QLabel(check);
help->setText(bStr.arg(file));