Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Exporting QWidget::grab's result QPixmap to the Internet
Pippin last edited by
QWidget::grabis terrific, and I made a QPushButton just for it. Whenever the user clicks the QPushButton, a slot is called that runs
QWidget::grab, and I have a screenshot of the QMainWindow as a QPixmap right away. Now I could save that QPixmap in the hard drive (say, as a PNG file) but I think it would be much better if I could export it to dedicated websites such as imgur.com. Problem is, I'm a newbie and I don't know how to do that. Has anyone tried this? What is the easiest way to export an image to the Internet?
Thank you for your time!
You usually need to check the service API (here for imgur).
That usually implies creating an application for the website you want to access and implement the communication with QNetworkAccessManager.
Hope it helps
Pippin last edited by Pippin
I'm a bit surprised, because imgur.com's main page allows you to browse your hard drive and load whatever file. I was hoping that my problem could be solved with a simple QUrl, that would contain somewhere the path to the file.
No its not simple to program.
You could easy pop the home page with upload using
bool QDesktopServices::openUrl ( const QUrl & url )
and let user point to the image
Alternativ you could use an extern commandline tool to do the upload
And simply call it with QProcess.