Results 1 to 8 of 8

Thread: Challenges in migration of Qt 4.8.2 project into Qt 5.7 and above

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2019
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Challenges in migration of Qt 4.8.2 project into Qt 5.7 and above

    What kind if items do you create as graphics items?
    Grids and Ellipses are created as graphics item and in future vendor company will also create some items as graphics Item.

    It might be possible to just make custom declarative items and create all items from QML.
    In Qt 4.8.2 we used QDeclalativeItem to create some objects in QML and added it to QGraphicsScene. But now in Qt 5.7 how will we create it?

    So currently you have a QDeclarativeView as an item in your QGraphicsScene?
    No, We are not using QDeclarativeView. We used QQuickWidget to access Item form QML file and added it to QGraphicsScene.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Challenges in migration of Qt 4.8.2 project into Qt 5.7 and above

    Quote Originally Posted by Anjali Srivastava View Post
    Grids and Ellipses are created as graphics item and in future vendor company will also create some items as graphics Item.
    Should be trivial to create these as custom QDeclarativeItems

    Quote Originally Posted by Anjali Srivastava View Post
    In Qt 4.8.2 we used QDeclalativeItem to create some objects in QML and added it to QGraphicsScene.
    Ah, ok, very hacky.

    If you use a QDeclarativeView instead then you can use the same approach when moving to a QQuickWidget.


    Quote Originally Posted by Anjali Srivastava View Post
    We used QQuickWidget to access Item form QML file and added it to QGraphicsScene.
    Well, that's not possible since Qt5 QQuickItems are not QGraphicsItems.
    QtQuick is rendered with an OpenGL based scene graph.

    As far as I understood your setup you have these options:

    1) Remove the usage of QML

    2) Keep using QGraphicsView and just use QQmlEngine with custom types to create QGraphicItem based objects in QML

    3) Move the Qt4 version to use QDeclarativeView and custom QDeclarativeItem and then port that almost unchanged to QtQuickWidget and custom QQuickPaintedItems.

    Cheers,
    _

  3. #3
    Join Date
    Feb 2019
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Challenges in migration of Qt 4.8.2 project into Qt 5.7 and above

    Quote Originally Posted by anda_skoa View Post
    Should be trivial to create these as custom QDeclarativeItems

    1) Remove the usage of QML

    2) Keep using QGraphicsView and just use QQmlEngine with custom types to create QGraphicItem based objects in QML

    3) Move the Qt4 version to use QDeclarativeView and custom QDeclarativeItem and then port that almost unchanged to QtQuickWidget and custom QQuickPaintedItems.


    _

    Yes I think you are right, If I follow the point two then could you provide any example or link for the same.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Challenges in migration of Qt 4.8.2 project into Qt 5.7 and above

    The QML engine (in both Qt4 and Qt5) can essentially create instances of any class that is derived from QObject (directly or indirectly).

    So for example if you have a class that derives from QGraphicsObject you should be able to register that with the QML engine's type system and then use in QML like any of the "built-in" types.

    http://doc.qt.io/archives/qt-4.8/qde...mlRegisterType
    http://doc.qt.io/qt-5/qqmlengine.html#qmlRegisterType

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 26th September 2017, 17:49
  2. Migration to QT 5
    By pl01 in forum Newbie
    Replies: 2
    Last Post: 29th April 2013, 12:23
  3. Qt4 migration
    By grsandeep85 in forum Qt Programming
    Replies: 1
    Last Post: 20th August 2009, 07:31
  4. Migration from Qt3 to Qt4
    By mourad in forum Qt Programming
    Replies: 1
    Last Post: 13th May 2008, 19:10

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.