From 7c4faa67f4b45671884bdccd99d83f92ca655366 Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Fri, 20 Jul 2018 11:00:29 +0200 Subject: ... --- src/gui/nodeitem.cpp | 3 ++- src/gui/stylepalette.cpp | 5 +++-- src/gui/tikzscene.cpp | 11 ++++++----- src/gui/tikzview.cpp | 40 ++++++++++++++++++++++++++++------------ 4 files changed, 39 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gui/nodeitem.cpp b/src/gui/nodeitem.cpp index 922747d..b452848 100644 --- a/src/gui/nodeitem.cpp +++ b/src/gui/nodeitem.cpp @@ -70,8 +70,9 @@ void NodeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidge QPen pen(QColor(180,180,220)); QVector p; - p << 2.0 << 2.0; + p << 1.0 << 2.0; pen.setDashPattern(p); + pen.setWidthF(2.0f); painter->setPen(pen); painter->setBrush(Qt::NoBrush); painter->drawPath(shape()); diff --git a/src/gui/stylepalette.cpp b/src/gui/stylepalette.cpp index 6d6599b..e3fea0b 100644 --- a/src/gui/stylepalette.cpp +++ b/src/gui/stylepalette.cpp @@ -46,12 +46,13 @@ StylePalette::StylePalette(QWidget *parent) : ui->styleListView->setModel(_nodeModel); ui->styleListView->setViewMode(QListView::IconMode); ui->styleListView->setMovement(QListView::Static); - ui->styleListView->setGridSize(QSize(70,40)); + ui->styleListView->setGridSize(QSize(48,48)); + ui->edgeStyleListView->setModel(_edgeModel); ui->edgeStyleListView->setViewMode(QListView::IconMode); ui->edgeStyleListView->setMovement(QListView::Static); - ui->edgeStyleListView->setGridSize(QSize(70,40)); + ui->edgeStyleListView->setGridSize(QSize(48,48)); reloadStyles(); diff --git a/src/gui/tikzscene.cpp b/src/gui/tikzscene.cpp index 772c67b..47464fe 100644 --- a/src/gui/tikzscene.cpp +++ b/src/gui/tikzscene.cpp @@ -44,7 +44,7 @@ TikzScene::TikzScene(TikzDocument *tikzDocument, ToolPalette *tools, QPen pen; pen.setColor(QColor::fromRgbF(0.5f, 0.0f, 0.5f)); - pen.setWidth(3); + //pen.setWidth(3.0f); pen.setCosmetic(true); _drawEdgeItem->setPen(pen); _drawEdgeItem->setLine(0,0,0,0); @@ -52,10 +52,11 @@ TikzScene::TikzScene(TikzDocument *tikzDocument, ToolPalette *tools, addItem(_drawEdgeItem); pen.setColor(QColor::fromRgbF(0.6f, 0.6f, 0.8f)); - pen.setWidth(3); - QVector dash; - dash << 4.0 << 4.0; - pen.setDashPattern(dash); + //pen.setWidth(3.0f); + //QVector dash; + //dash << 4.0 << 4.0; + pen.setStyle(Qt::DashLine); + //pen.setDashPattern(dash); _rubberBandItem->setPen(pen); QBrush brush(QColor::fromRgbF(0.6,0.6,0.8,0.2)); diff --git a/src/gui/tikzview.cpp b/src/gui/tikzview.cpp index 700cf29..6cdb17c 100644 --- a/src/gui/tikzview.cpp +++ b/src/gui/tikzview.cpp @@ -57,52 +57,68 @@ void TikzView::drawBackground(QPainter *painter, const QRectF &rect) // draw the grid QPen pen1; - pen1.setWidth(1); + //pen1.setWidthF(0.5); pen1.setCosmetic(true); - pen1.setColor(QColor(230,230,230)); + pen1.setColor(QColor(250,250,255)); QPen pen2 = pen1; - pen2.setColor(QColor(200,200,200)); + pen2.setColor(QColor(240,240,250)); QPen pen3 = pen1; - pen3.setColor(QColor(160,160,160)); + pen3.setColor(QColor(220,220,240)); painter->setPen(pen1); if (_scale > 0.2f) { for (int x = -GRID_SEP; x > rect.left(); x -= GRID_SEP) { - if (x % (GRID_SEP * GRID_N) != 0) painter->drawLine(x, rect.top(), x, rect.bottom()); + if (x % (GRID_SEP * GRID_N) != 0) { + qreal xf = (qreal)x; + painter->drawLine(xf, rect.top(), xf, rect.bottom()); + } } for (int x = GRID_SEP; x < rect.right(); x += GRID_SEP) { - if (x % (GRID_SEP * GRID_N) != 0) painter->drawLine(x, rect.top(), x, rect.bottom()); + if (x % (GRID_SEP * GRID_N) != 0) { + qreal xf = (qreal)x; + painter->drawLine(xf, rect.top(), xf, rect.bottom()); + } } for (int y = -GRID_SEP; y > rect.top(); y -= GRID_SEP) { - if (y % (GRID_SEP * GRID_N) != 0) painter->drawLine(rect.left(), y, rect.right(), y); + if (y % (GRID_SEP * GRID_N) != 0) { + qreal yf = (qreal)y; + painter->drawLine(rect.left(), yf, rect.right(), yf); + } } for (int y = GRID_SEP; y < rect.bottom(); y += GRID_SEP) { - if (y % (GRID_SEP * GRID_N) != 0) painter->drawLine(rect.left(), y, rect.right(), y); + if (y % (GRID_SEP * GRID_N) != 0) { + qreal yf = (qreal)y; + painter->drawLine(rect.left(), yf, rect.right(), yf); + } } } painter->setPen(pen2); for (int x = -GRID_SEP*GRID_N; x > rect.left(); x -= GRID_SEP*GRID_N) { - painter->drawLine(x, rect.top(), x, rect.bottom()); + qreal xf = (qreal)x; + painter->drawLine(xf, rect.top(), xf, rect.bottom()); } for (int x = GRID_SEP*GRID_N; x < rect.right(); x += GRID_SEP*GRID_N) { - painter->drawLine(x, rect.top(), x, rect.bottom()); + qreal xf = (qreal)x; + painter->drawLine(xf, rect.top(), xf, rect.bottom()); } for (int y = -GRID_SEP*GRID_N; y > rect.top(); y -= GRID_SEP*GRID_N) { - painter->drawLine(rect.left(), y, rect.right(), y); + qreal yf = (qreal)y; + painter->drawLine(rect.left(), yf, rect.right(), yf); } for (int y = GRID_SEP*GRID_N; y < rect.bottom(); y += GRID_SEP*GRID_N) { - painter->drawLine(rect.left(), y, rect.right(), y); + qreal yf = (qreal)y; + painter->drawLine(rect.left(), yf, rect.right(), yf); } painter->setPen(pen3); -- cgit v1.2.3