forked from qt-creator/qt-creator
QmlDesigner: Add empty placeholder to effect maker's view
Fixes: QDS-10592 Change-Id: Icc6193b358b83fce2a229321e30880e35e074055 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -136,4 +136,17 @@ Item {
|
||||
} // Column
|
||||
} // ScrollView
|
||||
}
|
||||
|
||||
Text {
|
||||
id: emptyText
|
||||
|
||||
text: qsTr("Add an effect node to start")
|
||||
color: StudioTheme.Values.themeTextColor
|
||||
font.pixelSize: StudioTheme.Values.baseFontSize
|
||||
|
||||
x: scrollView.x + (scrollView.width - emptyText.width) * .5
|
||||
y: scrollView.y + scrollView.height * .5
|
||||
|
||||
visible: EffectMakerBackend.effectMakerModel.isEmpty
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ Item {
|
||||
IconButton {
|
||||
id: closeButton
|
||||
|
||||
icon: StudioTheme.Constants.close_small
|
||||
icon: StudioTheme.Constants.closeCross
|
||||
buttonSize: 22
|
||||
iconScale: containsMouse ? 1.2 : 1
|
||||
transparentBg: true
|
||||
|
||||
@@ -56,12 +56,22 @@ bool EffectMakerModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
return true;
|
||||
}
|
||||
|
||||
void EffectMakerModel::setIsEmpty(bool val)
|
||||
{
|
||||
if (m_isEmpty != val) {
|
||||
m_isEmpty = val;
|
||||
emit isEmptyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void EffectMakerModel::addNode(const QString &nodeQenPath)
|
||||
{
|
||||
beginInsertRows({}, m_nodes.size(), m_nodes.size());
|
||||
auto *node = new CompositionNode(nodeQenPath);
|
||||
m_nodes.append(node);
|
||||
endInsertRows();
|
||||
|
||||
setIsEmpty(false);
|
||||
}
|
||||
|
||||
void EffectMakerModel::moveNode(int fromIdx, int toIdx)
|
||||
@@ -82,6 +92,9 @@ void EffectMakerModel::removeNode(int idx)
|
||||
m_nodes.removeAt(idx);
|
||||
delete node;
|
||||
endRemoveRows();
|
||||
|
||||
if (m_nodes.isEmpty())
|
||||
setIsEmpty(true);
|
||||
}
|
||||
|
||||
const QList<Uniform *> EffectMakerModel::allUniforms()
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
|
||||
|
||||
bool isEmpty() const { return m_isEmpty; }
|
||||
void setIsEmpty(bool val);
|
||||
|
||||
void addNode(const QString &nodeQenPath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user