Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8699789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:02:00+00:00 2026-06-13T02:02:00+00:00

I am trying to run slightly modified code from the Qt fluidLauncher demo that

  • 0

I am trying to run slightly modified code from the Qt fluidLauncher demo that shows a slideshow. The code is pasted in below. When the paintEvent is handled a black rectangle is shown on the screen because the imported image size is 0.

Single stepping through the code in Qt creator, the currentImagePath is ‘”/home/tim/Pictures/HPIM0406.JPG”‘ in the watch window. The path is correct including the case and / dividers. The ‘slide’ variable always shows <not accessible>.

At the point in the code where slideSize = slide.size() the slide size changes from (8481696,0) to (0,0). It appears that although no error is thrown, the QPixmap slide (currentImagePath); is not retrieving the image.

void SlideShow::paintEvent(QPaintEvent *event)
{
 QPainter painter(this);
 QString currentImagePath;

 painter.setRenderHint(QPainter::Antialiasing, false);

 if (d->imagePaths.size() > 0) {
    currentImagePath = d->imagePaths[d->currentSlide];
     QPixmap slide( currentImagePath );
     QSize slideSize = slide.size();
     QSize scaledSize = QSize(qMin(slideSize.width(), size().width()),
         qMin(slideSize.height(), size().height()));
     if (slideSize != scaledSize)
         slide = slide.scaled(scaledSize, Qt::KeepAspectRatio);

     QRect pixmapRect(qMax( (size().width() - slide.width())/2, 0),
                      qMax( (size().height() - slide.height())/2, 0),
                      slide.width(),
                      slide.height());

     if (pixmapRect.top() > 0) {
         // Fill in top & bottom rectangles:
         painter.fillRect(0, 0, size().width(), pixmapRect.top(), Qt::black);
         painter.fillRect(0, pixmapRect.bottom(), size().width(), size().height(), Qt::black);
     }

     if (pixmapRect.left() > 0) {
         // Fill in left & right rectangles:
         painter.fillRect(0, 0, pixmapRect.left(), size().height(), Qt::black);
         painter.fillRect(pixmapRect.right(), 0, size().width(), size().height(), Qt::black);
     }

     painter.drawPixmap(pixmapRect, slide);

 } else
     painter.fillRect(event->rect(), Qt::black);

}

I’ve struggled with the problem for most of the evening. Can anyone suggest additional code that I could add for debugging or let me know what may be wrong with this code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:02:02+00:00Added an answer on June 13, 2026 at 2:02 am

    I’ve some idea for solving your problem:

    1. You should add resource file (.qrc) and paste your image to it. Use syntax loads pixmap from resource file.

    2. Try paste dividers how home/tim/Pictures/HPIM0406.JPG or /home/tim/Pictures/HPIM0406.JPG or home\\tim\\Pictures\\HPIM0406.JPG. Some remark: you wrote ‘”/home/tim/Pictures/HPIM0406.JPG”‘, ” – use not single quotes into QPixmap constructor. I don’t understand, you wrote just in here or into your code.

    I hope it helps you 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run tclhttpd in a slave interpreter but slightly modified so as
I'm following this post and trying to run the code (copied below), and I'm
I am trying run a program from a qmake .pro file which modifies the
jsFiddle (with slightly modified values so it appears correctly). I am trying to move
I'm trying to run a query that checks if some conditions are true and
I am trying to run /Applications/MAMP/bin/php/php5.4.3/bin/pear From Terminal on Mac OS X Lion. I
I'm trying to consume a Java based SOAP web service from VBA code in
Situation: I'm trying run an https store (xcart) under one domain secure.example.com and I
Trying to run the following command in php to run powershell command... the following
Trying to run my program in FreeBSD OS, I have the following results: $

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.