Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 453950b4 authored by Fabio D'Urso's avatar Fabio D'Urso

Merge remote-tracking branch 'origin/KDE/4.11'

parents 55dd9eb8 c64a6499
......@@ -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 )
{
......
......@@ -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; }
......
......@@ -1854,10 +1854,7 @@ void PageView::mouseMoveEvent( QMouseEvent * e )
if ( d->annotator && d->annotator->active() )
{
PageViewItem * pageItem = pickItemOnPoint( eventPos.x(), eventPos.y() );
if (pageItem || d->annotator->annotating())
setCursor( Qt::CrossCursor );
else
setCursor( Qt::ForbiddenCursor );
updateCursor( eventPos );
d->annotator->routeMouseEvent( e, pageItem );
return;
}
......@@ -3656,7 +3653,15 @@ void PageView::updateCursor( const QPoint &p )
{
// detect the underlaying page (if present)
PageViewItem * pageItem = pickItemOnPoint( p.x(), p.y() );
if ( pageItem )
if ( d->annotator && d->annotator->active() )
{
if ( pageItem || d->annotator->annotating() )
setCursor( d->annotator->cursor() );
else
setCursor( Qt::ForbiddenCursor );
}
else if ( pageItem )
{
double nX = pageItem->absToPageX(p.x());
double nY = pageItem->absToPageY(p.y());
......@@ -3668,7 +3673,7 @@ void PageView::updateCursor( const QPoint &p )
setCursor( Qt::CrossCursor );
else if ( d->mouseAnn )
setCursor( Qt::ClosedHandCursor );
else
else if ( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Browse )
{
const Okular::ObjectRect * linkobj = pageItem->page()->objectRect( Okular::ObjectRect::Action, nX, nY, pageItem->uncroppedWidth(), pageItem->uncroppedHeight() );
const Okular::ObjectRect * annotobj = pageItem->page()->objectRect( Okular::ObjectRect::OAnnotation, nX, nY, pageItem->uncroppedWidth(), pageItem->uncroppedHeight() );
......@@ -3701,17 +3706,21 @@ void PageView::updateCursor( const QPoint &p )
setCursor( Qt::PointingHandCursor );
}
}
}
else if ( Okular::Settings::mouseMode() == Okular::Settings::EnumMouseMode::Browse )
{
setCursor( (d->annotator && d->annotator->active()) ? Qt::CrossCursor : Qt::OpenHandCursor );
else
{
setCursor( Qt::OpenHandCursor );
}
}
else
{
setCursor( Qt::ArrowCursor );
setCursor( Qt::OpenHandCursor );
}
}
}
else
{
setCursor( Qt::ArrowCursor );
}
}
else
{
......
......@@ -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 )
{
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment