未验证 提交 521d0ce4 编写于 作者: J Jim 提交者: GitHub

Merge pull request #2444 from WizardCM/property-help-icon

UI: Show help icon for properties with tooltips
<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>
\ No newline at end of file
<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>
\ No newline at end of file
......@@ -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())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册