mirror of
https://gitee.com/drabel/LibQQt.git
synced 2025-01-04 10:18:44 +08:00
不规则label,支持scaledContent
This commit is contained in:
parent
9a3d1c32ca
commit
3dd7233201
@ -23,6 +23,17 @@ void QQtIrregularLabel::makeMaskWidget ( void )
|
||||
if ( normalImage.isNull() )
|
||||
return; //return QQtLabel::resizeEvent ( event );
|
||||
|
||||
if ( hasScaledContents() )
|
||||
{
|
||||
//zoom
|
||||
setMask ( QPixmap::fromImage ( normalImage
|
||||
.scaled ( rect().width(), rect().height(), Qt::IgnoreAspectRatio )
|
||||
).mask() );
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//label的特点,
|
||||
//图片无论如何不会缩放的 !!!
|
||||
//图片无论如何不会变形的
|
||||
|
@ -116,9 +116,12 @@ MainWindow::MainWindow ( QWidget* parent ) :
|
||||
ui->label_3->installEventFilter ( clicker );
|
||||
|
||||
ui->label_8->setPixmap ( QPixmap ( conf_root ( "a1.png" ) ) );
|
||||
//ui->label_8->setScaledContents ( true );
|
||||
//ui->label_8->setAutoFillBackground ( true );
|
||||
ui->label_7->setPixmap ( QPixmap ( conf_root ( "a1.png" ) ) );
|
||||
ui->label_7->installEventFilter ( clicker );
|
||||
ui->label_7->installEventFilter ( this );
|
||||
//ui->label_7->setScaledContents ( true );
|
||||
|
||||
QStringList items;
|
||||
items << "Qt::AlignLeft"
|
||||
|
Loading…
x
Reference in New Issue
Block a user