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

View file

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

View file

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

View file

@ -86,7 +86,6 @@ Item {
source: "image://icontheme/" + model.iconName
visible: !_image.visible
asynchronous: true
smooth: false
}
Image {
@ -99,7 +98,6 @@ Item {
visible: _image.status === Image.Ready
fillMode: Image.PreserveAspectFit
asynchronous: true
smooth: false
cache: false
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());
QString thumbnailsName = QString::fromLatin1(md5.result().toHex()) + QLatin1String(".png");
QString thumbnailsPath = m_thumbnailsDir + thumbnailsName;
QString thumbnailsPath = m_thumbnailsDir + thumbDir + thumbnailsName;
if (!QFile::exists(thumbnailsPath)) {
return generateThumbnail(path, thumbnailsPath, requestedSize);