Qlabel设置字体颜色、大小以及中文显示方法

        //设置字号
        QFont ft;
        ft.setPointSize(20);
        ui.label5->setFont(ft);

        //设置颜色
        QPalette pa;
        pa.setColor(QPalette::WindowText,Qt::red);
        ui.label5->setPalette(pa);
	QString qstr;
    string str = "字符串";
    qstr = (QString(QString::fromLocal8Bit(str.c_str())));
    ui.label7->setText(qstr );

猜你喜欢

转载自blog.csdn.net/weixin_43491924/article/details/87984631