Custom ListView for chat window

  • Hi Gurus!
    I want to create interface with Qt creator 2.6.1 (Qt 5.0)


    I need to know the path to it, please suggest if I should use QListView or QListWidget?

    should I sub class ListView or should I apply style sheets, when I look into most of the samples I see more of qml rather then C++ code.

    Sikander Mirza

  • QListView or QListWidget doesn't matter. The latter is just a subclass of the first, and only adds a build-in, item based model to the basis QListView. I'd go for the View option any day. If you want an item based API for the model, just use a QStandardItemModel.

    You can do this using a delegate, but it will require custom rendering of the item. QML is more suited for this.

  • thanks a lot, as being a newbie to Qt, I have tried doing some random R&D and may be the question is not appropriate, I work with C++ and of-course instead of sub-classing and custom rendering it is better to use QML, I want to understand something that...

    in QML I would be able to write up the look and feel of the listview and then set this model to ListView via some API's (if I am write then please guide me with the steps)

    1- I created a new qml file called myList.qml
    2- I tried using QDeclarativeEngine or things like that but I can't include them.

    so lets say I want to create a button custom button or any custom widget(specifically a listView like above) in a Qt C++ application I am unable to get a start of it.

    so please let me know
    do I have to include some other Libraries headers?
    can I get a a few simple lines of steps to have a qml based list view in place like how to invoke a qml.
    QDeclarativeEngine *engine = new QDeclarativeEngine();


  • Hi There!
    I managed to find out that now it would be like with Qt 5.0 the changes in the

    QQuickView view;
    now the testnew.qml looks like
    import QtQuick 2.0

    Rectangle { width: 200; height: 200; color: "red" }
    but still when I launch Application I don't see anything so please correct my basic concept if its wrong.

    I created a basic Qt Gui Application.
    added QT += qml quick to .pro file.

    and I thought that on my C++ application a box or 200x200 with a red colour will appear.
    but I don't understand where it would be placed probably in center of my form?

    please tell me the very first steps or guide me to a visual or other tutorial.

    the application that I have is a simple chat application with image background and with custom listview and image buttons.

Log in to reply

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