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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:43:45+00:00 2026-06-02T09:43:45+00:00

In my university, we are working with interfaces, using QT Jambi (Java) with the

  • 0

In my university, we are working with interfaces, using QT Jambi (Java) with the Eclipse Integration.
I would like to improve my design of my Elevator interface.

The main problem is that I would like to update the QLCDNumber with the floor in real-time.
What I do to simulate the elevator working, is to do a Thread.sleep(1000) between 2 floors, so that way, my QLCDNumber will display “an animation” saying “1…2…3…4”. The problem is that the QLCDNumber only displays 1 and 4, no animation.

So, for example (resumed), the code I made is this one:

private void simulate(int floor){
    while(actualFloor < floor){
        try{
           Thread.sleep(1000);
        }catch(InterruptedException e){};
    actualFloor++;
    ui.LCDfloor.display(actualFloor);   
    }
}

Why this code only shows the 1st floor and the last one?
Sorry if you didn’t understand what I wanted, my English is improving every day 🙂

Thank you in advance.

*Please note that LCDFloor is the name of the QLCDNumber widget

  • 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-02T09:43:46+00:00Added an answer on June 2, 2026 at 9:43 am

    It looks like you have two problems:

    1. (I assume) You’re calling Thread.sleep() on the GUI thread. In other words, when you call simulate, you’re doing so on the same thread as the rest of the gui operations. This causes the entire gui to pause.

    2. You’ve never given Qt the chance to actually update the UI. When you call ui.LCDfloor.display(actualFloor), the a paint event is queued so that the UI can be updated, but rather than giving the UI a chance to actually execute the paint event, you continue with your loop which prevents the UI from ever being updated until after your simulation is finished.

    You have two basic fixes:

    1. Don’t sleep, it’s poor design. Instead, use timer’s and signals to simulate the changes.
    2. Force events to be processed using processEvents.

    Also keep in mind that you can’t update a GUI element from a non gui thread. And as this is homework, I’ll leave the rest to you :).

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

Sidebar

Related Questions

hey everyone... so i'm working on a database design class for university. I've got
I am working on an Java assignment for a software design course in my
I am working on a university project, which involves profile and event management using
I am working in android. i am trying to display name of university using
I'm working on a university assignment to improve a game engine. The code we've
I'm working on university scheduling problem and using simple genetic algorithm for this. Actually
I am currently working on a university project, using HTML5. I have been writing
I'm working for a university project, and I have the following question: I have
I'm working on a project whereby the University has full control over the source
I am Working on a project (C#) in the university and they said that

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.