I don't see such signal at all in QComboBox docs. One idea worth trying would be to reimplement virtual method QComboBox::showpopup().
I don't see such signal at all in QComboBox docs. One idea worth trying would be to reimplement virtual method QComboBox::showpopup().
J-P Nurmi
Hi again,
what do you think about using events for this special issue ?
http://doc.trolltech.com/4.3/eventsandfilters.html
I don't think it's a good idea. There are lots of (perhaps even style dependent) ways to make the combo box show its popup. But which ever way to user causes the combo box to show its popup, the virtual method QComboBox::showpopup() is always called. Just reimplement it and you'll get notified whenever the popup is shown. In your reimplementation you naturally call the base class implementation to actually do the job.
J-P Nurmi
Hi jpn,
thanks for your reply.
Could you try to explain me your idea a bit more detailed ?
At the moment i dont understand your idea 100%
QComboBox::showPopup:
>>Displays the list of items in the combobox. If the list is empty then the no items will be shown.
So how can i use showPopup to check if someone has clicked the box ?
Till now i just see the option to let the comboBox open itself with that function.....which must be triggered again by something else.
My target is too:
Run a specific function (re-scan for new interfaces) if a user opens my QcomboBox (which displays the available interfaces).
Best regards
ape
Last edited by ape; 4th February 2008 at 08:06.
QComboBox::showPopup() gets called whenever the popup view is about to be shown. So what you could do is to reimplement it, initialize contents if appropriate and call the base class implementation to actually show the popup.
Qt Code:
void MyComboBox::showPopup() { if (!initialized) { initializeContents(); } }To copy to clipboard, switch view to plain text mode
J-P Nurmi
ape (4th February 2008)
Ok i guess i do understand the basic idea now a bit better.
My first test does not work, but i guess that has something to do with my implementation.
Qt Code:
void MainWindow::showPopup() { // re-Init-Section // .... // .... // end- re-Init Section }To copy to clipboard, switch view to plain text mode
Error:
mainwindow.cpp:350: error: cannot call member function `virtual void QComboBox::showPopup()' without object
You must subclass QComboBox. You cannot implement its method to another class eg. MainWindow.
Qt Code:
{ ... };To copy to clipboard, switch view to plain text mode
J-P Nurmi
ape (4th February 2008)
ok i guess i got it.
Thanks again for your nice help jpn.
Bookmarks