当前位置: 首页>>代码示例>>C++>>正文


C++ QRegion::contains方法代码示例

本文整理汇总了C++中QRegion::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ QRegion::contains方法的具体用法?C++ QRegion::contains怎么用?C++ QRegion::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QRegion的用法示例。


在下文中一共展示了QRegion::contains方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: indexAt

QModelIndex HistogramView::indexAt(const QPoint &point)const
{
    QPoint newPoint(point.x(),point.y());
    QRegion region;
    foreach(region,MRegionList)				// 男 列
    {
        if (region.contains(newPoint))
        {
            int row = MRegionList.indexOf(region);
            QModelIndex index = model()->index(row,1,rootIndex());
            return index;
        }
    }
    foreach(region,FRegionList)				// 女 列
    {
        if (region.contains(newPoint))
        {
            int row = FRegionList.indexOf(region);
            QModelIndex index = model()->index(row,2,rootIndex());
            return index;
        }
    }
    foreach(region,SRegionList)				// 合计 列
    {
        if (region.contains(newPoint))
        {
            int row = SRegionList.indexOf(region);
            QModelIndex index = model()->index(row,3,rootIndex());
            return index;
        }
    }
    return QModelIndex();
}
开发者ID:Pengfei-Gao,项目名称:develop-reference-data,代码行数:33,代码来源:histogramview.cpp

示例2: proofeIntersections

/*
 * Pr黤t, ob ein Element in einem anderen liegt. Dabei nehmen wir an, dass GRASS eine
 * Fehlermeldung ausgibt, wenn sich zwei Elemente schneiden. Somit reicht es hier aus,
 * nur einen Punkt zu pr黤en.
 */
void proofeIntersections(QList<struct element>* eList)
{
  warning("Pr黤e 躡erschneidungen ...");

  QList<QRegion> regList;

  for(unsigned int loop = 0; loop < eList->count() - 1; loop++)
    {
      struct element* elA = eList->at(loop);

      QPointArray pArray(elA->pointList.count());

      for(unsigned int pLoop = 0; pLoop < elA->pointList.count(); pLoop++)
	{
	  pArray.setPoint(pLoop, QPoint(elA->pointList.at(pLoop)->latitude / 2000,
					elA->pointList.at(pLoop)->longitude / 2000));
	}

      for(unsigned int regLoop = 0; regLoop < regList.count(); regLoop++)
	{
	  QRegion* testReg = regList.at(regLoop);

	  if(testReg->contains(pArray.point(0)))
	    {
	      // Element ist in fr黨erer Region enthalten ...
	      elA->isValley = !eList->at(regLoop)->isValley;
	      elA->sortID++;
	    }
	}

      regList.append(new QRegion(pArray));
    }

  warning("   ... fertig");
}
开发者ID:Exadios,项目名称:MapConverting,代码行数:40,代码来源:converter.cpp

示例3: paintChannelLabelAll

