Fix property window crash

This commit is contained in:
reionwong 2021-08-17 15:58:29 +08:00
parent dede872fac
commit c5eccdebc0
5 changed files with 9 additions and 10 deletions

View file

@ -172,7 +172,7 @@ bool FilePropertiesDialog::event(QEvent *e)
void FilePropertiesDialog::init() void FilePropertiesDialog::init()
{ {
engine()->rootContext()->setContextProperty("main", this); engine()->rootContext()->setContextProperty("main", this);
engine()->addImageProvider(QStringLiteral("icontheme"), new DesktopIconProvider()); // engine()->addImageProvider(QStringLiteral("icontheme"), new DesktopIconProvider());
setFlag(Qt::Dialog); setFlag(Qt::Dialog);
setTitle(tr("Properties")); setTitle(tr("Properties"));
@ -225,9 +225,11 @@ void FilePropertiesDialog::init()
m_isWritable = false; m_isWritable = false;
m_fileName = tr("%1 files").arg(m_items.count()); m_fileName = tr("%1 files").arg(m_items.count());
m_location = QFileInfo(m_items.first().localPath()).dir().path(); m_location = QFileInfo(m_items.first().localPath()).dir().path();
m_iconName = "unknown";
emit fileNameChanged(); emit fileNameChanged();
emit locationChanged(); emit locationChanged();
emit iconNameChanged();
} }
emit isWritableChanged(); emit isWritableChanged();

View file

@ -65,11 +65,10 @@ Item {
RowLayout { RowLayout {
spacing: FishUI.Units.largeSpacing * 2 spacing: FishUI.Units.largeSpacing * 2
Image { FishUI.IconItem {
width: 64 width: 64
height: width height: 64
sourceSize: Qt.size(width, height) source: main.iconName
source: "image://icontheme/" + main.iconName
} }
TextField { TextField {

View file

@ -94,7 +94,7 @@ Item {
sourceSize: Qt.size(width, height) sourceSize: Qt.size(width, height)
source: "image://icontheme/" + model.iconName source: "image://icontheme/" + model.iconName
visible: !_image.visible visible: !_image.visible
smooth: false smooth: true
antialiasing: true antialiasing: true
ColorOverlay { ColorOverlay {
@ -128,7 +128,7 @@ Item {
source: model.thumbnail ? model.thumbnail : "" source: model.thumbnail ? model.thumbnail : ""
asynchronous: true asynchronous: true
cache: false cache: false
smooth: false smooth: true
antialiasing: true antialiasing: true
// Because of the effect of OpacityMask. // Because of the effect of OpacityMask.

View file

@ -86,7 +86,6 @@ Item {
source: "image://icontheme/" + model.iconName source: "image://icontheme/" + model.iconName
visible: !_image.visible visible: !_image.visible
asynchronous: true asynchronous: true
smooth: false
} }
Image { Image {
@ -99,7 +98,6 @@ Item {
visible: _image.status === Image.Ready visible: _image.status === Image.Ready
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
asynchronous: true asynchronous: true
smooth: false
cache: false cache: false
layer.enabled: true layer.enabled: true

View file

@ -126,7 +126,7 @@ QString ThumbnailCache::requestThumbnail(const QString &filePath, const QSize &r
md5.addData(QString::number(info.lastModified().toTime_t()).toStdString().c_str()); md5.addData(QString::number(info.lastModified().toTime_t()).toStdString().c_str());
QString thumbnailsName = QString::fromLatin1(md5.result().toHex()) + QLatin1String(".png"); QString thumbnailsName = QString::fromLatin1(md5.result().toHex()) + QLatin1String(".png");
QString thumbnailsPath = m_thumbnailsDir + thumbnailsName; QString thumbnailsPath = m_thumbnailsDir + thumbDir + thumbnailsName;
if (!QFile::exists(thumbnailsPath)) { if (!QFile::exists(thumbnailsPath)) {
return generateThumbnail(path, thumbnailsPath, requestedSize); return generateThumbnail(path, thumbnailsPath, requestedSize);