PDA

View Full Version : Displaying tooltip over combobox that reads text from main class for current item?



falconium
8th April 2011, 17:42
Hi,

I have a QWizardPage that has a combo box on it. I have inherited ChartComboBox from QComboBox to modify mouseMoveEvent in order to show a tooltip over it. It is working at the moment:


void ChartComboBox::mouseMoveEvent(QMouseEvent *e)
{
QToolTip::showText(e->globalPos(), "TEST", this);
}

I can get data for combo box in QWizardPage object via wizard->caller->getData() function, where

- wizard is the internal pointer to QWizard provided by Qt,
- caller is a pointer to the main class, and it is stored as public in QWizard constructor,
- getData() is a function in main class.

Now, I a want to display a specific text in tooltip based on the current item in ChartComboBox if mouse moves over it. I don't know how to do it as ChartComboBox doesn't have a pointer to main class to call a "getData()" function, and I don't know how to do this.

The question is, how to get this text from a QList<struct> variable residing in main class as public and how to know which item is the currently selected when the mouse moves over the combo box.

Thank you in advance!

falconium
8th April 2011, 19:54
bounce to get info