From ba1b81d1c94f907c315ad3d6b3b50fc198d1b036 Mon Sep 17 00:00:00 2001
From: zinface
Date: Thu, 9 Nov 2023 11:38:23 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=85=89=E6=A0=87?=
=?UTF-8?q?=E5=8A=A8=E7=94=BB=E9=A2=84=E8=A7=88=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
dialog.cpp | 19 +++++++++++++++++++
dialog.h | 5 +++++
dialog.ui | 7 +++++++
3 files changed, 31 insertions(+)
diff --git a/dialog.cpp b/dialog.cpp
index b25fcc6..2843ffb 100644
--- a/dialog.cpp
+++ b/dialog.cpp
@@ -49,6 +49,17 @@ Dialog::Dialog(const QString& path, QWidget *parent)
if (!path.isEmpty()) {
openFolderPath(path);
}
+
+ previewCursorTime.setInterval(100);
+ connect(&previewCursorTime, &QTimer::timeout, this, [this](){
+ if (previewIndex < previewCursor.length()) {
+ QImage img = previewCursor[previewIndex];
+ ui->preview->setPixmap(QPixmap::fromImage(img));
+ previewIndex++;
+ } else {
+ previewIndex = 0;
+ }
+ });
}
Dialog::~Dialog()
@@ -259,6 +270,10 @@ void Dialog::openFolderPath(QString path)
void Dialog::showCursor(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{
+ previewCursorTime.stop();
+ previewCursor.clear();
+ previewIndex = 0;
+
if (!current) {
ui->teCursorInfo->clear();
return;
@@ -306,11 +321,14 @@ void Dialog::showCursor(QTreeWidgetItem *current, QTreeWidgetItem *previous)
QByteArray imgBa;
QBuffer buffer(&imgBa);
cursor.image.save(&buffer, "PNG");
+ previewCursor.append(cursor.image.copy());
imgBa = imgBa.toBase64();
currentCursorFile.cachedCursors += "";
}
+
+// previewCursor = cursorList;
currentCursorFile.cachedCursors += "
";
}
@@ -326,6 +344,7 @@ void Dialog::showCursor(QTreeWidgetItem *current, QTreeWidgetItem *previous)
}
}
+ previewCursorTime.start();
ui->teCursorInfo->setHtml(currentCursorFile.cachedCursors);
}
diff --git a/dialog.h b/dialog.h
index 749810e..14fa623 100644
--- a/dialog.h
+++ b/dialog.h
@@ -24,6 +24,7 @@
#include
#include
#include
+#include
#include
namespace Ui { class Dialog; }
@@ -58,6 +59,10 @@ public:
void openFolderPath(QString path);
void showCursor(QTreeWidgetItem *current, QTreeWidgetItem *previous);
+ QList previewCursor;
+ QTimer previewCursorTime;
+ int previewIndex;
+
private slots:
void on_pbExport_clicked();
diff --git a/dialog.ui b/dialog.ui
index 0dfc17f..023f8cd 100644
--- a/dialog.ui
+++ b/dialog.ui
@@ -59,6 +59,13 @@
+ -
+
+
+
+
+
+