Results 1 to 3 of 3

Thread: MV(C): how to QListView?

  1. #1
    Join Date
    Jan 2011
    Location
    Paris
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default MV(C): how to QListView?

    Hi all,

    I'm not a Qt newbie but i'm a MVC newbie ...
    I'm currently thinking about an app but i'm stucked and do not know how to start. Basically, this app will have a QListView and some tool buttons. What i need, is to display in the QListview files and folders that will need some kind of processing. Of course, tool buttons will help in adding some files and folders for further processing.
    I do not know where to start ... Should I derived from QAbstractItemModel? I do not know at app start up how many files/folders will need to be processed. I also want to enable d'n'd in the QListView for a comfortable user experience with this app. Could you please give me some ways to do this?

    For the processing, I need to retrieve the full files/folders paths from the QlistView so they can feed an algorithm of my own in a separate thread to avoid unresponsive GUI (I already know how to do that part). What I do not already know is how to populate my QListView with files/folders. This why I'm asking your help.

    I already have designed my own .ui with Qt designer but would like to go a step ahead and start implementing that (really simple) app. Any help would be appreciated. Please, do not focus on the d'n'd part, but more on the MV(C) (as from what I(ve read so far, Qt, mixes "V" and "C" ...) and its specific implentation: should I create my own class derived from QAbstractItemModel, whici methods are mandatory, and so on ...

    Regards,

    Olivier
    Last edited by olivier1978; 10th February 2013 at 01:46.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: MV(C): how to QListView?

    If you decided on using QListView then yes you have to at-least implement a model (a derived QAbstractItemModel).

    If the item count in the list is not large then you could also explore using QListWidget, where you need not implement a model, in fact no new class required. Just create QListWidgetItem and insert in to the QListWidget.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Jan 2011
    Location
    Paris
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MV(C): how to QListView?

    Thanks Santosh . QListWidget seems to fit my needs. Will give it a try.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.