Gui: fix image handling:

* Change FileHandlder to accepts all image format supported by Qt
* Make sure image object is not touched after accepting or rejecting changes
* Make option 'Keep aspect ratio' the default
* Fix WhatThis text of command
This commit is contained in:
wmayer
2023-03-22 17:55:55 +01:00
parent 3e3540192b
commit 6ae787cc6b
4 changed files with 15 additions and 5 deletions

View File

@@ -24,6 +24,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QFileInfo>
# include <QImageReader>
# include <QStringList>
# include <Inventor/SoInput.h>
#endif
@@ -146,10 +147,14 @@ bool FileHandler::openInternal()
return true;
}
if (hasExtension(QStringList() << QLatin1String("bmp")
<< QLatin1String("jpg")
<< QLatin1String("png")
<< QLatin1String("xpm"))) {
QStringList supportedFormats;
auto imageFormats = QImageReader::supportedImageFormats();
std::transform(imageFormats.cbegin(), imageFormats.cend(),
std::back_inserter(supportedFormats), [](const QByteArray& format) {
return QString::fromLatin1(format);
});
if (hasExtension(supportedFormats)) {
openImage();
return true;
}