Results 1 to 4 of 4

Thread: qtreeview -file path

  1. #1
    Join Date
    Jun 2006
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default qtreeview -file path

    hi ,
    i am writing treeview code like this. this code displaying all file
    in my computer and then when i was click this item in treview
    for example this message apper : /user
    but i need all path this file like this : /home/user/a.txt...

    thanks alot
    Onder


    treeDosyalar = new QTreeView();
    model = new QDirModel();
    treeDosyalar->setModel(model);

    connect(treeDosyalar, SIGNAL(doubleClicked(QModelIndex)),this,

    SLOT(treeAc(QModelIndex)));

    void treeAc(QModelIndex qm)
    {
    QString text = qm.parent().data(0).toString();
    QMessageBox::information(this, "Mesaj", text);
    }

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: qtreeview -file path

    Try these methods:
    QFileInfo QDirModel::fileInfo ( const QModelIndex & index ) const
    QString QDirModel::fileName ( const QModelIndex & index ) const
    QString QDirModel::filePath ( const QModelIndex & index ) const
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    onder (12th July 2006)

  4. #3
    Join Date
    Jun 2006
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qtreeview -file path

    i am trying : QDirModelFilePath like this



    void treeAc(const QModelIndex qm)
    {
    QString text1 = QDirModel::filePath(qm);
    QMessageBox::information(this, "Mesaj", text1);
    }

    but i am taking this error :

    form.h:54: error: cannot call member function `QString QDirModel::filePath(const
    QModelIndex&) const' without object

    whats wrong, thanks alot

    Onder

  5. #4
    Join Date
    Jun 2006
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qtreeview -file path

    sorry i found. thank you

    onder

Similar Threads

  1. Draging a non-existing file to the Windows Desktop
    By klaus1111 in forum Qt Programming
    Replies: 13
    Last Post: 20th September 2007, 11:47
  2. Which path should I use?
    By Dark_Tower in forum Newbie
    Replies: 3
    Last Post: 8th April 2006, 12:09
  3. [Win32/VC++ 8.0] Strange problems with qrc_*.cpp files
    By mloskot in forum Installation and Deployment
    Replies: 6
    Last Post: 6th March 2006, 10:28
  4. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52
  5. Set include file path in KDevelop
    By zlatko in forum KDE Forum
    Replies: 2
    Last Post: 16th January 2006, 11:12

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.