void MultiLayer::mousePressEvent(QMouseEvent *e) { int margin = 5; QPoint pos = canvas->mapFromParent(e->pos()); // iterate backwards, so layers on top are preferred for selection QList<QWidget *>::iterator i = graphsList.end(); while (i != graphsList.begin()) { --i; QRect igeo = (*i)->frameGeometry(); igeo.addCoords(-margin, -margin, margin, margin); if (igeo.contains(pos)) { if (e->modifiers() & Qt::ShiftModifier) { if (d_layers_selector) d_layers_selector->add(*i); else { d_layers_selector = new SelectionMoveResizer(*i); connect(d_layers_selector, SIGNAL(targetsChanged()), this, SIGNAL(modifiedPlot())); } } else { setActiveGraph((Graph *)(*i)); active_graph->raise(); if (!d_layers_selector) { d_layers_selector = new SelectionMoveResizer(*i); connect(d_layers_selector, SIGNAL(targetsChanged()), this, SIGNAL(modifiedPlot())); } } return; } } if (d_layers_selector) delete d_layers_selector; }
void MultiLayer::wheelEvent(QWheelEvent *e) { QApplication::setOverrideCursor(Qt::waitCursor); bool resize = false; QPoint aux; QSize intSize; Graph *resize_graph = 0; // Get the position of the mouse int xMouse = e->x(); int yMouse = e->y(); for (int i = 0; i < (int)graphsList.count(); i++) { Graph *gr = (Graph *)graphsList.at(i); intSize = gr->plotWidget()->size(); aux = gr->pos(); if (xMouse > aux.x() && xMouse < (aux.x() + intSize.width())) { if (yMouse > aux.y() && yMouse < (aux.y() + intSize.height())) { resize_graph = gr; resize = TRUE; } } } if (resize && (e->state() == Qt::AltButton || e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)) { intSize = resize_graph->plotWidget()->size(); // If alt is pressed then change the width if (e->state() == Qt::AltButton) { if (e->delta() > 0) { intSize.rwidth() += 5; } else if (e->delta() < 0) { intSize.rwidth() -= 5; } } // If crt is pressed then changed the height else if (e->state() == Qt::ControlButton) { if (e->delta() > 0) { intSize.rheight() += 5; } else if (e->delta() < 0) { intSize.rheight() -= 5; } } // If shift is pressed then resize else if (e->state() == Qt::ShiftButton) { if (e->delta() > 0) { intSize.rwidth() += 5; intSize.rheight() += 5; } else if (e->delta() < 0) { intSize.rwidth() -= 5; intSize.rheight() -= 5; } } aux = resize_graph->pos(); resize_graph->setGeometry(QRect(QPoint(aux.x(), aux.y()), intSize)); resize_graph->plotWidget()->resize(intSize); emit modifiedPlot(); } QApplication::restoreOverrideCursor(); }
void MultiLayer::resizeLayers(const QSize &size, const QSize &oldSize, bool scaleFonts) { QApplication::setOverrideCursor(Qt::waitCursor); double w_ratio = (double)size.width() / (double)oldSize.width(); double h_ratio = (double)(size.height()) / (double)(oldSize.height()); for (int i = 0; i < graphsList.count(); i++) { Graph *gr = (Graph *)graphsList.at(i); if (gr && !gr->ignoresResizeEvents()) { int gx = qRound(gr->x() * w_ratio); int gy = qRound(gr->y() * h_ratio); int gw = qRound(gr->width() * w_ratio); int gh = qRound(gr->height() * h_ratio); gr->setGeometry(QRect(gx, gy, gw, gh)); gr->plotWidget()->resize(QSize(gw, gh)); if (scaleFonts) gr->scaleFonts(h_ratio); } } lastSize = size; emit modifiedPlot(); emit resizedWindow(this); QApplication::restoreOverrideCursor(); }
void MultiLayer::setFonts(const QFont &titleFnt, const QFont &scaleFnt, const QFont &numbersFnt, const QFont &legendFnt) { for (int i = 0; i < (int)graphsList.count(); i++) { Graph *gr = (Graph *)graphsList.at(i); QwtPlot *plot = gr->plotWidget(); QwtText text = plot->title(); text.setFont(titleFnt); plot->setTitle(text); for (int j = 0; j < QwtPlot::axisCnt; j++) { plot->setAxisFont(j, numbersFnt); text = plot->axisTitle(j); text.setFont(scaleFnt); plot->setAxisTitle(j, text); } QVector<int> keys = gr->textMarkerKeys(); for (int k = 0; k < (int)keys.size(); k++) { Legend *mrk = (Legend *)gr->textMarker(keys[k]); if (mrk) mrk->setFont(legendFnt); } plot->replot(); } emit modifiedPlot(); }
void MultiLayer::setGraphGeometry(int x, int y, int w, int h) { if (active_graph->pos() == QPoint(x, y) && active_graph->size() == QSize(w, h)) return; active_graph->setGeometry(QRect(QPoint(x, y), QSize(w, h))); active_graph->plotWidget()->resize(QSize(w, h)); emit modifiedPlot(); }
void MultiLayer::removeLayer() { if (!active_graph) { QMessageBox::warning( this, tr("Remove Layer error"), tr("There are no layers to be removed!")); return; } // remove corresponding button LayerButton *btn = 0; int i; for (i = 0; i < buttonsList.count(); i++) { btn = (LayerButton *)buttonsList.at(i); if (btn->isOn()) { buttonsList.removeAll(btn); btn->close(true); break; } } // update the texts of the buttons for (i = 0; i < buttonsList.count(); i++) { btn = (LayerButton *)buttonsList.at(i); btn->setText(QString::number(i + 1)); } if (active_graph->zoomOn() || active_graph->activeTool()) emit setPointerCursor(); int index = graphsList.indexOf(active_graph); graphsList.removeAt(index); active_graph->close(); graphs--; if (index >= graphsList.count()) index--; if (graphs == 0) { active_graph = 0; return; } active_graph = (Graph *)graphsList.at(index); for (i = 0; i < (int)graphsList.count(); i++) { Graph *gr = (Graph *)graphsList.at(i); if (gr == active_graph) { LayerButton *button = (LayerButton *)buttonsList.at(i); button->setOn(TRUE); break; } } emit modifiedPlot(); }
void MultiLayer::setGraphGeometry(int x, int y, int w, int h) { if (active_graph->pos() == QPoint (x,y) && active_graph->size() == QSize (w,h)) return; active_graph->setGeometry(QRect(QPoint(x,y),QSize(w,h))); active_graph->plotWidget()->resize(QSize(w, h)); if (hasOverlapingLayers()) updateTransparency(); emit modifiedPlot(); }
void MultiLayer::moveGraph(Graph* g, const QPoint& pos) { setCursor(Qt::PointingHandCursor); QPoint aux; int w=canvas->width(); int h=canvas->height(); if (!movedGraph) { movedGraph=TRUE; QPixmap pix=pix.grabWidget(canvas,0,0,-1,-1 ); QPixmapCache::insert ("QTIPLOT_multilayer",pix); for (int i=0;i<(int)graphsList->count();i++) { Graph *gr=(Graph *)graphsList->at(i); gr->hide(); } xMouse=pos.x(); yMouse=pos.y(); aux=g->pos(); xActiveGraph=aux.x(); yActiveGraph=aux.y(); } QPixmap pix(w,h,-1); pix.fill( QColor(white)); QPixmapCache::find ("QTIPLOT_multilayer",pix); QPainter painter(&pix); painter.setRasterOp(Qt::NotROP); xActiveGraph+=pos.x()-xMouse; yActiveGraph+=pos.y()-yMouse; painter.drawRect(QRect(QPoint(xActiveGraph,yActiveGraph),g->size())); painter.end(); bitBlt( canvas, 0, 0,&pix, 0, 0, -1, -1 ); xMouse=pos.x(); yMouse=pos.y(); emit modifiedPlot(); }
void MultiLayer::arrangeLayers(int c, int r, int colsGap, int rowsGap) { QApplication::setOverrideCursor(waitCursor); int i; cols=c; rows=r; colsSpace=colsGap; rowsSpace=rowsGap; int iterations = 0; QSize maxSize = calculateMaxCanvasSize(c, r); QSize canvas_size = QSize(1,1); while (canvas_size != maxSize && iterations < 10) { iterations++; canvas_size = maxSize; maxSize = calculateMaxCanvasSize(c, r); } bool arrangeFailed = false; for (i=0; i<graphs; i++) { Graph *gr=(Graph *)graphsList->at(i); QwtPlotLayout *pl = gr->plotWidget()->plotLayout(); QSize size = pl->canvasRect().size(); if (size.width() < 10 || size.height() < 10) { arrangeFailed = true; break; } } updateTransparency(); emit modifiedPlot(); QApplication::restoreOverrideCursor(); if (arrangeFailed) { QMessageBox::warning(this,tr("QtiPlot - Error: arranging layers failed!"), tr("There is not enaugh space available in this window." "<p>You could try to maximize it first and to rearrange the layers using the automatic option!</p>")); } }
void MultiLayer::setLayersNumber(int n) { if (graphs == n) return; int dn = graphs - n; if (dn > 0) { for (int i = 0; i < dn; i++) { // remove layer buttons LayerButton *btn = (LayerButton *)buttonsList.last(); if (btn) { btn->close(); buttonsList.removeLast(); } Graph *g = (Graph *)graphsList.last(); if (g) { // remove layers if (g->zoomOn() || g->activeTool()) setPointerCursor(); g->close(); graphsList.removeLast(); } } graphs = n; if (!graphs) { active_graph = 0; return; } // check whether the active Graph.has been deleted if (graphsList.indexOf(active_graph) == -1) active_graph = (Graph *)graphsList.last(); for (int j = 0; j < (int)graphsList.count(); j++) { Graph *gr = (Graph *)graphsList.at(j); if (gr == active_graph) { LayerButton *button = (LayerButton *)buttonsList.at(j); button->setOn(TRUE); break; } } } else { for (int i = 0; i < abs(dn); i++) addLayer(); } emit modifiedPlot(); }
void MultiLayer::arrangeLayers(bool fit, bool userSize) { if (!graphs) return; QApplication::setOverrideCursor(Qt::waitCursor); if (d_layers_selector) delete d_layers_selector; if (fit) findBestLayout(rows, cols); // the canvas sizes of all layers become equal only after several // resize iterations, due to the way Qwt handles the plot layout int iterations = 0; QSize size = arrangeLayers(userSize); QSize canvas_size = QSize(1, 1); while (canvas_size != size && iterations < 10) { iterations++; canvas_size = size; size = arrangeLayers(userSize); } if (userSize) { // resize window bool ignoreResize = active_graph->ignoresResizeEvents(); for (int i = 0; i < (int)graphsList.count(); i++) { Graph *gr = (Graph *)graphsList.at(i); gr->setIgnoreResizeEvents(true); } this->showNormal(); QSize size = canvas->childrenRect().size(); this->resize(QSize(size.width() + right_margin, size.height() + bottom_margin + LayerButton::btnSize())); for (int i = 0; i < (int)graphsList.count(); i++) { Graph *gr = (Graph *)graphsList.at(i); gr->setIgnoreResizeEvents(ignoreResize); } } emit modifiedPlot(); QApplication::restoreOverrideCursor(); }
void MultiLayer::addTextLayer(const QPoint& pos) { Graph* g=addLayer(); g->setTitle(""); QMemArray<bool> axesOn(4); for (int j=0;j<4;j++) axesOn[j]=FALSE; g->enableAxes(axesOn); g->plotWidget()->setLineWidth(1); g->setIgnoreResizeEvents(true); QSize size=g->newLegend(tr("enter your text here")); setGraphGeometry(pos.x(), pos.y(), size.width()+10, size.height()+10); g->setIgnoreResizeEvents(false); g->show(); connectLayer(g); QApplication::restoreOverrideCursor(); canvas->releaseMouse(); addTextOn=FALSE; emit drawTextOff(); emit modifiedPlot(); }
Graph* MultiLayer::addLayerToOrigin() { addLayerButton(); Graph* g = new Graph(canvas,0,0); g->removeLegend(); int w = canvas->width(); int h = canvas->height(); g->setGeometry(QRect(0, 0, w, h)); g->plotWidget()->resize(QSize(w,h)); graphsList->append(g); connectLayer(g); active_graph=g; makeTransparentLayer(g); g->show(); emit modifiedPlot(); return g; }
void MultiLayer::addTextLayer(const QPoint &pos) { Graph *g = addLayer(); g->removeLegend(); g->setTitle(""); QVector<bool> axesOn(4); for (int j = 0; j < 4; j++) axesOn[j] = false; g->enableAxes(axesOn); g->setIgnoreResizeEvents(true); g->setTextMarkerDefaults(defaultTextMarkerFrame, defaultTextMarkerFont, defaultTextMarkerColor, defaultTextMarkerBackground); Legend *mrk = g->newLegend(tr("enter your text here")); QSize size = mrk->rect().size(); setGraphGeometry(pos.x(), pos.y(), size.width() + 10, size.height() + 10); g->setIgnoreResizeEvents(false); g->show(); QApplication::restoreOverrideCursor(); canvas->releaseMouse(); addTextOn = false; emit drawTextOff(); emit modifiedPlot(); }
void MultiLayer::connectLayer(Graph *g) { connect (g,SIGNAL(drawTextOff()),this,SIGNAL(drawTextOff())); connect (g,SIGNAL(showPlotDialog(long)),this,SIGNAL(showPlotDialog(long))); connect (g,SIGNAL(createTable(const QString&,int,int,const QString&)),this,SIGNAL(createTable(const QString&,int,int,const QString&))); connect (g,SIGNAL(viewLineDialog()),this,SIGNAL(showLineDialog())); connect (g,SIGNAL(showContextMenu()),this,SIGNAL(showGraphContextMenu())); connect (g,SIGNAL(showAxisDialog(int)),this,SIGNAL(showAxisDialog(int))); connect (g,SIGNAL(axisDblClicked(int)),this,SIGNAL(showScaleDialog(int))); connect (g,SIGNAL(xAxisTitleDblClicked()),this,SIGNAL(showXAxisTitleDialog())); connect (g,SIGNAL(yAxisTitleDblClicked()),this,SIGNAL(showYAxisTitleDialog())); connect (g,SIGNAL(rightAxisTitleDblClicked()),this,SIGNAL(showRightAxisTitleDialog())); connect (g,SIGNAL(topAxisTitleDblClicked()),this,SIGNAL(showTopAxisTitleDialog())); connect (g,SIGNAL(showMarkerPopupMenu()),this,SIGNAL(showMarkerPopupMenu())); connect (g,SIGNAL(cursorInfo(const QString&)),this,SIGNAL(cursorInfo(const QString&))); connect (g,SIGNAL(viewImageDialog()),this,SIGNAL(showImageDialog())); connect (g,SIGNAL(createTablePlot(const QString&,int,int,const QString&)),this,SIGNAL(createTablePlot(const QString&,int,int,const QString&))); connect (g,SIGNAL(showPieDialog()),this,SIGNAL(showPieDialog())); connect (g,SIGNAL(viewTitleDialog()),this,SIGNAL(viewTitleDialog())); connect (g,SIGNAL(modifiedGraph()),this,SIGNAL(modifiedPlot())); connect (g,SIGNAL(selectedGraph(Graph*)),this, SLOT(setActiveGraph(Graph*))); connect (g,SIGNAL(viewTextDialog()),this,SIGNAL(showTextDialog())); connect (g,SIGNAL(updateTable(const QString&,int,const QString&)),this,SIGNAL(updateTable(const QString&,int,const QString&))); connect (g,SIGNAL(updateTableColumn(const QString&, double *, int)), this,SIGNAL(updateTableColumn(const QString&, double *, int))); connect (g,SIGNAL(clearCell(const QString&,double)),this,SIGNAL(clearCell(const QString&,double))); connect (g,SIGNAL(moveGraph(Graph*, const QPoint& )),this, SLOT(moveGraph(Graph*, const QPoint&))); connect (g,SIGNAL(releaseGraph(Graph*)),this, SLOT(releaseGraph(Graph*))); connect (g,SIGNAL(modifiedGraph(Graph*)), this, SLOT(updateLayerTransparency(Graph*))); connect (g,SIGNAL(createIntensityTable(const QPixmap&)), this,SIGNAL(createIntensityTable(const QPixmap&))); connect (g,SIGNAL(createHistogramTable(const QString&,int,int,const QString&)), this,SIGNAL(createHistogramTable(const QString&,int,int,const QString&))); //when resizing a layer by mouse-dragging connect (g,SIGNAL(resizeGraph(Graph*, const QPoint& )),this, SLOT(resizeGraph(Graph*, const QPoint&))); connect (g,SIGNAL(newSizeGraph(Graph*)),this, SLOT(newSizeGraph(Graph*))); }
bool MultiLayer::resizeLayers (const QResizeEvent *re) { QSize oldSize=re->oldSize(); QSize size=re->size(); if ( size == oldSize || maxSize().width() > oldSize.width() ) return false; QApplication::setOverrideCursor(waitCursor); double w_ratio=(double)size.width()/(double)oldSize.width(); double h_ratio=(double)(size.height())/(double)(oldSize.height()); for (int i=0;i<(int)graphsList->count();i++) { Graph *gr=(Graph *)graphsList->at(i); if (gr && gr->isVisible() && !gr->ignoresResizeEvents()) { int gx = qRound(gr->x()*w_ratio); int gy = qRound(gr->y()*h_ratio); int gw = qRound(gr->width()*w_ratio); int gh = qRound(gr->height()*h_ratio); gr->setGeometry(QRect(gx,gy,gw,gh)); gr->plotWidget()->resize(QSize(gw, gh)); gr->resizeMarkers(w_ratio, h_ratio); } } if (hasOverlapingLayers()) updateTransparency(); emit modifiedPlot(); emit resizedPlot(this); QApplication::restoreOverrideCursor(); return TRUE; }
void MultiLayer::connectLayer(Graph *g) { connect(g, SIGNAL(drawLineEnded(bool)), this, SIGNAL(drawLineEnded(bool))); connect(g, SIGNAL(drawTextOff()), this, SIGNAL(drawTextOff())); connect(g, SIGNAL(showPlotDialog(int)), this, SIGNAL(showPlotDialog(int))); connect( g, SIGNAL(createTable(const QString &, const QString &, QList<Column *>)), this, SIGNAL(createTable(const QString &, const QString &, QList<Column *>))); connect(g, SIGNAL(viewLineDialog()), this, SIGNAL(showLineDialog())); connect(g, SIGNAL(showContextMenu()), this, SIGNAL(showGraphContextMenu())); connect(g, SIGNAL(showLayerButtonContextMenu()), this, SIGNAL(showLayerButtonContextMenu())); connect(g, SIGNAL(showAxisDialog(int)), this, SIGNAL(showAxisDialog(int))); connect(g, SIGNAL(axisDblClicked(int)), this, SIGNAL(showScaleDialog(int))); connect(g, SIGNAL(xAxisTitleDblClicked()), this, SIGNAL(showXAxisTitleDialog())); connect(g, SIGNAL(yAxisTitleDblClicked()), this, SIGNAL(showYAxisTitleDialog())); connect(g, SIGNAL(rightAxisTitleDblClicked()), this, SIGNAL(showRightAxisTitleDialog())); connect(g, SIGNAL(topAxisTitleDblClicked()), this, SIGNAL(showTopAxisTitleDialog())); connect(g, SIGNAL(showMarkerPopupMenu()), this, SIGNAL(showMarkerPopupMenu())); connect(g, SIGNAL(showCurveContextMenu(int)), this, SIGNAL(showCurveContextMenu(int))); connect(g, SIGNAL(cursorInfo(const QString &)), this, SIGNAL(cursorInfo(const QString &))); connect(g, SIGNAL(viewImageDialog()), this, SIGNAL(showImageDialog())); connect(g, SIGNAL(viewTitleDialog()), this, SIGNAL(viewTitleDialog())); connect(g, SIGNAL(modifiedGraph()), this, SIGNAL(modifiedPlot())); connect(g, SIGNAL(selectedGraph(Graph *)), this, SLOT(setActiveGraph(Graph *))); connect(g, SIGNAL(viewTextDialog()), this, SIGNAL(showTextDialog())); connect(g, SIGNAL(createIntensityTable(const QString &)), this, SIGNAL(createIntensityTable(const QString &))); }
void MultiLayer::removeLayer() { //remove corresponding button LayerButton *btn=0; int i; for (i=0;i<(int)buttonsList->count();i++) { btn=(LayerButton*)buttonsList->at(i); if (btn->isOn()) { buttonsList->take(buttonsList->find(btn)); btn->close(TRUE); break; } } //update the texts of the buttons for (i=0;i<(int)buttonsList->count();i++) { btn=(LayerButton*)buttonsList->at(i); btn->setText(QString::number(i+1)); } if (active_graph->selectorsEnabled() || active_graph->zoomOn() || active_graph->removePointActivated() || active_graph->movePointsActivated() || active_graph->enabledCursor()|| active_graph->pickerActivated()) { setPointerCursor(); } graphsList->take (graphsList->find(active_graph)); active_graph->close(); graphs--; if (graphs == 0) { active_graph = 0; return; } active_graph=(Graph*) graphsList->current(); for (i=0;i<(int)graphsList->count();i++) { Graph *gr=(Graph *)graphsList->at(i); if (gr == active_graph) { LayerButton *button=(LayerButton *)buttonsList->at(i); button->setOn(TRUE); break; } } if (graphs) hbox1->setMaximumWidth(graphs*((LayerButton *)buttonsList->at(0))->width()); if (hasOverlapingLayers()) updateTransparency(); emit modifiedPlot(); }
void MultiLayer::resizeGraph(Graph* g, const QPoint& pos) { yesResize=FALSE; QPoint aux; // Get the coordinates of the layout, within which draging the mouse will resize the plot // These coordinates actually define the size of the plot. // We have, however, a margin of 3 pixels. These are also named virtual borders xlb=1; ytb=5; if(!resizedGraph) { oldw=g->plotWidget()->size().width(); oldh=g->plotWidget()->size().height(); xrb=g->plotWidget()->canvas()->size().width()-3; ybb=g->plotWidget()->canvas()->size().height()-3; Save_oldh=oldh; Save_oldw=oldw; QPixmap pix(oldw+10,oldh+10,-1); pix=pix.grabWidget(canvas,0,0,-1,-1); QPixmapCache::insert ("QTIPLOT_multilayer",pix); QPainter painter(&pix); painter.setRasterOp(Qt::NotROP); painter.drawRect(QRect(QPoint(g->pos().x()-5,g->pos().y()-5),QSize(oldw+10,oldh+10))); painter.end(); bitBlt( canvas, 0, 0,&pix, 0, 0, -1, -1 ); } if(!resizedGraph) // This is the first time we press the shift button. We will start resizing only if //we are close to the virtual borders { if(abs(pos.x()-xlb)<2 || abs(pos.x()-xrb)<4) { this->setCursor(SizeHorCursor); yesResize=TRUE; } if(abs(pos.y()-ytb)<4 || abs(pos.y()-ybb)<4) { this->setCursor(SizeVerCursor); yesResize=TRUE; } if((abs(pos.y()-ytb)<2 && abs(pos.x()-xlb)<2) || (abs(pos.y()-ybb)<2 && abs(pos.x()-xrb)<2 )) { this->setCursor(SizeFDiagCursor); yesResize=TRUE; } if((abs(pos.y()-ytb)<2 && abs(pos.x()-xrb)<2) || (abs(pos.y()-ybb)<2 && abs(pos.x()-xlb)<2) ) { this->setCursor(SizeBDiagCursor); yesResize=TRUE; } } else // In the second time, we do not need to check how close we are to the virtual borders. We determine // how will resize the layout by the difference in the old and new position of the mouse { int deltax=pos.x()-xrMouse; int deltay=pos.y()-yrMouse; if(deltax!=0 && deltay==0) this->setCursor(SizeHorCursor); else if(deltax==0 && deltay!=0) this->setCursor(SizeVerCursor); else if( (deltax>0 && deltay>0) || (deltax<0 && deltay<0)) this->setCursor(SizeFDiagCursor); else if( (deltax<0 && deltay>0) || (deltax>0 && deltay<0)) this->setCursor(SizeBDiagCursor); } if(!resizedGraph) // First time { if(yesResize) { // Do we resize it from left or top? if(abs(pos.y()-ytb)<4 || abs(pos.x()-xlb)<4 || abs(pos.y()-ytb)<2 && abs(pos.x()-xlb)<2 || abs(pos.y()-ytb)<2 && abs(pos.x()-xrb)<2 || (abs(pos.y()-ybb)<2 && abs(pos.x()-xlb)<2) ) ChangeOrigin=TRUE; resizedGraph=TRUE; // Get the initial location of the mouse xrMouse=pos.x(); yrMouse=pos.y(); QPixmap pix(oldw,oldh,-1); pix=pix.grabWidget(canvas,0,0,-1,-1); QPixmapCache::insert ("QTIPLOT_multilayer",pix); for (int i=0;i<(int)graphsList->count();i++) { Graph *gr=(Graph *)graphsList->at(i); gr->hide(); } aux=g->pos(); xInt=aux.x(); yInt=aux.y(); } } else // What happens in later times { int deltax=pos.x()-xrMouse; int deltay=pos.y()-yrMouse; if(deltax!=0 &&deltay==0) { if(!ChangeOrigin) oldw+=deltax; else if(ChangeOrigin) { oldw-=deltax; xInt+=deltax; } oldh=Save_oldh; Save_oldw=oldw; } else if(deltax==0 && deltay!=0) { if(!ChangeOrigin) oldh+=deltay; else if(ChangeOrigin) { oldh-=deltay; yInt+=deltay; } oldw=Save_oldw; Save_oldh=oldh; } else if(deltax!=0 && deltay!=0) { if(!ChangeOrigin) { oldh+=deltay; oldw+=deltax; } else if(ChangeOrigin) { oldh-=deltay; oldw-=deltax; yInt+=deltay; xInt+=deltax; } Save_oldw=oldw; Save_oldh=oldh; } else if(deltax==0 && deltay==0) { oldw=Save_oldw; oldh=Save_oldh; } QPixmap pix(oldw,oldh,-1); pix.fill( QColor(white)); QPixmapCache::find ("QTIPLOT_multilayer",pix); QPainter painter(&pix); painter.setRasterOp(Qt::NotROP); painter.drawRect(QRect(QPoint(xInt,yInt),QSize(oldw,oldh))); painter.end(); bitBlt( canvas, 0, 0,&pix, 0, 0, -1, -1 ); xrMouse=pos.x(); yrMouse=pos.y(); emit modifiedPlot(); Save_oldw=oldw; Save_oldh=oldh; } }