Hey-ho!
I've a little problem, I'm sure it's just me not knowing the Qt-context, so hopefully that wont be difficult.
I'd like to use a Picture as mouse Pointer. So I switched my MainWindow to enable mouseTracking via the Designer, added a QLabel, loaded my Pixmap... every thing working so far. Now i wanted to place a QLabel on my Mainwindow. And of course it should also accept the picture as mouse:
//...
textLabel->setMouseTracking(true);
textLabel
->setCursor
(QCursor(Qt
::BlankCursor));
//...
//...
QLabel * textLabel = new QLabel(widget);
textLabel->setMouseTracking(true);
textLabel->setCursor(QCursor(Qt::BlankCursor));
//...
To copy to clipboard, switch view to plain text mode
The after a while I add some text to the label:
//...
project1->labels.at(1)->setText("Foo"); //dont bother with the vector, just the place our label from above went ;)
//...
//...
project1->labels.at(1)->setText("Foo"); //dont bother with the vector, just the place our label from above went ;)
//...
To copy to clipboard, switch view to plain text mode
Still everything is fine, I see the text where it should be and I can move the mouse over it.
But if I try the same with html inside the String, all of a sudden the mouseTracking wont work any more:
//...
project1->labels.at(1)->setText("<b>Foo</b>");
//...
//...
project1->labels.at(1)->setText("<b>Foo</b>");
//...
To copy to clipboard, switch view to plain text mode
When I try to move the mouse over the Label now, the mouse-picture gets caught at the edges of the Label. The mouse is moving on invisibly, emerging on the other side of the Label, and then the pictures changes its location to the new mouse location.
Everything I changed was the added html inside the String. So i guess, my Labeltext changed from plain to richtext. But whats the matter with the mouseTracking not working anymore?
Ohh... and heres the picture-following-the mouse algorithm, just in case...
{
ui->fingerLabel->move(pEvent->x() - 50, pEvent->y() + 1);
}
void MainWindow::mouseMoveEvent(QMouseEvent * pEvent)
{
ui->fingerLabel->move(pEvent->x() - 50, pEvent->y() + 1);
}
To copy to clipboard, switch view to plain text mode
I would realy appreciate some hints.
Bookmarks