mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
UI: Display message if no properties available
Display "No properties available" text in the property view if there are no properties available. Closes Pull Request #377
This commit is contained in:
@@ -53,6 +53,8 @@ void OBSPropertiesView::ReloadProperties()
|
||||
RefreshProperties();
|
||||
}
|
||||
|
||||
#define NO_PROPERTIES_STRING QTStr("Basic.PropertiesWindow.NoProperties")
|
||||
|
||||
void OBSPropertiesView::RefreshProperties()
|
||||
{
|
||||
int h, v;
|
||||
@@ -75,6 +77,7 @@ void OBSPropertiesView::RefreshProperties()
|
||||
layout->setLabelAlignment(Qt::AlignRight);
|
||||
|
||||
obs_property_t *property = obs_properties_first(properties.get());
|
||||
bool hasNoProperties = !property;
|
||||
|
||||
while (property) {
|
||||
AddProperty(property, layout);
|
||||
@@ -91,6 +94,11 @@ void OBSPropertiesView::RefreshProperties()
|
||||
lastWidget->setFocus(Qt::OtherFocusReason);
|
||||
lastWidget = nullptr;
|
||||
}
|
||||
|
||||
if (hasNoProperties) {
|
||||
QLabel *noPropertiesLabel = new QLabel(NO_PROPERTIES_STRING);
|
||||
layout->addWidget(noPropertiesLabel);
|
||||
}
|
||||
}
|
||||
|
||||
void OBSPropertiesView::SetScrollPos(int h, int v)
|
||||
|
||||
Reference in New Issue
Block a user