Setting a cursor on QTextEdit
Hi!
Was just wondering how to set the mouse cursor on the QTextEdit.
setCursor() doesn't work.
viewPort()->setCursor() does work, but when I compile the program to an *.exe, and run it, that line makes it crash.
And I don't want to use QApplication::setOverrideCursor...
Anyone able to help me?
Thanks
Re: Setting a cursor on QTextEdit
Quote:
setCursor() doesn't work.
Sure it doesn, if you use it right! ;)
Show us your code.
Re: Setting a cursor on QTextEdit
Quite simple:
The pointing hand cursor won't override the default IBeam (isn't it ?)
Code:
#include "myclass.h"
{
setMouseTracking(true);
}
myClass::~myClass()
{
}
{
setCursor(Qt::PointingHandCursor);
}
Re: Setting a cursor on QTextEdit
Try
Code:
viewport()->setMouseTracking(true);
Re: Setting a cursor on QTextEdit
But wouldn't that just help if mouseMoveEvent wasn't called?
Because mouseMoveEvent is getting called everytime I move the mouse.
setCursor() just doesn't work for me :(
Re: Setting a cursor on QTextEdit
How about
Code:
viewport()->setCursor(Qt::PointingHandCursor);
then? :)
Re: Setting a cursor on QTextEdit
Quote:
Originally Posted by
Erlendhg
viewPort()->setCursor() does work, but when I compile the program to an *.exe, and run it, that line makes it crash.
The weird about this is that in my new little test program
Code:
#include "myclass.h"
{
viewport()->setCursor(Qt::PointingHandCursor);
}
myClass::~myClass()
{
}
that actually does work, but not in my big program.
*scratching my head*
Well, this does work for me anyway:
Code:
viewPort->setCursor(Qt::PointingHandCursor);
setViewport(viewPort);