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. [Solved]QDirModel : No display
Forum Updated to NodeBB v4.3 + New Features

[Solved]QDirModel : No display

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.5k 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.
  • Z Offline
    Z Offline
    zitamina
    wrote on 29 Apr 2013, 14:50 last edited by
    #1

    Hello !
    I'm starting to discover the Qt Model : QdirModel;
    the problem is that i get no display of the discs or anything

    @#include "window.h"
    #include <QtGui>

    Window::Window(QWidget *parent) :
    QMainWindow(parent)

    {

    QVBoxLayout *layout = new QVBoxLayout;
    
    QDirModel *modele = new QDirModel(this);
    
    QTreeView *vue = new QTreeView;
    vue->setModel(modele);
    

    layout->addWidget(vue);
    setLayout(layout);

    }
    @
    any ideas about the source of the problem ? thanks a lot

    1 Reply Last reply
    0
    • R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 29 Apr 2013, 15:01 last edited by
      #2

      QDirModel class is obsolete.
      you should use "QFileSystemModel":http://qt-project.org/doc/qt-4.8/qfilesystemmodel.html instead

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zitamina
        wrote on 29 Apr 2013, 16:44 last edited by
        #3

        thanks .the problem is in the llayout ...the window should inherit QWidget noit QMainWindow
        Still a BIGINNER ! :)

        1 Reply Last reply
        0
        • R Offline
          R Offline
          raven-worx
          Moderators
          wrote on 29 Apr 2013, 17:02 last edited by
          #4

          QMainWindow does inhertit QWidget, so thats not the problem.
          The problem is, that you tried to set a layout on QMainWindow itself, instead you should set a QWidget (with a layout set) as "central widget":http://qt-project.org/doc/qt-4.8/qmainwindow.html#setCentralWidget.

          Nevertheless you still should use QFileSystemModel!

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zitamina
            wrote on 30 Apr 2013, 09:10 last edited by
            #5

            thanks a lot ^^,

            1 Reply Last reply
            0

            3/5

            29 Apr 2013, 16:44

            • Login

            • Login or register to search.
            3 out of 5
            • First post
              3/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved