Qt Quick or Qt Widgets: autocomplete and other stuff



  • Narrow question: Does the qtquick/qml system support autocompletion? How? I am referring to autocompletion of text in an application, not autocompletion of code in the IDE.

    Broader Question: Should I start my new project using Qt Quick or Qt Widgets? It's a small app working with a PostgreSQL database, and I would like functionality like a tabular display, autocompletion of fields, and possibly autocompletion of fields in a table. Target is probably a Linux desktop, though I'd consider making it available over the web or for Mac or iPad (probably too much typing for the iPad). Another useful feature would be to display a list of sorted text items and as you type the first letters you move automatically to the row with that begins with that latter.

    It's for my wife to enter and correct some data.

    The docs show the using widgets I can at least get autocompletion, but I don't see something similar for quick. But my impression is that Quick is the favored framework, and so I want to check how it compares.

    Thanks for any info.


  • Moderators

    Hi @Ross-Boylan and Welcome,

    No QtQuick doesn't support it currently officially. However there are few people who have tried to do it. For. eg. qmlcompletionbox
    But I think it would be quite cumbersome to add it to QML's TableView if you go QtQuick way.

    Lets see who wins here:

    • It's a small app working with a PostgreSQL database, and I would like functionality like a tabular display, autocompletion of fields, and possibly autocompletion of fields in a table.

      -Could be done with Qt Widgets. A ready-made example: http://doc.qt.io/qt-5/qtwidgets-itemviews-spreadsheet-example.html. On the other hand no such existing functionality in QtQuick. So Qt Widgets wins here.

    • Target is probably a Linux desktop, though I'd consider making it available over the web or for Mac or iPad (probably too much typing for the iPad).

      -Both can run on Linux/Windows and Mac. To run it on web you will need to make a plugin for Qt Widgets which means the user will need to download the app and libraries first. I find that quite non user friendly. But I doubt about its future whether it would be supported or not. Also there are few softwares which try render the Qt apps into JavsScript and HTML. For eg http://code.google.com/p/nativeclient-sdk/ and https://github.com/kripken/emscripten. Demos: http://vps2.etotheipiplusone.com:30176/redmine/projects/emscripten-qt/wiki/Demos So according to me a lot of work required here to just run a simple app. No clear winner :(

    • Another useful feature would be to display a list of sorted text items and as you type the first letters you move automatically to the row with that begins with that latter.

      -Can be done in both. QListView in Qt Widgets and ListView in QML with a custom QSortFilterProxyModel. Both win :)

    • The docs show the using widgets I can at least get autocompletion, but I don't see something similar for quick.

      -True. Qt Widgets wins.

    • But my impression is that Quick is the favored framework, and so I want to check how it compares.

      -But what if it doesn't support currently the features you require ?

    So personally I think Qt Widgets wins here and probably good head start.



  • @p3c0 Thanks for your really helpful response. I thought perhaps Quick didn't have it because the expectation was that one would use javascript for the functionality.

    It sounds as if, for my purposes, Quick may be the wave of the future but it's not the wave of the present.
    Ross


  • Moderators

    @Ross-Boylan

    I thought perhaps Quick didn't have it because the expectation was that one would use javascript for the functionality.

    That's a good point. You can try implementing your own custom one.

    It sounds as if, for my purposes, Quick may be the wave of the future but it's not the wave of the present.
    Yes, atleast for now. May be in future we would have something like QCompleter for QML.

    Happy Coding ...



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.