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


C++ QWMatrix::reset方法代码示例

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


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

示例1: show

/*
void KColorGrid::show()
{
  //updateScrollBars();
  QWidget::show();
}
*/
void KColorGrid::paintEvent(QPaintEvent *e)
{
  //kdDebug(4640) << "KColorGrid::paintEvent" << endl;

  //updateScrollBars();
  //QWidget::paintEvent(e);

  const QRect urect = e->rect();

  //kdDebug(4640) << "Update rect = ( " << //urect.left() << ", " << urect.top() << ", " << urect.width() << ", " << urect.height() << " )" << endl;


  int firstcol = getX(urect.x())-1;
  int firstrow = getY(urect.y())-1;
  int lastcol  = getX(urect.right())+1;
  int lastrow  = getY(urect.bottom())+1;

  QWMatrix matrix;
  QPixmap pm(urect.width(),urect.height());
  pm.fill(paletteBackgroundColor());
  QPainter p;
  p.begin( &pm );

  firstrow = (firstrow < 0) ? 0 : firstrow;
  firstcol = (firstcol < 0) ? 0 : firstcol;
  lastrow = (lastrow >= rows) ? rows : lastrow;
  lastcol = (lastcol >= cols) ? cols : lastcol;
  //kdDebug(4640) << urect.x() << " x " << urect.y() << "  -  row: " << urect.width() << " x " << urect.height() << endl;
  //kdDebug(4640) << "col: " << firstcol << " -> " << lastcol << "  -  row: " << firstrow << " -> " << lastrow << endl;

/*
  if(this->isA("KDrawGrid"))
    kdDebug(4640) << "KDrawGrid\n   firstcol: " << firstcol << "\n   lastcol: " << lastcol << "\n   firstrow: " << firstrow << "\n   lastrow: " << lastrow << endl;
*/
  for(int i = firstrow; i < lastrow; i++)
  {
    //if(this->isA("KDrawGrid"))
    //  kdDebug(4640) << "Updating row " << i << endl;
    for(int j = firstcol; j < lastcol; j++)
    {
      matrix.translate( (j*cellsize)-urect.x(), (i*cellsize)-urect.y() );
      p.setWorldMatrix( matrix );
      //p.setClipRect(j*cellsize, i*cellsize, cellsize, cellsize);
      paintCell(&p, i, j);
      //p.setClipping(FALSE);
      matrix.reset();
      p.setWorldMatrix( matrix );
    }
    //kapp->processEvents();
  }

  matrix.translate(-urect.x(),-urect.y());
  p.setWorldMatrix( matrix );
  paintForeground(&p,e);
  
  p.end();

  bitBlt(this,urect.topLeft(),&pm,QRect(0,0,pm.width(),pm.height()));

}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:67,代码来源:kcolorgrid.cpp

示例2: show

/*
void KColorGrid::show()
{
  //updateScrollBars();
  QWidget::show();
}
*/
void KColorGrid::paintEvent(QPaintEvent *e)
{
  //debug("KColorGrid::paintEvent");

  //updateScrollBars();
  //QWidget::paintEvent(e);

  const QRect urect = e->rect();

  //debug("Update rect = ( %i, %i, %i, %i )",
    //urect.left(),urect.top(), urect.width(), urect.height() );


  int firstcol = getX(urect.x())-1;
  int firstrow = getY(urect.y())-1;
  int lastcol  = getX(urect.right())+1;
  int lastrow  = getY(urect.bottom())+1;

  QWMatrix matrix;
  QPainter p;
  p.begin( this );

  firstrow = (firstrow < 0) ? 0 : firstrow;
  firstcol = (firstcol < 0) ? 0 : firstcol;
  lastrow = (lastrow >= rows) ? rows : lastrow;
  lastcol = (lastcol >= cols) ? cols : lastcol;
  //debug("%d x %d  -  row: %d x %d", urect.x(), urect.y(), urect.width(), urect.height());
  //debug("col: %d -> %d  -  row: %d -> %d", firstcol, lastcol, firstrow, lastrow);

/*
  if(this->isA("KDrawGrid"))
    debug("KDrawGrid\n   firstcol: %d\n   lastcol: %d\n   firstrow: %d\n   lastrow: %d",
        firstcol, lastcol, firstrow, lastrow);
*/
  for(int i = firstrow; i < lastrow; i++)
  {
    //if(this->isA("KDrawGrid"))
    //  debug("Updating row %d", i);
    for(int j = firstcol; j < lastcol; j++)
    {
      matrix.translate( (j*cellsize), (i*cellsize) );
      p.setWorldMatrix( matrix );
      //p.setClipRect(j*cellsize, i*cellsize, cellsize, cellsize);
      paintCell(&p, i, j);
      //p.setClipping(FALSE);
      matrix.reset();
      p.setWorldMatrix( matrix );
    }
    //kapp->processEvents();
  }

  p.end();

}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:61,代码来源:kcolorgrid.cpp

示例3: QSize

QSize
ImageView::getProperMatrixAndSize(QWMatrix &mat, QPixmap &img)
{
    int       width, height;
    int       vsplit, hsplit;
    double    scale = 1.0f;

    width = img.width();
    height = img.height();

    switch (m_splitMethod) {
    case IVSM_NONE:
        vsplit = 1;
        hsplit = 1;
        break;
    case IVSM_STATIC:
        vsplit = m_vSplit;
        hsplit = m_hSplit;
        break;
    case IVSM_PORTRAIT:
        hsplit = 1;
        while (width/hsplit>height) hsplit++;
        vsplit = 1;
        break;
    case IVSM_LANDSCAPE:
        vsplit = 1;
        while (height/vsplit>width) hsplit++;
        hsplit = 1;
        break;
    }
    if (hsplit>1)
        width = (width+hsplit-1)/hsplit;
    if (vsplit>1)
        height = (height+vsplit-1)/vsplit;


    switch (m_fitMethod) {
    case IVFM_NONE:
        scale = 1.0f;
        break;
    case IVFM_STATIC:
        scale = m_scaleFactor;
        break;
    case IVFM_WIDTH:
        scale = (double)m_deskSize.width()/width;
        break;
    case IVFM_HEIGHT:
        scale = (double)m_deskSize.height()/height;
        break;
    case IVFM_BOTH:
        scale = (double)m_deskSize.height()/height;
        if ((double)m_deskSize.width()/width<scale)
            scale = (double)m_deskSize.width()/width;
        break;
    }
    if (m_noScaleUp && m_fitMethod!=IVFM_STATIC && scale>1.0f) {
        scale = 1.0f;
    }
    mat.reset();
    mat.scale(scale, scale);

    return QSize(hsplit, vsplit);
}
开发者ID:lanterrt,项目名称:QAView,代码行数:63,代码来源:imageview.cpp


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