qabstractitemmodel for xesam searches
Jos van den Oever
jvdoever at gmail.com
Mon Apr 28 22:06:44 BST 2008
Hi all,
I'm working on some gui code for strigi. It will be written as a
QAbstractItemModel and this is turning out really nice.
In the model, the rows will be hits and the columns properties.
Here's a short example of a simle line edit for typing a query which
the model shows in simple table.
QWidget w;
QVBoxLayout v;
w.setLayout(&v);
QLineEdit l;
v.addWidget(&l);
XesamModel model;
// specify the columns (pseudo code atm)
model << "xesam:name" << "xesam:url" << "xesam:size" << "xesam:mimeType";
QTableView view(&w);
view.setModel(&model);
v.addWidget(&view);
// start a new search for every key pressed
QObject::connect(&l, SIGNAL(textChanged(const QString&)),
&model, SLOT(setUserQuery(const QString&)));
w.show();
Each QModelIndex can have several roles and you will be able to
associate a xesam field with a role.
Such a XesamModel can be easily used in lists, tables, comboboxes, you name it.
I'm now working on writing an nicer view for general search.
Cheers,
Jos
PS: this is where it's at
http://websvn.kde.org/trunk/playground/libs/xesamclient/
More information about the kde-core-devel
mailing list