久久久久久久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 ()?環形?)
主站蜘蛛池模板: 羞羞在线视频 | 久久精品久久久 | 国产成人91| 欧美黄色录像 | 欧美久久综合 | 欧美日韩视频在线 | 国产精品一品二区三区的使用体验 | 亚洲一区二区中文字幕 | ass亚洲尤物裸体pics | 欧美三级欧美一级 | 国产一级片视频 | 欧美黄网站 | 自拍偷拍欧美日韩 | 国产成人在线免费观看 | 青青青在线视频 | 中国农村毛片免费播放 | 黄色激情网站 | 亚洲精品www久久久久久广东 | 美女久久久 | 日韩精品一区二区在线 | 免费成人在线观看 | 一区二区三区在线观看视频 | 中文字幕一区在线观看 | 精品视频免费 | 亚洲欧美综合网 | 日韩a在线| 99热最新网址 | 色综合视频在线观看 | 欧美日韩成人一区二区 | 五月婷婷丁香 | 国产美女毛片 | 亚洲一区二区久久 | 国产成人一区 | 91久久久久久久久久 | 天堂a在线 | 四虎网站在线观看 | 欧美一级一级 | 日韩国产一区 | 丁香午夜| 欧美黄色一级大片 | 欧美激情成人 |