Plasma.QueryMatch

KDE 4.5 PyKDE API Reference

- KDE's Python API

# QueryMatch Class Reference

`from PyKDE4.plasma import *`

Namespace: Plasma

## Detailed Description

QueryMatch plasma/querymatch.h <Plasma/QueryMatch>

A match returned by an AbstractRunner in response to a given RunnerContext.

## Enumerations
Type | { NoMatch, CompletionMatch, PossibleMatch, InformationalMatch, HelperMatch, ExactMatch }
## Methods
| __init__ (self, Plasma.AbstractRunner runner)
| __init__ (self, Plasma.QueryMatch other)
| createConfigurationInterface (self, QWidget parent)
QVariant | data (self)
bool | hasConfigurationInterface (self)
QIcon | icon (self)
QString | id (self)
bool | isEnabled (self)
bool | isValid (self)
bool | operator < (self, Plasma.QueryMatch other)
bool | operator == (self, Plasma.QueryMatch other)
float | relevance (self)
| run (self, Plasma.RunnerContext context)
Plasma.AbstractRunner | runner (self)
QAction | selectedAction (self)
| setData (self, QVariant data)
| setEnabled (self, bool enable)
| setIcon (self, QIcon icon)
| setId (self, QString id)
| setRelevance (self, float relevance)
| setSelectedAction (self, QAction action)
| setSubtext (self, QString text)
| setText (self, QString text)
| setType (self, Plasma.QueryMatch.Type type)
QString | subtext (self)
QString | text (self)
Plasma.QueryMatch.Type | type (self)

## Method Documentation

__init__ | ( | self, |
|  | Plasma.AbstractRunner | runner
| ) |  |  |

Constructs a PossibleMatch associated with a given RunnerContext and runner.

Parameters:

  | search | the RunnerContext this match belongs to
  | runner | the runner this match belongs to

__init__ | ( | self, |
|  | Plasma.QueryMatch | other
| ) |  |  |

Copy constructor

createConfigurationInterface | ( | self, |
|  | QWidget | parent
| ) |  |  |

If hasConfigurationInterface() returns true, this method may be called to get a widget displaying the options the user can interact with to modify the behaviour of what happens when the match is run.

Parameters:

  | widget | the parent of the options widgets.

Since:
  4.3

QVariant data | ( |  | self ) |

Returns:
  the data associated with this match; usually runner-specific

bool hasConfigurationInterface | ( |  | self ) |

Returns:
  true if this match can be configured before being run

Since:
  4.3

QIcon icon | ( |  | self ) |

Returns:
  the icon for this match

QString id | ( |  | self ) |

@ruetnr a string that can be used as an ID for this match, even between different queries. It is based in part on the source of the match (the AbstractRunner) and distinguishing information provided by the runner, ensuring global uniqueness as well as consistency between query matches.

bool isEnabled | ( |  | self ) |

Returns:
  true if the match is enabled and therefore runnable, otherwise false

bool isValid | ( |  | self ) |

Returns:
  true if the match is valid and can therefore be run, an invalid match does not have an associated AbstractRunner

bool operator < | ( | self, |
|  | Plasma.QueryMatch | other
| ) |  |  |

bool operator == | ( | self, |
|  | Plasma.QueryMatch | other
| ) |  |  |

float relevance | ( |  | self ) |

The relevance of this action to the search. By default, the relevance is 1.

Returns:
  a number between 0 and 1

run | ( | self, |
|  | Plasma.RunnerContext | context
| ) |  |  |

Requests this match to activae using the given context

Parameters:

  | context | the context to use in conjunction with this run

@sa AbstractRunner.run

Plasma.AbstractRunner runner | ( |  | self ) |

Returns:
  the runner associated with this action

QAction selectedAction | ( |  | self ) |

The current action.

setData | ( | self, |
|  | QVariant | data
| ) |  |  |

Sets data to be used internally by the associated AbstractRunner.

When set, it is also used to form part of the id() for this match. If that is innapropriate as an id, the runner may generate its own id and set that with setId(const QString&) directly after calling setData

setEnabled | ( | self, |
|  | bool | enable
| ) |  |  |

Sets whether or not this match can be activited

Parameters:

  | enable | true if the match is enabled and therefore runnable

setIcon | ( | self, |
|  | QIcon | icon
| ) |  |  |

Sets the icon associated with this match

Parameters:

  | icon | the icon to show along with the match

setId | ( | self, |
|  | QString | id
| ) |  |  |

Sets the id for this match; useful if the id does not match data().toString(). The id must be unique to all matches from this runner, and should remain constant for the same query for best results.

Parameters:

  | id | the new identifying string to use to refer to this entry

setRelevance | ( | self, |
|  | float | relevance
| ) |  |  |

Sets the relevance of this action for the search it was created for.

Parameters:

  | relevance | a number between 0 and 1.

setSelectedAction | ( | self, |
|  | QAction | action
| ) |  |  |

Sets the selected action

setSubtext | ( | self, |
|  | QString | text
| ) |  |  |

Sets the descriptive text for this match; can be longer than the main title text

Parameters:

  | text | the text to use as the description

setText | ( | self, |
|  | QString | text
| ) |  |  |

Sets the main title text for this match; should be short enough to fit nicely on one line in a user interface

Parameters:

  | text | the text to use as the title

setType | ( | self, |
|  | Plasma.QueryMatch.Type | type
| ) |  |  |

Sets the type of match this action represents.

QString subtext | ( |  | self ) |

Returns:
  the descriptive text for this match

QString text | ( |  | self ) |

Returns:
  the title text for this match

Plasma.QueryMatch.Type type | ( |  | self ) |

The type of action this is. Defaults to PossibleMatch.

## Enumeration Documentation

Type

The type of match. Value is important here as it is used for sorting

Enumerator:

  None = 0 |
  UnknownType = 1 |
  Directory = 2 |
  File = 4 |
  NetworkLocation = 8 |
  Executable = 16 |
  ShellCommand = 32 |
  Help = 64 |
  FileSystem = Directory|File|Executable|ShellCommand |