Key buffer issue with my QWizard program
-
Hi again!
I'm back with my QWizard and QWizardpages program... I'm having some problems with the key buffer...
My program is like:- WP1 : You start here and you have 3 big QPushButton with the first one focused. If you press Enter then you go to the next WP: let's say its WP2:
- WP2: It's like WP1 (to simplify) so, if you press enter you have selected the first option and you go to WP3.
The normal behaviour should be: WP1 is loaded > Press Enter > loads WP2 > press Enter > loads WP3 > ... BUT if I'm in WP1 and I pres Enter 4 times quickly it goes directly to WP5 (Imagine the tipical impatient user) or... If I push Enter shakily or somethig like that it skips wizardpages.
So here is my question: How can avoid that? Can I reset the buffer in every page, if yes how? Of course, changing the behaviour about the program is not an option ( The pushbutton has to be focused, if you press enter then you go to the next page, and so on...)
Note: In some pages there are no QPushbutton so the wizard's NextButton has the focus and it's the same problem (I say that if someone is wondering why QPushButtons instead of wizard's buttons)
Thank you!!!
P.D: I'm almost done with the program or at least I hope so :D -
Hi,
In that case shouldn't the Next button be disabled until one of the button is clicked ?
-
It's something strange.. let's say that in the wizardpages where there are QPushButtons, the Wizard's nextButton is disabled and the first QPushButton is focused while in the wizardpages that just contain/show information, the next button is enabled and focused so no matter in which page you are, if I press enter many times it skips the pages... (Imagine that when you press enter in WP1 some information is saved and some things done so it takes 2-3 seconds to change to the next WP (which is ok) but in that seconds you press Enter 4 times more.... then you will see WP5 instead of WP2). Hope it is clearer now :)
-
@roseicollis
Hello,Imagine that when you press enter in WP1 some information is saved and some things done so it takes 2-3 seconds to change to the next WP (which is ok) but in that seconds you press Enter 4 times more.... then you will see WP5 instead of WP2). Hope it is clearer now
Well, I'd guess you're blocking the event loop and when you after you switch the pages Qt processes the pending events so they get switched yet again. Could you check what happens if you call
QApplication::processEvents()
immediately before you switch to the next page?Kind regards.
-
@kshegunov said:
Could you check what happens if you call QApplication::processEvents() immediately before you switch to the next page?
What should I expect? It's like if it did nothing... should I see a change?
Anyway I've found that there is another problem with that: If I press Enter WITHOUT releasing the key, its the same as press it infinity times so I guess this is my main problem right now because there are some users that press Enter so slowly that keep it pushed some secs...
-
@roseicollis said:
What should I expect? It's like if it did nothing... should I see a change?
You'd expect the key events be processed before switching the page. However this as it seems might not be enough.
Can you share the code where you switch from one page to the next (the Qt part of it, not what you do with the user data)?Anyway I've found that there is another problem with that: If I press Enter WITHOUT releasing the key, its the same as press it infinity
Holding the
Enter
key will put events in the event loop queue and their number depends on the time you'd been holding the key.Kind regards.
-
@kshegunov said:
You'd expect the key events be processed before switching the page. However this as it seems might not be enough.
No, it seems its not but don't worry, my mate told me he has desactivated it on the system so I don't have to deal with that problem anymore :D
Thank you for all @kshegunov !!
-
@roseicollis
No problem. Don't forget to mark your topic as solved (I know it seems tedious, but it looks good on the forum to have more blue than green ;)).Kind regards.
-
@kshegunov isn't it marked? I marked it before writting the answer :S (The other topic I have about the dialog, I had to write solved on the title because the "Mark as Solved" option does not appear on Topic Tools dunno why.. and also I lost my pic here and I can't load a new none :( )
-
@roseicollis
Possibly my view hadn't updated.The other topic I have about the dialog, I had to write solved on the title because the "Mark as Solved" option does not appear on Topic Tools dunno why
Maybe you hadn't created is as a "question" topic and that's why the option weren't available in the topic tools. As for the picture, the only possibility is to setup a Gravatar account with your forum email and select the option in the profile, uploads are disabled.
-
@kshegunov said:
Maybe you hadn't created is as a "question" topic
O.o is there any other type of question? Maybe I did it wrong... :S
setup a Gravatar account with your forum email and select the option in the profile
I don't get why can't you upload a pic like before and you have to use that which I suppose is another webpage... but this is not the properly place to discuss something like that... Ty @kshegunov ^^
-
O.o is there any other type of question? Maybe I did it wrong... :S
There's a "general topic" and a "question topic".
I don't get why can't you upload a pic like before and you have to use that which I suppose is another webpage...
Look here.