Exemplo n.º 1
0
void WGraphFrame::paintEvent(QPaintEvent *e) {

  QPainter p;

  p.begin(this);
  drawFrame(&p);
  p.end();
  
  emit aboutToDraw();

  if (paintPixmap.size()!=contentsRect().size())
    paintPixmap.resize(contentsRect().size());
  
  if (p.begin(&paintPixmap,this)) {
    p.setRasterOp(XorROP);
    if (oldZoomRect.normalize().isValid()) {
      p.setPen(zoomRectPen);
      p.drawRect(oldZoomRect);
    }

    p.setRasterOp(CopyROP);

    parent->drawContent(p, e->erased() || needsRedraw);

    needsRedraw=false;
    drawGrid(p);

    p.setRasterOp(XorROP);
    if (zoomRect.normalize().isValid()) {
      p.setPen(zoomRectPen);
      p.drawRect(zoomRect);
    }
    oldZoomRect=zoomRect;

    p.end();

    bitBlt(this,contentsRect().topLeft(),&paintPixmap);
  }
}
Exemplo n.º 2
0
void AreaSelect::mouseReleaseEvent(QMouseEvent *e)
{
  int x,y;
  QPainter paint;
  QWMatrix m;

KDEBUG(KDEBUG_INFO, 3000, "AreaSelect::mouseReleaseEvent() handler called\n");

  if (isActive() && (e->button() == LeftButton)) {
    x= (e->pos()).x();
    y= (e->pos()).y();

    // Erase old line
    paint.begin(canvas->zoomedPixmap());
    paint.setPen(QPen(green, 0, DashLine));
    paint.setRasterOp(DEFAULT_RASTER_OP);
    paint.drawRect(startx, starty, lastx-startx, lasty-starty);

    paint.end();

    m.scale((float) 100/(canvas->zoom()), (float) 100/(canvas->zoom()));
    paint.begin(canvas->pixmap());
    //    paint.setPen(pen);
    paint.setWorldMatrix(m);
    paint.setRasterOp(CopyROP);
    canvas->setSelection(QRect(startx, starty, x-startx, y-starty));
    paint.end();
    drawing= FALSE;
    canvas->updateZoomed();
    canvas->repaint(0);

    startTimer(TIMER_INTERVALL);
    showedSF= false;
  }
  else {
KDEBUG(KDEBUG_WARN, 3000, "Warning event received when inactive (ignoring)\n");
  }
}
	void KviCanvasPolygon::draw(QPainter &p)
	{
		if(isEnabled())
		{
			p.setBrush(brush());
			p.setPen(pen());
			p.drawPolygon(areaPoints());
		}

		if(isSelected())
		{
			p.setRasterOp(NotROP);
			p.setPen(QPen(DotLine));
			p.drawPolygon(areaPoints());
			p.setBrush(QBrush());
			double dVal = 10;
			p.drawEllipse((int)(x() - dVal),(int)(y() - dVal),(int)(dVal * 2),(int)(dVal * 2));
			p.drawLine((int)(x() - (dVal * 2)),(int)y(),(int)(x() + (dVal * 2)),(int)y());
			p.drawLine((int)x(),(int)(y() - (dVal * 2)),(int)x(),(int)(y() + (dVal * 2)));
			p.setRasterOp(CopyROP);
			canvas()->setChanged(QRect((int)(x() - dVal),(int)(y() - dVal),(int)(dVal * 4),(int)(dVal * 4)));
		}
	}
