koffice/krita/ui
Cyrille Berger
cyb at lepi.org
Tue Jul 22 21:20:55 CEST 2008
SVN commit 836683 by berger:
* prevent mouse event to be processed if they are to close of a tablet even
This is a workaround, and we should check once 4.4.1 if the problem was solved
CCMAIL:kimageshop at kde.org
M +9 -0 canvas/kis_qpainter_canvas.cpp
M +3 -1 kis_tool_freehand.cc
--- trunk/koffice/krita/ui/canvas/kis_qpainter_canvas.cpp #836682:836683
@@ -27,6 +27,7 @@
#include <QColor>
#include <QString>
#include <QTime>
+#include <QTimer>
#include <QPixmap>
#include <QApplication>
#include <QMenu>
@@ -77,6 +78,7 @@
QPoint documentOffset;
bool tabletDown;
QTabletEvent previousEvent;
+ QTimer blockMouseEvent;
};
KisQPainterCanvas::KisQPainterCanvas(KisCanvas2 * canvas, QWidget * parent)
@@ -95,6 +97,7 @@
setAcceptDrops( true );
setFocusPolicy(Qt::StrongFocus);
setAttribute(Qt::WA_InputMethodEnabled, true);
+ m_d->blockMouseEvent.setSingleShot(true);
}
KisQPainterCanvas::~KisQPainterCanvas()
@@ -211,6 +214,7 @@
}
void KisQPainterCanvas::mouseMoveEvent(QMouseEvent *e) {
+ if( m_d->blockMouseEvent.isActive() ) return;
m_d->toolProxy->mouseMoveEvent( e, m_d->viewConverter->viewToDocument(e->pos() + m_d->documentOffset ) );
}
@@ -224,14 +228,18 @@
}
void KisQPainterCanvas::mousePressEvent(QMouseEvent *e) {
+ dbgRender << "Mouse press event";
+ if( m_d->blockMouseEvent.isActive() ) return;
m_d->toolProxy->mousePressEvent( e, m_d->viewConverter->viewToDocument(e->pos() + m_d->documentOffset ) );
}
void KisQPainterCanvas::mouseReleaseEvent(QMouseEvent *e) {
+ if( m_d->blockMouseEvent.isActive() ) return;
m_d->toolProxy->mouseReleaseEvent( e, m_d->viewConverter->viewToDocument(e->pos() + m_d->documentOffset ) );
}
void KisQPainterCanvas::mouseDoubleClickEvent(QMouseEvent *e) {
+ if( m_d->blockMouseEvent.isActive() ) return;
m_d->toolProxy->mouseDoubleClickEvent( e, m_d->viewConverter->viewToDocument(e->pos() + m_d->documentOffset ) );
}
@@ -255,6 +263,7 @@
void KisQPainterCanvas::tabletEvent( QTabletEvent *e )
{
+ m_d->blockMouseEvent.start(100);
dbgRender <<"tablet event:" << e->pressure() << e->type() << " " << e->device() << " " << e->x() << " " << e->y();
switch( e->type() ) {
case QEvent::TabletPress:
--- trunk/koffice/krita/ui/kis_tool_freehand.cc #836682:836683
@@ -82,7 +82,7 @@
void KisToolFreehand::mousePressEvent(KoPointerEvent *e)
{
-// dbgUI << "mousePressEvent" << m_mode;
+ dbgUI << "mousePressEvent" << m_mode;
// if (!currentImage())
// return;
@@ -99,7 +99,9 @@
{
currentPaintOpSettings()->mousePressEvent(e);
if(e->isAccepted())
+ {
return;
+ }
}
if (e->button() == Qt::LeftButton)
More information about the kimageshop
mailing list