| 27 | ClientPropertyModel::~ClientPropertyModel() = default; |
| 28 | |
| 29 | QVariant ClientPropertyModel::data(const QModelIndex &index, int role) const |
| 30 | { |
| 31 | if (role == Qt::ToolTipRole && index.isValid()) { |
| 32 | const auto idx0 = index.sibling(index.row(), 0); |
| 33 | const auto f = idx0.data(PropertyModel::PropertyFlagsRole).value<PropertyModel::PropertyFlags>(); |
| 34 | const auto revision = idx0.data(PropertyModel::PropertyRevisionRole); |
| 35 | const auto notifySignal = idx0.data(PropertyModel::NotifySignalRole).toString(); |
| 36 | |
| 37 | QStringList tt; |
| 38 | if (f != PropertyModel::None) { |
| 39 | QStringList fs; |
| 40 | if (f & PropertyModel::Constant) |
| 41 | fs.push_back(tr("constant")); |
| 42 | if (f & PropertyModel::Designable) |
| 43 | fs.push_back(tr("designable")); |
| 44 | if (f & PropertyModel::Final) |
| 45 | fs.push_back(tr("final")); |
| 46 | if (f & PropertyModel::Resetable) |
| 47 | fs.push_back(tr("resetable")); |
| 48 | if (f & PropertyModel::Scriptable) |
| 49 | fs.push_back(tr("scriptable")); |
| 50 | if (f & PropertyModel::Stored) |
| 51 | fs.push_back(tr("stored")); |
| 52 | if (f & PropertyModel::User) |
| 53 | fs.push_back(tr("user")); |
| 54 | if (f & PropertyModel::Writable) |
| 55 | fs.push_back(tr("writable")); |
| 56 | tt.push_back(tr("Attributes: %1").arg(fs.join(QLatin1String(", ")))); |
| 57 | } |
| 58 | if (!revision.isNull()) { |
| 59 | tt.push_back(tr("Revision: %1").arg(revision.toInt())); |
| 60 | } |
| 61 | if (!notifySignal.isEmpty()) { |
| 62 | tt.push_back(tr("Notify signal: %1").arg(notifySignal)); |
| 63 | } |
| 64 | |
| 65 | return tt.join(QLatin1String("\n")); |
| 66 | } |
| 67 | return QIdentityProxyModel::data(index, role); |
| 68 | } |
| 69 | |
| 70 | QVariant ClientPropertyModel::headerData(int section, Qt::Orientation orientation, int role) const |
| 71 | { |