static QgsMessageOutput::showMessage()

This commit is contained in:
Radim Blazek 2015-05-20 12:31:40 +02:00
parent 2dfea6a656
commit b89b6a5820
2 changed files with 17 additions and 2 deletions

View File

@ -42,6 +42,15 @@ QgsMessageOutput::~QgsMessageOutput()
{
}
void QgsMessageOutput::showMessage( const QString& title, const QString& message, MessageType msgType )
{
QgsMessageOutput *output = QgsMessageOutput::createMessageOutput();
output->setTitle( title );
output->setMessage( message, msgType );
output->showMessage();
}
////////////////////////////////
// QgsMessageOutputConsole
@ -79,3 +88,4 @@ void QgsMessageOutputConsole::setTitle( const QString& title )
{
mTitle = title;
}

View File

@ -54,16 +54,21 @@ class CORE_EXPORT QgsMessageOutput
//! set title for the messages
virtual void setTitle( const QString& title ) = 0;
//! display the message to the user
//! display the message to the user and deletes itself
virtual void showMessage( bool blocking = true ) = 0;
/** Display the blocking message to the user.
* @note added in 2.10
*/
static void showMessage( const QString& title, const QString& message, MessageType msgType );
//! sets function that will be used to create message output
//! @note not available in python bindings
// TODO: implementation where python class could be passed
static void setMessageOutputCreator( MESSAGE_OUTPUT_CREATOR f );
//! function that returns new class derived from QgsMessageOutput
//! (don't forget to delete it then)
//! (don't forget to delete it then if showMessage(bool) is not used showMessage(bool) deletes the instance)
static QgsMessageOutput* createMessageOutput();
private: