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


C++ repaint函数代码示例

本文整理汇总了C++中repaint函数的典型用法代码示例。如果您正苦于以下问题:C++ repaint函数的具体用法?C++ repaint怎么用?C++ repaint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setBackgroundBrush


//.........这里部分代码省略.........
                    picPosY = picPosY + 1;
                }
                break;
            }
            case McGround:
            {
                // сделал траву фоном (строка 43)
                // QGraphicsPixmapItem* Ground = m_Scene->addPixmap(QPixmap("../player/ground.jpg"));
                //  Ground->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }
            case McFood:
            {
                QGraphicsPixmapItem*  Food = m_Scene->addPixmap(QPixmap("../player/food.png"));
                Food->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                Food->scale(Size, Size);
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }

                break;
            }
            case McStick:
            {
                QGraphicsPixmapItem* Stick = m_Scene->addPixmap(QPixmap("../player/stick.png"));
                Stick->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                Stick->scale(Size, Size);
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }
            case McStock:
            {
                QGraphicsPixmapItem* Stock = m_Scene->addPixmap(QPixmap("../player/stock.jpeg"));
                Stock->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                Stock->scale(Size/4, Size/4);
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }

            case McWay:
            {
                QGraphicsPixmapItem* Way = m_Scene->addPixmap(QPixmap("../player/ground.jpg"));
                Way->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }

            case McError:
            {
                QGraphicsPixmapItem* Error = m_Scene->addPixmap(QPixmap("../player/unknown.png"));
                Error->setPos(picSize * picPosX, picSize * picPosY);
                picPosX = picPosX + 1;
                if(picPosX == m_Map.GetMapSizeX())
                {
                    picPosX = 0;
                    picPosY = picPosY + 1;
                }
                break;
            }

            }
        }


    std::stringstream sstream;
    sstream  << "MapSize = "<<m_Map.GetMapSizeX() << "\nGame step = " << m_GameStep;
    QString QStr = QString::fromStdString(sstream.str());
    QGraphicsTextItem* Size_of_Map = m_Scene->addText(QStr);
    Size_of_Map->setPos((m_Map.GetMapSizeX()+1)*picSize, 1);



    // перерисовываем окно вывода
    repaint();

}
开发者ID:VulpesCorsac,项目名称:Mathematical-Modelling-DPQE-MIPT,代码行数:101,代码来源:PlayerLoop.cpp

示例2: repaint

void GLWidget::setDisplayTexture(GLuint texture)
{
    m_displayTexture = texture;
    repaint();
}
开发者ID:fieldOfView,项目名称:uv-mapper,代码行数:5,代码来源:glwidget.cpp

示例3: repaint

void FieldViewerPainter::handleZoomOut()
{
    scaleFactor -= .1;
    repaint();
}
开发者ID:CheddarB,项目名称:nbites,代码行数:5,代码来源:FieldViewerPainter.cpp

示例4: repaint

void
StatsGauge::setPercentage( float percentage )
{
    m_percentage = percentage;
    repaint();
}
开发者ID:ehaas,项目名称:tomahawk,代码行数:6,代码来源:StatsGauge.cpp

示例5: repaint

void NMainFrameWidget::dynamicPosChanged(int val) {

    currentVoice_->getCurrentElement()->dynamic_ = val;
    repaint();
    
}
开发者ID:BackupTheBerlios,项目名称:noteedit-svn,代码行数:6,代码来源:mainframewidget2.cpp

示例6: repaint

void SearchLineEdit::setMessageVisible( bool on )
{
    message = on;
    repaint();
    return;
}
开发者ID:0xheart0,项目名称:vlc,代码行数:6,代码来源:searchlineedit.cpp

示例7: main

int
main(int argc, char **argv)
{
        FILE *fp;
        FILE *in;

        if(argc == 2){
                fp = fopen(argv[1], "r");
                in = stdin;
        } else {
                fp = stdin;
                in = fopen("/dev/tty", "r");
        }
        if(!fp || !in)
                err(1, "Cannot open files");


        signal(SIGINT, finish);

        (void) initscr();
        (void) keypad(stdscr, TRUE);
        (void) nonl();
        (void) cbreak();
        (void) noecho();

        (void) read_file(fp);

        v_end = LINES;
        (void) repaint();

	lastreg = malloc(80 * sizeof(char*));
	if(!lastreg)
		err(1, "can't lastreg");

        for(;;){
                int c = getch();
                switch(c){
                case 'j':
                        godown();
                        break;
                case 'k':
                        goup();
                        break;
                case '<':
                        gostart();
                        break;
                case '>':
                        goend();
                        break;
                case 'q':
                        finish(0);
                        break;
		case KEY_NPAGE:
		case ' ':
			downpage();
			break;
		case KEY_PPAGE:
		case KEY_BACKSPACE:
			uppage();
			break;
		case '/':
			dosearch();
			break;
		case '?':
			dobacksearch();
			break;
		case 12: /* ^L */
			repaint();
			break;
                }
        }
}
开发者ID:gabc,项目名称:much,代码行数:72,代码来源:much.c

示例8: width

void Hruler::mouseMoveEvent(QMouseEvent *m)
{
	if (m_doc->isLoading())
		return;
	if (textEditMode)
	{
		double ColWidth = (textWidth() - ColGap * (Cols - 1)) / Cols;
		int ColEnd, ColStart;
		double oldInd;
		if (RulerCode == rc_leftFrameDist || RulerCode == rc_rightFrameDist)
		{
			ColStart = 0; //textPosToLocal(0);
			ColEnd   = width(); //textPosToLocal(textWidth());
		}
		else
		{
			ColStart = textPosToLocal((ColWidth+ColGap)*(ActCol-1));
			ColEnd   = textPosToLocal((ColWidth+ColGap)*(ActCol-1) + ColWidth);
		}
		if ((Mpressed) && (m->y() < height()) && (m->y() > 0) && (m->x() > ColStart - m_doc->guidesPrefs().grabRadius) && (m->x() < ColEnd + m_doc->guidesPrefs().grabRadius))
		{
			qApp->changeOverrideCursor(QCursor(Qt::SizeHorCursor));
			double toplimit = textWidth() + RExtra - (ColGap * (Cols - 1))-1;
			double toplimit2 = textWidth() + Extra - (ColGap * (Cols - 1))-1;
			switch (RulerCode)
			{
				case rc_leftFrameDist:
					Extra -= (MouseX - m->x()) / Scaling;
					if (Extra < 0)
						Extra = 0;
					if (Extra > toplimit2)
						Extra = toplimit2;
					emit MarkerMoved(currItem->xPos(), textBase()-currItem->xPos());
					repaint();
					break;
				case rc_rightFrameDist:
					RExtra += (MouseX - m->x()) / Scaling;
					if (RExtra < 0)
						RExtra = 0;
					if (RExtra > toplimit)
						RExtra = toplimit;
					emit MarkerMoved(textBase(), toplimit -RExtra);
					repaint();
					break;
				case rc_indentFirst:
					First -= (MouseX - m->x()) / Scaling;
					if (First+Indent < 0)
						First = -Indent;
					if (First+Indent > ColWidth)
						First  = ColWidth-Indent;
					emit MarkerMoved(textBase(), First+Indent);
					repaint();
					break;
				case rc_leftMargin:
					oldInd = Indent+First;
					Indent -= (MouseX - m->x()) / Scaling;
					if (Indent < 0)
						Indent = 0;
					if (Indent > ColWidth-1)
						Indent  = ColWidth-1;
					First = oldInd - Indent;
					emit MarkerMoved(textBase(), Indent);
					repaint();
					break;
				case rc_rightMargin:
					RMargin -= (MouseX - m->x()) / Scaling;
					if (RMargin < 0)
						RMargin = 0;
					if (RMargin > ColWidth-1)
						RMargin  = ColWidth-1;
					emit MarkerMoved(textBase(), RMargin);
					repaint();
					break;
				case rc_tab:
					TabValues[ActTab].tabPosition -= (MouseX - m->x()) / Scaling;
					if (TabValues[ActTab].tabPosition < 0)
						TabValues[ActTab].tabPosition = 0;
					if (TabValues[ActTab].tabPosition > ColWidth-1)
						TabValues[ActTab].tabPosition  = ColWidth-1;
					emit MarkerMoved(textBase(), TabValues[ActTab].tabPosition);
					UpdateTabList();
					repaint();
					break;
				default:
					break;
			}
			MouseX = m->x();
/*			if (RulerCode != rc_none)
			{
				QPoint py = m_view->viewport()->mapFromGlobal(m->globalPos());
				QPainter p;
				p.begin(m_view->viewport());
				p.setCompositionMode(QPainter::CompositionMode_Xor);
				p.setPen(QPen(Qt::white, 1, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
				QPoint out = m_view->contentsToViewport(QPoint(0, qRound(m_doc->currentPage()->yOffset() * Scaling)));
				p.drawLine(Markp, out.y(), Markp, out.y()+qRound(m_doc->currentPage()->height() * Scaling));
				p.drawLine(py.x(), out.y(), py.x(), out.y()+qRound(m_doc->currentPage()->height() * Scaling));
				p.end(); 
				Markp = py.x();
			}*/
//.........这里部分代码省略.........
开发者ID:Fahad-Alsaidi,项目名称:scribus-svn,代码行数:101,代码来源:hruler.cpp

示例9: repaint

void KPathPointTypeCommand::redo()
{
    QUndoCommand::redo();
    repaint(false);
    m_additionalPointData.clear();

    QList<PointData>::iterator it(m_oldPointData.begin());
    for (; it != m_oldPointData.end(); ++it) {
        KPathPoint *point = it->m_pointData.pathShape->pointByIndex(it->m_pointData.pointIndex);
        KPathPoint::PointProperties properties = point->properties();

        switch (m_pointType) {
        case Line: {
            point->removeControlPoint1();
            point->removeControlPoint2();
            break;
        }
        case Curve: {
            KoPathPointIndex pointIndex = it->m_pointData.pointIndex;
            KoPathPointIndex prevIndex;
            KoPathPointIndex nextIndex;
            KPathShape * path = it->m_pointData.pathShape;
            // get previous path node
            if (pointIndex.second > 0)
                prevIndex = KoPathPointIndex(pointIndex.first, pointIndex.second - 1);
            else if (pointIndex.second == 0 && path->isClosedSubpath(pointIndex.first))
                prevIndex = KoPathPointIndex(pointIndex.first, path->subpathPointCount(pointIndex.first) - 1);
            // get next node
            if (pointIndex.second < path->subpathPointCount(pointIndex.first) - 1)
                nextIndex = KoPathPointIndex(pointIndex.first, pointIndex.second + 1);
            else if (pointIndex.second < path->subpathPointCount(pointIndex.first) - 1
                     && path->isClosedSubpath(pointIndex.first))
                nextIndex = KoPathPointIndex(pointIndex.first, 0);

            KPathPoint * prevPoint = path->pointByIndex(prevIndex);
            KPathPoint * nextPoint = path->pointByIndex(nextIndex);

            if (prevPoint && ! point->activeControlPoint1() && appendPointData(KPathPointData(path, prevIndex))) {
                KPathSegment cubic = KPathSegment(prevPoint, point).toCubic();
                if (prevPoint->activeControlPoint2()) {
                    prevPoint->setControlPoint2(cubic.first()->controlPoint2());
                    point->setControlPoint1(cubic.second()->controlPoint1());
                } else
                    point->setControlPoint1(cubic.second()->controlPoint1());
            }
            if (nextPoint && ! point->activeControlPoint2() && appendPointData(KPathPointData(path, nextIndex))) {
                KPathSegment cubic = KPathSegment(point, nextPoint).toCubic();
                if (nextPoint->activeControlPoint1()) {
                    point->setControlPoint2(cubic.first()->controlPoint2());
                    nextPoint->setControlPoint1(cubic.second()->controlPoint1());
                } else
                    point->setControlPoint2(cubic.first()->controlPoint2());
            }
            break;
        }
        case Symmetric: {
            properties &= ~KPathPoint::IsSmooth;
            properties |= KPathPoint::IsSymmetric;

            // calculate vector from node point to first control point and normalize it
            QPointF directionC1 = point->controlPoint1() - point->point();
            qreal dirLengthC1 = sqrt(directionC1.x() * directionC1.x() + directionC1.y() * directionC1.y());
            directionC1 /= dirLengthC1;
            // calculate vector from node point to second control point and normalize it
            QPointF directionC2 = point->controlPoint2() - point->point();
            qreal dirLengthC2 = sqrt(directionC2.x() * directionC2.x() + directionC2.y() * directionC2.y());
            directionC2 /= dirLengthC2;
            // calculate the average distance of the control points to the node point
            qreal averageLength = 0.5 * (dirLengthC1 + dirLengthC2);
            // compute position of the control points so that they lie on a line going through the node point
            // the new distance of the control points is the average distance to the node point
            point->setControlPoint1(point->point() + 0.5 * averageLength * (directionC1 - directionC2));
            point->setControlPoint2(point->point() + 0.5 * averageLength * (directionC2 - directionC1));
        }
        break;
        case Smooth: {
            properties &= ~KPathPoint::IsSymmetric;
            properties |= KPathPoint::IsSmooth;

            // calculate vector from node point to first control point and normalize it
            QPointF directionC1 = point->controlPoint1() - point->point();
            qreal dirLengthC1 = sqrt(directionC1.x() * directionC1.x() + directionC1.y() * directionC1.y());
            directionC1 /= dirLengthC1;
            // calculate vector from node point to second control point and normalize it
            QPointF directionC2 = point->controlPoint2() - point->point();
            qreal dirLengthC2 = sqrt(directionC2.x() * directionC2.x() + directionC2.y() * directionC2.y());
            directionC2 /= dirLengthC2;
            // compute position of the control points so that they lie on a line going through the node point
            // the new distance of the control points is the average distance to the node point
            point->setControlPoint1(point->point() + 0.5 * dirLengthC1 * (directionC1 - directionC2));
            point->setControlPoint2(point->point() + 0.5 * dirLengthC2 * (directionC2 - directionC1));
        }
        break;
        case Corner:
        default:
            properties &= ~KPathPoint::IsSymmetric;
            properties &= ~KPathPoint::IsSmooth;
            break;
        }
        point->setProperties(properties);
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:koffice,代码行数:101,代码来源:KPathPointTypeCommand.cpp

示例10: repaint

void WFormWidget::propagateSetEnabled(bool enabled)
{
  flags_.set(BIT_ENABLED_CHANGED);
  repaint();
  WInteractWidget::propagateSetEnabled(enabled);
}
开发者ID:DTidd,项目名称:wt,代码行数:6,代码来源:WFormWidget.C

示例11: movementMario

void GameBoard::timerEvent(QTimerEvent *event)
{
    movementMario();
    removeDestroyed();
    repaint();
}
开发者ID:louptheron,项目名称:mario,代码行数:6,代码来源:gameboard.cpp

示例12: if


//.........这里部分代码省略.........
   } 

   if(event->timerId() == timeridShoot2){
      EnemyObject *g;
      int indexBullet = 3;

      if(bulletList[3]->isDestroyed()){
          for(int i = 0; i < enemyList.size(); i++){
	      g = dynamic_cast <Enemy3*> (enemyList[i]);

              if(g != NULL && !enemyList[i]->isDestroyed()){
                 bulletList[indexBullet]->setDestroyed(false);
                 bulletList[indexBullet]->resetState(enemyList[i]->getRect().left(),enemyList[i]->getRect().top());
                 indexBullet++;
              }
           }
       }
    }

   if(event->timerId() == timeridskBullet){
      EnemyBullet* c;

      for(int i = 0; i < bulletList.size(); i++){
          c = dynamic_cast <SeekerBullet*> (bulletList[i]);

          if(c != NULL){
              bulletList[i]->setlastLocation(bulletList[i]->getRect().left(),bulletList[i]->getRect().top());
              bulletList[i]->determineDirection(prot->getRect().left(),prot->getRect().top());
              bulletList[i]->move();
          }
      }

   }

   if(event->timerId() == timeridDisappear){
      EnemyObject* d;

      for(int i = 0; i < enemyList.size(); i++){
              d = dynamic_cast <Enemy3*> (enemyList[i]);

              if(d != NULL){
                  enemyList[i]->resetState();
              }
      }

   }


   if(event->timerId() == timeridEnemy){
     for(int i = 0; i < enemyList.size(); i++)
        enemyList[i]->move();
     checkCollision(); 
     checkCrossLine();
   }

   if(event->timerId() == timeridArrow){
     for(int i = 0; i < arrowList.size(); i++)
        arrowList[i]->move();
     checkCollision();

     for(int i = 0; i < arrowList.size(); i++){
         if(!arrowList[i]->isDestroyed())
            break;

         if(i == arrowList.size()-1){
             if(arrowList.size() != 8){
                deleteArrows();
                arrowList.resize(0);
                createArrows(8);
                arrowCount = 0;
             }
         }
     }
   }

   if(event->timerId() == timeridItem){
       protectItem->setDestroyed(true);
       killTimer(timeridItem);
   }

   if(event->timerId() == timeridInvincible){
      protect->setDestroyed(true);
      killTimer(timeridInvincible);
   }

  if(event->timerId() == timeridBullet){
      EnemyBullet* e;

      for(int i = 0; i < bulletList.size(); i++){

         e = dynamic_cast <Bullet*> (bulletList[i]);

         if(e != NULL)
            bulletList[i]->move();
      }
   }

   if(event->timerId() == timeridAnimation)
       repaint();
}
开发者ID:dany1532,项目名称:Hold_The_Line,代码行数:101,代码来源:HoldtheLine.cpp

示例13: repaint

void MidiPad::setColour(const juce::Colour &colour) {
    bgColour = colour;
	repaint();
}
开发者ID:Amcut,项目名称:pizmidi,代码行数:4,代码来源:MidiPad.cpp

示例14: killTimers

void HoldLine::stopGame(){
      killTimers();
      gameOver = true;
      gameStarted = false;
      repaint();
}
开发者ID:dany1532,项目名称:Hold_The_Line,代码行数:6,代码来源:HoldtheLine.cpp

示例15: repaint

void DBoxFE_Splash::animate() {
  state = (( state + 1 ) % ( 2 * progress_bar_size - 1 ) );
  repaint();
}
开发者ID:BackupTheBerlios,项目名称:dboxfe-svn,代码行数:4,代码来源:dboxfe_splash.cpp


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