Handling mouseevent in Qstatusbar .
In my statusbar , i have added one Qlabel inside which i am displaying some message . Now what i want is when i click on that Qlabel(present inside the Qstatusbar ) , the message should disappear ..
I have added the label inside statusbar as follows ,
7 replies
Why do you want to use a mouseClick on the status bar message.. You can also dispay the message for a particular time interval and it will disappear after timeout.
check this [qt-project.org]
i have done as u said above , but it has no impact ..
Here i am mentioning my code
inside display.h
- #ifndef MSGDISPLAY_H
- #define MSGDISPLAY_H
- #include <QLabel>
- {
- Q_OBJECT
- public:
- ~MsgDisplay();
- protected:
- };
- #endif // MSGDISPLAY_H
- inside display.cpp
- #include "MsgDisplay.h"
- {
- }
- {
- setText("<font color='Blue'>Demo Message<font>");
- QFont font;
- font.setPointSize(10);
- font.setBold(true);
- setFont(font);
- }
- MsgDisplay::~MsgDisplay()
- {
- }
- {
- hide();
- }
- inside Myclass.cpp
- #include display.h
- void Myclass::Label()
- {
- MsgDisplay *statusLabel = new MsgDisplay();
- ui.statusBar->addWidget(statusLabel);
- }
I got the solution for the above one ..
Now i am running through one more problem i.e when i minimize my main application window the status bar message is getting truncated . Is there any way to resolve this issue ? I mean to say the same message shall be displayed without any trucation during minimizing and maximizing .
You must log in to post a reply. Not a member yet? Register here!





