[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    qabstractitemmodel for xesam searches
From:       "Jos van den Oever" <jvdoever () gmail ! com>
Date:       2008-04-28 21:06:44
Message-ID: c2dbc4260804281406t57adc0ccrc2c7aa7fc4823631 () mail ! gmail ! com
[Download RAW message or body]

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/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic