KDE 4.2 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)
QVariant | data (self)
QIcon | icon (self)
QString | id (self)
bool | isEnabled (self)
bool | isValid (self)
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.

@arg search the RunnerContext this match belongs to @arg runner the runner this match belongs to

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

Copy constructor

QVariant data | ( |  | self ) |

QIcon icon | ( |  | self ) |

QString id | ( |  | self ) |

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 ) |

bool isValid | ( |  | self ) |

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 ) |

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
| ) |  |  |

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

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
| ) |  |  |

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

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

Sets the type of match this action represents.

QString subtext | ( |  | self ) |

QString text | ( |  | self ) |

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:

  NoMatch = 0 |
  CompletionMatch = 10 |
  PossibleMatch = 30 |
  InformationalMatch = 50 |
  HelperMatch = 70 |
  ExactMatch = 100 |