Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Label in a QToolbar

Tags:

label

qt

qtoolbar

How would you suggest to add a label on a QToolbar ? Since it only accepts action or somethings like that.

Thx

like image 428
Matthieu Riegler Avatar asked Apr 09 '12 21:04

Matthieu Riegler


1 Answers

As abresas wrote, a toolbar can be populated with a QAction. The QString passed along with the QAction is used in several ways (e.g as tooltip), but with 4.8 the default is to show a toolbar button with the icon only. To show the text with the icon, set the toolbar to a Qt::ToolButtonStyle, e.g.

ui->toolBar->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
like image 141
handle Avatar answered Sep 17 '22 05:09

handle