[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Sat Sep 13 00:54:58 CEST 2003
CVS commit by staikos:
fix painting and add a small fudge factor to get the label to fall in the
"exact" right place without any offset
M +23 -23 kstlabel.cpp 1.16
M +2 -4 kstlabel.h 1.14
M +8 -4 kstview.cpp 1.34
--- kdeextragear-2/kst/kst/kstlabel.cpp #1.15:1.16
@@ -124,5 +124,5 @@ void KstLabel::draw(QPainter &p, int px,
QString processedText;
- GreekCharType GC[] = {{"\\Alpha", "A"}, {"\\alpha", "a"},
+ static const GreekCharType GC[] = {{"\\Alpha", "A"}, {"\\alpha", "a"},
{"\\Beta", "B"}, {"\\beta", "b"},
{"\\Chi", "C"}, {"\\chi", "c"},
@@ -460,3 +460,3 @@ QByteArray KstLabelDrag::encodedData(con
}
-
+// vim: ts=2 sw=2 et
--- kdeextragear-2/kst/kst/kstlabel.h #1.13:1.14
@@ -35,6 +35,5 @@ typedef enum {CxBy, CxTy, CxCy, LxBy, Lx
class KstLabel {
public:
- KstLabel(const QString &in_text,
- KstJustifyType in_j = CxBy,
+ KstLabel(const QString &in_text, KstJustifyType in_j = CxBy,
float in_rotation = 0.0, float in_X=0.0,
float in_Y=0.0, bool is_sample = false);
@@ -56,6 +55,5 @@ public:
/** draw the label with painter at px, py */
- void draw(QPainter &p, int px, int py,
- bool doDraw=true);
+ void draw(QPainter &p, int px, int py, bool doDraw=true);
void setSize(int size);
--- kdeextragear-2/kst/kst/kstview.cpp #1.33:1.34
@@ -366,8 +366,11 @@ void KstView::mouseMoveEvent(QMouseEvent
KstLabel *label = plot->labelList.at(i_label);
QRect oldExtents = label->extents;
- QPixmap pm(oldExtents.width(), oldExtents.height());
+ QPixmap pm(plot->GetWinRegion().width(), plot->GetWinRegion().height());
pm.fill();
+ { // Scope is needed to kill off the painter before we resize
QPainter p(&pm);
- label->draw(p, 0, 0, true);
+ label->draw(p, 2, oldExtents.height() + 2, true);
+ }
+ pm.resize(oldExtents.width() + 4, oldExtents.height() + 4);
label->extents = oldExtents; // restore them incase the drag is cancelled
QDragObject *d = new KstLabelDrag(this, plot_num, i_label, _draggablePoint - plot->GetWinRegion().topLeft() - oldExtents.topLeft(), pm);
@@ -691,5 +694,5 @@ void KstView::dropEvent(QDropEvent *e) {
}
- QPoint pos = e->pos() - plotPtr->GetPlotRegion().topLeft() - hs;
+ QPoint pos = e->pos() - plotPtr->GetPlotRegion().topLeft() - hs + QPoint(2 /* border offset */, 2 /* border offset */ + 8 /* fudge factor */);
QSize divisor = plotPtr->GetPlotRegion().size();
l->move(float(pos.x())/divisor.width(), float(pos.y())/divisor.height());
@@ -1174,2 +1177,3 @@ void KstView::forceUpdate() {
#include "kstview.moc"
+// vim: ts=2 sw=2 et
More information about the Kst
mailing list