コード例 #1
0
void ClifView::on_actionOpen_triggered()
{
  QString filename = QFileDialog::getOpenFileName(this,
        tr("Open clif File"));
  
  std::string path(filename.toLocal8Bit().constData());
  lf_file.open(path, H5F_ACC_RDONLY);
  
  //lffile = H5::H5File(filename.toLocal8Bit().constData(), H5F_ACC_RDONLY);

  vector<string> datasets = lf_file.datasetList();
  
  //FIXME clean root list!

  for(uint i=0;i<datasets.size();i++) {
     QString path(datasets[i].c_str());
     DatasetRoot *root = new DatasetRoot(&lf_file, datasets[i]);
     
     QTreeWidgetItem *item = new QTreeWidgetItem(ui->tree, QStringList(path));
     item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
     
     item->setData(0, Qt::UserRole, QVP<DatasetRoot>::asQVariant(root));
     root_list.push_back(root);
  }
}
コード例 #2
0
ファイル: tasksdialog.cpp プロジェクト: zeddq/synergy-plugin
void TasksDialog::taskListDownloaded(SynergyResponse response)
{
    if (response.error)
    {
        error(response.stdErr);
        return;
    }

    ui->treeWidget->clear();

    if (response.stdOut.isEmpty())
    {
        m_taskListReceived = true;
        ui->stackedWidget->setCurrentIndex(0);
        return;
    }

    QStringList taskList = response.stdOut.split(QLatin1String("\n"), QString::SkipEmptyParts);
    foreach(QString task, taskList)
    {
        int spaceIndex = task.indexOf(QLatin1Char(' '));
        QString objectName = task.left(spaceIndex);
        QString displayName = task.right(task.length() - spaceIndex);

        QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui->treeWidget);
        treeItem->setText(0, displayName);
        treeItem->setData(0, Qt::UserRole, objectName);
        treeItem->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
    }
