7 changes: 6 additions & 1 deletion src/gui/qgsmaptool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
#include <QAbstractButton>

QgsMapTool::QgsMapTool( QgsMapCanvas* canvas )
: QObject( canvas ), mCanvas( canvas ), mCursor( Qt::CrossCursor ), mAction( NULL ), mButton( NULL )
: QObject( canvas )
, mCanvas( canvas )
, mCursor( Qt::CrossCursor )
, mAction( NULL )
, mButton( NULL )
, mToolName( QString() )
{
}

Expand Down
18 changes: 18 additions & 0 deletions src/gui/qgsmaptool.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define QGSMAPTOOL_H

#include "qgsconfig.h"
#include "qgsmessagebar.h"

#include <QCursor>
#include <QString>
Expand Down Expand Up @@ -45,6 +46,9 @@ class QAbstractButton;
*/
class GUI_EXPORT QgsMapTool : public QObject
{

Q_OBJECT

public:

//! virtual destructor
Expand Down Expand Up @@ -121,6 +125,18 @@ class GUI_EXPORT QgsMapTool : public QObject
//! returns pointer to the tool's map canvas
QgsMapCanvas* canvas();

//! Emit map tool changed with the old tool
//! @note added in 2.3
QString toolName() { return mToolName; }

signals:
//! emit a message
void displayMessage( QString message );
void displayMessage( QString message, QgsMessageBar::MessageLevel );

//! emit signal to clear previous message
void removeMessage();

protected:

//! constructor takes map canvas as a parameter
Expand Down Expand Up @@ -158,6 +174,8 @@ class GUI_EXPORT QgsMapTool : public QObject
//! which will be used to set that action as active
QAbstractButton* mButton;

//! translated name of the map tool
QString mToolName;
};

#endif
4 changes: 2 additions & 2 deletions src/gui/qgsmessagebaritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ void QgsMessageBarItem::writeContent()
{
// add ':' to end of title
QString t = mTitle.trimmed();
if ( !t.endsWith( ":" ) && !content.isEmpty() )
if ( !content.isEmpty() && !t.endsWith( ":" ) && !t.endsWith( ": " ) )
t += ": ";
content.prepend( QString( "<b>" ) + t + "</b>" );
content.prepend( QString( "<b>" ) + t + " </b>" );
}
mTextEdit->setText( content );
}
Expand Down