[umbrello-devel] [umbrello] [Bug 327701] code import wizard: does not read folders

Ralf Habacker ralf.habacker at freenet.de
Sun Dec 1 00:25:14 UTC 2013


https://bugs.kde.org/show_bug.cgi?id=327701

Ralf Habacker <ralf.habacker at freenet.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |CONFIRMED
                 CC|                            |ralf.habacker at freenet.de
     Ever confirmed|0                           |1

--- Comment #1 from Ralf Habacker <ralf.habacker at freenet.de> ---
A debugging session shows that  QFileSystemModel::row() returns zero if the
related dir is not expanded, see below: 

void CodeImpSelectPage::treeClicked(const QModelIndex& index)
{
....
    uDebug() << "item at row=" << index.row() << " / column=" <<
index.column();
    QFileSystemModel* indexModel = (QFileSystemModel*)index.model();
    QFileInfo fileInfo = indexModel->fileInfo(index);
    if (fileInfo.isDir()) {
        // QFileSystemModel returns zero childrens for a collapsed directory
        int rows = indexModel->rowCount(index);
...
The code import wizard has code to select and count file recursivly with
selected  "include subdirs", but it fails because of the zero childs mentioned
above.
                QFileInfo childInfo = indexModel->fileInfo(childIndex);
                if (childInfo.isDir() && ui_subdirCheckBox->isChecked()) {
                    treeClicked(childIndex);
                }

I found a partial workaround by expanding the directory before fetching the
children. 
    if (fileInfo.isDir()) {
        // QFileSystemModel returns zero childrens for a collapsed directory
        ui_treeView->setExpanded(index, true);
        qApp->processEvents();
        int rows = indexModel->rowCount(index);

unfortunally a few tests show that this fix is not enough to set this bug as
resolved.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the umbrello-devel mailing list