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

Interfaces

Public Member Functions | Protected Member Functions | List of all members
KRegExpEditorInterface Class Referenceabstract

#include <kregexpeditorinterface.h>

Public Member Functions

virtual ~KRegExpEditorInterface ()
 
virtual void doSomething (QString method, void *arguments)=0
 
virtual void redo ()=0
 
virtual QString regExp () const =0
 
virtual void setMatchText (const QString &)=0
 
virtual void setRegExp (const QString &regexp)=0
 
virtual void undo ()=0
 

Protected Member Functions

virtual void canRedo (bool)=0
 
virtual void canUndo (bool)=0
 
virtual void changes (bool)=0
 

Detailed Description

A graphical editor for regular expressions.

Author
Jesper K. Pedersen black.nosp@m.ie@k.nosp@m.de.or.nosp@m.g

The actual editor is located in kdeutils, with an interface in kdelibs. This means that it is a bit more comlicated to create an instance of the editor, but only a little bit more complicated.

To check if kregexpeditor in kdeutils is installed and available use this line:

bool installed=!KTrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty();

The following is a template for what you need to do to create an instance of the regular expression dialog:

QDialog *editorDialog = KServiceTypeTrader::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor" );
if ( editorDialog ) {
// kdeutils was installed, so the dialog was found fetch the editor interface
KRegExpEditorInterface *editor = static_cast<KRegExpEditorInterface *>( editorDialog->qt_cast( "KRegExpEditorInterface" ) );
Q_ASSERT( editor ); // This should not fail!
// now use the editor.
editor->setRegExp("^kde$");
// Finally exec the dialog
editorDialog->exec();
}
else {
// Don't offer the dialog.
}

Note: signals and slots must be connected to the editorDialog object, not to the editor object:

connect( editorDialog, SIGNAL( canUndo( bool ) ), undoBut, SLOT( setEnabled( bool ) ) );

If you want to create an instance of the editor widget, i.e. not the dialog, then you must do it in the following way:

QWidget *editorWidget =
KServiceTypeTrader::createInstanceFromQuery<QWidget>(
"KRegExpEditor/KRegExpEditor", QString(), parent );
if ( editorWidget ) {
// kdeutils was installed, so the widget was found fetch the editor interface
KRegExpEditorInterface *editor = static_cast<KRegExpEditorInterface *>( editorWidget->qt_cast( "KRegExpEditorInterface" ) );
Q_ASSERT( editor ); // This should not fail!
// now use the editor.
editor->setRegExp("^kde$");
// Finally insert the widget into the layout of its parent
layout->addWidget( editorWidget );
}
else {
// Don't offer the editor widget.
}

Definition at line 94 of file kregexpeditorinterface.h.

Constructor & Destructor Documentation

virtual KRegExpEditorInterface::~KRegExpEditorInterface ( )
inlinevirtual

Definition at line 103 of file kregexpeditorinterface.h.

Member Function Documentation

virtual void KRegExpEditorInterface::canRedo ( bool  )
protectedpure virtual

This signal tells whether redo is available.

virtual void KRegExpEditorInterface::canUndo ( bool  )
protectedpure virtual

This signal tells whether undo is available.

virtual void KRegExpEditorInterface::changes ( bool  )
protectedpure virtual

This signal is emitted whenever the regular expression changes.

The argument is true when the regular expression is different from the loaded regular expression and false when it is equal to the loaded regular expression.

virtual void KRegExpEditorInterface::doSomething ( QString  method,
void *  arguments 
)
pure virtual

This method allows for future changes that will not break binary compatibility.

DO NOT USE!

KDE has a policy of keeping binary compatibility for all major version of KDE. This means that new methods can not be added to this API before KDE version 4.0.

This method is an escape door for that.

Conclusion: You should not use this method in this version of KDE!

virtual void KRegExpEditorInterface::redo ( )
pure virtual
virtual QString KRegExpEditorInterface::regExp ( ) const
pure virtual

returns the regular expression of the editor in Qt3 QRegExp syntax.

Note, there is also a 'regexp' Qt property available.

virtual void KRegExpEditorInterface::setMatchText ( const QString &  )
pure virtual

Set text to use when showing matches.

NOT IMPLEMENTED YET!

This method is not yet implemented. In later version of the widget this method will be used to give the widget a text to show matches of the regular expression on.

virtual void KRegExpEditorInterface::setRegExp ( const QString &  regexp)
pure virtual

Set the regular expression for the editor.

The syntax must be Qt3 QRegExp syntax.

virtual void KRegExpEditorInterface::undo ( )
pure virtual

The documentation for this class was generated from the following file:
  • kregexpeditorinterface.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:52:10 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Interfaces

Skip menu "Interfaces"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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