Added object creation mode (box only) to view.
This commit is contained in:
@@ -15,6 +15,7 @@ set (glabels_sources
|
|||||||
ColorPaletteDialog.cpp
|
ColorPaletteDialog.cpp
|
||||||
ColorPaletteItem.cpp
|
ColorPaletteItem.cpp
|
||||||
ColorSwatch.cpp
|
ColorSwatch.cpp
|
||||||
|
Cursors.cpp
|
||||||
FieldButton.cpp
|
FieldButton.cpp
|
||||||
FieldMenu.cpp
|
FieldMenu.cpp
|
||||||
FieldMenuItem.cpp
|
FieldMenuItem.cpp
|
||||||
@@ -67,6 +68,7 @@ set (glabels_forms
|
|||||||
)
|
)
|
||||||
|
|
||||||
set (glabels_resource_files
|
set (glabels_resource_files
|
||||||
|
cursors.qrc
|
||||||
icons.qrc
|
icons.qrc
|
||||||
images.qrc
|
images.qrc
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/* Cursors.cpp
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Jim Evins <evins@snaught.com>
|
||||||
|
*
|
||||||
|
* This file is part of gLabels-qt.
|
||||||
|
*
|
||||||
|
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* gLabels-qt is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Cursors.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <QPixmap>
|
||||||
|
|
||||||
|
|
||||||
|
glabels::Cursors::Barcode::Barcode()
|
||||||
|
: QCursor( QPixmap(":cursors/32x32/cursor_barcode.png"), 7, 7 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
glabels::Cursors::Box::Box()
|
||||||
|
: QCursor( QPixmap(":cursors/32x32/cursor_box.png"), 7, 7 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
glabels::Cursors::Ellipse::Ellipse()
|
||||||
|
: QCursor( QPixmap(":cursors/32x32/cursor_ellipse.png"), 7, 7 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
glabels::Cursors::Image::Image()
|
||||||
|
: QCursor( QPixmap(":cursors/32x32/cursor_image.png"), 7, 7 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
glabels::Cursors::Line::Line()
|
||||||
|
: QCursor( QPixmap(":cursors/32x32/cursor_line.png"), 7, 7 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
glabels::Cursors::Text::Text()
|
||||||
|
: QCursor( QPixmap(":cursors/32x32/cursor_text.png"), 7, 7 )
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
/* Cursors.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Jim Evins <evins@snaught.com>
|
||||||
|
*
|
||||||
|
* This file is part of gLabels-qt.
|
||||||
|
*
|
||||||
|
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* gLabels-qt is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef glabels_Cursors_h
|
||||||
|
#define glabels_Cursors_h
|
||||||
|
|
||||||
|
|
||||||
|
#include <QCursor>
|
||||||
|
|
||||||
|
|
||||||
|
namespace glabels
|
||||||
|
{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Glabels Cursors
|
||||||
|
///
|
||||||
|
namespace Cursors
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
class Barcode : public QCursor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Barcode();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Box : public QCursor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Box();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Ellipse : public QCursor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Ellipse();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Image : public QCursor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Image();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Line : public QCursor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Line();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Text : public QCursor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Text();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // glabels_Cursors_h
|
||||||
@@ -57,7 +57,7 @@ namespace glabels
|
|||||||
mShadowState = false;
|
mShadowState = false;
|
||||||
mShadowX = 1.3;
|
mShadowX = 1.3;
|
||||||
mShadowY = 1.3;
|
mShadowY = 1.3;
|
||||||
mShadowColorNode = ColorNode( QColor::fromRgb(0x000000) );
|
mShadowColorNode = ColorNode( QColor( 0, 0, 0 ) );
|
||||||
mShadowOpacity = 0.5;
|
mShadowOpacity = 0.5;
|
||||||
|
|
||||||
mSelectedFlag = false;
|
mSelectedFlag = false;
|
||||||
@@ -768,6 +768,8 @@ namespace glabels
|
|||||||
{
|
{
|
||||||
mW = w;
|
mW = w;
|
||||||
mH = h;
|
mH = h;
|
||||||
|
|
||||||
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ namespace glabels
|
|||||||
mHandles << new HandleSouthWest( this );
|
mHandles << new HandleSouthWest( this );
|
||||||
mHandles << new HandleWest( this );
|
mHandles << new HandleWest( this );
|
||||||
|
|
||||||
/* TODO: initialize default line and fill poperties. */
|
mLineWidth = 1.0;
|
||||||
|
mLineColorNode = ColorNode( QColor( 0, 0, 0 ) );
|
||||||
|
mFillColorNode = ColorNode( QColor( 0, 255, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1021,7 +1021,7 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
void MainWindow::objectsArrowMode()
|
void MainWindow::objectsArrowMode()
|
||||||
{
|
{
|
||||||
qDebug() << "ACTION: objects->Select Mode";
|
mView->arrowMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1039,7 +1039,7 @@ namespace glabels
|
|||||||
///
|
///
|
||||||
void MainWindow::objectsCreateBox()
|
void MainWindow::objectsCreateBox()
|
||||||
{
|
{
|
||||||
qDebug() << "ACTION: objects->Create->Box";
|
mView->createBoxMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+223
-117
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include "LabelModel.h"
|
#include "LabelModel.h"
|
||||||
#include "LabelModelObject.h"
|
#include "LabelModelObject.h"
|
||||||
|
#include "LabelModelBoxObject.h"
|
||||||
|
#include "Cursors.h"
|
||||||
|
|
||||||
#include "libglabels/Markup.h"
|
#include "libglabels/Markup.h"
|
||||||
#include "libglabels/FrameRect.h"
|
#include "libglabels/FrameRect.h"
|
||||||
@@ -130,9 +132,9 @@ glabels::View::setModel( LabelModel* model )
|
|||||||
{
|
{
|
||||||
setZoomReal( 1, false );
|
setZoomReal( 1, false );
|
||||||
|
|
||||||
connect( model, SIGNAL(changed()), this, SLOT(onModelChanged()) );
|
connect( model, SIGNAL(changed()), this, SLOT(update()) );
|
||||||
connect( model, SIGNAL(selectionChanged()), this, SLOT(onModelSelectionChanged()) );
|
connect( model, SIGNAL(selectionChanged()), this, SLOT(update()) );
|
||||||
connect( model, SIGNAL(sizeChanged()), this, SLOT(onModelSizeChanged()) );
|
connect( model, SIGNAL(sizeChanged()), this, SLOT(update()) );
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -286,6 +288,33 @@ glabels::View::setZoomReal( double zoom, bool zoomToFitFlag )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Arrow mode (normal mode)
|
||||||
|
///
|
||||||
|
void
|
||||||
|
glabels::View::arrowMode()
|
||||||
|
{
|
||||||
|
setCursor( Qt::ArrowCursor );
|
||||||
|
|
||||||
|
mInObjectCreateMode = false;
|
||||||
|
mState = IdleState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Create box mode
|
||||||
|
///
|
||||||
|
void
|
||||||
|
glabels::View::createBoxMode()
|
||||||
|
{
|
||||||
|
setCursor( Cursors::Box() );
|
||||||
|
|
||||||
|
mInObjectCreateMode = true;
|
||||||
|
mCreateObjectType = Box;
|
||||||
|
mState = IdleState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Resize Event Handler
|
/// Resize Event Handler
|
||||||
///
|
///
|
||||||
@@ -310,118 +339,6 @@ glabels::View::resizeEvent( QResizeEvent *event )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Mouse Movement Event Handler
|
|
||||||
///
|
|
||||||
void
|
|
||||||
glabels::View::mouseMoveEvent( QMouseEvent* event )
|
|
||||||
{
|
|
||||||
if ( mModel )
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Transform to label coordinates
|
|
||||||
*/
|
|
||||||
QTransform transform;
|
|
||||||
|
|
||||||
transform.scale( mScale, mScale );
|
|
||||||
transform.translate( mX0, mY0 );
|
|
||||||
|
|
||||||
QPointF pWorld = transform.inverted().map( event->posF() );
|
|
||||||
double xWorld = pWorld.x();
|
|
||||||
double yWorld = pWorld.y();
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Emit signal regardless of mode
|
|
||||||
*/
|
|
||||||
emit pointerMoved( xWorld, yWorld );
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Handle event as appropriate for mode
|
|
||||||
*/
|
|
||||||
if ( !mInObjectCreateMode )
|
|
||||||
{
|
|
||||||
switch (mState)
|
|
||||||
{
|
|
||||||
|
|
||||||
case IdleState:
|
|
||||||
if ( mModel->isSelectionAtomic() &&
|
|
||||||
mModel->handleAt( mScale, xWorld, yWorld ) )
|
|
||||||
{
|
|
||||||
setCursor( Qt::CrossCursor );
|
|
||||||
}
|
|
||||||
else if ( mModel->objectAt( mScale, xWorld, yWorld ) )
|
|
||||||
{
|
|
||||||
setCursor( Qt::SizeAllCursor );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setCursor( Qt::ArrowCursor );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ArrowSelectRegion:
|
|
||||||
mSelectRegion.setX2( xWorld );
|
|
||||||
mSelectRegion.setY2( yWorld );
|
|
||||||
update();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ArrowMove:
|
|
||||||
mModel->moveSelection( (xWorld - mMoveLastX),
|
|
||||||
(yWorld - mMoveLastY) );
|
|
||||||
mMoveLastX = xWorld;
|
|
||||||
mMoveLastY = yWorld;
|
|
||||||
update();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ArrowResize:
|
|
||||||
handleResizeMotion( xWorld, yWorld );
|
|
||||||
update();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
// Should not happen!
|
|
||||||
qWarning() << "Invalid arrow state.";
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( mState != IdleState )
|
|
||||||
{
|
|
||||||
switch (mCreateObjectType)
|
|
||||||
{
|
|
||||||
case Box:
|
|
||||||
// @TODO
|
|
||||||
break;
|
|
||||||
case Ellipse:
|
|
||||||
// @TODO
|
|
||||||
break;
|
|
||||||
case Line:
|
|
||||||
// @TODO
|
|
||||||
break;
|
|
||||||
case Image:
|
|
||||||
// @TODO
|
|
||||||
break;
|
|
||||||
case Text:
|
|
||||||
// @TODO
|
|
||||||
break;
|
|
||||||
case Barcode:
|
|
||||||
// @TODO
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Should not happen!
|
|
||||||
qWarning() << "Invalid create type.";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Mouse Button Press Event Handler
|
/// Mouse Button Press Event Handler
|
||||||
///
|
///
|
||||||
@@ -451,6 +368,10 @@ glabels::View::mousePressEvent( QMouseEvent* event )
|
|||||||
|
|
||||||
if ( !mInObjectCreateMode )
|
if ( !mInObjectCreateMode )
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// NORMAL MODE
|
||||||
|
//
|
||||||
|
|
||||||
LabelModelObject* object = 0;
|
LabelModelObject* object = 0;
|
||||||
Handle* handle = 0;
|
Handle* handle = 0;
|
||||||
if ( mModel->isSelectionAtomic() &&
|
if ( mModel->isSelectionAtomic() &&
|
||||||
@@ -497,7 +418,6 @@ glabels::View::mousePressEvent( QMouseEvent* event )
|
|||||||
mMoveLastY = yWorld;
|
mMoveLastY = yWorld;
|
||||||
|
|
||||||
mState = ArrowMove;
|
mState = ArrowMove;
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -519,6 +439,53 @@ glabels::View::mousePressEvent( QMouseEvent* event )
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// OBJECT CREATION MODE
|
||||||
|
//
|
||||||
|
|
||||||
|
if ( mState == IdleState )
|
||||||
|
{
|
||||||
|
switch ( mCreateObjectType )
|
||||||
|
{
|
||||||
|
case Box:
|
||||||
|
mCreateObject = new LabelModelBoxObject();
|
||||||
|
break;
|
||||||
|
case Ellipse:
|
||||||
|
// mCreateObject = new LabelModelEllipseObject();
|
||||||
|
break;
|
||||||
|
case Line:
|
||||||
|
// mCreateObject = new LabelModelLineObject();
|
||||||
|
break;
|
||||||
|
case Image:
|
||||||
|
// mCreateObject = new LabelModelImageObject();
|
||||||
|
break;
|
||||||
|
case Text:
|
||||||
|
// mCreateObject = new LabelModelTextObject();
|
||||||
|
break;
|
||||||
|
case Barcode:
|
||||||
|
// mCreateObject = new LabelModelBarcodeObject();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Q_ASSERT_X( false, "View::::mousePressEvent", "Invalid creation type" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mCreateObject->setPosition( xWorld, yWorld );
|
||||||
|
mCreateObject->setSize( 0, 0 );
|
||||||
|
mModel->addObject( mCreateObject );
|
||||||
|
|
||||||
|
mModel->unselectAll();
|
||||||
|
mModel->selectObject( mCreateObject );
|
||||||
|
|
||||||
|
mCreateX0 = xWorld;
|
||||||
|
mCreateY0 = yWorld;
|
||||||
|
|
||||||
|
mState = CreateDrag;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ( event->button() & Qt::RightButton )
|
else if ( event->button() & Qt::RightButton )
|
||||||
@@ -532,6 +499,123 @@ glabels::View::mousePressEvent( QMouseEvent* event )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Mouse Movement Event Handler
|
||||||
|
///
|
||||||
|
void
|
||||||
|
glabels::View::mouseMoveEvent( QMouseEvent* event )
|
||||||
|
{
|
||||||
|
using std::min;
|
||||||
|
using std::max;
|
||||||
|
|
||||||
|
if ( mModel )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Transform to label coordinates
|
||||||
|
*/
|
||||||
|
QTransform transform;
|
||||||
|
|
||||||
|
transform.scale( mScale, mScale );
|
||||||
|
transform.translate( mX0, mY0 );
|
||||||
|
|
||||||
|
QPointF pWorld = transform.inverted().map( event->posF() );
|
||||||
|
double xWorld = pWorld.x();
|
||||||
|
double yWorld = pWorld.y();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Emit signal regardless of mode
|
||||||
|
*/
|
||||||
|
emit pointerMoved( xWorld, yWorld );
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Handle event as appropriate for mode
|
||||||
|
*/
|
||||||
|
if ( !mInObjectCreateMode )
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// NORMAL MODE
|
||||||
|
///
|
||||||
|
|
||||||
|
switch (mState)
|
||||||
|
{
|
||||||
|
|
||||||
|
case IdleState:
|
||||||
|
if ( mModel->isSelectionAtomic() &&
|
||||||
|
mModel->handleAt( mScale, xWorld, yWorld ) )
|
||||||
|
{
|
||||||
|
setCursor( Qt::CrossCursor );
|
||||||
|
}
|
||||||
|
else if ( mModel->objectAt( mScale, xWorld, yWorld ) )
|
||||||
|
{
|
||||||
|
setCursor( Qt::SizeAllCursor );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setCursor( Qt::ArrowCursor );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ArrowSelectRegion:
|
||||||
|
mSelectRegion.setX2( xWorld );
|
||||||
|
mSelectRegion.setY2( yWorld );
|
||||||
|
update();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ArrowMove:
|
||||||
|
mModel->moveSelection( (xWorld - mMoveLastX),
|
||||||
|
(yWorld - mMoveLastY) );
|
||||||
|
mMoveLastX = xWorld;
|
||||||
|
mMoveLastY = yWorld;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ArrowResize:
|
||||||
|
handleResizeMotion( xWorld, yWorld );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Should not happen!
|
||||||
|
Q_ASSERT_X( false, "View::::mouseMoveEvent", "Invalid state" );
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// OBJECT CREATION MODE
|
||||||
|
//
|
||||||
|
|
||||||
|
if ( mState != IdleState )
|
||||||
|
{
|
||||||
|
switch (mCreateObjectType)
|
||||||
|
{
|
||||||
|
case Box:
|
||||||
|
case Ellipse:
|
||||||
|
case Image:
|
||||||
|
case Text:
|
||||||
|
case Barcode:
|
||||||
|
mCreateObject->setPosition( min( xWorld, mCreateX0 ),
|
||||||
|
min( yWorld, mCreateY0 ) );
|
||||||
|
mCreateObject->setSize( max(xWorld,mCreateX0) - min(xWorld,mCreateX0),
|
||||||
|
max(yWorld,mCreateY0) - min(yWorld,mCreateY0) );
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Line:
|
||||||
|
mCreateObject->setSize( xWorld - mCreateX0, yWorld - mCreateY0 );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Should not happen!
|
||||||
|
Q_ASSERT_X( false, "View::::mouseMoveEvent", "Invalid creation mode" );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Mouse Button Release Event Handler
|
/// Mouse Button Release Event Handler
|
||||||
///
|
///
|
||||||
@@ -561,6 +645,9 @@ glabels::View::mouseReleaseEvent( QMouseEvent* event )
|
|||||||
|
|
||||||
if ( !mInObjectCreateMode )
|
if ( !mInObjectCreateMode )
|
||||||
{
|
{
|
||||||
|
///
|
||||||
|
/// NORMAL MODE
|
||||||
|
///
|
||||||
|
|
||||||
switch (mState)
|
switch (mState)
|
||||||
{
|
{
|
||||||
@@ -582,7 +669,6 @@ glabels::View::mouseReleaseEvent( QMouseEvent* event )
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
mState = IdleState;
|
mState = IdleState;
|
||||||
update();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -590,7 +676,27 @@ glabels::View::mouseReleaseEvent( QMouseEvent* event )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// OBJECT CREATION MODE
|
||||||
|
//
|
||||||
|
|
||||||
|
if ( (fabs(mCreateObject->w()) < 4) && (fabs(mCreateObject->h()) < 4) )
|
||||||
|
{
|
||||||
|
switch (mCreateObjectType)
|
||||||
|
{
|
||||||
|
case Text:
|
||||||
|
mCreateObject->setSize( 0, 0 );
|
||||||
|
break;
|
||||||
|
case Line:
|
||||||
|
mCreateObject->setSize( 72, 0 );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mCreateObject->setSize( 72, 72 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
arrowMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -116,8 +116,8 @@ namespace glabels
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent( QResizeEvent* event );
|
void resizeEvent( QResizeEvent* event );
|
||||||
void mouseMoveEvent( QMouseEvent* event );
|
|
||||||
void mousePressEvent( QMouseEvent* event );
|
void mousePressEvent( QMouseEvent* event );
|
||||||
|
void mouseMoveEvent( QMouseEvent* event );
|
||||||
void mouseReleaseEvent( QMouseEvent* event );
|
void mouseReleaseEvent( QMouseEvent* event );
|
||||||
void leaveEvent( QEvent* event );
|
void leaveEvent( QEvent* event );
|
||||||
void paintEvent( QPaintEvent* event );
|
void paintEvent( QPaintEvent* event );
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<!DOCTYPE RCC>
|
||||||
|
|
||||||
|
<RCC version="1.0">
|
||||||
|
<qresource>
|
||||||
|
<file>cursors/32x32/cursor_barcode.png</file>
|
||||||
|
<file>cursors/32x32/cursor_box.png</file>
|
||||||
|
<file>cursors/32x32/cursor_ellipse.png</file>
|
||||||
|
<file>cursors/32x32/cursor_image.png</file>
|
||||||
|
<file>cursors/32x32/cursor_line.png</file>
|
||||||
|
<file>cursors/32x32/cursor_text.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 198 B |
Binary file not shown.
|
After Width: | Height: | Size: 200 B |
Binary file not shown.
|
After Width: | Height: | Size: 243 B |
Binary file not shown.
|
After Width: | Height: | Size: 247 B |
Binary file not shown.
|
After Width: | Height: | Size: 198 B |
Binary file not shown.
|
After Width: | Height: | Size: 210 B |
Reference in New Issue
Block a user