[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [labplot] src/kdefrontend/dockwidgets: When selecting an image file in curve and histogram docks,
From: Alexander Semke <null () kde ! org>
Date: 2017-11-14 22:41:43
Message-ID: E1eEjtn-0002k9-Mw () code ! kde ! org
[Download RAW message or body]
Git commit 68eaa4cf32f7680543fb32b5e8fcda83b4c5dddd by Alexander Semke.
Committed on 14/11/2017 at 22:41.
Pushed by asemke into branch 'master'.
When selecting an image file in curve and histogram docks, filter to the supported \
image formats in the file open dialog.
M +9 -1 src/kdefrontend/dockwidgets/HistogramDock.cpp
M +9 -1 src/kdefrontend/dockwidgets/XYCurveDock.cpp
https://commits.kde.org/labplot/68eaa4cf32f7680543fb32b5e8fcda83b4c5dddd
diff --git a/src/kdefrontend/dockwidgets/HistogramDock.cpp \
b/src/kdefrontend/dockwidgets/HistogramDock.cpp index b53474ea..e868ba64 100644
--- a/src/kdefrontend/dockwidgets/HistogramDock.cpp
+++ b/src/kdefrontend/dockwidgets/HistogramDock.cpp
@@ -42,6 +42,7 @@
#include <QDir>
#include <QDirModel>
#include <QFileDialog>
+#include <QImageReader>
#include <QPainter>
#include <KConfigGroup>
@@ -857,7 +858,14 @@ void HistogramDock::fillingSecondColorChanged(const QColor& c){
void HistogramDock::selectFile() {
KConfigGroup conf(KSharedConfig::openConfig(), "HistogramDock");
QString dir = conf.readEntry("LastImageDir", "");
- QString path = QFileDialog::getOpenFileName(this, i18n("Select the image file"), \
dir); +
+ QString formats;
+ foreach(const QByteArray& format, QImageReader::supportedImageFormats()) {
+ QString f = "*." + QString(format.constData());
+ formats.isEmpty() ? formats+=f : formats+=' '+f;
+ }
+
+ QString path = QFileDialog::getOpenFileName(this, i18n("Select the image file"), \
dir, i18n("Images (%1)", formats)); if (path.isEmpty())
return; //cancel was clicked in the file-dialog
diff --git a/src/kdefrontend/dockwidgets/XYCurveDock.cpp \
b/src/kdefrontend/dockwidgets/XYCurveDock.cpp index b310b9ce..84579dc2 100644
--- a/src/kdefrontend/dockwidgets/XYCurveDock.cpp
+++ b/src/kdefrontend/dockwidgets/XYCurveDock.cpp
@@ -43,6 +43,7 @@
#include <QDir>
#include <QDirModel>
#include <QFileDialog>
+#include <QImageReader>
#include <QPainter>
#include <KConfig>
@@ -1456,7 +1457,14 @@ void XYCurveDock::fillingSecondColorChanged(const QColor& c) {
void XYCurveDock::selectFile() {
KConfigGroup conf(KSharedConfig::openConfig(), "XYCurveDock");
QString dir = conf.readEntry("LastImageDir", "");
- QString path = QFileDialog::getOpenFileName(this, i18n("Select the image file"), \
dir); +
+ QString formats;
+ foreach(const QByteArray& format, QImageReader::supportedImageFormats()) {
+ QString f = "*." + QString(format.constData());
+ formats.isEmpty() ? formats+=f : formats+=' '+f;
+ }
+
+ QString path = QFileDialog::getOpenFileName(this, i18n("Select the image file"), \
dir, i18n("Images (%1)", formats)); if (path.isEmpty())
return; //cancel was clicked in the file-dialog
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic