~ubuntu-branches/ubuntu/trusty/scribus-ng/trusty

« back to all changes in this revision

Viewing changes to scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-15 15:57:12 UTC
  • mfrom: (4.2.10 sid)
  • Revision ID: package-import@ubuntu.com-20120215155712-biimoc8o875jht80
Tags: 1.4.0.dfsg+r17300-1
* Prepare a dummy transitional package to converge on the 1.4.0 release.
* debian/NEWS: update the news.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
 
to the COPYING file provided with the program. Following this notice may exist
4
 
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
 
for which a new license (GPL+exception) is in place.
6
 
*/
7
 
/**************************************************************************
8
 
*   Copyright (C) 2008 by Franz Schmid                                    *
9
 
*   franz.schmid@altmuehlnet.de                                           *
10
 
*                                                                         *
11
 
*   This program is free software; you can redistribute it and/or modify  *
12
 
*   it under the terms of the GNU General Public License as published by  *
13
 
*   the Free Software Foundation; either version 2 of the License, or     *
14
 
*   (at your option) any later version.                                   *
15
 
*                                                                         *
16
 
*   This program is distributed in the hope that it will be useful,       *
17
 
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18
 
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
19
 
*   GNU General Public License for more details.                          *
20
 
*                                                                         *
21
 
*   You should have received a copy of the GNU General Public License     *
22
 
*   along with this program; if not, write to the                         *
23
 
*   Free Software Foundation, Inc.,                                       *
24
 
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
25
 
***************************************************************************/
26
 
 
27
 
#include "meshdistortiondialog.h"
28
 
 
29
 
#include <QPainterPath>
30
 
#include <QGraphicsItem>
31
 
 
32
 
#include "commonstrings.h"
33
 
#include "fpointarray.h"
34
 
#include "pageitem.h"
35
 
#include "sccolorengine.h"
36
 
#include "scpattern.h"
37
 
#include "selection.h"
38
 
#include "util_icon.h"
39
 
//#include "util_math.h"
40
 
 
41
 
NodeItem::NodeItem(QRectF geom, uint num, MeshDistortionDialog *parent) : QGraphicsEllipseItem(geom)
42
 
{
43
 
        dialog = parent;
44
 
        handle = num;
45
 
        setBrush(Qt::NoBrush);
46
 
        setPen(QPen(Qt::red, 2.0));
47
 
        setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
48
 
        setZValue(9999999);
49
 
        setAcceptsHoverEvents(true);
50
 
        mouseMoving = false;
51
 
        mousePressed = false;
52
 
}
53
 
 
54
 
void NodeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
55
 
{
56
 
        Q_UNUSED(widget);
57
 
        if (option->state & QStyle::State_Selected)
58
 
        {
59
 
                painter->setBrush(Qt::red);
60
 
                painter->setPen(QPen(Qt::red, qMax(0.1, 1.0 / option->levelOfDetail)));
61
 
        }
62
 
        else
63
 
        {
64
 
                painter->setBrush(Qt::NoBrush);
65
 
                painter->setPen(QPen(Qt::red, qMax(0.2, 2.0 / option->levelOfDetail)));
66
 
        }
67
 
        painter->drawEllipse(rect());
68
 
}
69
 
 
70
 
void NodeItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
71
 
{
72
 
        mousePressed = true;
73
 
        mouseMoving = false;
74
 
        QGraphicsItem::mousePressEvent(event);
75
 
}
76
 
 
77
 
void NodeItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
78
 
{
79
 
        mouseMoving = true;
80
 
        if ((mouseMoving) && (mousePressed))
81
 
                dialog->updateMesh(true);
82
 
        QGraphicsItem::mouseMoveEvent(event);
83
 
}
84
 
 
85
 
void NodeItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
86
 
{
87
 
        if ((mouseMoving) && (mousePressed))
88
 
                dialog->updateMesh(false);
89
 
        mouseMoving = false;
90
 
        mousePressed = false;
91
 
        QGraphicsItem::mouseReleaseEvent(event);
92
 
}
93
 
 
94
 
void NodeItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
95
 
{
96
 
        QPainterPath p;
97
 
        p.addEllipse(rect());
98
 
        if (isSelected())
99
 
                qApp->changeOverrideCursor(QCursor(Qt::SizeAllCursor));
100
 
        else
101
 
                qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
102
 
}
103
 
 
104
 
void NodeItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
105
 
{
106
 
        QPainterPath p;
107
 
        p.addEllipse(rect());
108
 
        if (isSelected())
109
 
                qApp->changeOverrideCursor(QCursor(Qt::SizeAllCursor));
110
 
        else
111
 
                qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
112
 
}
113
 
 
114
 
void NodeItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *)
115
 
{
116
 
        qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
117
 
}
118
 
 
119
 
MeshDistortionDialog::MeshDistortionDialog(QWidget* parent, ScribusDoc *doc) : QDialog(parent)
120
 
{
121
 
        setupUi(this);
122
 
        setModal(true);
123
 
        setWindowIcon(QIcon(loadIcon("AppIcon.png")));
124
 
        buttonZoomOut->setIcon(QIcon(loadIcon("16/zoom-out.png")));
125
 
        buttonZoomIn->setIcon(QIcon(loadIcon("16/zoom-in.png")));
126
 
        m_doc = doc;
127
 
        PageItem *currItem;
128
 
        double gx, gy, gh, gw;
129
 
        doc->m_Selection->setGroupRect();
130
 
        doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
131
 
        uint selectedItemCount = doc->m_Selection->count();
132
 
        w4 = qMax(gw, gh) / 2.0;
133
 
        w2 = qMax(gw, gh);
134
 
        ww = qMax(gw, gh) * 2.0;
135
 
        QStack<PageItem*> groupStack;
136
 
        QStack<QGraphicsPathItem*> groupStack2;
137
 
        QStack<PageItem*> groupStack3;
138
 
        groupStack2.push(0);
139
 
        for (uint i = 0; i < selectedItemCount; ++i)
140
 
        {
141
 
                currItem = doc->m_Selection->itemAt(i);
142
 
                FPointArray path = currItem->PoLine;
143
 
                deltaX = ((w2 - gw) / 2.0) + w4;
144
 
                deltaY = ((w2 - gh) / 2.0) + w4;
145
 
                QPainterPath pp;
146
 
                if (currItem->itemType() == PageItem::PolyLine)
147
 
                        pp = path.toQPainterPath(false);
148
 
                else
149
 
                        pp = path.toQPainterPath(true);
150
 
                QGraphicsPathItem* pItem = new QGraphicsPathItem(pp, groupStack2.top());
151
 
                if (groupStack2.top() == 0)
152
 
                {
153
 
                        scene.addItem(pItem);
154
 
                        pItem->setPos(currItem->xPos() - gx + deltaX, currItem->yPos() - gy + deltaY);
155
 
                        pItem->rotate(currItem->rotation());
156
 
                }
157
 
                else
158
 
                {
159
 
                        PageItem* parent = groupStack3.top();
160
 
                        QMatrix mm;
161
 
                        mm.rotate(-parent->rotation());
162
 
                        mm.translate(-parent->xPos(), -parent->yPos());
163
 
                        pItem->setPos(mm.map(QPointF(currItem->xPos(), currItem->yPos())));
164
 
                }
165
 
                QPainterPath pathO = pp;
166
 
                QMatrix mmO;
167
 
                mmO.translate(-w4, -w4);
168
 
                pathO = pItem->mapToScene(pathO);
169
 
                pathO = mmO.map(pathO);
170
 
                Geom::Piecewise<D2<Geom::SBasis> >  path_a_pw;
171
 
                if (currItem->itemType() == PageItem::PolyLine)
172
 
                        path_a_pw = QPainterPath2Piecewise(pathO, false);
173
 
                else
174
 
                        path_a_pw = QPainterPath2Piecewise(pathO, true);
175
 
                origPath.append(path_a_pw);
176
 
                pItem->setZValue(i);
177
 
                origPathItem.append(pItem);
178
 
                if (((currItem->fillColor() == CommonStrings::None) && (currItem->GrType == 0)) || (currItem->controlsGroup()))
179
 
                        pItem->setBrush(Qt::NoBrush);
180
 
                else
181
 
                {
182
 
                        if (currItem->GrType != 0)
183
 
                        {
184
 
                                if (currItem->GrType != 8)
185
 
                                {
186
 
                                        QGradient pat;
187
 
                                        double x1 = currItem->GrStartX;
188
 
                                        double y1 = currItem->GrStartY;
189
 
                                        double x2 = currItem->GrEndX;
190
 
                                        double y2 = currItem->GrEndY;
191
 
                                        switch (currItem->GrType)
192
 
                                        {
193
 
                                                case 1:
194
 
                                                case 2:
195
 
                                                case 3:
196
 
                                                case 4:
197
 
                                                case 6:
198
 
                                                        pat = QLinearGradient(x1, y1,  x2, y2);
199
 
                                                        break;
200
 
                                                case 5:
201
 
                                                case 7:
202
 
                                                        pat = QRadialGradient(x1, y1, sqrt(pow(x2 - x1, 2) + pow(y2 - y1,2)), x1, y1);
203
 
                                                        break;
204
 
                                        }
205
 
                                        QList<VColorStop*> colorStops = currItem->fill_gradient.colorStops();
206
 
                                        QColor qStopColor;
207
 
                                        for( int offset = 0 ; offset < colorStops.count() ; offset++ )
208
 
                                        {
209
 
                                                qStopColor = colorStops[ offset ]->color;
210
 
                                                int h, s, v, sneu, vneu;
211
 
                                                int shad = colorStops[offset]->shade;
212
 
                                                qStopColor.getHsv(&h, &s, &v);
213
 
                                                sneu = s * shad / 100;
214
 
                                                vneu = 255 - ((255 - v) * shad / 100);
215
 
                                                qStopColor.setHsv(h, sneu, vneu);
216
 
                                                qStopColor.setAlphaF(colorStops[offset]->opacity);
217
 
                                                pat.setColorAt(colorStops[ offset ]->rampPoint, qStopColor);
218
 
                                        }
219
 
                                        pItem->setBrush(pat);
220
 
                                }
221
 
                                else if ((currItem->GrType == 8) && (!currItem->pattern().isEmpty()) && (doc->docPatterns.contains(currItem->pattern())))
222
 
                                {
223
 
                                        double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation;
224
 
                                        currItem->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation);
225
 
                                        QMatrix qmatrix;
226
 
                                        qmatrix.translate(patternOffsetX, patternOffsetY);
227
 
                                        qmatrix.rotate(patternRotation);
228
 
                                        qmatrix.scale(patternScaleX / 100.0, patternScaleY / 100.0);
229
 
                                        QImage pat = *doc->docPatterns[currItem->pattern()].getPattern();
230
 
                                        QBrush brush = QBrush(pat);
231
 
                                        brush.setMatrix(qmatrix);
232
 
                                        pItem->setBrush(brush);
233
 
                                }
234
 
                        }
235
 
                        else
236
 
                        {
237
 
                                QColor paint = ScColorEngine::getShadeColorProof(doc->PageColors[currItem->fillColor()], doc, currItem->fillShade());
238
 
                                paint.setAlphaF(1.0 - currItem->fillTransparency());
239
 
                                pItem->setBrush(paint);
240
 
                        }
241
 
                }
242
 
                if ((currItem->lineColor() == CommonStrings::None) || (currItem->controlsGroup()))
243
 
                        pItem->setPen(Qt::NoPen);
244
 
                else
245
 
                {
246
 
                        QColor paint = ScColorEngine::getShadeColorProof(doc->PageColors[currItem->lineColor()], doc, currItem->lineShade());
247
 
                        paint.setAlphaF(1.0 - currItem->lineTransparency());
248
 
                        pItem->setPen(QPen(paint, currItem->lineWidth(), currItem->lineStyle(), currItem->lineEnd(), currItem->lineJoin()));
249
 
                }
250
 
                if (currItem->controlsGroup())
251
 
                {
252
 
                        groupStack.push(currItem->groupsLastItem);
253
 
                        groupStack2.push(pItem);
254
 
                        groupStack3.push(currItem);
255
 
                        pItem->setFlags(QGraphicsItem::ItemClipsChildrenToShape);
256
 
                }
257
 
                if (groupStack.count() != 0)
258
 
                {
259
 
                        while (currItem == groupStack.top())
260
 
                        {
261
 
                                groupStack3.pop();
262
 
                                groupStack2.pop();
263
 
                                groupStack.pop();
264
 
                                if (groupStack.count() == 0)
265
 
                                        break;
266
 
                        }
267
 
                }
268
 
        }
269
 
        for(unsigned dim = 0; dim < 2; dim++)
270
 
        {
271
 
                sb2[dim].us = 2;
272
 
                sb2[dim].vs = 2;
273
 
                const int depth = sb2[dim].us*sb2[dim].vs;
274
 
                sb2[dim].resize(depth, Linear2d(0));
275
 
        }
276
 
        handles.resize(sb2[0].vs*sb2[0].us*4);
277
 
        origHandles.resize(sb2[0].vs*sb2[0].us*4);
278
 
        unsigned ii = 0;
279
 
        for(unsigned vi = 0; vi < sb2[0].vs; vi++)
280
 
        {
281
 
                for(unsigned ui = 0; ui < sb2[0].us; ui++)
282
 
                {
283
 
                        for(unsigned iv = 0; iv < 2; iv++)
284
 
                        {
285
 
                                for(unsigned iu = 0; iu < 2; iu++)
286
 
                                {
287
 
                                        handles[ii++] = Geom::Point((2*(iu+ui)/(2.*ui+1)+1)*w4, (2*(iv+vi)/(2.*vi+1)+1)*w4);
288
 
                                }
289
 
                        }
290
 
                }
291
 
        }
292
 
        Geom::Point dir(1,-2);
293
 
        for(unsigned dim = 0; dim < 2; dim++)
294
 
        {
295
 
                Geom::Point dir(0,0);
296
 
                dir[dim] = 1;
297
 
                for(unsigned vi = 0; vi < sb2[dim].vs; vi++)
298
 
                {
299
 
                        for(unsigned ui = 0; ui < sb2[dim].us; ui++)
300
 
                        {
301
 
                                for(unsigned iv = 0; iv < 2; iv++)
302
 
                                {
303
 
                                        for(unsigned iu = 0; iu < 2; iu++)
304
 
                                        {
305
 
                                                unsigned corner = iu + 2*iv;
306
 
                                                unsigned i = ui + vi*sb2[dim].us;
307
 
                                                Geom::Point base((2*(iu+ui)/(2.*ui+1)+1)*w4, (2*(iv+vi)/(2.*vi+1)+1)*w4);
308
 
                                                if(vi == 0 && ui == 0)
309
 
                                                        base = Geom::Point(w4, w4);
310
 
                                                double dl = dot((handles[corner+4*i] - base), dir)/dot(dir,dir);
311
 
                                                sb2[dim][i][corner] = dl/(ww/2.0)*pow(4.0f,((int)(ui+vi)));
312
 
                                        }
313
 
                                }
314
 
                        }
315
 
                }
316
 
        }
317
 
        QPainterPath pathG;
318
 
        D2sb2d2QPainterPath(&pathG, sb2, 9, ww);
319
 
        pItemG = new QGraphicsPathItem(pathG);
320
 
        pItemG->setPen(QPen(Qt::black));
321
 
        pItemG->setBrush(Qt::NoBrush);
322
 
        pItemG->setZValue(8888888);
323
 
        scene.addItem(pItemG);
324
 
        for(unsigned i = 0; i < handles.size(); i++)
325
 
        {
326
 
                origHandles[i] = handles[i];
327
 
                double x = handles[i][Geom::X];
328
 
                double y = handles[i][Geom::Y];
329
 
                NodeItem* pItemN = new NodeItem(QRectF(x-4.0, y-4.0, 8.0, 8.0), i, this);
330
 
                scene.addItem(pItemN);
331
 
                nodeItems.append(pItemN);
332
 
        }
333
 
        previewLabel->setRenderHint(QPainter::Antialiasing);
334
 
        previewLabel->setScene(&scene);
335
 
        isFirst = true;
336
 
        connect(buttonZoomIn, SIGNAL(clicked()), this, SLOT(doZoomIn()));
337
 
        connect(buttonZoomOut, SIGNAL(clicked()), this, SLOT(doZoomOut()));
338
 
        connect(resetButton, SIGNAL(clicked()), this, SLOT(doReset()));
339
 
}
340
 
 
341
 
void MeshDistortionDialog::showEvent(QShowEvent *e)
342
 
{
343
 
        QDialog::showEvent(e);
344
 
        if (isFirst)
345
 
        {
346
 
                QRectF scR = scene.itemsBoundingRect().adjusted(-50, -50, 50, 50);
347
 
                previewLabel->fitInView(scR, Qt::KeepAspectRatio);
348
 
                scene.setSceneRect(scR);
349
 
                adjustHandles();
350
 
        }
351
 
        isFirst = false;
352
 
}
353
 
 
354
 
void MeshDistortionDialog::doZoomIn()
355
 
{
356
 
        previewLabel->scale(2.0, 2.0);
357
 
        adjustHandles();
358
 
}
359
 
 
360
 
void MeshDistortionDialog::doZoomOut()
361
 
{
362
 
        previewLabel->scale(0.5, 0.5);
363
 
        adjustHandles();
364
 
}
365
 
 
366
 
void MeshDistortionDialog::doReset()
367
 
{
368
 
        bool found = false;
369
 
        for(int n = 0; n < nodeItems.count(); n++)
370
 
        {
371
 
                if (nodeItems.at(n)->isSelected())
372
 
                {
373
 
                        found = true;
374
 
                        handles[nodeItems.at(n)->handle] = origHandles[nodeItems.at(n)->handle];
375
 
                }
376
 
        }
377
 
        if (!found)
378
 
        {
379
 
                for(unsigned i = 0; i < handles.size(); i++)
380
 
                {
381
 
                        handles[i] = origHandles[i];
382
 
                }
383
 
        }
384
 
        adjustHandles();
385
 
        updateMesh(false);
386
 
}
387
 
 
388
 
void MeshDistortionDialog::adjustHandles()
389
 
{
390
 
        double sc = previewLabel->matrix().m11();
391
 
        for(int n = 0; n < nodeItems.count(); n++)
392
 
        {
393
 
                double x = handles[n][Geom::X];
394
 
                double y = handles[n][Geom::Y];
395
 
                QPointF mm = nodeItems.at(n)->mapFromScene(QPointF(x - 4.0 / sc, y - 4.0 / sc));
396
 
                nodeItems.at(n)->setRect(QRectF(mm.x(), mm.y(), 8.0 / sc, 8.0 / sc));
397
 
        }
398
 
}
399
 
 
400
 
void MeshDistortionDialog::updateMesh(bool gridOnly)
401
 
{
402
 
        for(int n = 0; n < nodeItems.count(); n++)
403
 
        {
404
 
                QPointF mm = nodeItems.at(n)->mapToScene(nodeItems.at(n)->rect().center());
405
 
                Geom::Point mouse(mm.x(), mm.y());
406
 
                handles[n] = mouse;
407
 
        }
408
 
        Geom::Point dir(1,-2);
409
 
        for(unsigned dim = 0; dim < 2; dim++)
410
 
        {
411
 
                Geom::Point dir(0,0);
412
 
                dir[dim] = 1;
413
 
                for(unsigned vi = 0; vi < sb2[dim].vs; vi++)
414
 
                {
415
 
                        for(unsigned ui = 0; ui < sb2[dim].us; ui++)
416
 
                        {
417
 
                                for(unsigned iv = 0; iv < 2; iv++)
418
 
                                {
419
 
                                        for(unsigned iu = 0; iu < 2; iu++)
420
 
                                        {
421
 
                                                unsigned corner = iu + 2*iv;
422
 
                                                unsigned i = ui + vi*sb2[dim].us;
423
 
                                                Geom::Point base((2*(iu+ui)/(2.*ui+1)+1)*w4, (2*(iv+vi)/(2.*vi+1)+1)*w4);
424
 
                                                if(vi == 0 && ui == 0)
425
 
                                                        base = Geom::Point(w4, w4);
426
 
                                                double dl = dot((handles[corner+4*i] - base), dir)/dot(dir,dir);
427
 
                                                sb2[dim][i][corner] = dl/(ww/2.0)*pow(4.0f,((int)(ui+vi)));
428
 
                                        }
429
 
                                }
430
 
                        }
431
 
                }
432
 
        }
433
 
        if ((!gridOnly) || (origPathItem.count() < 20))
434
 
        {
435
 
                if (origPathItem.count() > 19)
436
 
                        qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
437
 
                for (int a = 0; a < origPathItem.count(); a++)
438
 
                {
439
 
                        QGraphicsPathItem* pItem = origPathItem[a];
440
 
                        Geom::Piecewise<D2<Geom::SBasis> >  path_a_pw = origPath[a];
441
 
                        Piecewise<D2<SBasis> > output;
442
 
                        for(unsigned i = 0; i < path_a_pw.size(); i++)
443
 
                        {
444
 
                                D2<SBasis> B = path_a_pw[i];
445
 
                                B *= (2./ww);
446
 
                                D2<SBasis> tB = compose_each(sb2, B);
447
 
                                B = B*(ww/2.0) + Geom::Point(w4, w4);
448
 
                                tB = tB*(ww/2.0) + Geom::Point(w4, w4);
449
 
                                output.concat(Piecewise<D2<SBasis> >(tB));
450
 
                        }
451
 
                        QPainterPath pathP;
452
 
                        Piecewise2QPainterPath(&pathP, output);
453
 
                        pathP = pItem->mapFromScene(pathP);
454
 
                        pItem->setPath(pathP);
455
 
                }
456
 
                if (origPathItem.count() > 19)
457
 
                        qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
458
 
        }
459
 
        QPainterPath pathG;
460
 
        D2sb2d2QPainterPath(&pathG, sb2, 9, ww);
461
 
        pItemG->setPath(pathG);
462
 
}
463
 
 
464
 
void MeshDistortionDialog::updateAndExit()
465
 
{
466
 
        qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
467
 
        for (int a = 0; a < origPathItem.count(); a++)
468
 
        {
469
 
                Geom::Piecewise<D2<Geom::SBasis> >  path_a_pw;
470
 
                QGraphicsPathItem* pItem = origPathItem[a];
471
 
                QPainterPath path = pItem->path();
472
 
                FPointArray outputPath;
473
 
                outputPath.fromQPainterPath(path);
474
 
                PageItem *currItem = m_doc->m_Selection->itemAt(a);
475
 
                currItem->PoLine = outputPath;
476
 
                currItem->Frame = false;
477
 
                currItem->ClipEdited = true;
478
 
                currItem->FrameType = 3;
479
 
                m_doc->AdjustItemSize(currItem);
480
 
                currItem->OldB2 = currItem->width();
481
 
                currItem->OldH2 = currItem->height();
482
 
                currItem->updateClip();
483
 
                currItem->ContourLine = currItem->PoLine.copy();
484
 
        }
485
 
        qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
486
 
}