Skip to content

Commit 8507d4a

Browse files
committed
Revert "core/qmlglobal: add saveToFile"
This reverts commit 13e8736.
1 parent 3f506f7 commit 8507d4a

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

src/core/qmlglobal.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@
1515
#include <qqmlcontext.h>
1616
#include <qqmlengine.h>
1717
#include <qqmllist.h>
18-
#include <qquickitemgrabresult.h>
1918
#include <qscreen.h>
2019
#include <qtenvironmentvariables.h>
21-
#include <qthreadpool.h>
2220
#include <qtmetamacros.h>
2321
#include <qtypes.h>
24-
#include <qurl.h>
2522
#include <qvariant.h>
2623
#include <qwindowdefs.h>
2724
#include <unistd.h>
@@ -316,25 +313,6 @@ QString QuickshellGlobal::iconPath(const QString& icon, const QString& fallback)
316313
return IconImageProvider::requestString(icon, "", fallback);
317314
}
318315

319-
void QuickshellGlobal::saveToFile(
320-
const QQuickItemGrabResult* grabResult,
321-
const QUrl& filePath
322-
) {
323-
if (!filePath.isLocalFile()) {
324-
qWarning() << "saveToFile can only save to a file on the local filesystem";
325-
return;
326-
}
327-
328-
const QString localFile = filePath.toLocalFile();
329-
QImage image = grabResult->image();
330-
331-
QThreadPool::globalInstance()->start([image, localFile] {
332-
if (!image.save(localFile)) {
333-
qWarning() << "Failed to save image to" << localFile;
334-
}
335-
});
336-
}
337-
338316
QuickshellGlobal* QuickshellGlobal::create(QQmlEngine* engine, QJSEngine* /*unused*/) {
339317
auto* qsg = new QuickshellGlobal();
340318
auto* generation = EngineGeneration::findEngineGeneration(engine);

src/core/qmlglobal.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <qqmlengine.h>
1010
#include <qqmlintegration.h>
1111
#include <qqmllist.h>
12-
#include <qquickitemgrabresult.h>
1312
#include <qscreen.h>
1413
#include <qtmetamacros.h>
1514
#include <qtypes.h>
@@ -185,15 +184,6 @@ class QuickshellGlobal: public QObject {
185184
/// This function is equivalent to @@Quickshell.Io.Process.startDetached().
186185
Q_INVOKABLE static void execDetached(const qs::io::process::ProcessContext& context);
187186

188-
/// Save the contents of an ItemGrabResult to a file asynchronously.
189-
///
190-
/// > [!INFO] This function is equivalent to an asynchronous version of
191-
/// > @@QtQuick.ItemGrabResult.saveToFile().
192-
/// >
193-
/// > You can use it in a similar way: `Item.grabToImage(res => Quickshell.saveToFile(res, path))`
194-
Q_INVOKABLE static void
195-
saveToFile(const QQuickItemGrabResult* grabResult, const QUrl& filePath);
196-
197187
/// Returns a string usable for a @@QtQuick.Image.source for a given system icon.
198188
///
199189
/// > [!INFO] By default, icons are loaded from the theme selected by the qt platform theme,

0 commit comments

Comments
 (0)