Skip to content
Permalink
Browse files

message log viewer: window isn't closeable and last tab has to stay

(fixes #16220)
  • Loading branch information
jef-n committed Feb 24, 2017
1 parent 2b8487d commit e0c58eb7d7c1da5891bb4ee37a4ed8548c3ac1d1
Showing with 17 additions and 5 deletions.
  1. +12 −2 src/gui/qgsmessagelogviewer.cpp
  2. +5 −3 src/gui/qgsmessagelogviewer.h
@@ -42,6 +42,15 @@ QgsMessageLogViewer::QgsMessageLogViewer( QStatusBar *statusBar, QWidget *parent
connect( tabWidget, SIGNAL( tabCloseRequested( int ) ), this, SLOT( closeTab( int ) ) );
}

void QgsMessageLogViewer::closeEvent( QCloseEvent *e )
{
e->ignore();
}

void QgsMessageLogViewer::reject()
{
}

void QgsMessageLogViewer::logMessage( QString message, QString tag, QgsMessageLog::MessageLevel level )
{
if ( tag.isNull() )
@@ -63,6 +72,7 @@ void QgsMessageLogViewer::logMessage( QString message, QString tag, QgsMessageLo
w->setReadOnly( true );
tabWidget->addTab( w, tag );
tabWidget->setCurrentIndex( tabWidget->count() - 1 );
tabWidget->setTabsClosable( true );
}

QString prefix = QStringLiteral( "%1\t%2\t" )
@@ -74,6 +84,6 @@ void QgsMessageLogViewer::logMessage( QString message, QString tag, QgsMessageLo

void QgsMessageLogViewer::closeTab( int index )
{
if ( tabWidget->count() > 1 )
tabWidget->removeTab( index );
tabWidget->removeTab( index );
tabWidget->setTabsClosable( tabWidget->count() > 1 );
}
@@ -25,9 +25,7 @@
#include "qgis_gui.h"

class QStatusBar;
class QToolButton;
class QShowEvent;
class QHideEvent;
class QCloseEvent;

/** \ingroup gui
* A generic dialog widget for displaying QGIS log messages.
@@ -41,6 +39,10 @@ class GUI_EXPORT QgsMessageLogViewer: public QDialog, private Ui::QgsMessageLogV
public slots:
void logMessage( QString message, QString tag, QgsMessageLog::MessageLevel level );

protected:
void closeEvent( QCloseEvent *e ) override;
void reject() override;

private slots:
void closeTab( int index );
};

0 comments on commit e0c58eb

Please sign in to comment.
You can’t perform that action at this time.