Salome HOME
Prevent status bar messages hiding by toolbuttons actions
authorjfa <jfa@opencascade.com>
Tue, 4 Oct 2005 10:15:17 +0000 (10:15 +0000)
committerjfa <jfa@opencascade.com>
Tue, 4 Oct 2005 10:15:17 +0000 (10:15 +0000)
src/SUIT/SUIT_Application.cxx
src/SUIT/SUIT_Application.h

index 7d5b6d99c0b97c6a156e2880bcf5cb2b654f2a7b..f9d210d5527226be6fa2b377f45edcf612ad43e4 100755 (executable)
@@ -4,6 +4,8 @@
 #include "SUIT_Desktop.h"
 #include "SUIT_ResourceMgr.h"
 
+#include <qlabel.h>
+#include <qtimer.h>
 #include <qstatusbar.h>
 
 #include <QtxAction.h>
@@ -13,7 +15,8 @@
 SUIT_Application::SUIT_Application()
 : QObject( 0 ),
 myStudy( 0 ),
-myDesktop( 0 )
+myDesktop( 0 ),
+myStatusLabel( 0 )
 { 
 }
 
@@ -89,8 +92,15 @@ SUIT_ResourceMgr* SUIT_Application::resourceMgr() const
 #define DEFAULT_MESSAGE_DELAY 3000
 void SUIT_Application::putInfo ( const QString& msg, const int msec )
 {
-  if ( desktop() )
-    desktop()->statusBar()->message( msg, msec <= 0 ? DEFAULT_MESSAGE_DELAY : msec );
+  if ( desktop() ) {
+    //desktop()->statusBar()->message( msg, msec <= 0 ? DEFAULT_MESSAGE_DELAY : msec );
+    if ( !myStatusLabel ) {
+      myStatusLabel = new QLabel (desktop()->statusBar());
+      desktop()->statusBar()->addWidget(myStatusLabel, /*int stretch = */1);
+    }
+    myStatusLabel->setText(msg);
+    QTimer::singleShot(msec <= 0 ? DEFAULT_MESSAGE_DELAY : msec, myStatusLabel, SLOT(clear()));
+  }
 }
 
 SUIT_Application* SUIT_Application::startApplication( int argc, char** argv ) const
index 1961d77b4858b2c85f8699cd2d082d26b2a69588..283d546de6103c869087bd5012a8651aa376bd70 100755 (executable)
@@ -14,6 +14,7 @@ class SUIT_ViewModel;
 class SUIT_ResourceMgr;
 class QString;
 class QIconSet;
+class QLabel;
 /*! \class QObject
  * \brief For more information see <a href="http://doc.trolltech.com">QT documentation</a>.
  */
@@ -133,6 +134,8 @@ protected slots:
 private:
   SUIT_Study*           myStudy;
   SUIT_Desktop*         myDesktop;
+
+  QLabel*               myStatusLabel;
 };
 
 //! This function must return a new application instance.