#ifndef TESTIMAGECROPPERLABEL_H #define TESTIMAGECROPPERLABEL_H #include #include #include #include #include #include #include #include #include #include "imagecropperlabel.h" class ImageCropperDemo : public QDialog { Q_OBJECT public: ImageCropperDemo(QWidget* parent = nullptr); void setupLayout(); void init(); public slots: void onOutputShapeChanged(int idx); void onCropperShapeChanged(int idx); void onEnableOpacityChanged(int state); void onShowDragSquareChanged(int state); void onDragSquareEdgeChanged(QString edge); void onOpacityChanged(int val); void onFixedWidthChanged(QString width); void onFixedHeightChanged(QString height); void onWidthChanged(QString width);//厘米宽度改变事件 void onHeightChanged(QString height);//厘米高度改变事件 void onMinWidthChanged(QString width); void onMinHeightChanged(QString height); void onShowRectBorder(int state); void onChooseRectBorderColor(); void onChooseDragSquareColor(); void onChooseOriginalImage(); void onUpdatePreview(); void onSaveCroppedImage(); private: void setLabelColor(QLabel* label, QColor color) { QPixmap pixmap(QSize(80, 25)); pixmap.fill(color); label->setPixmap(pixmap); } private: ImageCropperLabel* imgCropperLabel; QHBoxLayout* mainLayout; QLabel* labelPreviewImage; QComboBox* comboOutputShape; QComboBox* comboCropperShape; QLineEdit* editOriginalImagePath; QPushButton* btnChooseOriginalImagePath; QLineEdit* editCropperFixedWidth;//固定尺寸宽度,单位像素 QLineEdit* editCropperFixedHeight;//固定尺寸高度,单位像素 QLineEdit* editCropperMinWidth; QLineEdit* editCropperMinHeight; QLineEdit* editResolution;//设置图片分辨率 QLineEdit* editFixedWidth;//固定尺寸宽度,单位厘米 QLineEdit* editFixedHeight;//固定尺寸高度,单位厘米 QCheckBox* checkShowDragSquare; QCheckBox* checkEnableOpacity; QSlider* sliderOpacity; QLineEdit* editDragSquareEdge; QCheckBox* checkShowRectBorder; QLabel* labelRectBorderColor; QPushButton* btnChooseRectBorderCorlor; QLabel* labelDragSquareColor; QPushButton* btnChooseDragSquareColor; QPushButton* btnSavePreview; QPushButton* btnQuit; }; #endif // TESTIMAGECROPPERLABEL_H