[Qt-jambi-interest] QComboBox + signals
Florian Hübner
florian.huebner at psi.ch
Tue Aug 19 17:01:40 CEST 2008
Thanks for the hints, I still have some problems with the connect method
though:
**************************************************************************
searchComboBox_.setEditText(tr("Enter search expression..."));
searchComboBox_.setFocusPolicy(FocusPolicy.StrongFocus);
QFocusEvent fevent = new QFocusEvent(QEvent.Type.FocusIn);
searchComboBox_.focusInEvent(fevent).connect(this,"clearSearchBox()");
public Signal0 mySig = new Signal0();
class myQComboBox extends QComboBox{
public myQComboBox(QWidget widget) {
super(widget);
}
protected void focusInEvent(QFocusEvent arg__1){
mySig.emit();
super.focusInEvent(arg__1);
}
}
**************************************************************************
Eclipse complains in line 4:
"Cannot invoke connect(MainWindow, String) on the primitive type void"
but I don't know what what the return value of focusInEvent should be
instead.
I am also unsure about the mySig.emit part.
best regards
Florian
Curt Nowak wrote:
> Sorry about those links in my last mail. (Copy&Paste mistake)
> Also, don't forget to set the focusPolicy of your ComboBox correctly. (See Qt.FocusPolicy)
>
> ________________________________
>
> Von: qt-jambi-interest-bounces at trolltech.com im Auftrag von Curt Nowak
> Gesendet: Di 19.08.2008 12:34
> An: qt-jambi-interest at trolltech.com
> Betreff: Re: [Qt-jambi-interest] QComboBox + signals
>
>
>
> Hi Florian,
>
> the first idea that pops into my head is to
>
>
> * subclass QComboBox and to
> * overwrite protected void focusInEvent(QFocusEvent <file:///D:/java/qt/qtjambi-win32-gpl-4.4.0_01/doc/html/com/trolltech/qt/gui/QFocusEvent.html> arg__1)
>
> into something like
>
> protected void focusInEvent(QFocusEvent <file:///D:/java/qt/qtjambi-win32-gpl-4.4.0_01/doc/html/com/trolltech/qt/gui/QFocusEvent.html> arg__1){
> mySignal.emit(...);
> super.focusInEvent(QFocusEvent <file:///D:/java/qt/qtjambi-win32-gpl-4.4.0_01/doc/html/com/trolltech/qt/gui/QFocusEvent.html> arg__1);
> }
>
> That should do. Cheers,
>
> Curt
>
> ________________________________
>
> Von: qt-jambi-interest-bounces at trolltech.com im Auftrag von Florian Hübner
> Gesendet: Di 19.08.2008 12:25
> An: qt-jambi-interest at trolltech.com
> Betreff: [Qt-jambi-interest] QComboBox + signals
>
>
>
> Hi everyone,
> I try to send a signal whenever a QComboBox receives focus but I
> couldn't find out how to do it. Anybody know an easy way for that?
>
> best regards
> Florian
> _______________________________________________
> Qt-jambi-interest mailing list
> Qt-jambi-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
>
>
>
> _______________________________________________
> Qt-jambi-interest mailing list
> Qt-jambi-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
>
>
>
> _______________________________________________
> Qt-jambi-interest mailing list
> Qt-jambi-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
More information about the Qt-jambi-interest
mailing list