![]() |
Setting text to a label and more
I never thought I would ask this question but how to I set text to a label properly? Both of these codes just work the first time it get called.
Code:
void FoodWindow::load() Code:
void ExerciseWindow::loadExercise(QList<QString> name) I also have problem when I went from a window to a dialog. After this code is called I guess the ui is still on-top but not showing, I can push the save button again. Code:
void NewExerciseWindow::saveExercise() Thanks! |
Re: Setting text to a label and more
long time I have not practiced the c++. But in java this problem can appear if you forget to refresh / repaint the components, maybe that is the same thing, here.
|
Re: Setting text to a label and more
After trying this I feel this might be right. I did try to call update() after setting the label text but nothing happends... Because it works later when a timer wants to change the text I tried to have a button to update the text and then the text changed to the right one!
When seeing this I remember that changing to landscape/portrait mode is exactly the same. In load/constructor nothing happends but having a button for it makes it works... |
Re: Setting text to a label and more
No one? This shouldn't be to hard :)
|
Re: Setting text to a label and more
To save CPU time, UIs are only updated when you ask for it, when the window is moved or when something else moves out of the way.
You'll have to find out how one sets a specific part of the screen as "dirty" and in need of an update. If you're using GTK+ you can do it like this Code:
GdkRectangle rectangle; |
Re: Setting text to a label and more
How do call load method?
Another thing. You don't have to clear label content before you set text: Code:
label->setText(""); |
Re: Setting text to a label and more
I finally solved this last night. What I did was to overload the changeEvent function and there called update. Why do I need to do this?
|
All times are GMT. The time now is 11:19. |
vBulletin® Version 3.8.8