class KTextEditor.Commandabstract class |
|
|
An Editor command line command. Introduction The Command class represents a command for the editor command line. A command simply consists of a string, for example find. To register a command use CommandInterface.registerCommand(). The Editor itself queries the command for a list of accepted strings/commands by calling cmds(). If the command gets invoked the function exec() is called, i.e. you have to implement the reaction in exec(). Whenever the user needs help for a command help() is called. Command Information To provide reasonable information about a specific command there are the following accessor functions for a given command string: - name() returns a label - description() returns a descriptive text - category() returns a category into which the command fits. These getters allow KTextEditor implementations to plug commands into menus and toolbars, so that a user can assign shortcuts. Command Extensions If your command needs to interactively react on changes while the user is typing text - look at the ifind command in Kate for example - you have to additionally derive your command from the class CommandExtension. The command extension provides methods to give help on flags or add a KCompletion object and process the typed text interactively.
See also KTextEditor.CommandInterface, KTextEditor.CommandExtension
Author Christoph Cullmann \ |
|
Return a list of strings a command may begin with. A string is the start part of a pure text which can be handled by this command, i.e. for the command s/sdl/sdf/g the corresponding string is simply s, and for char:1212 simply char. Returns list of supported commands |
|
|
Shows help for the given view and cmd string. If your command has a help text for cmd you have to return true and set the msg to a meaningful text. The help text is embedded by the Editor in a Qt.RichText enabled widget, e.g. a QToolTip. Returns true if your command has a help text, otherwise false |