tools/designer/src/lib/shared/qtresourceview.cpp
changeset 30 5dc02b23752f
parent 18 2f34d5167611
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   375 void QtResourceViewPrivate::createPaths()
   375 void QtResourceViewPrivate::createPaths()
   376 {
   376 {
   377     if (!m_resourceModel)
   377     if (!m_resourceModel)
   378         return;
   378         return;
   379 
   379 
   380     const QString root(QLatin1Char(':'));
   380     // Resource root up until 4.6 was ':', changed to ":/" as of 4.7
       
   381     const QString root(QLatin1String(":/"));
   381 
   382 
   382     QMap<QString, QString> contents = m_resourceModel->contents();
   383     QMap<QString, QString> contents = m_resourceModel->contents();
   383     QMapIterator<QString, QString> itContents(contents);
   384     QMapIterator<QString, QString> itContents(contents);
   384     while (itContents.hasNext()) {
   385     while (itContents.hasNext()) {
   385         const QString filePath = itContents.next().key();
   386         const QString filePath = itContents.next().key();
   418     //                 to pathToMatchingContents and pathToVisible with false, if non empty
   419     //                 to pathToMatchingContents and pathToVisible with false, if non empty
   419     //                 we add it with true and change every parent path in pathToVisible to true.
   420     //                 we add it with true and change every parent path in pathToVisible to true.
   420     // 3) we hide these items which has pathToVisible value false.
   421     // 3) we hide these items which has pathToVisible value false.
   421 
   422 
   422     const bool matchAll = m_filterPattern.isEmpty();
   423     const bool matchAll = m_filterPattern.isEmpty();
   423     const QString root(QLatin1Char(':'));
   424     const QString root(QLatin1String(":/"));
   424 
   425 
   425     QQueue<QString> pathQueue;
   426     QQueue<QString> pathQueue;
   426     pathQueue.enqueue(root);
   427     pathQueue.enqueue(root);
   427     while (!pathQueue.isEmpty()) {
   428     while (!pathQueue.isEmpty()) {
   428         const QString path = pathQueue.dequeue();
   429         const QString path = pathQueue.dequeue();
   662     return d_ptr->m_itemToResource.value(item);
   663     return d_ptr->m_itemToResource.value(item);
   663 }
   664 }
   664 
   665 
   665 void QtResourceView::selectResource(const QString &resource)
   666 void QtResourceView::selectResource(const QString &resource)
   666 {
   667 {
       
   668     if (resource.isEmpty())
       
   669         return;
   667     QFileInfo fi(resource);
   670     QFileInfo fi(resource);
   668     QDir dir = fi.absoluteDir();
   671     QDir dir = fi.absoluteDir();
   669     if (fi.isDir())
   672     if (fi.isDir())
   670         dir = QDir(resource);
   673         dir = QDir(resource);
   671     QString dirPath = dir.absolutePath();
   674     QString dirPath = dir.absolutePath();