QString QPainter

1.           += 才是累加;

2.          list 遍历用法

list<double>::iterator iter;
 for (iter = lstPercent.begin() ; iter != lstPercent.end(); iter++)
 {  
  m_lstNumber.append(*iter);
  m_add_number += *iter;
 } 

 

3.char a[60];  如果是char* 必须先开辟内存空间
 float my_prop = m_lstPercent.at(i)*100;
  sprintf(a,"%2.1f%%",my_prop);
 QString str = QString(QLatin1String(a));

 

4.painter.drawText(x - 20, y-10, 40, 20, Qt::AlignCenter, str);   painter的用法。

QPainter painter;

painter.setRenderHint(QPainter::Antialiasing, true); //设置平滑
 painter.setPen(Qt::NoPen);

 

 this->setWindowFlags(Qt::FramelessWindowHint);
    pixmap = new QPixmap(":/images/images/window_1024X768.png");
    pixmap2 = new QPixmap(":/images/images/ball_red_100.png");
    QSize size = pixmap->size();
    this->resize(pixmap->size());
    this->setMask(pixmap->mask());
    QPalette palette;
    palette.setBrush(this->backgroundRole(),QBrush(*(pixmap)));
    setPalette(palette);

   this->setAutoFillBackground(true);

你可能感兴趣的:(QString QPainter)