Results 1 to 8 of 8

Thread: Designer plugin widget property not recognized

  1. #1
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Designer plugin widget property not recognized

    Hi,

    I crated a simple designerplugin. It is a subclassed QLineEdit with a few additional properties:

    Qt Code:
    1. class QDESIGNER_WIDGET_EXPORT LineEdit : public QLineEdit
    2. {
    3. Q_OBJECT
    4. Q_PROPERTY(QString tableName READ tableName WRITE setTableName)
    5. Q_PROPERTY(QString columnName READ columnName WRITE setColumnName)
    6.  
    7. public:
    8. LineEdit(QWidget *parent = 0);
    9.  
    10. QString tableName() const;
    11. void setTableName(const QString &tableName);
    12. QString columnName() const;
    13. void setColumnName(const QString &columnName);
    14.  
    15. private:
    16. QString m_tableName;
    17. QString m_columnName;
    18.  
    19. };
    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():

    Qt Code:
    1. QString LineEditPlugin::domXml() const
    2. {
    3. return "<widget class=\"LineEdit\" name=\"lineEdit\">\n"
    4. " <property name=\"tableName\" >\n"
    5. " <string notr=\"true\"></string>\n"
    6. " </property>\n"
    7. " <property name=\"columnName\" >\n"
    8. " <string notr=\"true\"></string>\n"
    9. " </property>\n"
    10. "</widget>\n";
    11. }
    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Designer plugin widget property not recognized

    What property are we talking about? I can only see "tableName" and "columnName" properties declared.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: Designer plugin widget property not recognized

    yes. I dont what that these two properties to appear in linguist. Therefore I would like to set notr="true" in the .ui file. When I edit the properties in designers property editor it works properly (I get notr="true" in the ui file). But when I use my taskmenuextension the notr is removed ...

    tasmenuextension dialog is setting the properties like this (which works for the property value but as I said notr is removed):

    Qt Code:
    1. = QDesignerFormWindowInterface::findFormWindow(lineEdit)) {
    2. formWindow->cursor()->setWidgetProperty(lineEdit, "tableName", ui.tableComboBox->currentText());
    3. formWindow->cursor()->setWidgetProperty(lineEdit, "columnName", ui.columnComboBox->currentText());
    4. }
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Designer plugin widget property not recognized

    I admit I still don't see the problem. Your task menu extension doesn't influence the way the .ui file is generated. So the real problem is you don't know how to add the notr="true" attribute to the property. And I don't think there is an easy way to do that (if at all). What you can do is to use the "comment" subproperty of textual properties to enter information for the translator - like "don't translate this". It will probably be the easiest way to do it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: Designer plugin widget property not recognized

    Setting "notr" with my tastextension works now if I use

    Qt Code:
    1. lineEdit->setTableName(ui.tableComboBox->currentText());
    To copy to clipboard, switch view to plain text mode 

    instead of

    Qt Code:
    1. formWindow->cursor()->setProperty("tableName", ui.tableComboBox->currentText());
    To copy to clipboard, switch view to plain text mode 

    I think setting "notr" in domXML is ok. The Problem left is, that the property editor needs to be updated with the new values.

    But you are right :-) Actually I have no idea. It is just trial and error. All these interfaces are really difficult to understand.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Designer plugin widget property not recognized

    You can file a suggestion to Qt Software. They might introduce one more tag to Q_PROPERTY - like "translatable" or something like that. Or a checkbox in Designer indicating whether you want that text value to be retained regardless of language. I guess this would be the best option.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: Designer plugin widget property not recognized

    Hi,

    this suggestion is like "carrying owls to athens" i suppose Because in Qt 4.5 Designer there is such a feature (checkable Option translate or not). But It is not displayed with my added properties. If I add a dynamic property the checkbox is shown. Guess there is something wrong with my plugin widgets. But a possibility to add this option in Q_PROPERTY is a good idea. And there could be a few more examples covering the other designer interfaces.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Designer plugin widget property not recognized

    The mechanism works fine for QString fields in my custom widgets without any extra effort. Could you prepare a minimal compilable example of a plugin reproducing the problem?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 4
    Last Post: 9th August 2007, 08:20
  2. Replies: 13
    Last Post: 15th December 2006, 11:52
  3. custom plugin designer property with out a variable?
    By high_flyer in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2006, 19:11
  4. Size of a plugin widget in designer
    By high_flyer in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2006, 13:29
  5. Managing widget plugin in Qt Designer
    By yellowmat in forum Newbie
    Replies: 8
    Last Post: 31st January 2006, 09:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.