focus - Qt Child Frame passing KeyEvents to Parent Frame -
i have implemented osgqt based model viewer. attempting reposition submodels changing properties in child qframe main mainwindow based viewer frame. child frame non-modal , key events being passed osg viewer based handler in mainwindow instead of child window.
what appropriate attributes child window keep keyboard focus there , allow typing new values in qlineedit based modifier qtreewidgetitem column.
i have implemented working solution using custom itemdelegate follows.
class doublepositioneditdelegate: public qstyleditemdelegate { public: doublepositioneditdelegate(qobject* parent=0): qstyleditemdelegate(parent) {} virtual qwidget* createeditor(qwidget *parent, const qstyleoptionviewitem &option, const qmodelindex &index) const { qdoublespinbox* dspinbox = new qdoublespinbox(parent); dspinbox->setmaximum(1000000.0); dspinbox->setminimum(-1000000.0); dspinbox->grabkeyboard(); return dspinbox; } };
a more elegant/better solution still welcome.
Comments
Post a Comment