由於不同的字用不同的樣式,所以需要用到html來設定:
//add take buttons with tips
//設置text和樣式
QTextDocument Text_finish;
Text_finish.setHtml("<font size='28' color='white'>取貨完成</font><br><font size='4' color='white'>請先関好蓋並拉好門</font>");
//放入pixmap中
QPixmap pixmap_finish(Text_finish.size().width(), Text_finish.size().height());
pixmap_finish.fill( Qt::transparent );
//使用painter畫
QPainter painter_finish( &pixmap_finish );
Text_finish.drawContents(&painter_finish, pixmap_finish.rect());
QIcon ButtonIcon_finish(pixmap_finish);
ui->btn_take_takepage_finish->setIcon(ButtonIcon_finish);
ui->btn_take_takepage_finish->setIconSize(pixmap_finish.rect().size());