Merge branch 'OEFUniboard' of github.com:stayonshadow/PrivateBoard into OEFUniboard

preferencesAboutTextFull
Claudio Valerio 12 years ago
commit 004fd2fd48
  1. 69
      src/board/UBBoardView.cpp
  2. 9
      src/board/UBBoardView.h
  3. 1
      src/gui/UBCachePropertiesWidget.cpp
  4. 32
      src/gui/UBMainWindow.cpp
  5. 4
      src/gui/UBMainWindow.h

@ -864,12 +864,79 @@ void UBBoardView::setMultiselection(bool enable)
mMultipleSelectionIsEnabled = enable;
}
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX)
bool UBBoardView::directTabletEvent(QEvent *event)
{
QTabletEvent *tEvent = static_cast<QTabletEvent *>(event);
tEvent = new QTabletEvent(tEvent->type()
, mapFromGlobal(tEvent->pos())
, tEvent->globalPos()
, tEvent->hiResGlobalPos()
, tEvent->device()
, tEvent->pointerType()
, tEvent->pressure()
, tEvent->xTilt()
, tEvent->yTilt()
, tEvent->tangentialPressure()
, tEvent->rotation()
, tEvent->z()
, tEvent->modifiers()
, tEvent->uniqueId());
if (geometry().contains(tEvent->pos()))
{
if (NULL == widgetForTabletEvent(this->parentWidget(), tEvent->pos()))
{
tabletEvent(tEvent);
return true;
}
}
return false;
}
QWidget *UBBoardView::widgetForTabletEvent(QWidget *w, const QPoint &pos)
{
Q_ASSERT(w);
// it should work that, but it doesn't. So we check if it is control view.
//UBBoardView *board = qobject_cast<UBBoardView *>(w);
UBBoardView *board = UBApplication::boardController->controlView();
QWidget *childAtPos = NULL;
QList<QObject *> childs = w->children();
foreach(QObject *child, childs)
{
QWidget *childWidget = qobject_cast<QWidget *>(child);
if (childWidget)
{
if (childWidget->isVisible() && childWidget->geometry().contains(pos))
{
QWidget *lastChild = widgetForTabletEvent(childWidget, pos);
if (board && board->viewport() == lastChild)
continue;
if (NULL != lastChild)
childAtPos = lastChild;
else
childAtPos = childWidget;
break;
}
else
childAtPos = NULL;
}
}
return childAtPos;
}
#endif
void UBBoardView::longPressEvent()
{
UBDrawingController *drawingController = UBDrawingController::drawingController();
UBStylusTool::Enum currentTool = (UBStylusTool::Enum)UBDrawingController::drawingController ()->stylusTool ();
disconnect(&mLongPressTimer, SIGNAL(timeout()), this, SLOT(longPressEvent()));
if (UBStylusTool::Selector == currentTool)

@ -20,7 +20,6 @@
*/
#ifndef UBBOARDVIEW_H_
#define UBBOARDVIEW_H_
@ -54,7 +53,11 @@ class UBBoardView : public QGraphicsView
void setMultiselection(bool enable);
bool isMultipleSelectionEnabled() { return mMultipleSelectionIsEnabled; }
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX)
bool directTabletEvent(QEvent *event);
QWidget *widgetForTabletEvent(QWidget *w, const QPoint &pos);
#endif
signals:
void resized(QResizeEvent* event);
@ -153,7 +156,7 @@ class UBBoardView : public QGraphicsView
bool moveRubberBand;
UBRubberBand *mUBRubberBand;
QList<QGraphicsItem *> mRubberedItems;
QSet<QGraphicsItem*> mJustSelectedItems;

@ -372,4 +372,3 @@ void UBCachePropertiesWidget::onCacheEnabled()
{
emit showTab(this);
}

@ -27,6 +27,10 @@
#include "core/UBApplication.h"
#include "core/UBApplicationController.h"
#include "board/UBBoardController.h"
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX)
#include "board/UBBoardView.h"
#endif
#include "core/memcheck.h"
@ -145,6 +149,34 @@ void UBMainWindow::closeEvent(QCloseEvent *event)
emit closeEvent_Signal(event);
}
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX)
bool UBMainWindow::event(QEvent *event)
{
bool bRes = QMainWindow::event(event);
if (NULL != UBApplication::boardController)
{
UBBoardView *controlV = UBApplication::boardController->controlView();
if (controlV && controlV->isVisible())
{
switch (event->type())
{
case QEvent::TabletEnterProximity:
case QEvent::TabletLeaveProximity:
case QEvent::TabletMove:
case QEvent::TabletPress:
case QEvent::TabletRelease:
{
return controlV->directTabletEvent(event);
}
}
}
}
return bRes;
}
#endif
void UBMainWindow::onExportDone()
{
// HACK : When opening the file save dialog during the document exportation,

@ -83,6 +83,10 @@ class UBMainWindow : public QMainWindow, public Ui::MainWindow
QWidget *mDocumentsWidget;
private:
// work around for handling tablet events on MAC OS with Qt 4.8.0 and above
#if defined(Q_WS_MACX)
bool event(QEvent *event);
#endif
UBDownloadWidget* mpDownloadWidget;
};

Loading…
Cancel
Save