本文主要是介绍QPushButton显示“”,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
上周碰到的问题:画逻辑运算符的按钮,结果画“&”时显示为空。找到Qt assistant:
QPushButton::setText(const QString &text)
text : QString
This property holds the text shown on the button.
If the button has no text, the text() function will return a an empty string.
If the text contains an ampersand character ('&'), a shortcut is automatically created for it. The character that follows the '&' will be used as the shortcut key. Any previous shortcut will be overwritten, or cleared if no shortcut is defined by the text. See the QShortcut documentation for details (to display an actual ampersand, use '&&').
There is no default text.
Access functions:
QString | text () const |
void | setText ( const QString & text ) |
同样的在QGroupBox中,也是一样
QGroupBox::setTitle(const QString &title)
title : QString
This property holds the group box title text.
The group box title text will have a keyboard shortcut if the title contains an ampersand ('&') followed by a letter.
g->setTitle("&User information");
In the example above, Alt+U moves the keyboard focus to the group box. See the QShortcut documentation for details (to display an actual ampersand, use '&&').
There is no default title text.
Access functions:
QString | title () const |
void | setTitle ( const QString & title ) |
See also alignment.
这篇关于QPushButton显示“”的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!