Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ToolTip is not showing text
Forum Updated to NodeBB v4.3 + New Features

ToolTip is not showing text

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    davidesalvetti
    wrote on last edited by davidesalvetti
    #1

    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->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        tileVertical->setIcon(QIcon(":/rec/img/TileH.png"));
        tileVertical->setIconSize(QSize(32,32));
        tileVertical->setStyleSheet("background-color:black; color:white");
        tileVertical->setText(tr("Posiziona verticalmente"));
        tileVertical->setToolTip(tr("Posiziona verticalmente"));
        tileVertical->setFocusPolicy(Qt::NoFocus);
        ui->toolBar->addWidget(tileVertical);
        connect(tileVertical, SIGNAL(clicked()), this, SLOT(on_actionTileVertical_triggered()));
    

    Any advice on this? It would be very helpful.

    Thanks in advance


    Davide Salvetti

    RatzzR 1 Reply Last reply
    0
    • D davidesalvetti

      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->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
          tileVertical->setIcon(QIcon(":/rec/img/TileH.png"));
          tileVertical->setIconSize(QSize(32,32));
          tileVertical->setStyleSheet("background-color:black; color:white");
          tileVertical->setText(tr("Posiziona verticalmente"));
          tileVertical->setToolTip(tr("Posiziona verticalmente"));
          tileVertical->setFocusPolicy(Qt::NoFocus);
          ui->toolBar->addWidget(tileVertical);
          connect(tileVertical, SIGNAL(clicked()), this, SLOT(on_actionTileVertical_triggered()));
      

      Any advice on this? It would be very helpful.

      Thanks in advance


      Davide Salvetti

      RatzzR Offline
      RatzzR Offline
      Ratzz
      wrote on last edited by
      #2

      @davidesalvetti said in ToolTip is not showing text:

      Any advice on this?

      That is because of StyleSheet.

      --Alles ist gut.

      D 1 Reply Last reply
      3
      • RatzzR Ratzz

        @davidesalvetti said in ToolTip is not showing text:

        Any advice on this?

        That is because of StyleSheet.

        D Offline
        D Offline
        davidesalvetti
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved