Results 1 to 2 of 2

Thread: Problem in creating a QFileSystemModel

  1. #1
    Join Date
    Mar 2010
    Posts
    54
    Qt products
    Qt/Embedded
    Platforms
    Symbian S60

    Default Problem in creating a QFileSystemModel

    Hi All

    I am creating an application where on a button click , the "browse to directory" window pops up
    I have created the application , but when I initialise the QFileSystemModel, I get error
    The code has been given below where the SLOT(FileBrowseWindow()) should be called when we click the browse_button
    BUt currently , I am unable to initialise
    m_Model = new QFileSystemModel(this); Line 11
    while debugging the code goes in QGRAYRASTER.C


    Qt Code:
    1. window::window()
    2. {
    3. setAcceptDrops(false);
    4. namelabel = new QLabel("Name",this);
    5. nametext = new QTextEdit(this);
    6. loclabel = new QLabel("Location",this);
    7. locText = new QTextEdit(this);
    8. browse_button = new QPushButton("Browse",this);
    9. ok_button = new QPushButton("Ok",this);
    10. cancel_button = new QPushButton("Cancel",this);
    11. m_Model = new QFileSystemModel(this);
    12.  
    13. //creation of menu
    14. createMenu();
    15.  
    16.  
    17.  
    18.  
    19. //connection: signal & slots
    20. connect(browse_button,SIGNAL(clicked()),this,SLOT(FileBrowseWindow()),Qt::AutoConnection);
    21. connect(cancel_button,SIGNAL(clicked()),this,SLOT(ClearButton()),Qt::AutoConnection);
    22.  
    23. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void window::FileBrowseWindow()
    2. {
    3.  
    4. QTreeView tree;
    5. tree.setModel(m_Model);
    6. m_Model->setRootPath(QString("/home/kamlesh/"));
    7. tree.resize(640,480);
    8. tree.show();
    9. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2010
    Location
    Perth, Australia
    Posts
    37
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in creating a QFileSystemModel

    while debugging the code goes in QGRAYRASTER.C
    Can you provide the exact message? That will make it easier to identify the problem.
    Last edited by hackerNovitiate; 16th December 2010 at 15:21. Reason: updated contents

Similar Threads

  1. QFileSystemModel: creating custom rows of data
    By masterlaws in forum Qt Programming
    Replies: 3
    Last Post: 12th August 2013, 11:58
  2. Problem in getting data using QFileSystemModel
    By chinmayapadhi in forum Qt Programming
    Replies: 1
    Last Post: 15th August 2010, 19:34
  3. Replies: 2
    Last Post: 16th July 2010, 19:14
  4. Known problem with filters and QFileSystemModel?
    By Kumosan in forum Qt Programming
    Replies: 3
    Last Post: 27th August 2009, 08:14
  5. Problem When Creating my own Slot
    By Fatla in forum Qt Programming
    Replies: 12
    Last Post: 6th June 2008, 14:44

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
  •  
Qt is a trademark of The Qt Company.