|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.KRegExpEditorInterface
public class KRegExpEditorInterface
A graphical editor for regular expressions. The actual editor is located in kdeutils, with an interface in kdelibs. This means that it is a bit more complicated 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:
boolean 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 = KParts.ComponentFactory.createInstanceFromQueryNote: signals and slots must be connected to the editorDialog object, not to the editor object:( "KRegExpEditor/KRegExpEditor" ); if ( editorDialog ) { // kdeutils was installed, so the dialog was found fetch the editor interface KRegExpEditorInterface editor = (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. }
connect( editorDialog, SIGNAL("canUndo( boolean )"), undoBut, SLOT("setEnabled( boolean )") );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 = KParts.ComponentFactory.createInstanceFromQuery( "KRegExpEditor/KRegExpEditor", null, parent ); if ( editorWidget ) { // kdeutils was installed, so the widget was found fetch the editor interface KRegExpEditorInterface editor = (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. }
Constructor Summary | |
---|---|
protected |
KRegExpEditorInterface(java.lang.Class dummy)
|
Method Summary | |
---|---|
void |
redo()
|
java.lang.String |
regExp()
returns the regular expression of the editor in Qt3 QRegExp syntax. |
void |
setMatchText(java.lang.String arg1)
Set text to use when showing matches. |
void |
setRegExp(java.lang.String regexp)
Set the regular expression for the editor. |
void |
undo()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected KRegExpEditorInterface(java.lang.Class dummy)
Method Detail |
---|
public java.lang.String regExp()
public void setRegExp(java.lang.String regexp)
public void redo()
public void undo()
public void setMatchText(java.lang.String arg1)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |