QT笔记-QPush不规则画图与点击

    {
        QMatrix leftmatrix;
        leftmatrix.rotate(123);
 
  
        //163,163为原始分辨率,这里稍做了调整。
        QPixmap pixmap(":/image/StartDown.png");//pixmap.transformed(leftmatrix,Qt::SmoothTransformation);;//
        QPixmap fitpixmap=pixmap.transformed(leftmatrix,Qt::SmoothTransformation);;//pixmap.scaled(110,82).scaled(110, 70, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
 
  
        ui->pushButton_cup->setIcon(QIcon(fitpixmap));//  QIcon(":/image/StartDown.png"));
        ui->pushButton_cup->setIconSize(QSize(fitpixmap.size()));
        ui->pushButton_cup->setFlat(true);//就是这句能够实现按钮透明,用png图片时很有用
        ui->pushButton_cup->setStyleSheet("border: 0px");//消除边框,取消点击效果
 
  
 
  
//        QPixmap pixmapLeft(":/image/StartDown.png");
//        pixmapLeft  = pixmapLeft.transformed(leftmatrix,Qt::SmoothTransformation);
        ui->pushButton_cup->resize(fitpixmap.size());
        ui->pushButton_cup->setMask(fitpixmap.mask());
    }

你可能感兴趣的:(qt,笔记,开发语言)