コード例 #3
0
void BasketTreeListView::removeExpands()
{
    QTreeWidgetItemIterator it(this);
    while (*it) {
        QTreeWidgetItem *item = *it;
        if (item->childCount() <= 0)
            item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
        ++it;
    }
}
コード例 #4
0
ファイル: TreeWidget.cpp プロジェクト: vicrucann/cherish
void CanvasPhotoWidget::onCanvasAdded(const std::string &name)
{
    QTreeWidgetItem* item = new QTreeWidgetItem();
    if (!item) return;
    item->setText(0, QString(name.c_str()));
    item->setFlags(item->flags() | Qt::ItemIsEditable);
    item->setData(0,cher::DelegateChildRole,1);
    item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
//    item->setSizeHint(0, QSize(cher::APP_WIDGET_BUTTON, cher::APP_WIDGET_BUTTON));
    this->addTopLevelItem(item);
}
コード例 #5
0
ファイル: MaterialBrowser.cpp プロジェクト: raedwulf/pipeline
void MaterialBrowser::initMaterialCatalog( QString const & path )
{
  QFileInfoList topLevelList = QDir( path ).entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
  for ( int i=0 ; i<topLevelList.size() ; i++ )
  {
    DP_ASSERT( topLevelList[i].isDir() );
    QTreeWidgetItem * topLevelItem = new QTreeWidgetItem();
    topLevelItem->setChildIndicatorPolicy( QTreeWidgetItem::ShowIndicator );
    topLevelItem->setData( 0, Qt::UserRole, topLevelList[i].absoluteFilePath() );
    topLevelItem->setText( 0, topLevelList[i].absoluteFilePath().section( '/', -1 ) );

    m_catalog->addTopLevelItem( topLevelItem );
  }
}
コード例 #6
0
ファイル: dlgadditems.cpp プロジェクト: jjfsq1985/StudyLab
void dlgAddItems::browseItems()
{
    vector<OpcItem > vecAllBranches;
    m_pOpcCtrl->BrowserBranches(vecAllBranches);

    for (vector<OpcItem>::iterator it = vecAllBranches.begin(); it != vecAllBranches.end(); it++)
    {
        QTreeWidgetItem *rootItem = new QTreeWidgetItem(ui.treeGroups);
        wstring strGroup = (*it).sItem.GetBSTR();
        rootItem->setText(0, QString::fromStdWString(strGroup));
        rootItem->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
        ui.treeGroups->addTopLevelItem(rootItem);
    }
}
コード例 #7
0
QTreeWidgetItem *CollectionTreeWidget::addAlbum(QString artist, QString album, unsigned int albumId) {
    // Find id in database if we don't have it
    if (albumId == 0) {
         QSqlTableModel *model = service->collectionModel();

         // SQLite used two single quotes to escape a single quote! :)
         QString filter = "artist = '" + QString(artist).replace("'","''") + "' AND "
                          "album = '" + QString(album).replace("'","''") + "'";
         model->setFilter(filter);
         model->select();

         while (model->canFetchMore()) model->fetchMore();
         int total = model->rowCount();
         if (total > 0) {
            albumId = model->record(0).value(model->fieldIndex("id_album")).toInt();
         }
         else {
             qDebug("ERROR: no album found! -- " + model->filter().toUtf8());
             return NULL;
         }
    }

    // Looks for the artist
    QTreeWidgetItem *newAlbumNode; // The node with the album, whether it exists or not
    QTreeWidgetItem *artistItem;
    artistItem = addArtist(artist);

    // Look for album
    for (int i = 0; i < artistItem->childCount(); i++) {
        if (artistItem->child(i)->text(0) == album) {
            newAlbumNode = artistItem->child(i);
            return newAlbumNode;
        }
    }

    // Create our new album node and add it if it was not found
    newAlbumNode = new CollectionTreeWidgetItem(LevelAlbum, albumId, (QTreeWidget*)0);
    newAlbumNode->setText(0, album);
    newAlbumNode->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);

    // Set icon
    newAlbumNode->setIcon(0, IconFactory::fromTheme("media-cdrom"));

    artistItem->addChild(newAlbumNode);
    artistItem->sortChildren(0, Qt::AscendingOrder);

    return newAlbumNode;
}
コード例 #8
0
ファイル: ODBC_Connection.cpp プロジェクト: Edder/odbc-query
void ODBC_Connection::LoadTables()
{
	// the table and field view
	m_ui.TableTreeWidget->clear();

	// populate the available tables
	Logging::getInstance()->WriteLog(INFORMATION, QString("Retrieving database tables of connection \"%1\"...").arg(m_sConnectionName));
	for (int i = 0, count = m_db.tables().count(); i < count; i++)
	{
		QString sTableName = m_db.tables().value(i);
		QTreeWidgetItem *pItem = new QTreeWidgetItem(QStringList() << sTableName);
		pItem->setIcon(0, QIcon(":/ODBC_Query/Resources/table.png"));
		m_ui.TableTreeWidget->addTopLevelItem(pItem);
		pItem->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
	}
}
コード例 #9
0
 /**
  * Inserts widget to be layed out.
  *
  * @param widget ContactWidget object to display.
  * @param key Grouping object.
  */
 void Insert(ContactWidget* widget, const T key){
   if (!map_.contains(key)) {
     QTreeWidgetItem* item = new QTreeWidgetItem;
     item->setData(0, Qt::DisplayRole, titler_(widget, key));
     item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
     items_[key] = item;
     tree_->addTopLevelItem(item);
   }
   map_.insert(key, widget);
   QTreeWidgetItem* item = new QTreeWidgetItem;
   items_[key]->addChild(item);
   items_[key]->setExpanded(true);
   tree_->setItemWidget(item, 0, widget);
   // sort childern, which causes them to recalculate stylesheet and hide indentation
   items_[key]->sortChildren(0, Qt::AscendingOrder);
 }
