Results 1 to 4 of 4

Thread: Can folder color be changed in QTreeView when QFilesystemModel displays drives?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2012
    Posts
    24
    Thanks
    4
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Post Can folder color be changed in QTreeView when QFilesystemModel displays drives?

    Well I have been working on a Qt app where I need to display Filesystem using QFilesystemModel.I have been able to display it as expected.
    Qt Code:
    1. QFileSystemModel *model = new QFileSystemModel;
    2. model->setRootPath(QDir::currentPath())
    3. tree->setModel(model);
    To copy to clipboard, switch view to plain text mode 
    This displays all drives inside QTreeView. But we all know by default, the color of the folders present inside each drive is yellow. This is what i wanna change. Is there a way in Qt, where one can change the color of folder to “Blue”???

  2. The following user says thank you to owais_blore for this useful post:


  3. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Can folder color be changed in QTreeView when QFilesystemModel displays drives?

    Quote Originally Posted by owais_blore View Post
    This displays all drives inside QTreeView. But we all know by default, the color of the folders present inside each drive is yellow.
    No, we don't know that. If you mean the folder icon then on my system it is not yellow.

    This is what i wanna change. Is there a way in Qt, where one can change the color of folder to “Blue”???
    You can subclass the model and reimplement its data() method to return an icon of your choice or you can provide a custom delegate that will render each item in a way you like. And no, there is no QMakeMyFolderIconBlueDelegate class, you have to write it yourself.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. The following 2 users say thank you to wysota for this useful post:

    owais_blore (11th December 2012)

Similar Threads

  1. Replies: 5
    Last Post: 12th December 2012, 18:45
  2. Display System Drives in Specific Order in QTreeView
    By owais_blore in forum Qt Programming
    Replies: 6
    Last Post: 5th December 2012, 08:07
  3. QFileSystemModel with network drives not connected
    By GothmoG in forum Qt Programming
    Replies: 2
    Last Post: 3rd October 2012, 01:18
  4. Replies: 10
    Last Post: 25th November 2010, 11:33
  5. Splitter Color changed when referesh?
    By rajeshs in forum Qt Programming
    Replies: 1
    Last Post: 11th July 2007, 08:10

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.