mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
Support drag&drop for setting a custom cover in the properties dialog
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
#include "yacreader_field_edit.h"
|
||||
#include "yacreader_field_plain_text_edit.h"
|
||||
#include "db_helper.h"
|
||||
#include "yacreader_cover_label.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QApplication>
|
||||
@ -39,7 +40,8 @@ PropertiesDialog::PropertiesDialog(QWidget *parent)
|
||||
createTabBar();
|
||||
auto rootLayout = new QGridLayout;
|
||||
|
||||
cover = new QLabel();
|
||||
cover = new YACReader::CoverLabel();
|
||||
connect(cover, &YACReader::CoverLabel::imageDropped, this, &PropertiesDialog::loadCustomCoverImageFromPath);
|
||||
|
||||
mainLayout = new QGridLayout;
|
||||
mainLayout->addWidget(tabBar, 0, 0);
|
||||
@ -1165,7 +1167,11 @@ void PropertiesDialog::resetCover()
|
||||
void PropertiesDialog::loadCustomCoverImage()
|
||||
{
|
||||
auto path = YACReader::imageFileLoader(this);
|
||||
loadCustomCoverImageFromPath(path);
|
||||
}
|
||||
|
||||
void PropertiesDialog::loadCustomCoverImageFromPath(const QString &path)
|
||||
{
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -19,6 +19,10 @@ class QComboBox;
|
||||
// class YACReaderBusyWidget;
|
||||
class QToolButton;
|
||||
|
||||
namespace YACReader {
|
||||
class CoverLabel;
|
||||
}
|
||||
|
||||
#include "comic_db.h"
|
||||
|
||||
class PropertiesDialog : public QDialog
|
||||
@ -33,7 +37,7 @@ private:
|
||||
QTabWidget *tabBar;
|
||||
|
||||
QWidget *coverBox;
|
||||
QLabel *cover;
|
||||
YACReader::CoverLabel *cover;
|
||||
QScrollArea *sa;
|
||||
|
||||
QWidget *generalInfoBox;
|
||||
@ -175,6 +179,7 @@ public slots:
|
||||
void loadPreviousCover();
|
||||
void resetCover();
|
||||
void loadCustomCoverImage();
|
||||
void loadCustomCoverImageFromPath(const QString &path);
|
||||
void setCoverPage(int pageNumber);
|
||||
bool close();
|
||||
|
||||
|
Reference in New Issue
Block a user