qt/LedOK/player/playwin.h

54 lines
1.4 KiB
C
Raw Normal View History

2022-01-20 10:08:17 +08:00
#ifndef PLAYWIN_H
#define PLAYWIN_H
#include "elebase.h"
2022-08-25 18:37:24 +08:00
#include "synctimer.h"
2022-01-20 10:08:17 +08:00
#include <QWidget>
2022-08-25 18:37:24 +08:00
#include <QMenu>
2022-01-20 10:08:17 +08:00
#include <QVector>
#include <QMap>
class Page : public QWidget {
public:
explicit Page(QWidget *parent = nullptr);
int timeSpan = 0;
QVector<EleBase> eles;
};
class TimerValue{
public:
TimerValue(QWidget *ele = nullptr, bool visible = false): ele(ele), visible(visible){}
QWidget* ele;
bool visible;
};
class PlayWin : public QWidget{
Q_OBJECT
public:
2022-08-25 18:37:24 +08:00
static PlayWin* self;
2022-01-20 10:08:17 +08:00
SyncTimer* timer = nullptr;
int cur = 0;
2022-08-25 18:37:24 +08:00
QVector<Page*> pages;
2022-01-20 10:08:17 +08:00
QMap<int,TimerValue> timerMap;
2022-08-25 18:37:24 +08:00
QPoint mPressRel;
QMenu *menu;
2022-01-20 10:08:17 +08:00
PlayWin(QString dir, int x, int y, int width, int height, const QJsonObject &prog, QWidget *parent = nullptr);
public slots:
void sltNext();
void sltSetVisible(QWidget *wgt, bool visible){
wgt->setVisible(visible);
}
signals:
void sigSetVisible(QWidget *, bool);
protected:
void paintEvent(QPaintEvent *) override;
void timerEvent(QTimerEvent *) override;
2022-08-25 18:37:24 +08:00
void mousePressEvent(QMouseEvent *) override;
void mouseReleaseEvent(QMouseEvent *) override;
void mouseMoveEvent(QMouseEvent *) override;
void leaveEvent(QEvent *) override;
void contextMenuEvent(QContextMenuEvent *) override;
void closeEvent(QCloseEvent *) override;
2022-01-20 10:08:17 +08:00
};
#endif // PLAYWIN_H