Menu

Remove the mapping between the property 'QObject::objectName' and 'name'

Help
2015-05-18
2015-06-04
  • Arnaud Barré

    Arnaud Barré - 2015-05-18

    Hi Florian,

    Is there any reason why the property 'QObject::objectName' is mapped to the property 'name'? I guess it was related to keep compatibility with Qt 3.x (where property objectName was name). Could it be possible to remove this compatibility (or add a macro to enable/disable it)?

    The mapping can be found in the file src/PythonQtClassInfo.cpp (lines 137-144).

    Thanks,

    Arnaud

     
  • Florian Link

    Florian Link - 2015-05-18

    Yes, that is a legacy Qt3 feature because MeVisLab used Qt3 and PythonQt has Qt3 origins... I can make it a PythonQt::init() feature, will put it on my TODO list.

     
  • Arnaud Barré

    Arnaud Barré - 2015-05-18

    Thanks a lot.

     
  • Florian Link

    Florian Link - 2015-05-29

    This has been fixed on the svn trunk, use PYTHONQT_SUPPORT_NAME_PROPERTY define to get
    the name -> objectName alias behaviour, default is off.

     
  • Arnaud Barré

    Arnaud Barré - 2015-06-04

    The unit test "PythonQtTestApi::testProperties()" should be adapted too.


    void PythonQtTestApi::testProperties()
    {
    PythonQtObjectPtr main = PythonQt::self()->getMainModule();
    +#ifdef PYTHONQT_SUPPORT_NAME_PROPERTY
    // check for name alias (for backward comp to Qt3)
    main.evalScript("obj.name = 'hello'");
    QVERIFY(QString("hello") == main.getVariable("obj.name").toString());
    +#endif

    main.evalScript("obj.objectName = 'hello2'");
    QVERIFY(QString("hello2") == main.getVariable("obj.objectName").toString());

     

    Last edit: Arnaud Barré 2015-06-04

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.