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

使用 QtGui 顯示 QImage

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

問題描述

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

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 對象中讀取圖像,但是有什么簡單的方法可以調(diào)用 Qt 函數(shù),將 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 創(chuàng)建并創(chuàng)建標(biāo)簽(例如myLabel")

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

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

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);
}

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

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

相關(guān)文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數(shù)據(jù)?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環(huán): for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環(huán)?)
Reusing thread in loop c++(在循環(huán) C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環(huán)形?)
主站蜘蛛池模板: 2018中文字幕第一页 | 少妇一区二区三区 | 蜜桃毛片 | 国产精品久久久久久久久图文区 | 鲁大师一区影视 | 日韩激情在线 | 国产电影一区二区在线观看 | 精品成人一区二区 | 久久一级| 国产高清在线观看 | 久久精品国产a三级三级三级 | 国产免费福利小视频 | 精品国产乱码久久久 | 成人三级在线播放 | 在线亚州 | 久久午夜视频 | 亚洲精品乱码久久久久久按摩观 | 色成人免费网站 | 欧美精品一区二区三区蜜臀 | 欧美一区二区三区视频 | 免费观看黄色一级片 | 午夜在线视频 | 一区二区三区亚洲 | 91成人精品 | 在线视频亚洲 | 国产在线资源 | 国产91av视频 | 精品国产18久久久久久二百 | 草草草久久久 | 亚洲国产成人精品久久 | 亚洲精品在线看 | 免费看a| 欧美黄色一级毛片 | 欧美在线亚洲 | 精品中文字幕一区二区 | 9191成人精品久久 | 日本a级大片 | 中国美女av | 一区二区三区四区av | 亚洲欧美一区二区三区在线 | 国产在线视频网 |