0
我想在QToolButton
中使用HTML格式。例如在这张图片中,我应该在“Sara”和“Online”中创建QToolButton
。QToolButton不支持HTML
这里是我的代码:
viewControl=new QToolButton(this);
QString labelText = "<P><b><i><FONT COLOR='#fff'>";
labelText .append("Sara");
labelText .append("</i></b></P></br>");
labelText .append("online");
viewControl->setText(labelText);
如何解决?
我还在QToolButton
中使用了布局,但它显示出空白框。
QVBoxLayout *titleLayout = new QVBoxLayout();
QLabel *nameLabel = new QLabel("Name");
QLabel *onlineLabel = new QLabel ("online");
titleLayout->addWidget(nameLabel);
titleLayout->addWidget(onlineLabel);
viewControl->setLayout(titleLayout);
为什么你认为你可以在QToolButton中使用html? – perencia
我在QLabel中使用了html,我想我可以在QToolButton中使用它。 @perencia – AFN
你有没有试过? http://libqxt.bitbucket.org/doc/tip/qxtpushbutton.html – ramtheconqueror