Show IBeam cursor instead of Cross while creating text markup annotations

This commit is contained in:
Fabio D'Urso 2013-07-30 23:36:55 +02:00
parent 39d44edbd7
commit c64a6499e2
5 changed files with 24 additions and 1 deletions

View file

@ -11,6 +11,7 @@
// qt / kde includes
#include <qcolor.h>
#include <qcursor.h>
#include <qevent.h>
#include <qpainter.h>
@ -76,6 +77,11 @@ AnnotatorEngine::~AnnotatorEngine()
{
}
QCursor AnnotatorEngine::cursor() const
{
return Qt::CrossCursor;
}
SmoothPath::SmoothPath( const QLinkedList<Okular::NormalizedPoint> &points, const QPen &pen )
: points ( points ), pen ( pen )
{

View file

@ -53,6 +53,8 @@ class AnnotatorEngine
static void decodeEvent( const QMouseEvent * mouseEvent, EventType * eventType, Button * button );
static void decodeEvent( const QTabletEvent * tabletEvent, EventType * eventType, Button * button );
virtual QCursor cursor() const;
protected:
PageViewItem * item() { return m_item; }

View file

@ -3657,7 +3657,7 @@ void PageView::updateCursor( const QPoint &p )
if ( d->annotator && d->annotator->active() )
{
if ( pageItem || d->annotator->annotating() )
setCursor( Qt::CrossCursor );
setCursor( d->annotator->cursor() );
else
setCursor( Qt::ForbiddenCursor );
}

View file

@ -630,6 +630,11 @@ class TextSelectorEngine : public AnnotatorEngine
return QList< Okular::Annotation* >() << ann;
}
QCursor cursor() const
{
return Qt::IBeamCursor;
}
private:
// data
PageView * m_pageView;
@ -777,6 +782,11 @@ bool PageViewAnnotator::annotating() const
return active() && m_lockedItem;
}
QCursor PageViewAnnotator::cursor() const
{
return m_engine->cursor();
}
QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::EventType & eventType, const AnnotatorEngine::Button & button,
const QPointF & pos, PageViewItem * item )
{

View file

@ -70,6 +70,11 @@ class PageViewAnnotator : public QObject
bool active() const;
// @return Are we currently annotating (using the selected tool)?
bool annotating() const;
// returns the preferred cursor for the current tool. call this only
// if active() == true
QCursor cursor() const;
QRect routeMouseEvent( QMouseEvent * event, PageViewItem * item );
QRect routeTabletEvent( QTabletEvent * event, PageViewItem * item, const QPoint & localOriginInGlobal );
QRect performRouteMouseOrTabletEvent( const AnnotatorEngine::EventType & eventType, const AnnotatorEngine::Button & button,