Exemplo n.º 4
0
void KPixmapRegionSelectorWidget::updatePixmap()
{
   Q_ASSERT(!m_originalPixmap.isNull()); if(m_originalPixmap.isNull()) { m_label->setPixmap(m_originalPixmap); return; }
   if (m_selectedRegion.width()>m_originalPixmap.width()) m_selectedRegion.setWidth( m_originalPixmap.width() );
   if (m_selectedRegion.height()>m_originalPixmap.height()) m_selectedRegion.setHeight( m_originalPixmap.height() );

   QPainter painter;
   if (m_linedPixmap.isNull())
   {
     m_linedPixmap = m_originalPixmap;

     painter.begin(&m_linedPixmap);
     painter.setRasterOp( Qt::XorROP );
     painter.fillRect(0,0,m_linedPixmap.width(), m_linedPixmap.height(),
                  QBrush( QColor(255,255,255), Qt::BDiagPattern) );
     painter.end();

     QImage image=m_linedPixmap.convertToImage();
     image=KImageEffect::fade(image, 0.4, QColor(0,0,0));
     m_linedPixmap.convertFromImage(image);
   }

   QPixmap pixmap = m_linedPixmap;

   painter.begin(&pixmap);
   painter.drawPixmap( m_selectedRegion.topLeft(),
        m_originalPixmap, m_selectedRegion );

   painter.setPen( QColor(255,255,255) );
   painter.setRasterOp( Qt::XorROP );

   painter.drawRect( m_selectedRegion );

   painter.end();

   m_label->setPixmap(pixmap);
}
Exemplo n.º 5
0
void ClusterView::eraseTheLastDrawnLine(QColor polygonColor){
  //Paint in the buffer to allow the selection to be redrawn after a refresh
  QPainter painter;
  painter.begin(&doublebuffer);
  //set the window (part of the word I want to show)
  QRect r((QRect)window);
  painter.setWindow(r.left(),r.top(),r.width()-1,r.height()-1);//hack because Qt QRect is used differently in this function
  painter.setRasterOp(XorROP);
  painter.setPen(polygonColor);

  //The user did not move since the last left click (no mouseMoveEvent)
  if(nbSelectionPoints == selectionPolygon.size()){   
    //Treat the case when we reach the first point of the selection
    if(nbSelectionPoints == 1){
      //Resize selectionPolygon to remove the point from selectionPolygon
      selectionPolygon.resize(0);
      nbSelectionPoints = 0;
    }
    else{
      //Erase the last line drawn
      painter.drawPolyline(selectionPolygon,selectionPolygon.size()-2);
      //Resize selectionPolygon to remove the last point from selectionPolygon
      selectionPolygon.resize(selectionPolygon.size()-1);
      nbSelectionPoints = selectionPolygon.size();
    }
  }
  //The user moved since the last left click, a line has been drawn in the mouseMoveEvent
  else{
    //Treat the case when we reach the first point of the selection
    if(nbSelectionPoints == 1){
      //Erase the last line drawn (in mouseMoveEvent).
      painter.drawPolyline(selectionPolygon,selectionPolygon.size()-2);
    }
    else{
      //CAUTION, Do not remove this line otherwise strang dots will appear
      painter.drawPoint(selectionPolygon.point(selectionPolygon.size()-2));
      //Erase the last line drawn (in mouseMoveEvent) plus the line between the 2 last selected points
      //(selected by a left click of the user)
      painter.drawPolyline(selectionPolygon,selectionPolygon.size()-3);
    }
    //Resize selectionPolygon to remove the 2 last points
    //(the last selected and the one set in mouseMoveEvent) from selectionPolygon
    selectionPolygon.resize(selectionPolygon.size()-2);

    nbSelectionPoints = selectionPolygon.size();
  }
      
  painter.end();
}
/*!
  draw an outline

  \warning Outlining functionality is obsolete: use QwtPlotPicker or
  QwtPlotZoomer.
*/
void QwtPlotCanvas::drawOutline(QPainter &p)
{
    const QRect &r = contentsRect();

    QColor bg = ((QwtPlot *)parent())->canvasBackground();

    QPen pn = d_pen;
    pn.setColor(QColor(bg.rgb() ^ d_pen.color().rgb()));

    p.setPen(pn);
    p.setRasterOp(XorROP);
    p.setClipRect(r);
    p.setClipping(TRUE);

    switch(d_outline)
    {
        case Qwt::VLine:
            QwtPainter::drawLine(&p, d_lastPoint.x(), 
                r.top(), d_lastPoint.x(), r.bottom());
            break;
        
        case Qwt::HLine:
            QwtPainter::drawLine(&p, r.left(), 
                d_lastPoint.y(), r.right(), d_lastPoint.y());
            break;
        
        case Qwt::Cross:
            QwtPainter::drawLine(&p, r.left(), 
                d_lastPoint.y(), r.right(), d_lastPoint.y());
            QwtPainter::drawLine(&p, d_lastPoint.x(), 
                r.top(), d_lastPoint.x(), r.bottom());
            break;

        case Qwt::Rect:
            QwtPainter::drawRect(&p, d_entryPoint.x(), d_entryPoint.y(),
               d_lastPoint.x() - d_entryPoint.x() + 1,
               d_lastPoint.y() - d_entryPoint.y() + 1);
            break;
        
        case Qwt::Ellipse:
            p.drawEllipse(d_entryPoint.x(), d_entryPoint.y(),
               d_lastPoint.x() - d_entryPoint.x() + 1,
               d_lastPoint.y() - d_entryPoint.y() + 1);
            break;

        default:
            break;
    }
}
void KstGfxEllipseMouseHandler::pressMove(KstTopLevelViewPtr view, const QPoint& pos, bool shift, const QRect& geom) {
  if (_cancelled || !_mouseDown) {
    return;
  }

  QRect old = _prevBand;

  _prevBand = KstGfxMouseHandlerUtils::newRectCentered(pos, _mouseOrigin, geom, shift);

  if (old != _prevBand) {
    QPainter p;
    p.begin(view->widget());
    p.setPen(QPen(Qt::black, 0, Qt::SolidLine));
    p.setRasterOp(Qt::NotROP);
    if (old.topLeft() != QPoint(-1, -1)) {
      p.drawEllipse(old);
    }
    p.drawEllipse(_prevBand);
    p.end();
  }
}
Exemplo n.º 8
0
void ClusterView::resetSelectionPolygon(){

  if(selectionPolygon.size()>0){  
   //Erase the existing polygon
  
   //Select the appropriate color
   QColor color = selectPolygonColor(mode);

      //if the polygon was closed, erase the closing line
   if(polygonClosed){
     QPainter painter;
     painter.begin(&doublebuffer);
     //set the window (part of the word I want to show)
     QRect r((QRect)window);
     painter.setWindow(r.left(),r.top(),r.width()-1,r.height()-1);//hack because Qt QRect is used differently in this function

     painter.setRasterOp(XorROP);
     painter.setPen(color);
    
     //Erase the closing line
     painter.drawLine(selectionPolygon.point(0),selectionPolygon.point(selectionPolygon.size()-1));

     if(existLastMovingLine)painter.drawPoint(selectionPolygon.point(selectionPolygon.size()-1));
     //reset existLastMovingLine
     existLastMovingLine = false;
     
     painter.end();
     
     polygonClosed = false;
   }
   
   while(selectionPolygon.size()>0) eraseTheLastDrawnLine(color);

   //Reset the variables associates with the polygon

   //Resize selectionPolygon to remove all the last selected area, reinitialize nbSelectionPoints accordingly
   selectionPolygon.resize(0);
   nbSelectionPoints = 0;
  }
}
Exemplo n.º 9
0
void Line::mouseMoveEvent(QMouseEvent *e)
{
  int x,y;
  QPainter paint;

  if (isActive()) {
    x= (e->pos()).x();
    y= (e->pos()).y();

    if ((lastx != x) || (lasty != y)) {
      if (drawing) {
	paint.begin(canvas->zoomedPixmap());

	if (activeButton == LeftButton)
	  paint.setPen(leftpen);
	else
	  paint.setPen(rightpen);

	paint.setRasterOp(DEFAULT_RASTER_OP);

	// Draw new line
	paint.drawLine(startx, starty, x, y);
	// Erase old line
	paint.drawLine(startx, starty, lastx, lasty);

	lastx= x;
	lasty= y;

	paint.end();
	canvas->repaint(0);
      }
    }
  }
  else {
KDEBUG(KDEBUG_WARN, 3000, "Line: Warning event received when inactive (ignoring)\n");
  }
}
Exemplo n.º 10
0
void KstMouse::DrawBox(QPainter &p) {
  if (getMode() != LABEL_TOOL) {
    p.setRasterOp(Qt::NotROP);
    p.drawRect(getMouseRect());
  }
}
Exemplo n.º 11
0
void ClusterView::mouseMoveEvent(QMouseEvent* e){
  //Write the current coordinates in the statusbar.
  QPoint current = viewportToWorld(e->x(),e->y());

  if(dimensionX == timeDimension){
   int timeInS = static_cast<int>(current.x() * samplingInterval / static_cast<double>(1000000));
   statusBar->changeItem("Coordinates: (" + QString("%1").arg(timeInS) + ", " + QString("%1").arg(-current.y()) + ")",1);   
  }
  else if(dimensionY == timeDimension){
   int timeInS = static_cast<int>(current.y() * samplingInterval / static_cast<double>(1000000));
   statusBar->changeItem("Coordinates: (" + QString("%1").arg(current.x()) + ", " + QString("%1").arg(-timeInS) + ")",1);     
  }
  else  statusBar->changeItem("Coordinates: (" + QString("%1").arg(current.x()) + ", " + QString("%1").arg(-current.y()) + ")",1);


                          
  //The parent implementation takes care of the rubber band
  ViewWidget::mouseMoveEvent(e);

  //If the user is closing the polygon do not take mousemove event into account
  if(!polygonClosed){
    //In one of the selection modes we draw the tracking line
    if(mode == DELETE_NOISE || mode == DELETE_ARTEFACT || mode == NEW_CLUSTER || mode == NEW_CLUSTERS){
      
     //Select the appropriate color
     QColor color = selectPolygonColor(mode);

     //If there is no selection point, do not draw a tracking line
     if(selectionPolygon.size() == 0) return;

     //Paint in the buffer to allow the selection to be redrawn after a refresh
     QPainter painter;
     painter.begin(&doublebuffer);
     //set the window (part of the word I want to show)
     QRect r((QRect)window);
     painter.setWindow(r.left(),r.top(),r.width()-1,r.height()-1);//hack because Qt QRect is used differently in this function
     painter.setRasterOp(XorROP);
     painter.setPen(color);

     //First mouseMoveEvent after the last mousePressEvent
     if(nbSelectionPoints == selectionPolygon.size()){
       //Add the current point to the array
       selectionPolygon.putPoints(selectionPolygon.size(), 1, current.x(),current.y());
       painter.drawPolyline(selectionPolygon,selectionPolygon.size()-2);
     }
     else{
       //Erase the previous drawn line
       painter.drawPolyline(selectionPolygon,selectionPolygon.size()-2);
       //Replace the last point by the current one
       selectionPolygon.setPoint(selectionPolygon.size()-1,current);
       //Draw the new line
       painter.drawPolyline(selectionPolygon,selectionPolygon.size()-2);
     }
     painter.end();

     //Draw the new doublebuffer onto the widget
     QPainter p(this);
     p.drawPixmap(0, 0, doublebuffer);
    }
  }
}
Exemplo n.º 12
0
void ClusterView::mousePressEvent(QMouseEvent* e){ 
  //Defining a time window t oupdate the Traceview
  if(mode == SELECT_TIME){
   QPoint current = viewportToWorld(e->x(),e->y());
   if(dimensionX == timeDimension){
     dataType time = static_cast<dataType>(current.x() * samplingInterval / static_cast<double>(1000));
     emit moveToTime(time);
   }
   else if(dimensionY == timeDimension){
    dataType time = -static_cast<dataType>(current.y() * samplingInterval / static_cast<double>(1000));
    emit moveToTime(time);
   }
  }
   
  //The parent implementation takes care of the mode ZOOM
  //(rubber band and calculation of the firstClick)
  ViewWidget::mousePressEvent(e);

  //If there is a polygon to draw (one of the selection modes) 
  if(mode == DELETE_NOISE || mode == DELETE_ARTEFACT || mode == NEW_CLUSTER || mode == NEW_CLUSTERS){  
    //Select the appropriate color
    QColor color = selectPolygonColor(mode);

    //Erase the last line drawn
    if(e->button() == QMouseEvent::RightButton){
      if(selectionPolygon.size() == 0) return;

      //Erase the last drawn line by drawing into the buffer
      eraseTheLastDrawnLine(color);

      //Draw the new doublebuffer onto the widget
      QPainter p(this);
      p.drawPixmap(0, 0, doublebuffer);
    }

    //Close the polygon of selection and trigger the right action depending on the mode
    if(e->button() == QMouseEvent::MidButton && selectionPolygon.size()>0){      
      QRegion selectionArea;

      //Paint into the buffer to allow the selection to be redrawn after a refresh
      QPainter painter;
      painter.begin(&doublebuffer);
      //set the window (part of the word I want to show)
      QRect r((QRect)window);
      painter.setWindow(r.left(),r.top(),r.width()-1,r.height()-1);//hack because Qt QRect is used differently in this function
      painter.setPen(color);

      //If, once the last moving line erase, the polygon exists and has at least 3 points, draw it
      if(selectionPolygon.size()>2){
        //erase the last line drawn if the user moved since the last click
        eraseTheLastMovingLine(color);

        //Draw the closing line of the polygon
        painter.setRasterOp(XorROP);
        painter.drawLine(selectionPolygon.point(0),selectionPolygon.point(selectionPolygon.size()-1));

        polygonClosed = true;

        //Send an event to inform that the data have to be recompute accordingly to the selection polygon.
        //This asynchronous event will allow the widget to close the polygon
        //before asking the document to compute the data.
        ComputeEvent* event = getComputeEvent(selectionPolygon.copy());
        QApplication::postEvent(this,event);
       
      }
      //reset the polygon
      else resetSelectionPolygon();
       
      painter.end();
            
      //Draw the new doublebuffer onto the widget (show the closed polygon)
      QPainter p(this);
      p.drawPixmap(0, 0, doublebuffer);

      statusBar->clear();
    }
   
    if (e->button() == QMouseEvent::LeftButton){       
      QPoint selectedPoint = viewportToWorld(e->x(),e->y());
            
      if(nbSelectionPoints == 0) selectionPolygon.putPoints(0, 1, selectedPoint.x(),selectedPoint.y());
      //If the array is not empty, the last point has been put into the array in mouseMoveEvent
      nbSelectionPoints = selectionPolygon.size();
    }
  }      
}
Exemplo n.º 13
0
void WSpacePlot::drawContent(QPainter &p,bool) {

  QBrush brush;
  QColor color;
  int hue, selectHue, s, v;
  
  paintColor.getHsv(hue,s,v);
  colorGroup().highlight().getHsv(selectHue,s,v);
  
  QArray<SpaceCell>::Iterator it;
  QArray<SpaceCell>::Iterator end=cellData.end();

  if (drawGrid) {
    p.eraseRect(p.window());
    for (it=cellData.begin(); it!=end; ++it) {
      if (it->attr & selected) {
	p.fillRect(it->rect,colorGroup().highlight());
	p.setPen(colorGroup().highlight().light());
      } else p.setPen(colorGroup().mid());
      p.drawRect(it->rect);
    } 
  } else {   

    p.setBackgroundMode(OpaqueMode);
    p.setBackgroundColor(QColor(64,64,64));
    p.fillRect(p.window(),QBrush(black,Dense6Pattern));
    
    for (it=cellData.begin(); it!=end; ++it)
      if (it->visible) 
	if (it->attr&normal) {
	  
	  float val=clampf(dataRange.scaleValue(it->data));
	  
	  if (finite(val)) {
	    
	    if (it->attr & selected) 
	      color.setHsv(selectHue,128,int((0.5+0.5*val)*255));
	    else
	      color.setHsv(hue,255,int(val*255));
	    
	    p.fillRect(it->rect,color);	
	    
	    if (it->attr&marked) {
	      if (it->attr&selected) 
		color.setHsv(hue,255,int(val*255));
	      else 
		color.setHsv(selectHue,128,int((0.5+0.5*val)*255));	    
	      p.setPen(color);
	      p.drawRect(it->rect);
	    }
	  } else 
	    p.fillRect(it->rect,QBrush(paintColor,DiagCrossPattern));
	} 
  }
  
  if (hasFocus() && QRect(QPoint(0,0),viewSize).contains(currCell)) {
    p.setRasterOp(XorROP);
    p.setPen(white);
    p.drawRect(cellData[currCell.x()+currCell.y()*viewSize.width()].rect);
    p.setRasterOp(CopyROP);
  }
  
  if (!cellLabelRect.isEmpty()) {
    p.setBackgroundMode(TransparentMode);
    p.setPen(QToolTip::palette().active().text());
    p.fillRect(cellLabelRect,QToolTip::palette().active().background());
    p.drawRect(cellLabelRect);
    p.drawText(cellLabelRect,AlignCenter,cellLabelString);
  }
}
Exemplo n.º 14
0
void RectangleTool::drawTemporaryShape(QPainter& p)
{
    p.setRasterOp(Qt::NotROP);
    p.drawRect(QRect(m_polyline[2], m_polyline[1]));
    p.drawRect(QRect(m_polyline[2], m_polyline[0]));
}
Exemplo n.º 15
0
bool RenderFrameSet::userResize( MouseEventImpl *evt )
{
    if (needsLayout()) return false;
    
    bool res = false;
    int _x = evt->clientX();
    int _y = evt->clientY();
    
    if ( !m_resizing && evt->id() == EventImpl::MOUSEMOVE_EVENT || evt->id() == EventImpl::MOUSEDOWN_EVENT )
    {
#ifdef DEBUG_LAYOUT
        kdDebug( 6031 ) << "mouseEvent:check" << endl;
#endif
        
        m_hSplit = -1;
        m_vSplit = -1;
        //bool resizePossible = true;
        
        // check if we're over a horizontal or vertical boundary
        int pos = m_gridLayout[1][0] + xPos();
        for(int c = 1; c < element()->totalCols(); c++)
        {
            if(_x >= pos && _x <= pos+element()->border())
            {
            if(m_vSplitVar && m_vSplitVar[c-1] == true) m_vSplit = c-1;
#ifdef DEBUG_LAYOUT
            kdDebug( 6031 ) << "vsplit!" << endl;
#endif
            res = true;
            break;
            }
            pos += m_gridLayout[1][c] + element()->border();
        }
        
        pos = m_gridLayout[0][0] + yPos();
        for(int r = 1; r < element()->totalRows(); r++)
        {
            if( _y >= pos && _y <= pos+element()->border())
            {
            if(m_hSplitVar && m_hSplitVar[r-1] == true) m_hSplit = r-1;
#ifdef DEBUG_LAYOUT
            kdDebug( 6031 ) << "hsplitvar = " << m_hSplitVar << endl;
            kdDebug( 6031 ) << "hsplit!" << endl;
#endif
            res = true;
            break;
            }
            pos += m_gridLayout[0][r] + element()->border();
        }
#ifdef DEBUG_LAYOUT
        kdDebug( 6031 ) << m_hSplit << "/" << m_vSplit << endl;
#endif
        
        QCursor cursor;
        if(m_hSplit != -1 && m_vSplit != -1)
        {
            cursor = KCursor::sizeAllCursor();
        }
        else if( m_vSplit != -1 )
        {
            cursor = KCursor::sizeHorCursor();
        }
        else if( m_hSplit != -1 )
        {
            cursor = KCursor::sizeVerCursor();
        }
        
        if(evt->id() == EventImpl::MOUSEDOWN_EVENT)
        {
            setResizing(true);
            KApplication::setOverrideCursor(cursor);
            m_vSplitPos = _x;
            m_hSplitPos = _y;
            m_oldpos = -1;
        }
        else
            canvas()->view()->viewport()->setCursor(cursor);
        
    }
    
    // ### check the resize is not going out of bounds.
    if(m_resizing && evt->id() == EventImpl::MOUSEUP_EVENT)
    {
        setResizing(false);
        KApplication::restoreOverrideCursor();
        
        if(m_vSplit != -1 )
        {
        #ifdef DEBUG_LAYOUT
            kdDebug( 6031 ) << "split xpos=" << _x << endl;
#endif
            int delta = m_vSplitPos - _x;
            m_gridDelta[1][m_vSplit] -= delta;
            m_gridDelta[1][m_vSplit+1] += delta;
        }
        if(m_hSplit != -1 )
        {
#ifdef DEBUG_LAYOUT
            kdDebug( 6031 ) << "split ypos=" << _y << endl;
#endif
            int delta = m_hSplitPos - _y;
            m_gridDelta[0][m_hSplit] -= delta;
            m_gridDelta[0][m_hSplit+1] += delta;
        }
        
        // this just schedules the relayout
        // important, otherwise the moving indicator is not correctly erased
        setNeedsLayout(true);
    }
    
    else if (m_resizing || evt->id() == EventImpl::MOUSEUP_EVENT) {
#if APPLE_CHANGES
        KHTMLView *v = canvas()->view();
        QPainter paint;
        
        v->disableFlushDrawing();
        v->lockDrawingFocus();
#else
        QPainter paint( canvas()->view() );
#endif
        paint.setPen( Qt::gray );
        paint.setBrush( Qt::gray );
        
#if !APPLE_CHANGES
        paint.setRasterOp( Qt::XorROP );
#endif
        QRect r(xPos(), yPos(), width(), height());
        const int rBord = 3;
        int sw = element()->border();
        int p = m_resizing ? (m_vSplit > -1 ? _x : _y) : -1;
        if (m_vSplit > -1) {
            if ( m_oldpos >= 0 )
#if APPLE_CHANGES
                v->updateContents( m_oldpos + sw/2 - rBord , r.y(), 2*rBord, r.height(), true );
#else
                paint.drawRect( m_oldpos + sw/2 - rBord , r.y(),
                                2*rBord, r.height() );
#endif
            if ( p >= 0 ){
#if APPLE_CHANGES
                paint.setPen( Qt::NoPen );
                paint.setBrush( Qt::gray );
                v->setDrawingAlpha((float)0.25);
                paint.drawRect( p  + sw/2 - rBord, r.y(), 2*rBord, r.height() );
                v->setDrawingAlpha((float)1.0);
#else
                paint.drawRect( p  + sw/2 - rBord, r.y(), 2*rBord, r.height() );
#endif
            }
        } else {
            if ( m_oldpos >= 0 )
#if APPLE_CHANGES
                v->updateContents( r.x(), m_oldpos + sw/2 - rBord, r.width(), 2*rBord, true );
#else
                paint.drawRect( r.x(), m_oldpos + sw/2 - rBord,
                                r.width(), 2*rBord );
#endif
            if ( p >= 0 ){
#if APPLE_CHANGES
                paint.setPen( Qt::NoPen );
                paint.setBrush( Qt::gray );
                v->setDrawingAlpha((float)0.25);
                paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
                v->setDrawingAlpha((float)1.0);
#else
                paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
#endif
            }
        }
        m_oldpos = p;

#if APPLE_CHANGES
        v->unlockDrawingFocus();
        v->enableFlushDrawing();
#endif
    }
    
    return res;
}