Get the QPixmap from a QLabel

前端 未结 1 1670
名媛妹妹
名媛妹妹 2020-12-20 06:39

I have a QLabel called Picture which Pixmap has been set to a QImage.
I now want to modify the image in another funct

相关标签:
1条回答
  • 2020-12-20 07:09

    I think you shall check the return value of the pixmap() function.

    const QPixmap* pixmap = ui.Picture->pixmap();
    if ( pixmap )
    {
        QImage image( pixmap->toImage() );
    }
    

    Maybe you just called the function when the image was not set and that caused the exception.

    0 讨论(0)
提交回复
热议问题