//
// Paint all channel labels
//
void Monitor::paintChannelLabelAll(QRegion region, int x_offset, int y_offset,
				   int unitW, int unitH, int unitsX)
{
	int x = 0;
	int y = 0;
	int i = 0;
	QString s;
	
	for (i = 0; i < 512; i++)
	{
		// Calculate x and y positions for this channel
		x = ((i % unitsX) * (unitW));
		x += x_offset;
		
		y = unitH + static_cast<int> 
			(floor((i / unitsX)) * (unitH * 3));
		y += y_offset;
		
		if (region.contains(QRect(x, y, unitW, unitH)))
		{
			// Paint channel label
			paintChannelLabel(x, y, unitW, unitH,
					  s.sprintf("%.3d", i + 1));
		}
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:29,代码来源:monitor.cpp

示例4: paintFixtureLabelAll

//
// Paint all visible fixture labels
//
void Monitor::paintFixtureLabelAll(QRegion region, int x_offset, int y_offset,
				   int unitW, int unitH, int unitsX)
{
	int x = 0;
	int y = 0;
	int w = 0;
	int wcur = 0;
	int h = 0;
	
	t_fixture_id id = KNoID;
	Fixture* fxi = NULL;
	
	// Draw fixture names and their channel spaces
	for (id = 0; id < KFixtureArraySize; id++)
	{
		fxi = _app->doc()->fixture(id);
		if (fxi == NULL) continue;
		if (fxi->universe() != m_universe) continue;
		
		// Calculate x and y positions for this fixture label
		x = ((fxi->address() % unitsX) * unitW);
		x += x_offset;
		
		y = static_cast<int> 
			(floor((fxi->address() / unitsX)) * (unitH * 3));
		y += y_offset;
		
		// Get width and height for this fixture label
		w = (fxi->channels() * unitW) - X_OFFSET;
		h = unitH;
			
		// Check if this label needs to be painted at all
		if (region.contains(QRect(x, y, w, h)) == false)
			continue;

		if ((x + w + X_OFFSET) <= width())
		{
			// The label fits to one line, just draw it
			paintFixtureLabel(x, y, w, h, fxi->name());
		}
		else
		{
			// The label needs to be drawn on at least two lines
			while (w > 0)
			{	
				wcur = MIN(w, (unitsX * unitW) - (x));
				
				// Draw the label
				paintFixtureLabel(x, y, wcur, h, fxi->name());
			
				// Calculate remaining width
				w = w - wcur - X_OFFSET;
				
				// Next line
				y += (unitH * 3);
				x = x_offset;
			}
		}
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:63,代码来源:monitor.cpp

示例5: updateCursor

void QWidget::updateCursor( const QRegion &r ) const
{
    if ( qt_last_x && (!QWidget::mouseGrabber() || QWidget::mouseGrabber() == this) &&
	    qt_last_cursor != (WId)cursor().handle() && !qws_overrideCursor ) {
	QSize s( qt_screen->width(), qt_screen->height() );
	QPoint pos = qt_screen->mapToDevice(QPoint(*qt_last_x, *qt_last_y), s);
	if ( r.contains(pos) )
	    qwsDisplay()->selectCursor((QWidget*)this, (unsigned int)cursor().handle());
    }
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:10,代码来源:qwidget_qws.cpp

示例6: UpdateDesktopPluginArea

void LDesktop::UpdateDesktopPluginArea(){
  QRegion visReg( bgWindow->geometry() ); //visible region (not hidden behind a panel)
  QRect rawRect = visReg.boundingRect(); //initial value (screen size)
  for(int i=0; i<PANELS.length(); i++){
    QRegion shifted = visReg;
    QString loc = settings->value(PANELS[i]->prefix()+"location","top").toString().toLower();
    int vis = PANELS[i]->visibleWidth();
    if(loc=="top"){ 
      if(!shifted.contains(QRect(rawRect.x(), rawRect.y(), rawRect.width(), vis))){ continue; }
      shifted.translate(0, (rawRect.top()+vis)-shifted.boundingRect().top() ); 
    }else if(loc=="bottom"){
      if(!shifted.contains(QRect(rawRect.x(), rawRect.bottom()-vis, rawRect.width(), vis))){ continue; }	    
      shifted.translate(0, (rawRect.bottom()-vis)-shifted.boundingRect().bottom()); 
    }else if(loc=="left"){ 
      if( !shifted.contains(QRect(rawRect.x(), rawRect.y(), vis,rawRect.height())) ){ continue; }
      shifted.translate((rawRect.left()+vis)-shifted.boundingRect().left() ,0); 
    }else{  //right
      if(!shifted.contains(QRect(rawRect.right()-vis, rawRect.y(), vis,rawRect.height())) ){ continue; }
      shifted.translate((rawRect.right()-vis)-shifted.boundingRect().right(),0); 
    }
    visReg = visReg.intersected( shifted );
  }
  //Now make sure the desktop plugin area is only the visible area
  QRect rec = visReg.boundingRect();
  //LSession::handle()->XCB->SetScreenWorkArea((unsigned int) desktopnumber, rec);
  //Now remove the X offset to place it on the current screen (needs widget-coords, not global)
  globalWorkRect = rec; //save this for later
  rec.moveTopLeft( QPoint( rec.x()-desktop->screenGeometry(desktopnumber).x() , rec.y() ) );
  //qDebug() << "DPlug Area:" << rec.x() << rec.y() << rec.width() << rec.height();
  if(rec == bgDesktop->geometry()){return; } //nothing changed
  bgDesktop->setGeometry( rec );
  bgDesktop->setBackground( QBrush(Qt::NoBrush) );
  bgDesktop->update();
  //Re-paint the panels (just in case a plugin was underneath it and the panel is transparent)
  for(int i=0; i<PANELS.length(); i++){ PANELS[i]->update(); }
  //Also need to re-arrange any desktop plugins to ensure that nothing is out of the screen area
  AlignDesktopPlugins();
  //Make sure to re-disable any WM control flags
  LSession::handle()->XCB->SetDisableWMActions(bgWindow->winId());
}
开发者ID:LeFroid,项目名称:lumina,代码行数:40,代码来源:LDesktop.cpp

示例7: getScrollMode

/*!
  See QwtAbstractSlider::getScrollMode()

  \param pos point where the mouse was pressed
  \retval scrollMode The scrolling mode
  \retval direction  direction: 1, 0, or -1.

  \sa QwtAbstractSlider::getScrollMode()
*/
void QwtDial::getScrollMode( const QPoint &pos,
    QwtAbstractSlider::ScrollMode &scrollMode, int &direction ) const
{
    direction = 0;
    scrollMode = QwtAbstractSlider::ScrNone;

    const QRegion region( innerRect().toRect(), QRegion::Ellipse );
    if ( region.contains( pos ) && pos != innerRect().center() )
    {
        scrollMode = QwtAbstractSlider::ScrMouse;
        d_data->previousDir = -1.0;
    }
}
开发者ID:ClaFio,项目名称:GoldenCheetah,代码行数:22,代码来源:qwt_dial.cpp

示例8: paintEvent

void Document::paintEvent(QPaintEvent *event)
{
    QRegion paintRegion = event->region();
    QPainter painter(this);
    QPalette pal = palette();

    for (int i = 0; i < m_shapeList.count(); ++i) {
        const Shape &shape = m_shapeList.at(i);

        if (!paintRegion.contains(shape.rect()))
            continue;

        QPen pen = pal.text().color();
        pen.setWidth(i == m_currentIndex ? 2 : 1);
        painter.setPen(pen);
        painter.setBrush(gradient(shape.color(), shape.rect()));

        QRect rect = shape.rect();
        rect.adjust(1, 1, -resizeHandleWidth/2, -resizeHandleWidth/2);

        // paint the shape
        switch (shape.type()) {
            case Shape::Rectangle:
                painter.drawRect(rect);
                break;
            case Shape::Circle:
                painter.setRenderHint(QPainter::Antialiasing);
                painter.drawEllipse(rect);
                painter.setRenderHint(QPainter::Antialiasing, false);
                break;
            case Shape::Triangle:
                painter.setRenderHint(QPainter::Antialiasing);
                painter.drawPolygon(triangle(rect));
                painter.setRenderHint(QPainter::Antialiasing, false);
                break;
        }

        // paint the resize handle
        painter.setPen(pal.text().color());
        painter.setBrush(Qt::white);
        painter.drawRect(shape.resizeHandle().adjusted(0, 0, -1, -1));

        // paint the shape name
        painter.setBrush(pal.text());
        if (shape.type() == Shape::Triangle)
            rect.adjust(0, rect.height()/2, 0, 0);
        painter.drawText(rect, Qt::AlignCenter, shape.name());
    }
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:49,代码来源:document.cpp

示例9: indexAt

QModelIndex PieView::indexAt(const QPoint &point) const
{
    QPoint newPoint(point.x(),point.y());
    QRegion region;
    foreach(region,RegionList)				// 销售数量 列
    {
        if (region.contains(newPoint))
        {
            int row = RegionList.indexOf(region);
            QModelIndex index = model()->index(row,1,rootIndex());
            return index;
        }
    }
    return QModelIndex();
}
开发者ID:Chunting,项目名称:PowerTest,代码行数:15,代码来源:pieview.cpp

示例10: wangIdFromSurroundings

WangId WangFiller::wangIdFromSurroundings(const TileLayer &back,
                                          const QRegion &fillRegion,
                                          QPoint point) const
{
    Cell surroundingCells[8];

    QPoint adjacentPoints[8];
    getSurroundingPoints(point, mStaggeredRenderer, mStaggerAxis, adjacentPoints);

    for (int i = 0; i < 8; ++i) {
        if (!fillRegion.contains(adjacentPoints[i]))
            surroundingCells[i] = back.cellAt(adjacentPoints[i]);
    }

    return mWangSet->wangIdFromSurrounding(surroundingCells);
}
开发者ID:aTom3333,项目名称:tiled,代码行数:16,代码来源:wangfiller.cpp

示例11: paintScreen

void ThumbnailAsideEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
    {
    effects->paintScreen( mask, region, data );
    foreach( const Data& d, windows )
        {
        if( region.contains( d.rect ))
            {
            WindowPaintData data( d.window );
            data.opacity = opacity;
            QRect region;
            setPositionTransformations( data, region, d.window, d.rect, Qt::KeepAspectRatio );
            effects->drawWindow( d.window, PAINT_WINDOW_OPAQUE | PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_TRANSFORMED,
                region, data );
            }
        }
    }
开发者ID:lmurray,项目名称:kwin,代码行数:16,代码来源:thumbnailaside.cpp

示例12: objectsInRegion

const QList<MapObject*> objectsInRegion(const ObjectGroup *layer,
                                        const QRegion &where)
{
    QList<MapObject*> ret;
    for (MapObject *obj : layer->objects()) {
        // TODO: we are checking bounds, which is only correct for rectangles and
        // tile objects. polygons and polylines are not covered correctly by this
        // erase method (we are in fact deleting too many objects)
        // TODO2: toAlignedRect may even break rects.
        const QRect rect = obj->boundsUseTile().toAlignedRect();

        // QRegion::intersects() returns false for empty regions even if they are
        // contained within the region, so we also check for containment of the
        // top left to include the case of zero size objects.
        if (where.intersects(rect) || where.contains(rect.topLeft()))
            ret += obj;
    }
    return ret;
}
开发者ID:Bertram25,项目名称:tiled,代码行数:19,代码来源:automappingutils.cpp

示例13: paintChannelValueAll

//
// Paint all channel values
//
void Monitor::paintChannelValueAll(QRegion region, int x_offset, int y_offset,
				   int unitW, int unitH, int unitsX,
				   bool onlyDelta)
{
	int x = 0;
	int y = 0;
	int value = 0;
	int i = 0;
	
	QString s;

	// Set normal text color to painter
	m_painter.setPen(palette().color(QPalette::Text));
	
	for (i = 0; i < 512; i++)
	{
		// Lock value array
		m_valueMutex.lock();
	
		if (onlyDelta && m_oldValues[i] == m_newValues[i])
		{
			m_valueMutex.unlock();
			continue;
		}
		
		m_oldValues[i] = m_newValues[i];

		// Get channel value from array;
		value = m_newValues[i];
		
		// Unlock array
		m_valueMutex.unlock();
		
		// Calculate xy position for this channel
		x = ((i % unitsX) * (unitW));
		x += x_offset;
		
		y = (unitH * 2) + 
		    static_cast<int> (floor((i / unitsX)) * (unitH * 3));
		y += y_offset;
		
		// If all values must be drawn, draw only those that are
		// inside the invalidated area, otherwise draw the delta values
		if (!onlyDelta && !region.contains(QRect(x, y, unitW, unitH)))
			continue;
		
		// Draw only those values that are visible
		if (y < height())
		{
			// Convert the value to a string
			s.sprintf("%.3d", value);
		
			// Paint the value
			paintChannelValue(x, y, unitW, unitH, s);

			/* Update the biggest visible channel number only,
			   when the visibility of all channels is being
			   checked */
			if (onlyDelta == false)
				m_visibleMax = i;
		}
		else
		{
			// Rest of the values are not visible either
			break;
		}
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:71,代码来源:monitor.cpp

示例14: desktopChanged

void SlideEffect::desktopChanged( int old )
    {
    if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
        return;
    
    if( slide ) // old slide still in progress
        {
        QPoint diffPos = desktopRect( old ).topLeft() - slide_start_pos;
        int w = 0;
        int h = 0;
        if( effects->optionRollOverDesktops())
            {
            w = effects->workspaceWidth();
            h = effects->workspaceHeight();
            // wrap around if shorter
            if( diffPos.x() > 0 && diffPos.x() > w / 2 )
                diffPos.setX( diffPos.x() - w );
            if( diffPos.x() < 0 && abs( diffPos.x()) > w / 2 )
                diffPos.setX( diffPos.x() + w );
            if( diffPos.y() > 0 && diffPos.y() > h / 2 )
                diffPos.setY( diffPos.y() - h );
            if( diffPos.y() < 0 && abs( diffPos.y()) > h / 2 )
                diffPos.setY( diffPos.y() + h );
            }
        QPoint currentPos = slide_start_pos + mTimeLine.value() * diffPos;
        QRegion currentRegion = QRect( currentPos, QSize( displayWidth(), displayHeight()));
        if( effects->optionRollOverDesktops())
            {
            currentRegion |= ( currentRegion & QRect( -w, 0, w, h )).translated( w, 0 );
            currentRegion |= ( currentRegion & QRect( 0, -h, w, h )).translated( 0, h );
            currentRegion |= ( currentRegion & QRect( w, 0, w, h )).translated( -w, 0 );
            currentRegion |= ( currentRegion & QRect( 0, h, w, h )).translated( 0, -h );
            }
        QRect rect = desktopRect( effects->currentDesktop() );
        if( currentRegion.contains( rect ))
            { // current position is in new current desktop (e.g. quickly changing back),
              // don't do full progress
            if( abs( currentPos.x() - rect.x()) > abs( currentPos.y() - rect.y()))
                mTimeLine.setProgress(1 - abs( currentPos.x() - rect.x()) / double( displayWidth()));
            else
                mTimeLine.setProgress(1 - abs( currentPos.y() - rect.y()) / double( displayHeight()));
            }
        else // current position is not on current desktop, do full progress
            mTimeLine.setProgress(0);
        diffPos = rect.topLeft() - currentPos;
        if( mTimeLine.value() <= 0 )
            {
            // Compute starting point for this new move (given current and end positions)
            slide_start_pos = rect.topLeft() - diffPos * 1 / ( 1 - mTimeLine.value() );
            }
        else
            { // at the end, stop
            slide = false;
            mTimeLine.setProgress(0);
            effects->setActiveFullScreenEffect( NULL );
            }
        }
    else
        {
        if( effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this )
            return;
        mTimeLine.setProgress(0);
        slide_start_pos = desktopRect( old ).topLeft();
        slide = true;
        effects->setActiveFullScreenEffect( this );
        }
    effects->addRepaintFull();
    }
开发者ID:lmurray,项目名称:kwin,代码行数:68,代码来源:slide.cpp

示例15: paintScreen

void SlideEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
    {
    if( mTimeLine.value() == 0 )
        {
        effects->paintScreen( mask, region, data );
        return;
        }
    
    /*
     Transformations are done by remembering starting position of the change and the progress
     of it, the destination is computed from the current desktop. Positions of desktops
     are done using their topleft corner.
    */
    QPoint destPos = desktopRect( effects->currentDesktop() ).topLeft();
    QPoint diffPos = destPos - slide_start_pos;
    int w = 0;
    int h = 0;
    if( effects->optionRollOverDesktops())
        {
        w = effects->workspaceWidth();
        h = effects->workspaceHeight();
        // wrap around if shorter
        if( diffPos.x() > 0 && diffPos.x() > w / 2 )
            diffPos.setX( diffPos.x() - w );
        if( diffPos.x() < 0 && abs( diffPos.x()) > w / 2 )
            diffPos.setX( diffPos.x() + w );
        if( diffPos.y() > 0 && diffPos.y() > h / 2 )
            diffPos.setY( diffPos.y() - h );
        if( diffPos.y() < 0 && abs( diffPos.y()) > h / 2 )
            diffPos.setY( diffPos.y() + h );
        }
    QPoint currentPos = slide_start_pos + mTimeLine.value() * diffPos;
    QSize displaySize( displayWidth(), displayHeight());
    QRegion currentRegion = QRect( currentPos, displaySize );
    if( effects->optionRollOverDesktops())
        {
        currentRegion |= ( currentRegion & QRect( -w, 0, w, h )).translated( w, 0 );
        currentRegion |= ( currentRegion & QRect( 0, -h, w, h )).translated( 0, h );
        currentRegion |= ( currentRegion & QRect( w, 0, w, h )).translated( -w, 0 );
        currentRegion |= ( currentRegion & QRect( 0, h, w, h )).translated( 0, -h );
        }
    bool do_sticky = true;
    for( int desktop = 1;
         desktop <= effects->numberOfDesktops();
         ++desktop )
        {
        QRect rect = desktopRect( desktop );
        if( currentRegion.contains( rect )) // part of the desktop needs painting
            {
            painting_desktop = desktop;
            slide_painting_sticky = do_sticky;
            slide_painting_diff = rect.topLeft() - currentPos;
            if( effects->optionRollOverDesktops())
                {
                if( slide_painting_diff.x() > displayWidth())
                    slide_painting_diff.setX( slide_painting_diff.x() - w );
                if( slide_painting_diff.x() < -displayWidth())
                    slide_painting_diff.setX( slide_painting_diff.x() + w );
                if( slide_painting_diff.y() > displayHeight())
                    slide_painting_diff.setY( slide_painting_diff.y() - h );
                if( slide_painting_diff.y() < -displayHeight())
                    slide_painting_diff.setY( slide_painting_diff.y() + h );
                }
            do_sticky = false; // paint on-all-desktop windows only once
            ScreenPaintData d = data;
            d.xTranslate += slide_painting_diff.x();
            d.yTranslate += slide_painting_diff.y();
            // TODO mask parts that are not visible?
            effects->paintScreen( mask, region, d );
            }
        }
    }
开发者ID:lmurray,项目名称:kwin,代码行数:72,代码来源:slide.cpp


注:本文中的QRegion::contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。