ui.label是QLabel
ui.label_4->setText("some text");
//设置字号
QFont ft;
ft.setPointSize(12);
ui.label_4->setFont(ft);
//设置颜色
QPalette pa;
pa.setColor(QPalette::WindowText,Qt::red);
ui.label_4->setPalette(pa);
------------------------------
QLabel可以保存图片,显示图片,见:
void screenshot::shotScreen()
{
pixmap=QPixmap::grabWindow(QApplication::desktop()->winId());
ui->screenLabel->setPixmap(pixmap.scaled(ui->screenLabel->size()));
this->timer->stop();
this->show();
}
这个是 单线程妞写的一个截图程序,主要使用 pixmap=QPixmap::grabWindow(QApplication::desktop()->winId()); 然后把图片显示在label上。