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. Open an image in a window
Qt 6.11 is out! See what's new in the release blog

Open an image in a window

Scheduled Pinned Locked Moved General and Desktop
13 Posts 7 Posters 13.7k Views 1 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.
  • A Offline
    A Offline
    andre
    wrote on last edited by
    #4

    I think your path is not correct. Try outputting it using qDebug() and see what that yields. My guess is that you're missing a path separator between the directory and the file name, and that thus the file cannot be found, resulting in an empty image.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mariusmssj
      wrote on last edited by
      #5

      I feel so silly now xD I was missing " / " thank you =]

      I am really amazed how great the Qt creator is, I am slowly moving away from Visual studio all together.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GentooXativa
        wrote on last edited by
        #6

        We learn from errors, btw welcome to qt :D

        Jose Vicente Giner Sanchez - Senior Mobile Developer

        www.gigigo.com

        C/ Dr. Zamenhof 36bis, 1ºA 28027 Madrid
        T: +34 917431436

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mariusmssj
          wrote on last edited by
          #7

          Thank you GentooXativa,

          I got another question if you don't mind, i would like to achieve same result but open a .pdf document is that possible or it just better to open it using adobe reader?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mlong
            wrote on last edited by
            #8

            Qt doesn't have any built-in .pdf decoding/display classes that I'm aware of.

            Software Engineer
            My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mariusmssj
              wrote on last edited by
              #9

              [quote author="mlong" date="1334681681"]Qt doesn't have any built-in .pdf decoding/display classes that I'm aware of.

              [/quote]

              Thanks for a quick reply

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lgeyer
                wrote on last edited by
                #10

                I know that there are Qt interfaces for "Poppler":http://people.freedesktop.org/~aacid/docs/qt4/ and "MuPDF":https://github.com/xiangxw/mupdf-qt/wiki. I haven't used both so far, but you might give them a try.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mariusmssj
                  wrote on last edited by
                  #11

                  Using Poppler i get compile errors:

                  "
                  release/mainwindow.o:mainwindow.cpp:(.text+0x2e0): undefined reference to _imp___ZN7Poppler8Document4loadERK7QStringRK10QByteArrayS6_' release/mainwindow.o:mainwindow.cpp:(.text+0x32f): undefined reference to _imp___ZNK7Poppler8Document8isLockedEv'
                  release/mainwindow.o:mainwindow.cpp:(.text+0x33c): undefined reference to `_imp___ZN7Poppler8DocumentD1Ev'
                  collect2: ld returned 1 exit status
                  mingw32-make.exe[1]: *** [release\OpenGL.exe] Error 1
                  mingw32-make.exe: *** [release] Error 2
                  10:52:25: The process "E:\Qt_SDK\mingw\bin\mingw32-make.exe" exited with code 2.
                  Error while building project OpenGL Teaching Tool (target: Desktop)
                  When executing build step 'Make'
                  "

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    veeraps
                    wrote on last edited by
                    #12

                    Would you ensure that you have linked the libraries for Poppler?

                    Have you included them in your .PRO file under LIBS variable?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      adlike
                      wrote on last edited by
                      #13

                      i think it depends on what kind of image format are you using. if you are trying tiff. you might as well use "tiff windows viewing app":http://www.rasteredge.com/how-to/vb-net-imaging/tiff-windows-viewer-create/ to "open a tiff image":http://www.rasteredge.com/how-to/vb-net-imaging/tiff-get-to-start/ in the pc. search on the web, you will find a lot.

                      1 Reply Last reply
                      0

                      • Login

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