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) Missing icons in QTreeView and QTableView when using QFileSystemModel
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 2.1k Views
  • 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 Offline
    T Offline
    toptan
    wrote on last edited by
    #1

    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
    0
    • T Offline
      T Offline
      toptan
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • T Offline
        T Offline
        toptan
        wrote on last edited by
        #3

        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
        0

        • Login

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