Did a better implementation for the tool management

preferencesAboutTextFull
shibakaneki 12 years ago
parent 473b251514
commit 4d982d1eac
  1. 30
      src/board/UBBoardView.cpp
  2. 2
      src/board/UBBoardView.h
  3. 5
      src/board/UBDrawingController.cpp

@ -106,8 +106,7 @@ UBBoardView::~UBBoardView () {
delete suspendedMousePressEvent;
}
void
UBBoardView::init ()
void UBBoardView::init ()
{
connect (UBSettings::settings ()->boardPenPressureSensitive, SIGNAL (changed (QVariant)),
this, SLOT (settingChanged (QVariant)));
@ -144,8 +143,6 @@ UBBoardView::init ()
movingItem = NULL;
mWidgetMoved = false;
connectToStylusPalette();
}
UBGraphicsScene*
@ -1441,28 +1438,3 @@ UBBoardView::setToolCursor (int tool)
controlViewport->setCursor (UBResources::resources ()->penCursor);
}
}
void UBBoardView::connectToStylusPalette()
{
connect(UBApplication::mainWindow->actionPen, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionEraser, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionMarker, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionPointer, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionPlay, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionZoomIn, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionZoomOut, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionCapture, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionHand, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionLine, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionText, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
connect(UBApplication::mainWindow->actionSelector, SIGNAL(triggered(bool)), this, SLOT(onTriggeredAction(bool)));
}
void UBBoardView::onTriggeredAction(bool checked)
{
Q_UNUSED(checked);
QList<QGraphicsItem*> it = scene()->selectedItems();
foreach(QGraphicsItem* i, it){
i->setSelected(false);
}
}

@ -94,7 +94,6 @@ class UBBoardView : public QGraphicsView
private:
void init();
void connectToStylusPalette();
inline bool shouldDisplayItem(QGraphicsItem *item)
{
@ -152,7 +151,6 @@ class UBBoardView : public QGraphicsView
private slots:
void settingChanged(QVariant newValue);
void onTriggeredAction(bool checked);
public slots:

@ -18,8 +18,10 @@
#include "core/UBSettings.h"
#include "core/UBApplication.h"
#include "gui/UBMainWindow.h"
#include "domain/UBGraphicsScene.h"
#include "board/UBBoardController.h"
#include "gui/UBMainWindow.h"
#include "core/memcheck.h"
UBDrawingController* UBDrawingController::sDrawingController = 0;
@ -87,6 +89,7 @@ void UBDrawingController::setStylusTool(int tool)
{
if (tool != mStylusTool)
{
UBApplication::boardController->activeScene()->deselectAllItems();
if (mStylusTool == UBStylusTool::Pen || mStylusTool == UBStylusTool::Marker
|| mStylusTool == UBStylusTool::Line)
{

Loading…
Cancel
Save