When having a long text applied to a QToolbutton it overlaps the menu button for the right click menu like the following:
The code for the Button
TestWindow::TestWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::TestWindow)
{
ui->setupUi(this);
QMenu *menu = new QMenu();
QAction *testAction = new QAction(QLatin1String("testAction"), this);
menu->addAction(testAction);
ui->toolButton->setMenu(menu);
ui->toolButton->setText(QLatin1String("This is a long Text that should not overlap"));
ui->toolButton->setPopupMode(QToolButton::InstantPopup);
}
The toolbutton is just part of a horizontal layout of the central widget.
Is there an easy way to prevent this by e.g. cropping the text?