Hi All & YogeshGokul,
I tried what you all suggested but it is still not working .
I have attached a trial project in which i have created the object of QHoverEvent & invoking the event.
Please... Please let me know where i am going wrong.
This is the function where i want to make the QToolButton Hovered.
{
QPoint newPos
(toolButton
->pos
().
x()+5,toolButton
->pos
().
y()+10);
qDebug("ToolButton Position %d %d",newPos.x(),newPos.y());
qDebug("Cursor Position %d %d",oldPos.x(),oldPos.y());
qDebug("In Widget::keyPressEvent");
}
void Widget::keyPressEvent(QKeyEvent *event)
{
QPoint newPos(toolButton->pos().x()+5,toolButton->pos().y()+10);
QPoint oldPos(QCursor::pos());
qDebug("ToolButton Position %d %d",newPos.x(),newPos.y());
qDebug("Cursor Position %d %d",oldPos.x(),oldPos.y());
QHoverEvent *hoverEvent = new QHoverEvent(QEvent::HoverEnter,newPos,oldPos);
QApplication::postEvent(toolButton,hoverEvent);
qDebug("In Widget::keyPressEvent");
QWidget::keyPressEvent(event);
}
To copy to clipboard, switch view to plain text mode
Bookmarks