PDA

View Full Version : tooltip popup in delegate



iwatsu
8th February 2012, 18:35
I have a delegate that gets instantiated when double clicking on an item in a QTreeWidget.
I would like to pop up a tooltip for few seconds and that it slowly disappears afterwards.

Right now I'm doing this:


QWidget * Test::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
...
QToolTip::showText(QCursor::pos(), "test");
}


The tooltip shows up for a second and disappears. How would I go about doing that?
Thanks

iwatsu
10th February 2012, 19:55
I tried to do something like in the PropertyAnimation example of the Qt docs, but it disappears after a split second too.
Does anybody have an idea how to approach this?



QPushButton button("Animated Button", mParent);
button.show();
QPropertyAnimation animation(&button, "geometry");
animation.setDuration(10000);
animation.setStartValue(QRect(0, 0, 100, 30));
animation.setEndValue(QRect(250, 250, 100, 30));
animation.start();


Thanks,

iwatsu
13th February 2012, 17:48
Is that simply not possible?
Thanks

iwatsu
1st March 2012, 00:37
Please let me know if the question wasn't clear. Is it possible to display a widget with a text (like a tooltip) from inside the delegate's createEditor function?

ChrisW67
1st March 2012, 01:40
Use setToolTip() on the editor widget you create.