Exporting QWidget::grab's result QPixmap to the Internet
-
Hello,
QWidget::grab
is terrific, and I made a QPushButton just for it. Whenever the user clicks the QPushButton, a slot is called that runsQWidget::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!
-
Hi,
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
-
@SGaist oh, so there's nothing simple. It looks like this is going to take a huge amount of time, at least with imgur.com.
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.
-
@Pippin
Hi
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 imageAlternativ you could use an extern commandline tool to do the upload
http://imgur.com/tools/And simply call it with QProcess.