首页 > 代码库 > QLable 显示图片

QLable 显示图片

1,各种对就是不显示,因为路径中有其它符号如\n\r什么的

技术分享
 1 QStringList FileOpeartion::PathCombine (const QString strPath, QStringList strListTemp) 2 { 3     QStringList strReturn; 4      5     foreach (const QString &str, strListTemp) 6     { 7         if (!str.isEmpty()) 8         { 9             strReturn << strPath.trimmed() + str.trimmed();10         }11     }12     13     return strReturn;14 }15 16 17 QPixmap FileOpeartion::GetPicture (QString strPath, int mWidth, int mHeight)18 {19     QPixmap pictureimg;20     //"D:dataFolder/2015/03/15/AIA094/20150315_001402_1024_0094.jpg"21     22     if (pictureimg.load (strPath))23     {24         pictureimg = pictureimg.scaled (mWidth, mHeight, Qt::KeepAspectRatio);25     }26     27     return pictureimg;28 }
View Code

 

QLable 显示图片