Move setLayoutVisible() to utility

This commit is contained in:
WarmUpTill
2021-11-12 22:20:18 +01:00
committed by WarmUpTill
parent fd7e48eff9
commit 9d04b4d1a0
3 changed files with 11 additions and 10 deletions

View File

@@ -45,6 +45,7 @@ void placeWidgets(std::string text, QBoxLayout *layout,
bool addStretch = true);
void deleteLayoutItem(QLayoutItem *item);
void clearLayout(QLayout *layout, int afterIdx = 0);
void setLayoutVisible(QLayout *layout, bool visible);
QMetaObject::Connection PulseWidget(QWidget *widget, QColor startColor,
QColor = QColor(0, 0, 0, 0),
QString specifier = "QLabel ",

View File

@@ -947,16 +947,6 @@ bool patternControlIsOptional(VideoCondition cond)
cond == VideoCondition::HAS_NOT_CHANGED;
}
void setLayoutVisible(QLayout *layout, bool visible)
{
for (int i = 0; i < layout->count(); ++i) {
QWidget *widget = layout->itemAt(i)->widget();
if (widget != NULL) {
widget->setVisible(visible);
}
}
}
void MacroConditionVideoEdit::SetWidgetVisibility()
{
_imagePath->setVisible(requiresFileInput(_entryData->_condition));

View File

@@ -229,6 +229,16 @@ void clearLayout(QLayout *layout, int afterIdx)
}
}
void setLayoutVisible(QLayout *layout, bool visible)
{
for (int i = 0; i < layout->count(); ++i) {
QWidget *widget = layout->itemAt(i)->widget();
if (widget != NULL) {
widget->setVisible(visible);
}
}
}
bool compareIgnoringLineEnding(QString &s1, QString &s2)
{
// Let QT deal with different types of lineendings