mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-06 19:54:13 +02:00
Move the dark canvas into PaletteGraphicsView and test it directly
The inverted painting, the rubber band replay and the changed() receiver lived in DiagramView, which the unit tests cannot link, so the update-flag regression was only covered through a stand-in view. They now live in PaletteGraphicsView, a QGraphicsView subclass with no other dependency, and DiagramView derives from it. The view tells a subclass through paintingInverted(bool) when it renders for an inverted display; DiagramView forwards that to the diagram. The grid dot rule moves out of Diagram::drawBackground into QET::Palette::gridDotColor(). tst_qetpalette now links the real class: gridDotColorSoftensInvertedDots, paletteViewFollowsThePalette (light sheet, dark sheet at text contrast with a red box still red and the paintingInverted calls in order, back to light), paletteViewKeepsSceneUpdatesFlowing (three whole-scene updates and a selection each repaint, scene set after construction), paletteViewDrawsTheRubberBand.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include "titleblock/templatelocation.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QGraphicsView>
|
||||
#include "palettegraphicsview.h"
|
||||
|
||||
class Conductor;
|
||||
class Diagram;
|
||||
@@ -30,13 +30,12 @@ class QETDiagramEditor;
|
||||
class DVEventInterface;
|
||||
class QInputEvent;
|
||||
class QGestureEvent;
|
||||
class QPainter;
|
||||
|
||||
/**
|
||||
This class provides a widget to render an electric diagram in an editable,
|
||||
interactive way.
|
||||
*/
|
||||
class DiagramView : public QGraphicsView
|
||||
class DiagramView : public PaletteGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -85,6 +84,7 @@ class DiagramView : public QGraphicsView
|
||||
///Set for one call only, by the Escape handler, to let focus leave the view.
|
||||
bool m_releasing_focus = false;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void paintingInverted(bool inverted) override;
|
||||
void mousePressEvent(QMouseEvent *) override;
|
||||
void mouseMoveEvent(QMouseEvent *) override;
|
||||
void mouseReleaseEvent(QMouseEvent *) override;
|
||||
@@ -98,9 +98,6 @@ class DiagramView : public QGraphicsView
|
||||
virtual bool selectedItemHasFocus();
|
||||
|
||||
private:
|
||||
bool canvasIsInverted() const;
|
||||
void paintInverted(const QRect &area);
|
||||
void drawRubberBand(QPainter &painter);
|
||||
void handleElementDrop(QDropEvent *);
|
||||
void handleTitleBlockDrop(QDropEvent *);
|
||||
void handleTextDrop(QDropEvent *);
|
||||
|
||||
Reference in New Issue
Block a user