[Interest] Default delegate with QTableView and QSqlTableModel

preeteesh kakkar preeteesh.kakkar at gmail.com
Wed Mar 27 21:01:12 CET 2013


You may be able to use QIntValidator for that particular column, by default
Qt delegate will show everything as lineedit where you can put anything. If
you want to show QSpinBox you need to tell that for xyz column QSpinBox
Widget should open..

On Wed, Mar 27, 2013 at 2:46 PM, Tr3wory <tr3w at freemail.hu> wrote:

> Another piece of information: the model->data(...) returns a
> QVariant::LongLong...
>
> tr3w
>
> On Wed, Mar 27, 2013 at 8:32 PM, Tr3wory <tr3w at freemail.hu> wrote:
> > Hi all,
> >
> > I have a QTableView and a connected QSqlTableModel. The database is an
> > SQLite database with two columns, the types are TEXT and INTEGER.
> >
> > Everything is works as expected, except I don't get QSpinbox as a
> > editor for the INTEGER column, so I can write there anything, and
> > since the SQLite can store TEXT in an INTEGER column, I don't even get
> > an error...
> >
> > So what can I do?
> > Can I set the type (QVarinat::Int) of the column somehow (in the model
> > or in the view)?
> > If I use setItemDelegateForColumn on the view manually, can I use a
> > ready made delegate somehow
> > or the only possible solution is to create a SpinBoxDelegate for myself?
> >
> > Cheers,
> > tr3w
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130327/4b5d211e/attachment.html>


More information about the Interest mailing list