Added markup implementation.
This commit is contained in:
+14
-10
@@ -638,19 +638,22 @@ namespace glabels
|
||||
bool showEditToolBar = settings.value( "showEditToolBar", true ).toBool();
|
||||
bool showViewToolBar = settings.value( "showViewToolBar", true ).toBool();
|
||||
bool showGrid = settings.value( "showGrid", true ).toBool();
|
||||
bool showMarkup = settings.value( "showMarkup", true ).toBool();
|
||||
settings.endGroup();
|
||||
|
||||
viewFileToolBarAction->setChecked( showFileToolBar );
|
||||
viewFileToolBarAction ->setChecked( showFileToolBar );
|
||||
viewObjectsToolBarAction->setChecked( showObjectsToolBar );
|
||||
viewEditToolBarAction->setChecked( showEditToolBar );
|
||||
viewViewToolBarAction->setChecked( showViewToolBar );
|
||||
viewGridAction->setChecked( showGrid );
|
||||
viewEditToolBarAction ->setChecked( showEditToolBar );
|
||||
viewViewToolBarAction ->setChecked( showViewToolBar );
|
||||
viewGridAction ->setChecked( showGrid );
|
||||
viewMarkupAction ->setChecked( showMarkup );
|
||||
|
||||
fileToolBar->setVisible( showFileToolBar );
|
||||
objectsToolBar->setVisible( showObjectsToolBar );
|
||||
editToolBar->setVisible( showEditToolBar );
|
||||
viewToolBar->setVisible( showViewToolBar );
|
||||
view->setGridVisible( showGrid );
|
||||
fileToolBar ->setVisible( showFileToolBar );
|
||||
objectsToolBar->setVisible( showObjectsToolBar );
|
||||
editToolBar ->setVisible( showEditToolBar );
|
||||
viewToolBar ->setVisible( showViewToolBar );
|
||||
view ->setGridVisible( showGrid );
|
||||
view ->setMarkupVisible( showMarkup );
|
||||
}
|
||||
|
||||
|
||||
@@ -664,6 +667,7 @@ namespace glabels
|
||||
settings.setValue( "showEditToolBar", viewEditToolBarAction->isChecked() );
|
||||
settings.setValue( "showViewToolBar", viewViewToolBarAction->isChecked() );
|
||||
settings.setValue( "showGrid", viewGridAction->isChecked() );
|
||||
settings.setValue( "showMarkup", viewMarkupAction->isChecked() );
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
@@ -808,7 +812,7 @@ namespace glabels
|
||||
|
||||
void MainWindow::viewMarkup( bool state )
|
||||
{
|
||||
std::cout << "ACTION: edit->Markup" << std::endl;
|
||||
view->setMarkupVisible( state );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,11 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
#include "libglabels/Markup.h"
|
||||
#include "libglabels/FrameRect.h"
|
||||
#include "libglabels/FrameRound.h"
|
||||
#include "libglabels/FrameEllipse.h"
|
||||
#include "libglabels/FrameCd.h"
|
||||
|
||||
|
||||
namespace
|
||||
@@ -47,6 +51,9 @@ namespace
|
||||
const QColor gridLineColor( 192, 192, 192 );
|
||||
const double gridLineWidthPixels = 1;
|
||||
const double gridSpacing = 9; // TODO: determine from locale.
|
||||
|
||||
const QColor markupLineColor( 240, 99, 99 );
|
||||
const double markupLineWidthPixels = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +75,7 @@ namespace glabels
|
||||
|
||||
mScene->addItem( mLabelLayer = new QGraphicsItemGroup() );
|
||||
mScene->addItem( mGridLayer = new QGraphicsItemGroup() );
|
||||
mScene->addItem( mMarkupLayer = new QGraphicsItemGroup() );
|
||||
mScene->addItem( mObjectLayer = new QGraphicsItemGroup() );
|
||||
mScene->addItem( mForegroundLayer = new QGraphicsItemGroup() );
|
||||
}
|
||||
@@ -79,6 +87,7 @@ namespace glabels
|
||||
|
||||
createLabelLayer();
|
||||
createGridLayer();
|
||||
createMarkupLayer();
|
||||
|
||||
foreach (LabelModelObject* object, model->objectList() )
|
||||
{
|
||||
@@ -95,6 +104,12 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
void View::setMarkupVisible( bool visibleFlag )
|
||||
{
|
||||
mMarkupLayer->setVisible( visibleFlag );
|
||||
}
|
||||
|
||||
|
||||
void View::zoomIn()
|
||||
{
|
||||
// Find closest standard zoom level to our current zoom
|
||||
@@ -282,6 +297,25 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
void View::createMarkupLayer()
|
||||
{
|
||||
clearLayer( mMarkupLayer );
|
||||
|
||||
QPen pen( markupLineColor );
|
||||
pen.setCosmetic( true );
|
||||
pen.setWidthF( markupLineWidthPixels );
|
||||
|
||||
const libglabels::Frame* frame = mModel->frame();
|
||||
|
||||
foreach (libglabels::Markup* markup, frame->markups() )
|
||||
{
|
||||
QGraphicsItem* markupItem = markup->createGraphicsItem( frame, pen );
|
||||
|
||||
mMarkupLayer->addToGroup( markupItem );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void View::addObjectToObjectLayer( LabelModelObject* object )
|
||||
{
|
||||
QGraphicsItem* item = object->createGraphicsItem();
|
||||
|
||||
@@ -70,6 +70,7 @@ namespace glabels
|
||||
/////////////////////////////////////
|
||||
public:
|
||||
void setGridVisible( bool visibleFlag );
|
||||
void setMarkupVisible( bool visibleFlag );
|
||||
|
||||
|
||||
/////////////////////////////////////
|
||||
@@ -102,6 +103,7 @@ namespace glabels
|
||||
void clearLayer( QGraphicsItemGroup* layer );
|
||||
void createLabelLayer();
|
||||
void createGridLayer();
|
||||
void createMarkupLayer();
|
||||
void addObjectToObjectLayer( LabelModelObject* object );
|
||||
void createForegroundLayer();
|
||||
|
||||
@@ -114,6 +116,7 @@ namespace glabels
|
||||
|
||||
QGraphicsItemGroup* mLabelLayer;
|
||||
QGraphicsItemGroup* mGridLayer;
|
||||
QGraphicsItemGroup* mMarkupLayer;
|
||||
QGraphicsItemGroup* mObjectLayer;
|
||||
QGraphicsItemGroup* mForegroundLayer;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user