Added support for grid columns translations. Translated columns in
addressbook plugin.
This commit is contained in:
+12
-1
@@ -109,7 +109,12 @@ public:
|
||||
if (i == section) {
|
||||
QString colName(entity->metaObject()->property(i + 1).name());
|
||||
delete entity;
|
||||
return tr(colName.toStdString().c_str());
|
||||
|
||||
if (m_translations.contains(colName))
|
||||
{
|
||||
return m_translations[colName];
|
||||
}
|
||||
return colName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,6 +184,11 @@ public:
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void setTranslations(const QMap<QString, QString> &translations)
|
||||
{
|
||||
m_translations = translations;
|
||||
}
|
||||
|
||||
protected:
|
||||
void handleFilter(const QString &filter) override
|
||||
{
|
||||
@@ -210,6 +220,7 @@ protected:
|
||||
private:
|
||||
QList<QSharedPointer<T> > m_list;
|
||||
QList<QSharedPointer<T> > m_fullList;
|
||||
QMap<QString, QString> m_translations;
|
||||
bool filtered;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user