ui->label->setGeometry(QRect(328, 240, 60, 127*4)); //四倍行距,第一二为位置参数,三四位宽高,*4为行距
ui->label->setWordWrap(true);
ui->label->setAlignment(Qt::AlignTop);
ui->label->setText("hello word jwen A QLabel is often used as a label for an interactive widget. For this use QLabel provides a useful mechanism for adding an accelerator key (see QAccel) that will set the keyboard focus to the other widget");
如果是text里中文则可以直接换行,英文则需要判断空格换行
QFont ft;
ft.setPointSize(12);
ui->all_alarm->setFont(ft);
//设置颜色
QPalette pa;
pa.setColor(QPalette::WindowText,Qt::red);
ui->all_alarm->setPalette(pa);