[PyQt] hidden signals?

Detlev Offenbach detlev at die-offenbachs.de
Mon Dec 24 13:46:03 GMT 2007


On Montag, 24. Dezember 2007, Andreas Pakulat wrote:
> On 24.12.07 13:22:22, Jochen Georges wrote:
> > On Monday 24 December 2007 12:25:14 Andreas Pakulat wrote:
> > > On 24.12.07 09:16:17, Jochen Georges wrote:
> > >
> > > Thats not a simple self-contained example that demonstrates the
> > > problem. Sorry, but you have to create an app that we can simply run to
> > > check what exactly happens and whats wrong with that behaviour.
> > >
> > :-)
> > :
> > > Especially
> > > when the verbal description is relatively unclear like in this case (at
> > > least to me).
> >
> > sorry
>
> You could have stripped down that code a bit more, but its easy to see
> the problem, now that I can run it.
>
> > > Andreas
> >
> > to see what is going wrong, please
> >
> > 1. click "list"
> > 2. insert a number in the left lineedit
> > 3. press return
> >
> > now the right lineedit should have the focus.
>
> The problem is that the Interactive button is the "default" button in
> the dialog, so it automatically gets activated on return-presses.
> Changing from QDialog to QWidget fixes that, I don't see a way to have a
> Qt4 QDialog without a default button, though. Using setDefault on the
> push buttons doesn't seem to do anything useful.
>
> Andreas

If a dialog must be used, you can override the accept()-Method and handle the 
Return press there. E.g.

if (focusWidget() == leftLineEdit) {
	rightLineEdit->setFocus(Qt::OtherFocusReason);
	return;
}

QDialog::accept()

Regards,
Detlev
-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the PyQt mailing list