87 lines
3.2 KiB
C
87 lines
3.2 KiB
C
|
#ifndef MYBUTTON_H
|
|||
|
#define MYBUTTON_H
|
|||
|
|
|||
|
//#include <QObject>
|
|||
|
#include <QWidget>
|
|||
|
#include <QPushButton>
|
|||
|
#include <QLabel>
|
|||
|
|
|||
|
//自定义的按钮类,按钮上有一个Label,用于显示双层图片
|
|||
|
class MyButton : public QPushButton
|
|||
|
{
|
|||
|
public:
|
|||
|
MyButton(QWidget *parent=0);
|
|||
|
~MyButton();
|
|||
|
|
|||
|
public:
|
|||
|
QLabel *labelImage;//顶层logo
|
|||
|
QLabel *labelName;//参数设置按钮的条目名称
|
|||
|
QLabel *labelValue;//参数设置按钮的条目值
|
|||
|
|
|||
|
public:
|
|||
|
void setTopImage(QString imagePath,short int y = 0);//设置顶层图片
|
|||
|
void setTopImage(QString imagePath,short int y,short int x);
|
|||
|
void setTopImage(QString imagePath,short int x,short int y,short int width, short int height);
|
|||
|
void setShortCutTopImage(QString imagePath,QPoint point);//设置快捷按钮顶层图片
|
|||
|
|
|||
|
void setPreviewImage(QImage image);//设置花样选择预览图片
|
|||
|
void setItemLeftIcon(QString imagePath);//设置条目左侧图标
|
|||
|
void setLabelValueImage(QString imagePath);//设置开关图片
|
|||
|
|
|||
|
//设置底层图片(按下、抬起、失效)
|
|||
|
void setBottomImage(QString imagePath);
|
|||
|
|
|||
|
//设置白蓝渐变底层按钮样式(匹绣、快进快退、开位线绣)
|
|||
|
void setWhiteBlueBottomStyle();
|
|||
|
|
|||
|
//设置蓝色加border底层按钮样式(常用按钮)
|
|||
|
void setBlueBorderBottomStyle();
|
|||
|
|
|||
|
//设置橙色渐变底层按钮样式(界面菜单按钮)
|
|||
|
void setOrangeGradientBottomStyle(QString str);
|
|||
|
|
|||
|
//设置蓝色渐变底层按钮样式(界面菜单按钮)
|
|||
|
void setBlueGradientBottomStyle(QString str);
|
|||
|
|
|||
|
//设置蓝色渐变底层按钮样式(控制动作)
|
|||
|
void setBlueGradientBottomStyle();
|
|||
|
|
|||
|
//设置绿色渐变底层按钮样式
|
|||
|
void setGreenGradientBottomStyle(QString str);
|
|||
|
|
|||
|
#if(0)
|
|||
|
//设置控制动作界面底层图片(按下、抬起),并设置文字前景色
|
|||
|
void setControlWidgetBtnBottomImage(QString imagePath,QString color);
|
|||
|
#endif
|
|||
|
|
|||
|
//设置主按钮底层图片(选中、失效)
|
|||
|
void setCheckedBottomImage(QString imagePath);
|
|||
|
|
|||
|
//设置主按钮底层样式(选中、失效)
|
|||
|
void setMainBtnBottomStyle();
|
|||
|
|
|||
|
//设置按钮logo(按钮是没有点击事件的)
|
|||
|
void setUnPreBtnLogo(QString tStyle);
|
|||
|
|
|||
|
void initLeftNameRightValue(QRect rectName, QRect rectValue, int right = 0);//初始化label条目名称和条目值(参数设置)
|
|||
|
void initLeftImageRightName(QRect rectImage, QRect rectName);//初始化label图标显示和条目名称(文件导入)
|
|||
|
void initUpImageDownName(QRect rectImage,QRect rectName);//初始化label图标和名称(花样选择)
|
|||
|
void initLabelValue(QRect rectValue);//初始化labelValue
|
|||
|
|
|||
|
void setLabelFont(QFont font);//设置label字体
|
|||
|
void setLabelNameFont(QFont font);//设置label字体
|
|||
|
void setLabelValueFont(QFont font);//设置label字体
|
|||
|
|
|||
|
void setLabelName(QString name);//设置条目名称
|
|||
|
void setLabelNameStyle(QString style);//设置条目名称样式
|
|||
|
void setLabelValue(QString value);//设置条目值
|
|||
|
void setLabelValueStyle(QString style);//设置条目值样式
|
|||
|
void setLabelImage(QString style);//设置图片
|
|||
|
|
|||
|
void setBtnBackColor(QString style);
|
|||
|
void setImageBackColor(QString style);
|
|||
|
void setLabelImageChecked(QString style);
|
|||
|
};
|
|||
|
|
|||
|
#endif // MYBUTTON_H
|