Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Custom ListView for chat window
Forum Updated to NodeBB v4.3 + New Features

Custom ListView for chat window

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.4k 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.
  • S Offline
    S Offline
    sikander243
    wrote on last edited by
    #1

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

    !http://dl.dropbox.com/u/71159303/chatwindows.png(image)!

    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.

    regards
    Sikander Mirza

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

      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.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sikander243
        wrote on last edited by
        #3

        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.
        like
        QDeclarativeEngine *engine = new QDeclarativeEngine();
        ...
        ...

        regards
        Sikander

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sikander243
          wrote on last edited by
          #4

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

          @
          QQuickView view;
          view.setSource(QUrl::fromLocalFile("C:/Qt/testnew.qml"));
          view.show();
          @
          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.

          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