Commit a2a1b600 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Add user explanation about why the mask/clone is disabled

The node tooltip will have an explanation, why the node has been disabled

CCBUG:409949
parent a0caf30f
......@@ -502,6 +502,18 @@ QVariant KisNodeModel::data(const QModelIndex &index, int role) const
case KisNodeModel::ColorLabelIndexRole: {
return node->colorLabelIndex();
}
case KisNodeModel::DropReasonRole: {
QString result;
KisProjectionLeaf::NodeDropReason reason = node->projectionLeaf()->dropReason();
if (reason == KisProjectionLeaf::DropPassThroughMask) {
result = i18nc("@info:tooltip", "Disabled: masks on pass-through groups are not supported!");
} else if (reason == KisProjectionLeaf::DropPassThroughClone) {
result = i18nc("@info:tooltip", "Disabled: cloning pass-through groups is not supported!");
}
return result;
}
default:
if (role >= int(KisNodeModel::BeginThumbnailRole) && belongsToIsolatedGroup(node)) {
......
......@@ -94,6 +94,11 @@ public:
// is passed via QVariant as integer
SelectOpaqueRole,
// Returns a text explaining why the node has been excluded from
// projection rendering. If the node is not excluded, then empty
// string is returned
DropReasonRole,
/// This is to ensure that we can extend the data role in the future, since it's not possible to add a role after BeginThumbnailRole (due to "Hack")
ReservedRole = Qt::UserRole + 99,
......
......@@ -56,10 +56,17 @@ QTextDocument *NodeToolTip::createDocument(const QModelIndex &index)
rows.append(row.arg(properties[i].name).arg(value));
}
QString dropReason = index.data(KisNodeModel::DropReasonRole).toString();
if (!dropReason.isEmpty()) {
dropReason = QString("<p align=\"center\"><b>%1</b></p>").arg(dropReason);
}
rows = QString("<table>%1</table>").arg(rows);
const QString image = QString("<table border=\"1\"><tr><td><img src=\"data:thumbnail\"></td></tr></table>");
const QString body = QString("<h3 align=\"center\">%1</h3>").arg(name)
+ dropReason
+ QString("<p><table><tr><td>%1</td><td>%2</td></tr></table></p>").arg(image).arg(rows);
const QString html = QString("<html><body>%1</body></html>").arg(body);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment