mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Added Abhishek Bansal patch:
Diagram::background_color is now selectable and make component color reverse color for contrast, thanks Abhishek git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2670 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -37,6 +37,8 @@ const int Diagram::xGrid = 10;
|
||||
const int Diagram::yGrid = 10;
|
||||
const qreal Diagram::margin = 5.0;
|
||||
|
||||
// static variable to keep track of present background color of the diagram.
|
||||
QColor Diagram::background_color = Qt::white;
|
||||
/**
|
||||
Constructeur
|
||||
@param parent Le QObject parent du schema
|
||||
@@ -121,12 +123,17 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) {
|
||||
|
||||
// dessine un fond blanc
|
||||
p -> setPen(Qt::NoPen);
|
||||
p -> setBrush(Qt::white);
|
||||
//set brush color to present background color.
|
||||
p -> setBrush(Diagram::background_color);
|
||||
p -> drawRect(r);
|
||||
|
||||
if (draw_grid_) {
|
||||
// dessine les points de la grille
|
||||
p -> setPen(Qt::black);
|
||||
// if background color is black, then grid spots shall be white, else they shall be black in color.
|
||||
if (Diagram::background_color == Qt::black)
|
||||
p -> setPen(Qt::white);
|
||||
else
|
||||
p -> setPen(Qt::black);
|
||||
p -> setBrush(Qt::NoBrush);
|
||||
qreal limite_x = r.x() + r.width();
|
||||
qreal limite_y = r.y() + r.height();
|
||||
|
||||
Reference in New Issue
Block a user