Hi Curt, thanks alot, it works now.
best regards Florian Curt Nowak wrote: > Hi Florian, > > I'm assuming your post includes code of only one class plus its local class - > which btw. better be static. > To me it seems, your Signal should be part of your local class because your > "myQComboBox object" should emit it. > That way you can connect to the signal like this: > searchComboBox_.mySig.connect(this, "clearSearchBox()"); > > Hope that helps, Curt > > ________________________________ > > Von: [EMAIL PROTECTED] im Auftrag von Florian Hübner > Gesendet: Di 19.08.2008 17:01 > Cc: [email protected] > Betreff: Re: [Qt-jambi-interest] QComboBox + signals > > > > 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: [EMAIL PROTECTED] im Auftrag von Curt Nowak >> Gesendet: Di 19.08.2008 12:34 >> An: [email protected] >> 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: [EMAIL PROTECTED] im Auftrag von Florian Hübner >> Gesendet: Di 19.08.2008 12:25 >> An: [email protected] >> 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 [email protected] http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
