123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- #ifndef FOLDERLISTDIALOG_H
- #define FOLDERLISTDIALOG_H
- #include "MaskDialogBase.h"
- #include <QLabel>
- class ScrollArea;
- class AddFolderCard;
- class FolderCard;
- class FolderListDialog : public MaskDialogBase
- {
- Q_OBJECT
- public:
- FolderListDialog(const QStringList &folderList, const QString &title, const QString &content,
- QWidget *parent = nullptr);
- ~FolderListDialog();
- signals:
- void folderChanged(const QStringList &list);
- private:
- void initWidget();
- void setQss();
- void initLayout();
- void adjustWidgetSize();
- void deleteFolderCard(FolderCard *card);
- private slots:
- void showFileDialog();
- void onButtonClicked();
- void showDeleteFolderCardDialog();
- private:
- QStringList m_folderPaths;
- QStringList m_originalPaths;
- QString m_title;
- QString m_content;
- QVBoxLayout *m_vBoxLayout;
- QLabel *m_titleLabel;
- QLabel *m_contentLabel;
- ScrollArea *m_scrollArea;
- QWidget *m_scrollWidget;
- QPushButton *m_completeButton;
- AddFolderCard *m_addFolderCard;
- QList<FolderCard *> m_folderCards;
- QVBoxLayout *m_scrollLayout;
- };
- class ClickableWindow : public QWidget
- {
- Q_OBJECT
- public:
- explicit ClickableWindow(QWidget *parent = nullptr);
- // QWidget interface
- bool isPressed() const;
- bool isEnter() const;
- protected:
- void mousePressEvent(QMouseEvent *event) override;
- void mouseReleaseEvent(QMouseEvent *event) override;
- void enterEvent(QEvent *event) override;
- void leaveEvent(QEvent *event) override;
- void paintEvent(QPaintEvent *event) override;
- signals:
- void clicked();
- private:
- bool m_isPressed;
- bool m_isEnter;
- };
- class FolderCard : public ClickableWindow
- {
- Q_OBJECT
- public:
- explicit FolderCard(const QString &folderPath, QWidget *parent = nullptr);
- QString folderName() const;
- protected:
- void paintEvent(QPaintEvent *event) override;
- private:
- void drawText(QPainter *painter, int x1, int fontSize1, int x2, int fontSize2);
- private:
- QString m_folderPath;
- QString m_folderName;
- QPixmap m_closeIcon;
- };
- class AddFolderCard : public ClickableWindow
- {
- Q_OBJECT
- public:
- explicit AddFolderCard(QWidget *parent = nullptr);
- protected:
- void paintEvent(QPaintEvent *event) override;
- private:
- QPixmap m_iconPix;
- };
- #endif // FOLDERLISTDIALOG_H
|