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. QToolTip opacity
Forum Updated to NodeBB v4.3 + New Features

QToolTip opacity

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 5 Posters 2.2k Views 2 Watching
  • 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.
  • M minjunkim

    hi,

    i want to use QToolTip transparently

    i found few solutions in doc.qt

    QToolTip { opacity: 100;} is the solution

    i try it but does not work..

    What is the correct way?

    i think that i have to apply some code like this(setAttribute(Qt::WA_TranslucentBackground, true);)

    What am I doing wrong?

    my code is

    mybutton->setToolTip("this test");

    setStyleSheet("QToolTip { border: 2px solid darkkhaki; padding: 5px; border-radius: 3px; opacity: 100; }");

    J.HilkJ Offline
    J.HilkJ Offline
    J.Hilk
    Moderators
    wrote on last edited by
    #2

    @minjunkim said in QToolTip opacity:

    setStyleSheet("QToolTip { border: 2px solid darkkhaki; padding: 5px; border-radius: 3px; opacity: 100; }");

    setStyleSheet("QToolTip { border: 2px solid darkkhaki; padding: 5px; border-radius: 3px; background-color: rgba(255,255,0,0); }");


    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


    Q: What's that?
    A: It's blue light.
    Q: What does it do?
    A: It turns blue.

    M 1 Reply Last reply
    2
    • J.HilkJ J.Hilk

      @minjunkim said in QToolTip opacity:

      setStyleSheet("QToolTip { border: 2px solid darkkhaki; padding: 5px; border-radius: 3px; opacity: 100; }");

      setStyleSheet("QToolTip { border: 2px solid darkkhaki; padding: 5px; border-radius: 3px; background-color: rgba(255,255,0,0); }");

      M Offline
      M Offline
      minjunkim
      wrote on last edited by
      #3

      @J.Hilk

      thank you for reply

      I applied your suggestion.

      result is

      0_1541053314911_result.png

      i think that something remains

      mrjjM 1 Reply Last reply
      0
      • M minjunkim

        @J.Hilk

        thank you for reply

        I applied your suggestion.

        result is

        0_1541053314911_result.png

        i think that something remains

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #4

        @minjunkim

        Hi what platform are you on ?
        I had issue on windows 8/10 to make it transparent.

        M J.HilkJ 2 Replies Last reply
        3
        • mrjjM mrjj

          @minjunkim

          Hi what platform are you on ?
          I had issue on windows 8/10 to make it transparent.

          M Offline
          M Offline
          minjunkim
          wrote on last edited by
          #5

          @mrjj

          Hi,

          I 'm using the window10 platform.

          Is this a platform-specific issue?

          Is there any solution?

          mrjjM 1 Reply Last reply
          0
          • mrjjM mrjj

            @minjunkim

            Hi what platform are you on ?
            I had issue on windows 8/10 to make it transparent.

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #6

            @mrjj jep that's the issue.

            on windows I have the same issues as the op with the stylesheet and on macOS It works as intended:
            0_1541055180234_Bildschirmfoto 2018-11-01 um 07.52.10.png


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            2
            • M minjunkim

              @mrjj

              Hi,

              I 'm using the window10 platform.

              Is this a platform-specific issue?

              Is there any solution?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #7

              @minjunkim

              I never got it to work on win 10. ( worked fine in linux, win 7)
              I didn't find any solutions back then but maybe
              other have found way now.

              M 1 Reply Last reply
              1
              • mrjjM mrjj

                @minjunkim

                I never got it to work on win 10. ( worked fine in linux, win 7)
                I didn't find any solutions back then but maybe
                other have found way now.

                M Offline
                M Offline
                minjunkim
                wrote on last edited by
                #8

                @mrjj , @J-Hilk

                thank you!

                The information has helped a lot.

                Let me try to solve it.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  minjunkim
                  wrote on last edited by
                  #9

                  I gave up. I would be create custom class and use it.

                  1 Reply Last reply
                  1
                  • D Offline
                    D Offline
                    Dominikanetz
                    wrote on last edited by
                    #10

                    I know this topic is too old but think it help anyone else.
                    If set stylesheet right after initialisatioin of QApplication like that

                    QApplication a(argc, argv);
                    qApp->setStyleSheet("QToolTip {opacity: 150;}"); 
                    

                    it's take effect.

                    Then you can just change background or font colors in widgets

                    mybutton->setToolTip("this test");
                    mybutton->setStyleSheet("QToolTip {background-color: rgb(0, 0, 0); color: rgb(200, 200, 200);}");
                    
                    C 1 Reply Last reply
                    2
                    • D Dominikanetz

                      I know this topic is too old but think it help anyone else.
                      If set stylesheet right after initialisatioin of QApplication like that

                      QApplication a(argc, argv);
                      qApp->setStyleSheet("QToolTip {opacity: 150;}"); 
                      

                      it's take effect.

                      Then you can just change background or font colors in widgets

                      mybutton->setToolTip("this test");
                      mybutton->setStyleSheet("QToolTip {background-color: rgb(0, 0, 0); color: rgb(200, 200, 200);}");
                      
                      C Offline
                      C Offline
                      cawell
                      wrote on last edited by
                      #11

                      @Dominikanetz it doesn't work on linux

                      D 1 Reply Last reply
                      0
                      • C cawell

                        @Dominikanetz it doesn't work on linux

                        D Offline
                        D Offline
                        Dominikanetz
                        wrote on last edited by
                        #12

                        @cawell which version of Qt? Unfortunately this has a direct relationship. On version 5.9, everything worked fine everywhere. At 5.12 it was broken and it worked as I mentioned above. I didn't look further

                        1 Reply Last reply
                        1

                        • Login

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