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. Not displaying image in the window
Forum Updated to NodeBB v4.3 + New Features

Not displaying image in the window

Scheduled Pinned Locked Moved General and Desktop
5 Posts 5 Posters 1.6k 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.
  • S Offline
    S Offline
    shalinir
    wrote on 5 Feb 2013, 09:44 last edited by
    #1

    the source code
    @QPalette p = palette();
    QPixmap pixmap1(":/new/prefix1/BG");

        QDesktopWidget* desktopWidget = QApplication::desktop();
        QRect rect = desktopWidget->availableGeometry();
    
        QSize size(rect.width() , rect.height());
        QPixmap pixmap(pixmap1.scaled(size));
        p.setBrush(QPalette::Background,  pixmap);
        setPalette(p);@ when the project is built in the output console it displays--QPixmap::scaled: Pixmap is a null pixmap
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      stukdev
      wrote on 5 Feb 2013, 10:03 last edited by
      #2

      BG without extension?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on 5 Feb 2013, 10:04 last edited by
        #3

        So, is the image actually in the resource? Did you deploy the needed image format plugin?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tzander
          wrote on 5 Feb 2013, 10:06 last edited by
          #4

          yeah, like stuk said; you may have mis-typed the filename :)

          Also would like to suggest you use QImage for opening the image which is much faster than using a pixmap for nothing but scaling.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            postal267
            wrote on 5 Feb 2013, 11:13 last edited by
            #5

            I think you should replace
            QPixmap pixmap1(":/new/prefix1/BG");
            for
            QPixmap pixmap1(":/new/prefix1/BG.png");
            or
            QPixmap pixmap1(":/new/prefix1/BG.jpg");

            you need to put the image extension in the code.

            1 Reply Last reply
            0

            1/5

            5 Feb 2013, 09:44

            • Login

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