Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    (Solved) Missing icons in QTreeView and QTableView when using QFileSystemModel

    General and Desktop
    1
    3
    1938
    Loading More Posts
    • 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.
    • T
      toptan last edited by

      Hello, everybody!

      I am having simple main window with QTreeView and QTableView embedded in QSplitter. Both QTreeView and QTableView have their own QFileSystemModel. On Mac OS X some icons are missing. This happens almost everytime on OS X 10.7 and somewhat less often on 10.8. Qt version is 5.0.2.
      Please see attached screen shots.
      The code for main window is extremely simple:
      @
      #include "mainwindow.h"
      #include "ui_mainwindow.h"

      #include <QDebug>
      #include <QAbstractItemView>

      MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
      {
      ui->setupUi(this);
      m_leftModel = new QFileSystemModel(this);
      m_rightModel = new QFileSystemModel(this);
      ui->treeView->setModel(m_leftModel);
      ui->tableView->setModel(m_rightModel);
      ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
      ui->treeView->setColumnHidden(1, true);
      ui->treeView->setColumnHidden(2, true);
      ui->treeView->setColumnHidden(3, true);
      m_leftModel->setFilter(QDir::AllDirs | QDir::NoDotAndDotDot);
      m_leftModel->setRootPath(QDir::homePath());
      m_rightModel->setRootPath(QDir::homePath());
      connect(ui->treeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(onTreeSelectionChanged(QItemSelection,QItemSelection)));
      }

      MainWindow::~MainWindow()
      {
      delete ui;
      }

      void MainWindow::onTreeSelectionChanged(const QItemSelection &selected, const QItemSelection &)
      {
      QModelIndex index = selected.at(0).indexes().at(0);
      ui->tableView->setRootIndex(m_rightModel->index(m_leftModel->filePath(index)));
      }
      @

      I don't believe that I did something wrong. Does anybody had any similar issues on OS X? Should I file a bug or I am missing something obvious here?
      !http://s13.postimg.org/golicul0n/sc1.png(ScreenShot1)!
      !http://s23.postimg.org/7d3janvsb/sc2.png(ScreenShot2)!

      1 Reply Last reply Reply Quote 0
      • T
        toptan last edited by

        I've just checked with obsolete QDirModel instead of QFileSystemModel. The problem persists.

        1 Reply Last reply Reply Quote 0
        • T
          toptan last edited by

          I've filed a bug, and the developers are already working on this. Thanks, guys!

          Here is the link to the "bug":https://bugreports.qt-project.org/browse/QTBUG-30907

          1 Reply Last reply Reply Quote 0
          • First post
            Last post