コード例 #10
0
void medPacsWidget::search(QString query)
{
    this->readSettings();

    this->clear();

    if (!d->find) d->find = medAbstractPacsFactory::instance()->createFindScu("dcmtkFindScu");
    if(d->find)
    {
        d->find->clearAllQueryAttributes();
        d->find->setQueryLevel(medAbstractPacsFindScu::STUDY);
        d->find->addQueryAttribute(0x0010,0x0010, query.toAscii().constData()); // patient name
        d->find->addQueryAttribute(0x0008,0x0030, "\0"); // study date
        d->find->addQueryAttribute(0x0008,0x0050, "\0"); // accession no
        d->find->addQueryAttribute(0x0008,0x0061, "\0"); // modalities in study
        d->find->addQueryAttribute(0x0008,0x0090, "\0"); // ref physician
        d->find->addQueryAttribute(0x0008,0x1030, "\0"); // study description
        d->find->addQueryAttribute(0x0010,0x0020, "\0"); // patient ID
        d->find->addQueryAttribute(0x0010,0x0030, "\0"); // patient BD
        d->find->addQueryAttribute(0x0010,0x0040, "\0"); // sex
        d->find->addQueryAttribute(0x0020,0x000D, "\0"); // studyInstanceUID
        d->find->addQueryAttribute(0x0020,0x0010, "\0"); // study ID

        foreach(QStringList node, d->selectedNodes)
            d->find->sendFindRequest(node.at(0).toLatin1(), node.at(1).toLatin1(), tryToInt(node.at(2)),
                                     d->hostTitle.toLatin1(), d->hostAddress.toLatin1(), tryToInt(d->hostPort));

        QVector<medAbstractPacsNode *> nodes = d->find->getNodeContainer();

        foreach(medAbstractPacsNode *node, nodes) {

            QVector<medAbstractPacsResultDataset *> container = node->getResultDatasetContainer();

            foreach(medAbstractPacsResultDataset *dataset, container) {

                QTreeWidgetItem *item = new QTreeWidgetItem(this, QStringList()
                        << QString(dataset->findKeyValue(0x0010,0x0010))
                        << QString(dataset->findKeyValue(0x0008,0x1030))
                        << QString(dataset->findKeyValue(0x0020,0x0010))
                        << QString(dataset->findKeyValue(0x0008,0x0061)));

                item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
                item->setData(0,Qt::UserRole, d->index(*node));
                item->setData(1,Qt::UserRole, QPoint(0x0020,0x000D));
                item->setData(2,Qt::UserRole, QString(dataset->getStudyInstanceUID()));
            }
コード例 #11
0
ファイル: MaterialBrowser.cpp プロジェクト: raedwulf/pipeline
void MaterialBrowser::catalogItemExpanded( QTreeWidgetItem * item )
{
  GetApp()->setOverrideCursor( Qt::WaitCursor );

  std::vector<std::string> extensions = dp::fx::EffectLibrary::instance()->getRegisteredExtensions();

  QStringList filterList;
  for ( std::vector<std::string>::const_iterator it = extensions.begin() ; it != extensions.end() ; ++it )
  {
    filterList.push_back( QString( "*" ) + it->c_str() );
  }

  QString filePath = item->data( 0, Qt::UserRole ).toString();
  QFileInfoList fil = QDir( filePath ).entryInfoList( filterList, QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot, QDir::DirsFirst );
  for ( int i=0 ; i<fil.size() ; i++ )
  {
    QString filePath = fil[i].absoluteFilePath();
    if ( fil[i].isDir() )
    {
      QTreeWidgetItem * childItem = new QTreeWidgetItem();
      childItem->setData( 0, Qt::UserRole, filePath );
      childItem->setText( 0, filePath.section( '/', -1 ) );
      childItem->setChildIndicatorPolicy( QTreeWidgetItem::ShowIndicator );
      item->addChild( childItem );
    }
    else
    {
      std::string fp = filePath.toStdString();
      dp::fx::EffectLibrary::instance()->loadEffects( fp, dp::util::FileFinder( GetApp()->getPreferences()->getSearchPathsAsStdVector() ) );

      std::vector<std::string> materialNames;
      dp::fx::EffectLibrary::instance()->getEffectNames( fp, dp::fx::EffectSpec::EST_PIPELINE, materialNames );
      for ( std::vector<std::string>::const_iterator it = materialNames.begin() ; it != materialNames.end() ; ++it )
      {
        QTreeWidgetItem * childItem = new QTreeWidgetItem();
        childItem->setData( 0, Qt::UserRole, QString( it->c_str() ) );
        childItem->setText( 0, QString( it->c_str() ) );
        item->addChild( childItem );
      }
    }
  }

  GetApp()->restoreOverrideCursor();
}
コード例 #12
0
ファイル: ItemAdder.cpp プロジェクト: binarybazooka/teasafe
void ItemAdder::populate(QTreeWidgetItem *parent,
                         teasafe::SharedTeaSafe const &teaSafe,
                         std::string const &path)
{
    if(teaSafe->folderExists(path)) {
        teasafe::TeaSafeFolder f = teaSafe->getTeaSafeFolder(path);
        std::vector<teasafe::EntryInfo> entryInfos = f.listAllEntries();
        std::vector<teasafe::EntryInfo>::iterator it = entryInfos.begin();

        for(; it != entryInfos.end(); ++it) {
            QTreeWidgetItem *item = new QTreeWidgetItem(parent);
            if(it->type() == teasafe::EntryType::FolderType) {
                item->setChildIndicatorPolicy (QTreeWidgetItem::ShowIndicator);
            }
            item->setText(0, QString(it->filename().c_str()));
        }
    }

    emit finished();
}
コード例 #13
0
ファイル: historywindow.cpp プロジェクト: CyberSys/qutim
void HistoryWindow::fillDateTreeWidget(int index)
{
	if (ui.fromComboBox->count() == 0)
		return;
	auto contactInfo = ui.fromComboBox->itemData(index).value<History::ContactInfo>();
	ui.dateTreeWidget->clear();

	setWindowTitle(QStringLiteral("%1 (%2)").arg(ui.fromComboBox->currentText(), ui.accountComboBox->currentText()));

	history()->months(contactInfo, m_search).connect(this, [this, contactInfo] (const QList<QDate> &months) {
		int index = ui.fromComboBox->currentIndex();
		auto currentContactInfo = ui.fromComboBox->itemData(index).value<History::ContactInfo>();
		if (!(currentContactInfo == contactInfo))
			return;

		QTreeWidgetItem *year = nullptr;
		QTreeWidgetItem *month = nullptr;
		Icon yearIcon(QStringLiteral("view-calendar-year"));

		for (const QDate &date : months) {
			if (!year || year->data(0, Qt::UserRole).toInt() != date.year()) {
				year = new QTreeWidgetItem(ui.dateTreeWidget);
				year->setText(0, QString::number(date.year()));
				year->setIcon(0, yearIcon);
				year->setData(0, Qt::UserRole, date.year());
				year->setExpanded(true);
			}

			month = new QTreeWidgetItem(year);
			month->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
			month->setText(0, QDate::longMonthName(date.month()));
			month->setIcon(0, Icon("view-calendar-month"));
			month->setData(0, Qt::UserRole, date);
			month->setExpanded(false);
		}

		if (month)
			ui.dateTreeWidget->setCurrentItem(month);
	});
}
コード例 #14
0
ファイル: folderwizard.cpp プロジェクト: TaylorHicks/mirall
static void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QString path)
{
    QFileIconProvider prov;
    QIcon folderIcon = prov.icon(QFileIconProvider::Folder);
    if (pathTrail.size() == 0) {
        if (path.endsWith('/')) {
            path.chop(1);
        }
        parent->setToolTip(0, path);
        parent->setData(0, Qt::UserRole, path);
    } else {
        QTreeWidgetItem *item = findFirstChild(parent, pathTrail.first());
        if (!item) {
            item = new QTreeWidgetItem(parent);
            item->setIcon(0, folderIcon);
            item->setText(0, pathTrail.first());
            item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
        }

        pathTrail.removeFirst();
        recursiveInsert(item, pathTrail, path);
    }
}
コード例 #15
0
void QTreeWidgetItemProto::setChildIndicatorPolicy(int policy)
{
  QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject());
  if (item)
    item->setChildIndicatorPolicy((QTreeWidgetItem::ChildIndicatorPolicy)policy);
}
コード例 #16
0
OutputWindow::OutputWindow(QWidget *parent) :
    QDockWidget(parent),
    ui(new Ui::OutputWindow)
{
    ui->setupUi(this);
    setAllowedAreas(Qt::AllDockWidgetAreas);

    connect(ui->treeDataStruct, SIGNAL(doubleClicked(QModelIndex)),
            this, SLOT(modelDataStructDblClicked(QModelIndex)) );

    connect(ui->treeModelDsc, SIGNAL(doubleClicked(QModelIndex)),
            this, SLOT(modelModelDscDblClicked(QModelIndex)) );



    QPixmap px(":/flatastic1");
    int px_width = 112, px_height = 112;
    ui->tabWidget->setTabText(0, tr("Project"));
    ui->tabWidget->setTabText(1, tr("Data Structure"));
    ui->tabWidget->setTabText(2, tr("Model Description"));
    ui->tabWidget->setTabText(3, tr("Model Code"));
    ui->tabWidget->setTabIcon(0, QIcon(px.copy(0*px_width,3*px_height,  px_width,px_height)));
    ui->tabWidget->setTabIcon(1, QIcon(px.copy(3*px_width,3*px_height,  px_width,px_height)));
    ui->tabWidget->setTabIcon(2, QIcon(px.copy(4*px_width,0*px_height,  px_width,px_height)));
    ui->tabWidget->setTabIcon(3, QIcon(px.copy(1*px_width,0*px_height,  px_width,px_height)));

    xmlIcon = new QIcon(px.copy(1*px_width,2*px_height,  px_width,px_height));
    excelIcon = new QIcon(px.copy(4*px_width,2*px_height,  px_width,px_height));
    folderIcon = new QIcon(px.copy(4*px_width,4*px_height,  px_width,px_height));
    descIcon = new QIcon(px.copy(0*px_width,1*px_height,  px_width,px_height));

    modelFolder = qApp->applicationDirPath();

    QTreeWidget* tree;
    QTreeWidgetItem* item;
    QStringList ls;

    tree = ui->treeWidget;
    tree->setColumnCount(1);
    tree->setHeaderLabel(tr("Model Excel File"));

    tree->insertTopLevelItem(0, new QTreeWidgetItem(tree, ls));
    item = tree->topLevelItem(0);
    item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);

    tree = ui->treeDataStruct;
    tree->setColumnCount(1);
    tree->setHeaderLabel(tr("Model Data Structure"));

    tree->insertTopLevelItem(0, new QTreeWidgetItem(tree, ls));
    item = tree->topLevelItem(0);
    item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);

    tree = ui->treeModelDsc;
    tree->setColumnCount(1);
    tree->setHeaderLabel(tr("Model Description"));

    tree->insertTopLevelItem(0, new QTreeWidgetItem(tree, ls));
    item = tree->topLevelItem(0);
    item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);

    tree = ui->treeProject;
    tree->setColumnCount(1);
    tree->setHeaderLabel(tr("Model Code"));

    tree->insertTopLevelItem(0, new QTreeWidgetItem(tree, ls));
    item = tree->topLevelItem(0);
    item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);

}
コード例 #17
0
void EffectsListWidget::initList(QMenu *effectsMenu, KActionCategory *effectActions, QString categoryFile, bool transitionMode)
{
    QString current;
    QString currentFolder;
    bool found = false;
    effectsMenu->clear();

    if (currentItem()) {
        current = currentItem()->text(0);
        if (currentItem()->parent())
            currentFolder = currentItem()->parent()->text(0);
        else if (currentItem()->data(0, TypeRole) == EffectsList::EFFECT_FOLDER)
            currentFolder = currentItem()->text(0);
    }

    QTreeWidgetItem *misc = NULL;
    QTreeWidgetItem *audio = NULL;
    QTreeWidgetItem *custom = NULL;
    QList <QTreeWidgetItem *> folders;

    if (!categoryFile.isEmpty()) {
        QDomDocument doc;
        QFile file(categoryFile);
        doc.setContent(&file, false);
        file.close();
        QStringList folderNames;
        QDomNodeList groups = doc.documentElement().elementsByTagName(QStringLiteral("group"));
        for (int i = 0; i < groups.count(); ++i) {
            folderNames << i18n(groups.at(i).firstChild().firstChild().nodeValue().toUtf8().constData());
        }
        for (int i = 0; i < topLevelItemCount(); ++i) {
            topLevelItem(i)->takeChildren();
            QString currentName = topLevelItem(i)->text(0);
            if (currentName != i18n("Misc") && currentName != i18n("Audio") && currentName != i18nc("Folder Name", "Custom") && !folderNames.contains(currentName)) {
                takeTopLevelItem(i);
                --i;
            }
        }

        for (int i = 0; i < groups.count(); ++i) {
            QTreeWidgetItem *item = findFolder(folderNames.at(i));
            if (item) {
                item->setData(0, IdRole, groups.at(i).toElement().attribute(QStringLiteral("list")));
            } else {
                item = new QTreeWidgetItem((QTreeWidget*)0, QStringList(folderNames.at(i)));
                item->setData(0, TypeRole, QString::number((int) EffectsList::EFFECT_FOLDER));
                item->setData(0, IdRole, groups.at(i).toElement().attribute(QStringLiteral("list")));
                item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
                item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
                insertTopLevelItem(0, item);
            }
            folders.append(item);
        }

        misc = findFolder(i18n("Misc"));
        if (misc == NULL) {
            misc = new QTreeWidgetItem((QTreeWidget*)0, QStringList(i18n("Misc")));
            misc->setData(0, TypeRole, QString::number((int) EffectsList::EFFECT_FOLDER));
            misc->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
            insertTopLevelItem(0, misc);
        }

        audio = findFolder(i18n("Audio"));
        if (audio == NULL) {
            audio = new QTreeWidgetItem((QTreeWidget*)0, QStringList(i18n("Audio")));
            audio->setData(0, TypeRole, QString::number((int) EffectsList::EFFECT_FOLDER));
            audio->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
            insertTopLevelItem(0, audio);
        }

        custom = findFolder(i18nc("Folder Name", "Custom"));
        if (custom == NULL) {
            custom = new QTreeWidgetItem((QTreeWidget*)0, QStringList(i18nc("Folder Name", "Custom")));
            custom->setData(0, TypeRole, QString::number((int) EffectsList::EFFECT_FOLDER));
            custom->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
            insertTopLevelItem(0, custom);
        }
    }

    //insertTopLevelItems(0, folders);
    if (transitionMode) {
        loadEffects(&MainWindow::transitions, misc, &folders, EffectsList::TRANSITION_TYPE, current, &found);
    }
    else {
        loadEffects(&MainWindow::videoEffects, misc, &folders, EffectsList::EFFECT_VIDEO, current, &found);
        loadEffects(&MainWindow::audioEffects, audio, &folders, EffectsList::EFFECT_AUDIO, current, &found);
        loadEffects(&MainWindow::customEffects, custom, static_cast<QList<QTreeWidgetItem *> *>(0), EffectsList::EFFECT_CUSTOM, current, &found);
        if (!found && !currentFolder.isEmpty()) {
            // previously selected effect was removed, focus on its parent folder
            for (int i = 0; i < topLevelItemCount(); ++i) {
                if (topLevelItem(i)->text(0) == currentFolder) {
                    setCurrentItem(topLevelItem(i));
                    break;
                }
            }
        }
    }
    setSortingEnabled(true);
    sortByColumn(0, Qt::AscendingOrder);

    // populate effects menu
    QMenu *sub1 = NULL;
    QMenu *sub2 = NULL;
    QMenu *sub3 = NULL;
    QMenu *sub4 = NULL;
    for (int i = 0; i < topLevelItemCount(); ++i) {
        if (topLevelItem(i)->data(0, TypeRole) == EffectsList::TRANSITION_TYPE) {
            QTreeWidgetItem *item = topLevelItem(i);
            QAction *a = new QAction(item->icon(0), item->text(0), effectsMenu);
            QStringList data = item->data(0, IdRole).toStringList();
            QString id = data.at(1);
            if (id.isEmpty()) id = data.at(0);
            a->setData(data);
            a->setIconVisibleInMenu(false);
            effectsMenu->addAction(a);
            effectActions->addAction("transition_" + id, a);
            continue;
        }
        if (!topLevelItem(i)->childCount())
            continue;
        QMenu *sub = new QMenu(topLevelItem(i)->text(0), effectsMenu);
        effectsMenu->addMenu(sub);
        int effectsInCategory = topLevelItem(i)->childCount();
        bool hasSubCategories = false;
        if (effectsInCategory > 60) {
            // create subcategories if there are too many effects
            hasSubCategories = true;
            sub1 = new QMenu(i18nc("menu name for effects names between these 2 letters", "0 - F"), sub);
            sub->addMenu(sub1);
            sub2 = new QMenu(i18nc("menu name for effects names between these 2 letters", "G - L"), sub);
            sub->addMenu(sub2);
            sub3 = new QMenu(i18nc("menu name for effects names between these 2 letters", "M - R"), sub);
            sub->addMenu(sub3);
            sub4 = new QMenu(i18nc("menu name for effects names between these 2 letters", "S - Z"), sub);
            sub->addMenu(sub4);
        }
        for (int j = 0; j < effectsInCategory; ++j) {
            QTreeWidgetItem *item = topLevelItem(i)->child(j);
            QAction *a = new QAction(item->icon(0), item->text(0), sub);
            QStringList data = item->data(0, IdRole).toStringList();
            QString id = data.at(1);
            if (id.isEmpty()) id = data.at(0);
            a->setData(data);
            a->setIconVisibleInMenu(false);
            if (hasSubCategories) {
                // put action in sub category
                QRegExp rx("^[s-z].+");
                if (rx.exactMatch(item->text(0).toLower())) {
                    sub4->addAction(a);
                } else {
                    rx.setPattern(QStringLiteral("^[m-r].+"));
                    if (rx.exactMatch(item->text(0).toLower())) {
                        sub3->addAction(a);
                    }
                    else {
                        rx.setPattern(QStringLiteral("^[g-l].+"));
                        if (rx.exactMatch(item->text(0).toLower())) {
                            sub2->addAction(a);
                        }
                        else sub1->addAction(a);
                    }
                }
            }
            else sub->addAction(a);
            effectActions->addAction("video_effect_" + id, a);
        }
    }
}