Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Exporting QWidget::grab's result QPixmap to the Internet
Qt 6.11 is out! See what's new in the release blog

Exporting QWidget::grab's result QPixmap to the Internet

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.1k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pippin
    wrote on last edited by
    #1

    Hello, QWidget::grab is 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!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Pippin
        wrote on last edited by Pippin
        #3

        @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.

        mrjjM 1 Reply Last reply
        0
        • P Pippin

          @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.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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 image

          Alternativ you could use an extern commandline tool to do the upload
          http://imgur.com/tools/

          And simply call it with QProcess.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved