Nepomuk
Nepomuk::Utils::SimpleFacet Class Reference
A simple facet using a list of terms. More...
#include <Nepomuk/Utils/SimpleFacet>

Public Slots | |
| void | addTerm (const QString &text, const Nepomuk::Query::Term &queryTerm) |
| void | addTerm (const KGuiItem &item, const Nepomuk::Query::Term &queryTerm) |
| void | clear () |
| void | clearSelection () |
| bool | selectFromTerm (const Nepomuk::Query::Term &queryTerm) |
| void | setSelected (int index, bool selected=true) |
Public Member Functions | |
| SimpleFacet (QObject *parent=0) | |
| ~SimpleFacet () | |
| int | count () const |
| KGuiItem | guiItem (int index) const |
| bool | isSelected (int index) const |
| Query::Term | queryTerm () const |
| SelectionMode | selectionMode () const |
| void | setSelectionMode (SelectionMode mode) |
| Query::Term | termAt (int index) const |
Detailed Description
A simple facet using a list of terms.
The SimpleFacet maintains a list of Query::Term objects combined with a label (or a full KGuiItem if required). The usage is very simple: Create a new instance of SimpleFacet, add terms via the addTerm() methods, choose a selection mode via setSelectionMode(), and let SimpleFacet do the rest.
SimpleFacet even implements the selectFromTerm() method which provides enhanced user experience by converting queries into facets.
- Since:
- 4.6
Definition at line 50 of file simplefacet.h.
Constructor & Destructor Documentation
| Nepomuk::Utils::SimpleFacet::SimpleFacet | ( | QObject * | parent = 0 | ) |
Create a new empty facet.
| Nepomuk::Utils::SimpleFacet::~SimpleFacet | ( | ) |
Destructor.
Member Function Documentation
| void Nepomuk::Utils::SimpleFacet::addTerm | ( | const QString & | text, |
| const Nepomuk::Query::Term & | queryTerm | ||
| ) | [slot] |
| void Nepomuk::Utils::SimpleFacet::addTerm | ( | const KGuiItem & | item, |
| const Nepomuk::Query::Term & | queryTerm | ||
| ) | [slot] |
Add a new term.
- Parameters:
-
item The gui item used to present the choice to the user. term The query term which represents this choice.
| void Nepomuk::Utils::SimpleFacet::clear | ( | ) | [slot] |
Clear the list of terms.
| void Nepomuk::Utils::SimpleFacet::clearSelection | ( | ) | [virtual, slot] |
Clear the selection.
If selectionMode() is MatchOne the first choice should be selected.
Implements Nepomuk::Utils::Facet.
| int Nepomuk::Utils::SimpleFacet::count | ( | ) | const [virtual] |
- Returns:
- The number of terms added via addTerm().
Implements Nepomuk::Utils::Facet.
| KGuiItem Nepomuk::Utils::SimpleFacet::guiItem | ( | int | index | ) | const [virtual] |
- Returns:
- The gui item set via addTerm() for the Term at
indexor an empty KGuiItem ifindexis out of range.
Reimplemented from Nepomuk::Utils::Facet.
| bool Nepomuk::Utils::SimpleFacet::isSelected | ( | int | index | ) | const [virtual] |
- Returns:
trueif the term atindexhas been selected via setSelected().
Implements Nepomuk::Utils::Facet.
| Query::Term Nepomuk::Utils::SimpleFacet::queryTerm | ( | ) | const [virtual] |
- Returns:
- The currently selected Term. Depending on the selectionMode() this is either a single Term, a combination through Query::AndTerm, or a combination through Query::OrTerm.
Implements Nepomuk::Utils::Facet.
| bool Nepomuk::Utils::SimpleFacet::selectFromTerm | ( | const Nepomuk::Query::Term & | queryTerm | ) | [virtual, slot] |
The term is analyzed depending on the selectionMode().
- See also:
- Facet::selectFromTerm()
Implements Nepomuk::Utils::Facet.
| SelectionMode Nepomuk::Utils::SimpleFacet::selectionMode | ( | ) | const [virtual] |
The selection mode set via setSelectionMode()
Implements Nepomuk::Utils::Facet.
| void Nepomuk::Utils::SimpleFacet::setSelected | ( | int | index, |
| bool | selected = true |
||
| ) | [virtual, slot] |
Selects or deselects the term at index.
Depending on the selectionMode() this will also affect the selection of other terms.
Implements Nepomuk::Utils::Facet.
| void Nepomuk::Utils::SimpleFacet::setSelectionMode | ( | SelectionMode | mode | ) |
Set the selection mode to use in this facet.
The default is MatchOne.
| Query::Term Nepomuk::Utils::SimpleFacet::termAt | ( | int | index | ) | const |
- Returns:
- The term set via addTerm() for
indexor an invalid Query::Term ifindexis out of range.
The documentation for this class was generated from the following file:
KDE 4.6 API Reference