Merge pull request #2444 from WizardCM/property-help-icon
UI: Show help icon for properties with tooltips
This commit is contained in:
commit
521d0ce4b7
1
UI/forms/images/help.svg
Normal file
1
UI/forms/images/help.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-help-circle"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>
|
After Width: | Height: | Size: 367 B |
1
UI/forms/images/help_light.svg
Normal file
1
UI/forms/images/help_light.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="rgb(82.352941%,82.352941%,82.352941%)" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-help-circle"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>
|
After Width: | Height: | Size: 392 B |
@ -17,6 +17,8 @@
|
||||
<file>images/locked.svg</file>
|
||||
<file>images/invisible.svg</file>
|
||||
<file>images/visible.svg</file>
|
||||
<file>images/help.svg</file>
|
||||
<file>images/help_light.svg</file>
|
||||
<file>images/trash.svg</file>
|
||||
<file>images/revert.svg</file>
|
||||
<file>images/sources/brush.svg</file>
|
||||
|
@ -1436,6 +1436,35 @@ void OBSPropertiesView::AddProperty(obs_property_t *property,
|
||||
if (!widget)
|
||||
return;
|
||||
|
||||
if (obs_property_long_description(property)) {
|
||||
QString lStr = "<html>%1 <img src='%2' style=' \
|
||||
vertical-align: bottom; \
|
||||
' /></html>";
|
||||
bool lightTheme = palette().text().color().redF() < 0.5;
|
||||
QString file = lightTheme ? ":/res/images/help.svg"
|
||||
: ":/res/images/help_light.svg";
|
||||
if (label) {
|
||||
label->setText(lStr.arg(label->text(), file));
|
||||
label->setToolTip(
|
||||
obs_property_long_description(property));
|
||||
} else if (type == OBS_PROPERTY_BOOL) {
|
||||
QWidget *newWidget = new QWidget();
|
||||
QHBoxLayout *boxLayout = new QHBoxLayout(newWidget);
|
||||
boxLayout->setContentsMargins(0, 0, 0, 0);
|
||||
boxLayout->setAlignment(Qt::AlignLeft);
|
||||
|
||||
QCheckBox *check = qobject_cast<QCheckBox *>(widget);
|
||||
QLabel *help =
|
||||
new QLabel(lStr.arg(check->text(), file));
|
||||
help->setToolTip(
|
||||
obs_property_long_description(property));
|
||||
check->setText("");
|
||||
boxLayout->addWidget(check);
|
||||
boxLayout->addWidget(help);
|
||||
widget = newWidget;
|
||||
}
|
||||
}
|
||||
|
||||
layout->addRow(label, widget);
|
||||
|
||||
if (!lastFocused.empty())
|
||||
|
Loading…
x
Reference in New Issue
Block a user