Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Exporting QWidgets to QML?
Forum Updated to NodeBB v4.3 + New Features

[Solved] Exporting QWidgets to QML?

Scheduled Pinned Locked Moved QML and Qt Quick
9 Posts 3 Posters 4.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ephe
    wrote on last edited by
    #1

    I've got an application which uses QWidgets.
    Some special functionality is already implemented, for example I created an eventFilter that the enter key also changes the focus. I would also like to continue to use the validators, the setPlaceHolderText, setInputMask, etc. of the QLineEdit and some other built-in functionality of the QWidgets. Also, I could not find something similar to the QCombobox in QML.

    Now I would like to add animations to my application. Is it possible to "export" the QWidgets to QML? Or how can I reuse my existing code when I would like to switch to QML?

    I'm very new to QML, therefore I'm sorry if the answer is obvious. I would be really happy if you could recommend me some tutorials regarding this topic. Thank you!

    1 Reply Last reply
    0
    • T Offline
      T Offline
      task_struct
      wrote on last edited by
      #2

      Hello,

      see "this article":http://doc.qt.nokia.com/4.7-snapshot/declarative-cppextensions-qwidgets.html

      Also, you can use "Qt Components":http://doc.qt.nokia.com/qt-components-symbian-1.0/qt-components.html. They are available for Symbian, MeeGo and desktop.

      "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

      • Linu...
      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        I would recommend against the first approach. Yes, it is possible, but no, it is not a good idea. QGraphicsProxyWidget should IMO be avoided. It does not work properly, and is basically depricated due to it being a design flaw to begin with.

        Go for the components if you can.

        1 Reply Last reply
        0
        • E Offline
          E Offline
          ephe
          wrote on last edited by
          #4

          Thank you, I already heard that QGraphicsProxyWidget should be avoided at the Qt Dev Days. Is there an alternative for it if I want to create my own components?

          I saw that the native Qt Quick elements are derived from QDeclarativeItem. Maybe this helps when creating my own QML elements, but e.g. the QComboBox seems to be quite a lot of effort.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Why don't you look into how the Quick Desktop Compontents project creates combo boxes?
            See "here":http://qt.gitorious.org/qt-components/desktop for the sources and "here":http://www.youtube.com/watch?v=nj5jzv6njKg for the video.

            1 Reply Last reply
            0
            • E Offline
              E Offline
              ephe
              wrote on last edited by
              #6

              The Quick Desktop Components are amazing!
              Are the Qt Components also available for Desktop? I saw that the Page and PageStack qmls are in Symbian / Meego folders.

              Do you know if it is planned to include these components in the new QML version?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                They are not available yet in the sense of "officially released", however the sources are there for you to use if you want. It is likely that a set of components like these will appear in a future version of Qt, but don't count on it being there before Qt 5.1.

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  ephe
                  wrote on last edited by
                  #8

                  That sounds good!

                  But it would still be nice if I could reuse all my QWidget dialogs and if I would not have to rebuild them.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #9

                    [quote author="saho" date="1320329834"]But it would still be nice if I could reuse all my QWidget dialogs and if I would not have to rebuild them.[/quote]
                    Don't count on that. However, if you now have a good separation between your program logic and your UI, it should be easy to re-use at least the logic part of your application.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved