3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 05/10/2010 Added this text. :-)
15 #include "qg_graphicview.h"
17 #include "rs_actiondefault.h"
18 #include "rs_actionzoomin.h"
19 #include "rs_actionzoompan.h"
20 #include "rs_actionzoomscroll.h"
21 #include "rs_actionmodifydelete.h"
22 #include "rs_actionselectsingle.h"
23 #include "rs_dialogfactory.h"
24 #include "graphicview.h"
25 #include "rs_preview.h"
28 #include "rs_system.h"
29 #include "rs_patternlist.h"
30 #include "cadtoolbar.h"
31 #include "paintintf.h"
32 #include "qg_dialogfactory.h"
34 #define QG_SCROLLMARGIN 400
39 QG_GraphicView::QG_GraphicView(QWidget * parent, const char */*name*/, Qt::WindowFlags f):
40 QWidget(parent, f), GraphicView()//, refCount(0)
42 RS_DEBUG->print("QG_GraphicView::QG_GraphicView(parent, name, flags)...");
43 CommonInitialization();
49 QG_GraphicView::QG_GraphicView(RS_Document * doc, QWidget * parent)
51 // QG_GraphicView(parent, "graphicview");
52 CommonInitialization();
54 RS_DEBUG->print("QG_GraphicView::QG_GraphicView(doc, parent)...");
56 RS_DEBUG->print(" Setting Container...");
61 RS_DEBUG->print(" container set.");
65 setBorders(10, 10, 10, 10);
68 setDefaultAction(new RS_ActionDefault(*doc, *this));
71 void QG_GraphicView::CommonInitialization(void)
73 setBackground(background);
80 RS_DEBUG->print("--> Setting up layout...");
81 layout = new QGridLayout(this);
82 layout->setColumnStretch(0, 1);
83 layout->setColumnStretch(1, 0);
84 layout->setColumnStretch(2, 0);
85 layout->setRowStretch(0, 1);
86 layout->setRowStretch(1, 0);
89 void QGridLayout::addMultiCellWidget ( QWidget * w, int fromRow, int toRow, int fromCol, int toCol, int alignment = 0 )
90 Adds the widget w to the cell grid, spanning multiple rows/columns. The cell will span from fromRow, fromCol to toRow, toCol.
92 Alignment is specified by alignment, which is a bitwise OR of Qt::AlignmentFlags values. The default alignment is 0, which means that the widget fills the entire cell.
94 A non-zero alignment indicates that the widget should not grow to fill the available space but should be sized according to sizeHint().
96 RS_DEBUG->print("--> Creating hScrollBar...");
97 hScrollBar = new QG_ScrollBar(Qt::Horizontal, this);
98 // hScrollBar->setLineStep(50);
99 hScrollBar->setSingleStep(50);
100 // layout->addMultiCellWidget(hScrollBar, 1, 1, 0, 0);
101 layout->addWidget(hScrollBar, 1, 0);
102 // layout->addRowSpacing(1, hScrollBar->sizeHint().height());
103 layout->addItem(new QSpacerItem(0, hScrollBar->sizeHint().height()), 1, 0);
105 RS_DEBUG->print("--> Creating vScrollBar...");
106 vScrollBar = new QG_ScrollBar(Qt::Vertical, this);
107 // vScrollBar->setLineStep(50);
108 vScrollBar->setSingleStep(50);
109 // layout->addMultiCellWidget(vScrollBar, 0, 0, 2, 2);
110 layout->addWidget(vScrollBar, 0, 2);
111 // layout->addColSpacing(2, vScrollBar->sizeHint().width());
112 layout->addItem(new QSpacerItem(vScrollBar->sizeHint().width(), 0), 0, 2);
114 connect(hScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotHScrolled(int)));
115 connect(vScrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotVScrolled(int)));
120 QPixmap cur1(":/res/cur_cad_bmp.xpm");
121 bmp = QPixmap(":/res/cur_cad_mask.xpm");
123 curCad = new QCursor(cur1, 15, 15);
125 QPixmap cur2(":/res/cur_glass_bmp.xpm");
126 bmp = QPixmap(":/res/cur_glass_mask.xpm");
128 curMagnifier = new QCursor(cur2, 12, 12);
130 QPixmap cur3(":/res/cur_del_bmp.xpm");
131 bmp = QPixmap(":/res/cur_del_mask.xpm");
133 curDel = new QCursor(cur3, 15, 15);
135 QPixmap cur4(":/res/cur_select_bmp.xpm");
136 bmp = QPixmap(":/res/cur_select_mask.xpm");
138 curSelect = new QCursor(cur4, 15, 15);
140 QPixmap cur5(":/res/cur_hand_bmp.xpm");
141 bmp = QPixmap(":/res/cur_hand_mask.xpm");
143 curHand = new QCursor(cur5, 15, 15);
145 // No individual cursors for the Mac
153 // Dummy widgets for scrollbar corners:
154 //layout->addWidget(new QWidget(this), 1, 1);
155 //QWidget* w = new QWidget(this);
156 //w->setEraseColor(QColor(255,0,0));
157 gridStatus = new QLabel("-", this);
158 gridStatus->setAlignment(Qt::AlignRight);
159 // layout->addMultiCellWidget(gridStatus, 1, 1, 1, 2);
160 layout->addWidget(gridStatus, 1, 1, 1, 2);
161 // layout->addColSpacing(1, 50);
162 layout->addItem(new QSpacerItem(50, 0), 0, 1);
164 setMouseTracking(true);
165 // flickering under win:
166 //setFocusPolicy(WheelFocus);
168 #warning "QG_GraphicView constructor is setting Qt::NoFocus!!!"
169 // A-HAH! THIS IS THE PROBLEM!!!
170 // setFocusPolicy(Qt::NoFocus);
172 // setFocusPolicy(Qt::StrongFocus);
178 QG_GraphicView::~QG_GraphicView()
193 * @return width of widget.
195 int QG_GraphicView::getWidth()
197 return width() - vScrollBar->sizeHint().width();
201 * @return height of widget.
203 int QG_GraphicView::getHeight()
205 return height() - hScrollBar->sizeHint().height();
209 * Changes the current background color of this view.
211 void QG_GraphicView::setBackground(const RS_Color & bg)
213 GraphicView::setBackground(bg);
215 // setBackgroundColor(bg);
217 palette.setColor(backgroundRole(), bg);
222 * Sets the mouse cursor to the given type.
224 void QG_GraphicView::setMouseCursor(RS2::CursorType c)
229 case RS2::ArrowCursor:
230 setCursor(Qt::ArrowCursor);
232 case RS2::UpArrowCursor:
233 setCursor(Qt::UpArrowCursor);
235 case RS2::CrossCursor:
236 setCursor(Qt::CrossCursor);
238 case RS2::WaitCursor:
239 setCursor(Qt::WaitCursor);
241 case RS2::IbeamCursor:
242 setCursor(Qt::IBeamCursor);
244 case RS2::SizeVerCursor:
245 setCursor(Qt::SizeVerCursor);
247 case RS2::SizeHorCursor:
248 setCursor(Qt::SizeHorCursor);
250 case RS2::SizeBDiagCursor:
251 setCursor(Qt::SizeBDiagCursor);
253 case RS2::SizeFDiagCursor:
254 setCursor(Qt::SizeFDiagCursor);
256 case RS2::SizeAllCursor:
257 setCursor(Qt::SizeAllCursor);
259 case RS2::BlankCursor:
260 setCursor(Qt::BlankCursor);
262 case RS2::SplitVCursor:
263 setCursor(Qt::SplitVCursor);
265 case RS2::SplitHCursor:
266 setCursor(Qt::SplitHCursor);
268 case RS2::PointingHandCursor:
269 setCursor(Qt::PointingHandCursor);
271 case RS2::ForbiddenCursor:
272 setCursor(Qt::ForbiddenCursor);
274 case RS2::WhatsThisCursor:
275 setCursor(Qt::WhatsThisCursor);
285 case RS2::SelectCursor:
286 setCursor(*curSelect);
288 case RS2::MagnifierCursor:
289 setCursor(*curMagnifier);
291 case RS2::MovingHandCursor:
295 // Reduced cursor selection for the Mac:
297 setCursor(Qt::CrossCursor);
300 setCursor(Qt::CrossCursor);
302 case RS2::SelectCursor:
303 setCursor(Qt::CrossCursor);
305 case RS2::MagnifierCursor:
306 setCursor(Qt::CrossCursor);
308 case RS2::MovingHandCursor:
309 setCursor(Qt::PointingHandCursor);
316 * Sets the text for the grid status widget in the left bottom corner.
318 void QG_GraphicView::updateGridStatusWidget(const QString & text)
320 gridStatus->setText(text);
324 * Redraws the widget.
326 void QG_GraphicView::redraw()
328 RS_DEBUG->print("QG_GraphicView::redraw begin 1");
330 if (simulationRunning)
333 //Also, this stuff is properly taken care of by the Qt toolkit--
334 //so we don't have to be concerned with shit like this as long
335 //as we use update() instead of repaint()
337 static bool running = false;
342 RS_DEBUG->print("QG_GraphicView::redraw begin 2");
345 This is the only place in the entire codebase that a proper update is
348 if (isUpdateEnabled())
352 RS_DEBUG->print("QG_GraphicView::redraw end 2");
356 RS_DEBUG->print("QG_GraphicView::redraw end 1");
359 void QG_GraphicView::resizeEvent(QResizeEvent * /*e*/)
361 RS_DEBUG->print("QG_GraphicView::resizeEvent begin");
362 adjustOffsetControls();
363 adjustZoomControls();
365 RS_DEBUG->print("QG_GraphicView::resizeEvent end");
368 // Next three methods from RS_LayerListListener Interface:
369 void QG_GraphicView::layerEdited(RS_Layer *)
374 void QG_GraphicView::layerRemoved(RS_Layer *)
379 void QG_GraphicView::layerToggled(RS_Layer *)
384 void QG_GraphicView::emulateMouseMoveEvent()
386 // QMouseEvent e(QEvent::MouseMove, QPoint(mx, my), Qt::NoButton, Qt::NoButton);
387 //mouseMoveEvent(&e);
390 void QG_GraphicView::mousePressEvent(QMouseEvent * e)
392 // pan zoom with middle mouse button
393 if (e->button() == Qt::MidButton /*|| (e->state()==Qt::LeftButton|Qt::AltButton)*/)
394 setCurrentAction(new RS_ActionZoomPan(*container, *this));
396 GraphicView::mousePressEvent(e);
397 QWidget::mousePressEvent(e);
400 void QG_GraphicView::mouseReleaseEvent(QMouseEvent * e)
402 RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent");
403 GraphicView::mouseReleaseEvent(e);
404 //QWidget::mouseReleaseEvent(e);
406 if (!e->isAccepted())
408 if (QG_DIALOGFACTORY && QG_DIALOGFACTORY->getCadToolBar())
410 RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent: fwd to cadtoolbar");
411 QG_DIALOGFACTORY->getCadToolBar()->mouseReleaseEvent(e);
415 RS_DEBUG->print("QG_GraphicView::mouseReleaseEvent: OK");
418 void QG_GraphicView::mouseMoveEvent(QMouseEvent * e)
420 //RS_DEBUG->print("QG_GraphicView::mouseMoveEvent begin");
421 //QMouseEvent rsm = QG_Qt2Rs::mouseEvent(e);
423 GraphicView::mouseMoveEvent(e);
424 QWidget::mouseMoveEvent(e);
426 //What kind of cacamamie crap is this???
428 // // make sure that we can still use hotkeys and the mouse wheel
429 // if (parent() != NULL)
430 // ((QWidget *)parent())->setFocus();
433 //RS_DEBUG->print("QG_GraphicView::mouseMoveEvent end");
437 * support for the wacom graphic tablet.
439 void QG_GraphicView::tabletEvent(QTabletEvent * e)
442 if (testAttribute(Qt::WA_UnderMouse))
446 case QTabletEvent::Eraser:
447 if (e->type() == QEvent::TabletRelease)
449 if (container != NULL)
451 RS_ActionSelectSingle * a = new RS_ActionSelectSingle(*container, *this);
454 // QMouseEvent ev(QEvent::MouseButtonRelease, e->pos(), Qt::LeftButton, Qt::LeftButton);
455 // mouseReleaseEvent(&ev);
458 if (container->countSelected() > 0)
459 setCurrentAction(new RS_ActionModifyDelete(*container, *this));
464 case QTabletEvent::Stylus:
465 case QTabletEvent::Puck:
466 if (e->type() == QEvent::TabletPress)
469 // QMouseEvent ev(QEvent::MouseButtonPress, e->pos(), Qt::LeftButton, Qt::LeftButton);
470 // mousePressEvent(&ev);
472 else if (e->type() == QEvent::TabletRelease)
475 // QMouseEvent ev(QEvent::MouseButtonRelease, e->pos(), Qt::LeftButton, Qt::LeftButton);
476 // mouseReleaseEvent(&ev);
478 else if (e->type() == QEvent::TabletMove)
481 // QMouseEvent ev(QEvent::MouseMove, e->pos(), Qt::NoButton, 0);
482 // mouseMoveEvent(&ev);
492 /*if (e->pressure()>10 && lastPressure<10) {
493 QMouseEvent e(QEvent::MouseButtonPress, e->pos(),
494 Qt::LeftButton, Qt::LeftButton);
497 else if (e->pressure()<10 && lastPressure>10) {
498 QMouseEvent e(QEvent::MouseButtonRelease, e->pos(),
499 Qt::LeftButton, Qt::LeftButton);
500 mouseReleaseEvent(&e);
501 } else if (lastPos!=e->pos()) {
502 QMouseEvent e(QEvent::MouseMove, e->pos(),
507 lastPressure = e->pressure();
512 void QG_GraphicView::leaveEvent(QEvent * e)
514 GraphicView::mouseLeaveEvent();
515 QWidget::leaveEvent(e);
518 void QG_GraphicView::enterEvent(QEvent * e)
520 GraphicView::mouseEnterEvent();
521 QWidget::enterEvent(e);
524 void QG_GraphicView::focusOutEvent(QFocusEvent * e)
526 QWidget::focusOutEvent(e);
529 void QG_GraphicView::focusInEvent(QFocusEvent * e)
531 //printf("-->QG_GraphicView::focusInEvent(): Start. this %s focus...\n", (hasFocus() ? "has" : "DOES NOT HAVE"));
532 GraphicView::mouseEnterEvent();
533 QWidget::focusInEvent(e);
534 //printf("-->QG_GraphicView::focusInEvent(): End. this %s focus...\n", (hasFocus() ? "has" : "DOES NOT HAVE"));
538 * mouse wheel event. zooms in/out or scrolls when
539 * shift or ctrl is pressed.
541 void QG_GraphicView::wheelEvent(QWheelEvent * e)
543 //RS_DEBUG->print("wheel: %d", e->delta());
545 //printf("state: %d\n", e->state());
546 //printf("ctrl: %d\n", Qt::ControlButton);
550 Qt::KeyboardModifiers keyState = QApplication::keyboardModifiers();
551 Vector mouse = toGraph(Vector(e->x(), e->y()));
554 RS2::Direction direction = RS2::Up;
557 // if (e->state() == Qt::ControlModifier)
558 if (keyState == Qt::ControlModifier)
565 direction = RS2::Down;
567 // scroll left / right:
568 // else if (e->state() == Qt::ShiftModifier)
569 else if (keyState == Qt::ShiftModifier)
574 direction = RS2::Right;
576 direction = RS2::Left;
580 setCurrentAction(new RS_ActionZoomScroll(direction, *container, *this));
582 // else if (e->state() == 0)
583 else if (keyState == 0)
586 setCurrentAction(new RS_ActionZoomIn(*container, *this, RS2::In, RS2::Both, mouse));
588 setCurrentAction(new RS_ActionZoomIn(*container, *this, RS2::Out, RS2::Both, mouse));
594 void QG_GraphicView::keyPressEvent(QKeyEvent * e)
600 RS2::Direction direction = RS2::Up;
606 direction = RS2::Right;
610 direction = RS2::Left;
618 direction = RS2::Down;
626 setCurrentAction(new RS_ActionZoomScroll(direction, *container, *this));
628 GraphicView::keyPressEvent(e);
631 void QG_GraphicView::keyReleaseEvent(QKeyEvent * e)
633 GraphicView::keyReleaseEvent(e);
637 * Called whenever the graphic view has changed.
638 * Adjusts the scrollbar ranges / steps.
640 void QG_GraphicView::adjustOffsetControls()
642 static bool running = false;
649 RS_DEBUG->print("QG_GraphicView::adjustOffsetControls() begin");
651 if (container == NULL || hScrollBar == NULL || vScrollBar == NULL)
655 int ox = getOffsetX();
656 int oy = getOffsetY();
658 Vector min = container->getMin();
659 Vector max = container->getMax();
661 // no drawing yet - still allow to scroll
662 if (max.x < min.x + 1.0e-6 || max.y < min.y + 1.0e-6
663 || max.x > RS_MAXDOUBLE || max.x < RS_MINDOUBLE
664 || min.x > RS_MAXDOUBLE || min.x < RS_MINDOUBLE
665 || max.y > RS_MAXDOUBLE || max.y < RS_MINDOUBLE
666 || min.y > RS_MAXDOUBLE || min.y < RS_MINDOUBLE)
668 min = Vector(-10, -10);
669 max = Vector(100, 100);
672 int minVal = (int)(min.x * getFactor().x - QG_SCROLLMARGIN - getBorderLeft());
673 int maxVal = (int)(max.x * getFactor().x - getWidth() + QG_SCROLLMARGIN + getBorderRight());
675 hScrollBar->setValue(0);
677 if (minVal <= maxVal)
678 hScrollBar->setRange(minVal, maxVal);
680 minVal = (int)(getHeight() - max.y * getFactor().y
681 - QG_SCROLLMARGIN - getBorderTop());
682 maxVal = (int)(QG_SCROLLMARGIN + getBorderBottom()
683 - (min.y * getFactor().y));
685 if (minVal <= maxVal)
686 vScrollBar->setRange(minVal, maxVal);
688 hScrollBar->setPageStep((int)(getWidth()));
689 vScrollBar->setPageStep((int)(getHeight()));
691 hScrollBar->setValue(-ox);
692 vScrollBar->setValue(oy);
697 RS_DEBUG->print("H min: %d / max: %d / step: %d / value: %d\n",
698 hScrollBar->minimum(), hScrollBar->maximum(), hScrollBar->pageStep(), ox);
699 RS_DEBUG->print("V min: %d / max: %d / step: %d / value: %d\n",
700 vScrollBar->minimum(), vScrollBar->maximum(), vScrollBar->pageStep(), oy);
704 RS_DEBUG->print("QG_GraphicView::adjustOffsetControls() end");
710 * override this to adjust controls and widgets that
711 * control the zoom factor of the graphic.
713 void QG_GraphicView::adjustZoomControls()
718 * Slot for horizontal scroll events.
720 void QG_GraphicView::slotHScrolled(int value)
722 // Scrollbar behaviour tends to change with every Qt version..
723 // so let's keep old code in here for now
725 //static int running = false;
728 ////RS_DEBUG->print("value x: %d\n", value);
729 if (hScrollBar->maximum() == hScrollBar->minimum())
734 //if (isUpdateEnabled()) {
744 * Slot for vertical scroll events.
746 void QG_GraphicView::slotVScrolled(int value)
748 // Scrollbar behaviour tends to change with every Qt version..
749 // so let's keep old code in here for now
751 //static int running = false;
754 ////RS_DEBUG->print("value y: %d\n", value);
755 if (vScrollBar->maximum() == vScrollBar->minimum())
760 //if (isUpdateEnabled()) {
770 * Handles paint events by redrawing the graphic in this view.
771 * usually that's very fast since we only paint the buffer we
772 * have from the last call..
774 * This is not true anymore--even if it was true in the first place, which
775 * seems doubtful to me. Everything is redrawn every time; we need to see if
776 * relying on Qt do to the clipping is wise or not... Also, we need to clarify
777 * all rendering paths since they are not all logical or consistent.
779 void QG_GraphicView::paintEvent(QPaintEvent *)
781 RS_DEBUG->print("QG_GraphicView::paintEvent begin");
783 if (simulationRunning)
787 To fix the broken rendering here, we need to do one of the following:
789 1) Put preview object here and fix draw code to do an update() instead
790 of trying to draw directly to a widget context
791 2) Use a QPixmap as a randomly drawable surface and fix createDirectPainter()
792 to do an update() after drawing to the pixmap which will eventually end
795 I think 1) is cleaner in the long run, and will make the codebase much more
796 maintainable. However, 2) would make it possible to fix things fairly easily
797 without having to rearrange classes too much.
799 The way the UI is written is crap. It tries to be clever by doing direct
800 painting, bypassing the toolkit's built in rendering pipeline. Also, there
801 are tons of references to Qt stuff in what is supposed to be a toolkit
802 independent manner, resulting in unnecessary divisions of code and rendundant
803 class definitions. Still, the core is still useful and worth fixing just to
804 have something back in portage. We can make it better, faster, stronger. ;-)
806 If we can make the UI more like Inkscape we'll be in good shape. Plus elements
807 of VectorWorks & etc. as well...
809 -------------------------------------------------------------------------------
814 - Draw the preview (if any)
815 - Draw the snapper (if any)
819 // Qt4 handles double buffering of screen writes now, so this needs
821 #warning "!!! Need to pass a valid QPainter to drawIt() !!!"
825 //#warning "!!! Double buffering is out... !!!"
826 // Seems most rendering is going through this path... Hrm.
830 wPainter.begin(this);
831 wPainter.drawPixmap(0, 0, *buffer);
838 //// RS_DEBUG->print(RS_Debug::D_CRITICAL, "paintEvent seems to be called recursively: refCount=%u", refCount);
839 // printf("paintEvent seems to be called recursively: refCount=%u\n", refCount);
843 pntr.setBackgroundMode(Qt::OpaqueMode);
844 // pntr.setBackgroundColor(background);
845 pntr.setBackground(QBrush(background));
847 painter = new PaintInterface(&pntr);
852 painter = new RS_PainterQt(this);
854 //Nope, this didn't fix the problem...
855 //The problem is, unless we specifically tell Qt NOT to
856 //clear the window every time, it will...
860 painter->setDrawingMode(drawingMode);
861 ((RS_PainterQt *)painter)->setBackgroundMode(Qt::OpaqueMode);
862 ((RS_PainterQt *)painter)->setBackgroundColor(background);
863 // ((RS_PainterQt *)painter)->eraseRect(0, 0, getWidth(), getHeight());
868 printf("QG_GraphicView::paintEvent: painter is NOT NULL!\n");
873 //Note that we do drawIt() regardless here because paintEvent() clears the background
874 //*unless* we create the window with a specific style. Depending on our draw code, we
875 //just may go that way...
877 //Need some logic here to do drawing in preview mode, since it'll be calling
878 //update now instead of trying to do a direct draw...
881 //hrm. painter->setCompositionMode(QPainter::CompositionMode_Xor);
882 //needed anymore? painter->setXORMode();
883 painter->setOffset(previewOffset);
884 drawEntity(previewEntity);//meh -> , 1.0, false);
885 painter->setOffset(Vector(0, 0));
886 // We'll set previewMode to false here, just because we can
896 if (snapCoord1.valid)
899 //This is causing segfaults in the Qt::Painter code...
900 //*This* is causing the segfault!
901 //Actually, it looks like buggy painting code in PaintInterface()...
902 painter->drawCircle(toGui(snapCoord1), 4);
906 if (showCrosshairs1 == true)
908 painter->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width00, RS2::DashLine));
909 painter->drawLine(Vector(0, toGuiY(snapCoord1.y)),
910 Vector(getWidth(), toGuiY(snapCoord1.y)));
911 painter->drawLine(Vector(toGuiX(snapCoord1.x), 0),
912 Vector(toGuiX(snapCoord1.x), getHeight()));
917 if (snapCoord1.valid && snapCoord1 != snapSpot1)
919 painter->drawLine(toGui(snapSpot1) + Vector(-5, 0), toGui(snapSpot1) + Vector(-1, 4));
920 painter->drawLine(toGui(snapSpot1) + Vector(0, 5), toGui(snapSpot1) + Vector(4, 1));
921 painter->drawLine(toGui(snapSpot1) + Vector(5, 0), toGui(snapSpot1) + Vector(1, -4));
922 painter->drawLine(toGui(snapSpot1) + Vector(0, -5), toGui(snapSpot1) + Vector(-4, -1));
933 RS_DEBUG->print("QG_GraphicView::paintEvent end");
938 * Previews the given url for the file open dialog.
940 void QG_GraphicView::previewUrl(const Q3Url & u)
942 //static Drawing* gr = new Drawing();
944 RS_DEBUG->print("QG_GraphicView::previewUrl");
946 if (container != NULL && container->rtti() == RS2::EntityGraphic)
948 ((Drawing *)container)->open(u.path(), RS2::FormatUnknown);
953 RS_DEBUG->print("QG_GraphicView::previewUrl: OK");