Important: Please read the Qt Code of Conduct -

ToolTip is not showing text

  • Hi,

    I have problems with some of mine tooltips in my application.
    The tooltips rectangle is showed correctly, but there is no text into it although I've set it using setToolTip.
    The QToolButton have been put in a toolbar. That's the code:

        tileVertical = new QToolButton(ui->toolBar);
        tileVertical->setStyleSheet("background-color:black; color:white");
        tileVertical->setText(tr("Posiziona verticalmente"));
        tileVertical->setToolTip(tr("Posiziona verticalmente"));
        connect(tileVertical, SIGNAL(clicked()), this, SLOT(on_actionTileVertical_triggered()));

    Any advice on this? It would be very helpful.

    Thanks in advance

    Davide Salvetti

  • @davidesalvetti said in ToolTip is not showing text:

    Any advice on this?

    That is because of StyleSheet.

  • @Ratzz Thank you for the answer.

    Changing this line:

    tileVertical->setStyleSheet("background-color:black; color:white");

    to this:

    tileVertical->setStyleSheet("QToolButton{background-color:black; color:white;}QToolButton QWidget{color:black;}");

    worked for me.

Log in to reply