久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

使用 QtGui 顯示 QImage

Display QImage with QtGui(使用 QtGui 顯示 QImage)
本文介紹了使用 QtGui 顯示 QImage的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我是 Qt 的新手,我正在嘗試創建一個簡單的 GUI 應用程序,該應用程序在單擊按鈕后顯示圖像.

I am new to Qt, and I am trying to create a simple GUI Application that displays an image once a button has been clicked on.

我可以在 QImage 對象中讀取圖像,但是有什么簡單的方法可以調用 Qt 函數,將 QImage 作為輸入并顯示它?

I can read the image in a QImage object, but is there any simple way to call a Qt function that takes the QImage as an input, and displays it?

推薦答案

謝謝大家,我找到了方法,和 Dave 和 Sergey 一樣:

Thanks All, I found how to do it, which is the same as Dave and Sergey:

我正在使用 QT Creator:

I am using QT Creator:

在主 GUI 窗口中使用拖放 GUI 創建并創建標簽(例如myLabel")

In the main GUI window create using the drag drop GUI and create label (e.g. "myLabel")

在按鈕(單擊)的回調中,使用指向用戶界面窗口的 (*ui) 指針執行以下操作:

In the callback of the button (clicked) do the following using the (*ui) pointer to the user interface window:

void MainWindow::on_pushButton_clicked()
{
     QImage imageObject;
     imageObject.load(imagePath);
     ui->myLabel->setPixmap(QPixmap::fromImage(imageObject));

     //OR use the other way by setting the Pixmap directly

     QPixmap pixmapObject(imagePath");
     ui->myLabel2->setPixmap(pixmapObject);
}

這篇關于使用 QtGui 顯示 QImage的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數據?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環: for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環?)
Reusing thread in loop c++(在循環 C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環形?)
主站蜘蛛池模板: 久久婷婷av| 九九视频在线观看 | 老熟女毛片 | 国产成人免费在线 | 三级国产三级在线 | 一区二区电影 | 欧美亚洲国产日韩 | 亚洲国产aⅴ成人精品无吗 国产精品永久在线观看 | 久久久久国产精品一区 | 麻豆视频在线免费看 | 天堂中文在线播放 | 射久久| 国产免费拔擦拔擦8x高清 | 婷婷色综合 | 国产乱肥老妇国产一区二 | 粉嫩在线 | 婷婷一级片 | 国产精品精品视频一区二区三区 | 久久精品一区二区三区四区 | jdav视频在线观看免费 | 在线观看视频一区二区三区 | av国产精品 | 国产一区二区在线视频 | 精品九九| 国产精品影视 | 一区二区三区视频在线观看 | 国产高清精品在线 | 欧美一区视频在线 | 黄色小视频大全 | 欧美一级黄色免费看 | 日韩成人免费av | 一区二区三区在线免费观看 | 一区二区成人 | 一区二区三区欧美 | 久久成人av电影 | 在线看日韩 | 欧美一级二级视频 | 亚洲视频在线观看 | 国产精品国产三级国产a | 久久99久久| zzzwww在线看片免费 |