1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00

更新3按钮的绘图部分

This commit is contained in:
tianduanrui 2020-04-11 23:48:05 +08:00
parent 68b6a8a110
commit de4c4eadfd
3 changed files with 21 additions and 0 deletions

View File

@ -169,8 +169,16 @@ void QQtCheckBox::paintEvent ( QPaintEvent* event )
//qDebug() << isEnabled() << mWorkState;
QStylePainter p ( this );
#if 0
p.drawItemPixmap ( rect(), Qt::AlignCenter, QIcon ( QPixmap::fromImage ( mImage ) ).pixmap ( rect().size(),
QIcon::Normal, QIcon::On ) );
#else
p.drawItemPixmap ( rect(), Qt::AlignLeft | Qt::AlignTop,
/*不.copy() 切出图片的中间部分使用*/
QPixmap::fromImage ( mImage
.scaled ( rect().width(), rect().height(), Qt::IgnoreAspectRatio )
) );
#endif
QStyleOptionButton opt;
initStyleOption ( &opt );

View File

@ -169,11 +169,16 @@ void QQtPushButton::paintEvent ( QPaintEvent* event )
//qDebug() << isEnabled() << mWorkState;
QStylePainter p ( this );
#if 0
p.drawItemPixmap ( rect(), Qt::AlignCenter, QIcon ( QPixmap::fromImage ( mImage ) ).pixmap ( rect().size(),
QIcon::Normal, QIcon::On ) );
#else
p.drawItemPixmap ( rect(), Qt::AlignLeft | Qt::AlignTop,
/*不.copy() 切出图片的中间部分使用*/
QPixmap::fromImage ( mImage
.scaled ( rect().width(), rect().height(), Qt::IgnoreAspectRatio )
) );
#endif
QStyleOptionButton opt;
initStyleOption ( &opt );

View File

@ -168,8 +168,16 @@ void QQtRadioButton::paintEvent ( QPaintEvent* event )
//qDebug() << isEnabled() << mWorkState;
QStylePainter p ( this );
#if 0
p.drawItemPixmap ( rect(), Qt::AlignCenter, QIcon ( QPixmap::fromImage ( mImage ) ).pixmap ( rect().size(),
QIcon::Normal, QIcon::On ) );
#else
p.drawItemPixmap ( rect(), Qt::AlignLeft | Qt::AlignTop,
/*不.copy() 切出图片的中间部分使用*/
QPixmap::fromImage ( mImage
.scaled ( rect().width(), rect().height(), Qt::IgnoreAspectRatio )
) );
#endif
QStyleOptionButton opt;
initStyleOption ( &opt );