示例#1
0
void KBBGraphic::resizeEvent( QResizeEvent*  )
{
    int w = QWidget::width();
    int h = QWidget::height();
    int wNew, hNew;

    //  kbDebug() << w << " " << h << " " << minW << " " << minH << endl;
    if (w > minW) {
        wNew = w / numC();
    } else {
        wNew = CELLW;
    }
    if (h > minH) {
        hNew = h / numR();
    } else {
        hNew = CELLH;
    }
    if (pix != NULL) scalePixmaps( wNew, hNew );
    setCellWidth( wNew );
    setCellHeight( hNew );

    delete drawBuffer;
    drawBuffer = new QPixmap( cellW * numRows, cellH * numCols );
}
示例#2
0
void KBBGraphic::resizeEvent( QResizeEvent* e )
{
  int w = QWidget::width();
  int h = QWidget::height();
  int wNew, hNew;

  //  debug("%d %d %d %d", w, h, minW, minH );
  if (w > minW) {
    wNew = w / numC();
  } else {
    wNew = CELLW;
  }
  if (h > minH) {
    hNew = h / numR();
  } else {
    hNew = CELLH;
  }
  if (pix != NULL) scalePixmaps( wNew, hNew );
  setCellWidth( wNew );
  setCellHeight( hNew );

  if (drawBuffer != NULL) delete drawBuffer;
  drawBuffer = new QPixmap( cellW * numRows, cellH * numCols );
}