c++ - Qt - Why add '&' to the string? -
qpushbutton *quitbutton = new qpushbutton("&quit");
why add &
quit
? removing &
, seems code behaves same.
the ampersand makes button respond particular key-combination. in case, if press alt + q force button pushed.
from qt
the qpushbutton widget provides command button.
the push button, or command button, perhaps commonly used widget in graphical user interface. push (click) button command computer perform action, or answer question. typical buttons ok, apply, cancel, close, yes, no , help.
a command button rectangular , typically displays text label describing action. shortcut key can specified preceding preferred character ampersand in text. example:
qpushbutton *button = new qpushbutton("&download", this);
in example shortcut alt+d. see qshortcut documentation details (to display actual ampersand, use '&&').
Comments
Post a Comment