PDA

View Full Version : InputContext Issue



davethomaspilot
23rd May 2013, 23:18
I've used the sample code in myinputpanel.cpp and myinputpanelcontext.cpp successfully to bring up a custom widget for spinbox inputs. The spinboxes were part of a widget created in Qt Designer. But, I'm having issues when trying to use the inputcontext mechanism in another place.

I want to bring up a custom dialog whenever a specified column of a QTableWidget is clicked. The code I'm using to do this:




RaceDialog rd;
rd.exec();



Where RaceDialog is a QDialog built from Qt Designer. It's a simple dialog with a spinbox.

The dialog is shown when the column is clicked, and when I click on the spinbox input box, my custom widget is presented. But, it doesn't seem to get the focus--I get beeps whenever I click on my custom widget (clicks on the spinbox are still accepted).

I can't figure out why I have no issues when the spinbox is on the applications central widget, but the input panel doesn't get focus when I dynamically instantiate a dialog with a spinbox on it.

Is it because the spinbox is on a QDialog instead of a QWidget?

My slightly modified versions of myinputpanel.cpp, .h, and myinputpanelcontext.cpp, .h are attached (but I think differences from the sample code are irrelevant).

Thanks,

Dave Thomas

Added after 12 minutes:

I guess it's an event loop thing.

When I make the RaceDialog static, and use rd->show() instead of rd->exec(), it works ok.

So, I'll just do that.

maverick
6th March 2014, 13:24
hi,

i have tried the attached files but still facing the same issue....

the inputs are being handled in the myinputpanelcontext.cpp class (found using QDebug) but the LineEdit Where in it has to redirect the inputs are not being done.