mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
更新九宫格图片控件
This commit is contained in:
parent
2dcd399bbd
commit
21e92446ad
@ -133,6 +133,49 @@ QQtNinePatchWidget::QQtNinePatchWidget ( QWidget* parent ) : QWidget ( parent )
|
||||
mCorner = QSize ( 0, 0 );
|
||||
}
|
||||
|
||||
QQtNinePatchWidget::~QQtNinePatchWidget() {}
|
||||
|
||||
void QQtNinePatchWidget::setImage ( const QImage& image )
|
||||
{
|
||||
mImg = image;
|
||||
update();
|
||||
}
|
||||
|
||||
void QQtNinePatchWidget::setImage ( const QString& filename )
|
||||
{
|
||||
mImg.load ( filename );
|
||||
update();
|
||||
}
|
||||
|
||||
void QQtNinePatchWidget::setImage ( const QPixmap& pixmap )
|
||||
{
|
||||
mImg = pixmap.toImage();
|
||||
update();
|
||||
}
|
||||
|
||||
QImage& QQtNinePatchWidget::image()
|
||||
{
|
||||
return mImg;
|
||||
}
|
||||
|
||||
void QQtNinePatchWidget::setCornerSize ( QSize size )
|
||||
{
|
||||
mCorner = size;
|
||||
update();
|
||||
}
|
||||
|
||||
void QQtNinePatchWidget::setCornerHeight ( int height )
|
||||
{
|
||||
mCorner.setHeight ( height );
|
||||
update();
|
||||
}
|
||||
|
||||
void QQtNinePatchWidget::setCornerWidth ( int width )
|
||||
{
|
||||
mCorner.setWidth ( width );
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void QQtNinePatchWidget::paintEvent ( QPaintEvent* event )
|
||||
{
|
||||
|
@ -21,36 +21,16 @@ class QQTSHARED_EXPORT QQtNinePatchWidget : public QWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QQtNinePatchWidget ( QWidget* parent = nullptr );
|
||||
virtual ~QQtNinePatchWidget() {}
|
||||
virtual ~QQtNinePatchWidget();
|
||||
|
||||
void setImage ( const QImage& image ) {
|
||||
mImg = image;
|
||||
update();
|
||||
}
|
||||
void setImage ( const QString& filename ) {
|
||||
mImg.load ( filename );
|
||||
update();
|
||||
}
|
||||
void setImage ( const QPixmap& pixmap ) {
|
||||
mImg = pixmap.toImage();
|
||||
update();
|
||||
}
|
||||
QImage& image() {
|
||||
return mImg;
|
||||
}
|
||||
void setImage ( const QImage& image );
|
||||
void setImage ( const QString& filename );
|
||||
void setImage ( const QPixmap& pixmap );
|
||||
QImage& image();
|
||||
|
||||
void setCornerSize ( QSize size ) {
|
||||
mCorner = size;
|
||||
update();
|
||||
}
|
||||
void setCornerHeight ( int height ) {
|
||||
mCorner.setHeight ( height );
|
||||
update();
|
||||
}
|
||||
void setCornerWidth ( int width ) {
|
||||
mCorner.setWidth ( width );
|
||||
update();
|
||||
}
|
||||
void setCornerSize ( QSize size );
|
||||
void setCornerHeight ( int height );
|
||||
void setCornerWidth ( int width );
|
||||
protected:
|
||||
|
||||
signals:
|
||||
|
Loading…
x
Reference in New Issue
Block a user