qt - Handling mouseevent in QStatusBar -


In my status prompt, I added a QLabel inside which I am displaying some message . Now what do I want to do when I click on that code in QLabel ( QStatusBar ), the message should be missing.

The added status is added to the following:

  QLabel * cpyrightlbl = new QLabel (); Ui.statusBar-> AddWidget (cpyrightlbl); Cpyrightlbl- & gt; Set text ("demo message"); Cpyrightlbl- & gt; Set stylesheet ("border: 3px"); Cpyrightlbl- & gt; SetFixedWidth (.frameGameometry () width ()); Cpyrightlbl- & gt; Show (); You should create your own category from  QLabel  And then the function  QLabel :: mousePressEvent (QMouseEvent * ev) .  
  Repeat the zero CMyLabel :: mousePressEvent (QMouseEvent * ev) function {if (& gt; Button) == QT :: LeftButton} {This-> clear (); // or // it- & gt; Set text (""); } QLabel :: Mousepress Event (Eve); }   


Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -