51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
#ifndef PAGE5_H
|
|
#define PAGE5_H
|
|
|
|
#include <QtWidgets>
|
|
#include <QWidget>
|
|
#include <QVector>
|
|
|
|
class DraggableBox : public QLabel {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DraggableBox(QWidget *parent = nullptr,int opacityValue = 128); //128 is default opacityValue
|
|
void updateCoordLabel(); // Update coordinate display
|
|
QLabel *coordLabel; // Coordinate display box
|
|
QPoint dragStartPos;
|
|
void hideCoordLabel(); // Hide coordinate labels
|
|
|
|
protected:
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
void mouseMoveEvent(QMouseEvent *event) override;
|
|
void contextMenuEvent(QContextMenuEvent *event) override; // Add context menu events
|
|
void paintEvent(QPaintEvent *event) override; // Add draw border event
|
|
|
|
public slots:
|
|
void updateOpacity(int value); // Function to update transparency
|
|
|
|
private:
|
|
QSlider *opacitySlider; // Transparency slider
|
|
};
|
|
|
|
|
|
class Page5 : public QWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit Page5(QWidget *parent = nullptr);
|
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
|
~Page5();
|
|
|
|
private slots:
|
|
void addBox();
|
|
void clearBoxes();
|
|
|
|
private:
|
|
QPushButton *pButtonAddBox;
|
|
QPushButton *pButtonClear;
|
|
QVector<DraggableBox*> boxes;
|
|
};
|
|
|
|
#endif // PAGE5_H
|