• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • KTextEditor
  • MessageInterface
Public Member Functions | List of all members
KTextEditor::MessageInterface Class Referenceabstract
Document Extension Interfaces

#include <messageinterface.h>

Public Member Functions

 MessageInterface ()
 
virtual ~MessageInterface ()
 
virtual bool postMessage (Message *message)=0
 

Detailed Description

Message interface for posting interactive Messages to a Document and its Views.

This interface allows to post Messages to a Document. The Message then is shown either the specified View if Message::setView() was called, or in all Views of the Document.

Working with Messages

To post a message, you first have to cast the Document to this interface, and then create a Message. Example:

// doc is of type KTextEditor::Document*
KTextEditor::MessageInterface *iface =
qobject_cast<KTextEditor::MessageInterface*>( doc );
if( !iface ) {
// the implementation does not support the interface
return;
}
// always use a QPointer go guard your Message, if you keep a pointer
// after calling postMessage()
QPointer<Message> message = new Message("text", Message::Information);
message->setWordWrap(true);
message->addAction(...); // add your actions...
iface->postMessage(message);
// The Message is deleted automatically if the Message gets closed,
// meaning that you usually can forget the pointer.
// If you really need to delete a message before the user processed it,
// guard it with a QPointer!
See also
Message
Author
Dominik Haumann <dhaum.nosp@m.ann@.nosp@m.kde.o.nosp@m.rg>
Since
KDE 4.11

Definition at line 399 of file messageinterface.h.

Constructor & Destructor Documentation

KTextEditor::MessageInterface::MessageInterface ( )

Default constructor, for internal use.

Definition at line 179 of file messageinterface.cpp.

KTextEditor::MessageInterface::~MessageInterface ( )
virtual

Destructor, for internal use.

Definition at line 184 of file messageinterface.cpp.

Member Function Documentation

virtual bool KTextEditor::MessageInterface::postMessage ( Message *  message)
pure virtual

Post message to the Document and its Views.

If multiple Messages are posted, the one with the highest priority is shown first.

Usually, you can simply forget the pointer, as the Message is deleted automatically, once it is processed or the document gets closed.

If the Document does not have a View yet, the Message is queued and shown, once a View for the Document is created.

Parameters
messagethe message to show
Returns
true, if message was posted. false, if message == 0.

The documentation for this class was generated from the following files:
  • messageinterface.h
  • messageinterface.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal