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 6076687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:38:10+00:00 2026-05-23T10:38:10+00:00

I have a software that sends JPGs over the network to a GUI client

  • 0

I have a software that sends JPGs over the network to a GUI client that is supposed to display those images. I basically want to display them to a qt window but I’m having problems with how qt displays consecutive JPGs. I made a test to see if I’m getting the image correctly by printing it to a file and that checks out fine. Here’s the main code:

int main(int argc, char *argv[]) {
    // initialize resources, if needed
    // Q_INIT_RESOURCE(resfile);

    QApplication app(argc, argv);
    CameraWindow cw;
    cw.show();
    //app.setActiveWindow(&cw);
    cw.getData();       // this paints the window  
    return app.exec();
}

Here’s the code that initializes the widget:

class CameraWindow : public QDialog {
    Q_OBJECT
    public:
    bool serverConnected;
    void getData();
    CameraWindow()
    {
        imgl = new QLabel;
        widget.scrollImage->setWidget(imgl);
        widget.scrollImage->setBackgroundRole(QPalette::Dark);
    }
    QLabel *imgl;
    virtual ~CameraWindow();
    private:
    Ui::CameraWindow widget;
};

This is the relevant part of the code that is supposed to paint the image to the screen which is inside an infinite loop:

getData() called from main:

while (myrval < Header.imageSize) {
    myrval = myrval + recv(msgsock, (char*) ((int) buff + myrval),
        Header.imageSize- myrval, 0);
}

//buff contains the jpg at this point
QPixmap imgjpg;
imgjpg.loadFromData((const unsigned char*)buff, Header.imageSize, "JPG");
//scroll image is the parent that displays child
//in this case, the label
imgl->setPixmap(imgjpg);

I got this to work for just one image that was loaded from a file but when I use the same method for a set of streaming images, this doesn’t work. I’m new to Qt so I’m sure I have a subtle mistake.

Many thanks!

  • 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-05-23T10:38:11+00:00Added an answer on May 23, 2026 at 10:38 am

    Because you are in a infinite loop, the Qt may not have chance to handle event. Could you try to call QCoreApplication::processEvents after you setPixmap?

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

Sidebar

Related Questions

We have software that runs fine under a normal Windows installation but when we
We have this software that has a webservices component. Now, the administrator of this
I have a software that runs on mac (using terminal program) the program is
I have a simple software that is made in Delphi 7, and it crashes
We have a software product that evolves at the rhythm of clients' needs and
I have a software renderer that I am porting from PC to the iPhone.
I have this running software that is currently being used by about 400 people.
We have a large management software that is producing big reports of all kinds,
I have searched on the web for software that batch convert image at different
What best practices have you used in unit testing embedded software that are peculiar

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.