r24402 by jghali - Refactoring for ColorChart widget
scribus-commit
scribus-commit at lists.scribus.net
Wed Jan 13 02:32:21 UTC 2021
Author: jghali
Date: Wed Jan 13 02:32:20 2021
New Revision: 24402
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24402
Log:
Refactoring for ColorChart widget
Modified:
trunk/Scribus/scribus/ui/colorchart.cpp
trunk/Scribus/scribus/ui/colorchart.h
Modified: trunk/Scribus/scribus/ui/colorchart.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24402&path=/trunk/Scribus/scribus/ui/colorchart.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/colorchart.cpp (original)
+++ trunk/Scribus/scribus/ui/colorchart.cpp Wed Jan 13 02:32:20 2021
@@ -78,27 +78,27 @@
p.setClipRect(e->rect());
QImage tmp = QImage(width(), height(), QImage::Format_ARGB32_Premultiplied);
p2.begin(&tmp);
- p2.drawPixmap(0, 0, pmx);
- if (doDrawMark)
+ p2.drawPixmap(0, 0, m_pixmap);
+ if (m_drawMark)
{
p2.setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
- p2.drawLine(Xp - 5, Yp - 5, Xp - 1, Yp - 1);
- p2.drawLine(Xp - 5, Yp + 5, Xp - 1, Yp + 1);
- p2.drawLine(Xp + 2, Yp + 2, Xp + 6, Yp + 6);
- p2.drawLine(Xp + 2, Yp - 2, Xp + 6, Yp - 6);
+ p2.drawLine(m_markX - 5, m_markY - 5, m_markX - 1, m_markY - 1);
+ p2.drawLine(m_markX - 5, m_markY + 5, m_markX - 1, m_markY + 1);
+ p2.drawLine(m_markX + 2, m_markY + 2, m_markX + 6, m_markY + 6);
+ p2.drawLine(m_markX + 2, m_markY - 2, m_markX + 6, m_markY - 6);
}
p2.end();
p.drawImage(0, 0, tmp);
p.end();
- doDrawMark = false;
+ m_drawMark = false;
}
void ColorChart::drawMark(int x, int y)
{
- Xp = x;
- Yp = y;
- doDrawMark = true;
- repaint();
+ m_markX = x;
+ m_markY = y;
+ m_drawMark = true;
+ update();
}
void ColorChart::setMark(int h, int s)
@@ -149,7 +149,7 @@
++p;
}
}
- pmx = QPixmap::fromImage(image.scaled(xSize, ySize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
+ m_pixmap = QPixmap::fromImage(image.scaled(xSize, ySize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
}
else
{
@@ -165,7 +165,7 @@
++p;
}
}
- pmx = QPixmap::fromImage(ProofImage(&image, m_doc));
+ m_pixmap = QPixmap::fromImage(ProofImage(&image, m_doc));
}
- repaint();
+ update();
}
Modified: trunk/Scribus/scribus/ui/colorchart.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24402&path=/trunk/Scribus/scribus/ui/colorchart.h
==============================================================================
--- trunk/Scribus/scribus/ui/colorchart.h (original)
+++ trunk/Scribus/scribus/ui/colorchart.h Wed Jan 13 02:32:20 2021
@@ -56,14 +56,16 @@
void setMark(int h, int s);
void drawPalette(int val);
- int Xp {0};
- int Yp {0};
- bool doDrawMark {false};
int drawMode {0};
- QPixmap pmx;
protected:
ScribusDoc* m_doc;
+
+ int m_markX { 0 };
+ int m_markY { 0 };
+ bool m_drawMark {false};
+
+ QPixmap m_pixmap;
signals:
void ColorVal(int h, int s, bool ende);
More information about the scribus-commit
mailing list