Skip to content

Commit

Permalink
Do not show tooltips from message log viewer during QGIS startup.
Browse files Browse the repository at this point in the history
Showing them leads to disturbing effects while loading the GUI
  • Loading branch information
wonder-sk committed Jun 17, 2014
1 parent a745127 commit 1e94fd5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions python/gui/qgsmessagelogviewer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class QgsMessageLogViewer: QDialog
QgsMessageLogViewer( QStatusBar *statusBar = 0, QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
~QgsMessageLogViewer();

//! @note added in 2.4
void setShowToolTips( bool enabled );
//! @note added in 2.4
bool showToolTips() const;

public slots:
void logMessage( QString message, QString tag, QgsMessageLog::MessageLevel level );

Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
mLastMapToolMessage = 0;

mLogViewer = new QgsMessageLogViewer( statusBar(), this );
mLogViewer->setShowToolTips( false );

mLogDock = new QDockWidget( tr( "Log Messages" ), this );
mLogDock->setObjectName( "MessageLog" );
Expand Down Expand Up @@ -853,6 +854,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
toggleFullScreen();
#endif

mLogViewer->setShowToolTips( true );
} // QgisApp ctor

QgisApp::QgisApp( )
Expand Down
4 changes: 3 additions & 1 deletion src/gui/qgsmessagelogviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ QgsMessageLogViewer::QgsMessageLogViewer( QStatusBar *statusBar, QWidget *parent
: QDialog( parent, fl )
, mButton( 0 )
, mCount( 0 )
, mShowToolTips( true )
{
setupUi( this );

Expand Down Expand Up @@ -119,7 +120,8 @@ void QgsMessageLogViewer::logMessage( QString message, QString tag, QgsMessageLo
if ( !isVisible() && level > QgsMessageLog::INFO )
{
mButton->show();
QToolTip::showText( mButton->mapToGlobal( QPoint( 0, 0 ) ), mButton->toolTip() );
if ( mShowToolTips )
QToolTip::showText( mButton->mapToGlobal( QPoint( 0, 0 ) ), mButton->toolTip() );
}

if ( tag.isNull() )
Expand Down
6 changes: 6 additions & 0 deletions src/gui/qgsmessagelogviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class GUI_EXPORT QgsMessageLogViewer: public QDialog, private Ui::QgsMessageLogV
QgsMessageLogViewer( QStatusBar *statusBar = 0, QWidget *parent = 0, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );
~QgsMessageLogViewer();

//! @note added in 2.4
void setShowToolTips( bool enabled ) { mShowToolTips = enabled; }
//! @note added in 2.4
bool showToolTips() const { return mShowToolTips; }

public slots:
void logMessage( QString message, QString tag, QgsMessageLog::MessageLevel level );

Expand All @@ -49,6 +54,7 @@ class GUI_EXPORT QgsMessageLogViewer: public QDialog, private Ui::QgsMessageLogV
private:
QToolButton *mButton;
int mCount;
bool mShowToolTips;

private slots:
void closeTab( int index );
Expand Down

0 comments on commit 1e94fd5

Please sign in to comment.