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. [SOLVED] Implement QBalloonTip
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Implement QBalloonTip

Scheduled Pinned Locked Moved General and Desktop
13 Posts 2 Posters 6.3k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #2

    Hi, can't find a QBalloonTip class in the documentation. Can you please provide a link to that class in the documentation?

    kapsuleK 1 Reply Last reply
    0
    • ? A Former User

      Hi, can't find a QBalloonTip class in the documentation. Can you please provide a link to that class in the documentation?

      kapsuleK Offline
      kapsuleK Offline
      kapsule
      wrote on last edited by kapsule
      #3

      Hi @Wieland,

      The reference can be found at the following link. That's all I could find.

      http://cep.xray.aps.anl.gov/software/qt4-x11-4.2.2-browser/d7/d10/class_q_balloon_tip.html

      What I'm trying to find something like this.

      http://stackoverflow.com/questions/23523211/qt-tooltip-with-arrow

      Thanks.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #4

        Ah! Found it in the Qt4.5.3 sources: http://qt4-x11.sourcearchive.com/documentation/4.5.3really4.5.2/src_2gui_2util_2qsystemtrayicon__p_8h_source.html . QBalloonTip isn't part of the public API but defined in the (private) internals of of QSystemTrayIcon: qsystemtrayicon_p.h. You said that you included qsystemtrayicon.h, but you need to include qsystemtrayicon_p.h to use QBalloonTip. Of course you're free to do so, but I can only discourage you from doing this.

        kapsuleK 1 Reply Last reply
        0
        • ? A Former User

          Ah! Found it in the Qt4.5.3 sources: http://qt4-x11.sourcearchive.com/documentation/4.5.3really4.5.2/src_2gui_2util_2qsystemtrayicon__p_8h_source.html . QBalloonTip isn't part of the public API but defined in the (private) internals of of QSystemTrayIcon: qsystemtrayicon_p.h. You said that you included qsystemtrayicon.h, but you need to include qsystemtrayicon_p.h to use QBalloonTip. Of course you're free to do so, but I can only discourage you from doing this.

          kapsuleK Offline
          kapsuleK Offline
          kapsule
          wrote on last edited by
          #5

          Hi @Wieland,

          Thank you very much for the information. If it is a private source, you can not be used in a free app?

          Thanks,

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #6

            You can use it! Not being part of the public API means that QBalloonTip could be changed or removed from the next Qt version without any warning. You can not rely on it.

            kapsuleK 2 Replies Last reply
            0
            • ? A Former User

              You can use it! Not being part of the public API means that QBalloonTip could be changed or removed from the next Qt version without any warning. You can not rely on it.

              kapsuleK Offline
              kapsuleK Offline
              kapsule
              wrote on last edited by
              #7

              Hi @Wieland,

              Thank you very much.

              1 Reply Last reply
              0
              • ? A Former User

                You can use it! Not being part of the public API means that QBalloonTip could be changed or removed from the next Qt version without any warning. You can not rely on it.

                kapsuleK Offline
                kapsuleK Offline
                kapsule
                wrote on last edited by
                #8

                Hello again @Wieland

                One question. You know how you could implement this type of popup in QT?

                https://www.dropbox.com/s/as4wc47dd78vxxk/cqj30.jpg?dl=0

                Thanks,

                ? 1 Reply Last reply
                0
                • kapsuleK kapsule

                  Hello again @Wieland

                  One question. You know how you could implement this type of popup in QT?

                  https://www.dropbox.com/s/as4wc47dd78vxxk/cqj30.jpg?dl=0

                  Thanks,

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #9

                  @kapsule Hi! The link is dead!

                  kapsuleK 1 Reply Last reply
                  0
                  • ? A Former User

                    @kapsule Hi! The link is dead!

                    kapsuleK Offline
                    kapsuleK Offline
                    kapsule
                    wrote on last edited by
                    #10

                    @Wieland Hi,

                    Sorry, https://www.dropbox.com/s/zg7xm0hl5zjm8uv/cqj30.jpg?dl=0

                    ? 2 Replies Last reply
                    0
                    • kapsuleK kapsule

                      @Wieland Hi,

                      Sorry, https://www.dropbox.com/s/zg7xm0hl5zjm8uv/cqj30.jpg?dl=0

                      ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #11

                      @kapsule The following should work: First create a new class (say: MyBallonTip) that inhertits QWidget. Override its void QWidget::paintEvent(QPaintEvent *event) so that it draws the desired geometry. Then set its flags to Qt::Window | Qt::WA_TranslucentBackground |Qt::FramelessWindowHint.
                      I have no time to test it right now. Please tell me if it works. See you later!

                      1 Reply Last reply
                      0
                      • kapsuleK kapsule

                        @Wieland Hi,

                        Sorry, https://www.dropbox.com/s/zg7xm0hl5zjm8uv/cqj30.jpg?dl=0

                        ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #12

                        @kapsule Hi again! I just tested what I suggested to you and this works:

                        myballoontip.h

                        #ifndef MYBALLOONTIP_H
                        #define MYBALLOONTIP_H
                        
                        #include <QWidget>
                        
                        class MyBalloonTip : public QWidget
                        {
                            Q_OBJECT
                        public:
                            explicit MyBalloonTip(QWidget *parent = 0);
                            ~MyBalloonTip();
                        
                        protected:
                            void paintEvent(QPaintEvent*);
                        };
                        
                        #endif // MYBALLOONTIP_H
                        

                        myballontip.cpp

                        #include "myballoontip.h"
                        
                        #include <QPaintEvent>
                        #include <QPainter>
                        #include <QPen>
                        #include <QBrush>
                        
                        
                        MyBalloonTip::MyBalloonTip(QWidget *parent) : QWidget(parent)
                        {
                            this->setAttribute(Qt::WA_TranslucentBackground);
                            this->setWindowFlags(Qt::Window |Qt::FramelessWindowHint);
                            this->resize(200,100);
                        }
                        
                        MyBalloonTip::~MyBalloonTip()
                        {
                        }
                        
                        
                        void MyBalloonTip::paintEvent(QPaintEvent*)
                        {
                            QPainter painter(this);
                            QPen pen( QColor("orange") );
                            pen.setWidth(5);
                            painter.setPen(pen);
                            QBrush brush(QColor("lightblue"));
                            painter.setBrush(brush);
                        
                            painter.drawRect(0,0,this->width(), this->height()-50);
                            painter.drawRect(0,0,60,this->height());
                        
                            pen.setColor(QColor("black"));
                            painter.setPen(pen);
                            painter.drawText(20,30, "This is a tooltip!");
                        }
                        

                        This is what the result looks like: https://drive.google.com/file/d/0B2D1UtsPfTx-YnhsVFE1QThuT0E/view?usp=sharing

                        Hope this can serve you as a starting point!
                        Cheers!

                        1 Reply Last reply
                        0
                        • kapsuleK Offline
                          kapsuleK Offline
                          kapsule
                          wrote on last edited by
                          #13

                          Hi @Wieland

                          Perfect, thank you very much. Great job :)

                          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