⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

How to make a project that is done with QtQuick to a gui application?

  • I just made a searchbox ( which on text change filters some items ).


    But i found a qt example made with qtquick which is really nice looking and works very good.


    How can i make this example from qtquick to a gui application?
    Any suggestion? Thanks, Leon.

  • Moderators

    You mean how to embed a QML component in QtWidgets GUI?

    If so, in Quick1, QML is based on Graphics View Framework, you can add QDeclarativeView as a widget to your GUI (it inherits from QGraphicsView). This is not possible, though, with QtQuick2.

  • I think the title is not right. I am not asking generally, i am asking about this specific example, i want to add the search thing of, it at my application. But the example is written with qtquick or whatever this is. I am not familiar with qt quick and that's why i am a little confused.

    IN OTHER WORDS. I want to copy that example but not to be written with qt quick, but at a Qt Gui Application with normal qt programming.

    P.S If you don't understant what i mean i will explain it again.
    The example can be found at the getting started->qt quick examples

  • Moderators

    Uh, right, so you want to replicate the look of the QML example, but using standard QtWidgets.

    Can be done, although would mean much more work. There are probably a few ways to do this, the one that came to my mind is:

    subclass QLineEdit

    reimplement paintEvent()

    write your own code that will paint the line edit this new way.

    But that's probably an overkill. Maybe it could be also done, a bit easier, with QSS, but you'll have to research that path yourself. As I recollect, the Jasmin/ Blanchette book had a handy set of examples for both approaches.

    Also, KDE has KLineEdit, which seems to have just what you need: "LINK":http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKLineEdit.html.

  • Take a look at "QxtLineEdit":https://bitbucket.org/libqxt/libqxt/src/tip/src/gui/qxtlineedit.h, which has reset button in its 'tip' version. Actually, I haven't tested it yet.

Log in to reply