Hi,
I crated a simple designerplugin. It is a subclassed QLineEdit with a few additional properties:
class QDESIGNER_WIDGET_EXPORT LineEdit
: public QLineEdit{
Q_OBJECT
Q_PROPERTY(QString tableName READ tableName WRITE setTableName
) Q_PROPERTY(QString columnName READ columnName WRITE setColumnName
)
public:
void setTableName
(const QString &tableName
);
void setColumnName
(const QString &columnName
);
private:
};
class QDESIGNER_WIDGET_EXPORT LineEdit : public QLineEdit
{
Q_OBJECT
Q_PROPERTY(QString tableName READ tableName WRITE setTableName)
Q_PROPERTY(QString columnName READ columnName WRITE setColumnName)
public:
LineEdit(QWidget *parent = 0);
QString tableName() const;
void setTableName(const QString &tableName);
QString columnName() const;
void setColumnName(const QString &columnName);
private:
QString m_tableName;
QString m_columnName;
};
To copy to clipboard, switch view to plain text mode
Designer loads the plugin, but I do not get the no_translation option in the property editor. I tried to set it in domXML():
QString LineEditPlugin
::domXml() const {
return "<widget class=\"LineEdit\" name=\"lineEdit\">\n"
" <property name=\"tableName\" >\n"
" <string notr=\"true\"></string>\n"
" </property>\n"
" <property name=\"columnName\" >\n"
" <string notr=\"true\"></string>\n"
" </property>\n"
"</widget>\n";
}
QString LineEditPlugin::domXml() const
{
return "<widget class=\"LineEdit\" name=\"lineEdit\">\n"
" <property name=\"tableName\" >\n"
" <string notr=\"true\"></string>\n"
" </property>\n"
" <property name=\"columnName\" >\n"
" <string notr=\"true\"></string>\n"
" </property>\n"
"</widget>\n";
}
To copy to clipboard, switch view to plain text mode
The "notr" is always ignored and not saved to the .ui file. Any idea why? and how i can use this feature with the new properties?
Bookmarks