QUrl no translatable
-
Hi.
I'm creating my own plugin, and it has a property of QUrl type . When I compiling some element of this type in .ts file is appears as translatable, someone can tell me how you can use a QUrl with no translation option?
-
Just don't translate it.
More seriously, though, QUrl should not be translatable by default - make sure you are not using tr() or QObject::tr() somewhere in your code when setting the QUrl.
-
Hi and good morning.
I think the first post does not have enough information.
I'm working with Qt 4.7.4 and I'm creating my own plugin.
my plugin has a QUrl property and I never use tr() options so I think that the translate option is default.
this is the plugin code
pruebaplugin.cpp in the domXml() I establish the qurl variable like no translatable.pruebaplugin.cpp
@
...
QString PruebaPlugin::domXml() const
{
QString str;str=QString("<ui language="c++">\n"
" <widget class="Prueba_%1" name="Prueba_%1">\n"
" <property name="geometry">\n"
" <rect>\n"
" <x>0</x>\n"
" <y>0</y>\n"
" <width>50</width>\n"
" <height>50</height>\n"
" </rect>\n"
" </property>\n"
" <property name="path" >\n"
" <string notr="true"></string>\n"
" </property>\n"
" <property name="toolTip" >\n"
" <string></string>\n"
" </property>\n"
" <property name="whatsThis" >\n"
" <string></string>\n"
" </property>\n"
" </widget>\n"
"</ui>\n").arg(PLG_VRS);return str;
}
...@<property name="path" >
<string notr="true"></string> <--- notr=trueprueba.h
@class QDESIGNER_WIDGET_EXPORT Prueba_0 : public QWidget
{
Q_OBJECTQ_PROPERTY(QUrl path READ path WRITE setPath RESET resetPath)
public:
...
Private:
QUrl my_path;
@prueba.cpp
@
...
void PRUEBA::setPath(const QUrl &newPath) {
my_path=newPath;
}
QUrl PRUEBA::path() const {return my_path;}
void PRUEBA::resetPath() {my_path.clear();}
...
@when I use this plugin in the main app and when execute the lupdate the qurl variable appears in the .ts file.
What I'm doing wrong
-
Looking at your code, I don't see any reason why it should pop up in .ts file.
However inconvenient that may be, you can simply leave the string untranslated (then it will not change when you switch the language), or remove the offending line from .ts file (it's a simple XML file).
-
Thank for answer me.
I have another question that has relation with the Q_PROPERTY and the translations.
I have other variable like QString and it works properly while don't use the reset option. The QString objects in properties has a subproperties with translatable, disambiguation and comment option. I define this options disable in the domXml function, notr=true, but if it use the reset option(the arrow that it's in the right part of the variable) always appears on, can I control it? or can I disabled this arrow option?