| Summary: | QFileIconProvider doesn't provide under Plasma 5 | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-frameworkintegration | Reporter: | martchus |
| Component: | general | Assignee: | kdelibs bugs <kdelibs-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | aramgrigoryan, kdebugz.10.dubuit, olvmari, parejaobregon, wirthmi |
| Priority: | NOR | Keywords: | regression |
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Arch Linux | ||
| OS: | Linux | ||
| URL: | http://martchus.netai.net/images/screenshots/kde-no-icons.png | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
martchus
2016-02-02 20:05:39 UTC
I confirm this also happens in Debian stretch using plasma 5.4.3 and Qt 5.5.1.
I'm using pure Qt, as stated above. I'm using QFileSystemModel in the following way (which I understand is similar to what is reported originally):
QFileSystemModel *m_fileModel = new QFileSystemModel;
m_fileModel->setRootPath(QDir::homePath());
QListView *m_listView = new QListView;
m_listView->setModel(m_fileModel);
m_listView->setRootIndex(m_fileModel->index(QDir::homePath()));
Thanks for confirming this. The code you provided matches indeed what I reported. This issue is there for quite a time now and still unresolved. I already tried to investigate the issue myself and therefore built all required KDE libraries from Git but I don't know how I can tell my Qt 5 application to use the customized built of the plugin. Another problem is, that there is almost no documentation about platform integration plugins. However, I now suspect the problem might be caused by KIconEngine which is part of the kiconthemes module (and not the frameworksintegration module). Hi, I can also confirm same behavior at my Debian Stretch machine running Qt 5.5.1 and KDE Frameworks 5.16.0. Hi, I can also confirm the bug on OpenSuse Tumbleweed.
I think the problem is linked with QFileIconProvider wich can't find the icon name;
When you do
QFileInfo fi ( ... );
QFileIconProvider fip;
QIcon icon = fip.icon ( fi );
qDebug() << "icon.isNull()=" << icon.isNull()
<< "icon.name()=" << icon.name()
<< "icon.themeName()="<< icon.themeName()
<< "icon.themeSearchPaths()=" << icon.themeSearchPaths();
setIcon ( 0, icon );
The result is :
icon.isNull()= false icon.name()= "" icon.themeName()= "breeze" icon.themeSearchPaths()= ("/usr/share/icons", ":/icons")
icon is not null
theme name is OK
theme search path are OK
but there is no icon name
and when you use QIcon icon = fip.icon ( QFileIconProvider::File );
it's OK
By
Interesting. To summarize this: - The icon name is missing but the icon is not null. - Getting the icon via enum value seems to work. However, I think the problem is not solely a QFileIconProvider issue because it only occurs when frameworksintegration is enabled and hence KIconEngine is used. I have found a momentary workaround, you can try
first
QMimeDatabase mimeDatabase;
QFileInfo fileInfo ( fileName );
QMimeType mimeType = mimeDatabase.mimeTypeForFile( fileInfo );
and then
it->setIcon ( 0, QIcon::fromTheme( mimeType.iconName() ) );
show the good icon.
Icons seem to work again after recent updates (having plasma-integration 5.9.0 and kiconthemes 5.30.0 installed now). Thanks for fixing it. |