Technically you are right, on the other hand it is really counter intuitive to not have a default editor for qlonglong if the qsqlite driver gives me that for every integer by default. It would be a perfect solution to me if I could change the default type, but the QSqlDatabase::setNumericalPrecisionPolicy(QSql::LowPrecisionInt32) does not do the trick (and obviously it's not a general solution).
So my question is: is it possible to change the default type for INTEGER to QVariant::Int from qlonglong? Or even better, is it possible to change that for just a selected column in the QSqlTableModel? That would be a clean solution. Another good solution would be to set a delegate/editor for qlonglong, but do we have a better way than creating a subclass of QItemDelegate or QItemEditorCreatorBase with 50+ lines of code? tr3w On Thu, Mar 28, 2013 at 10:19 AM, André Somers <an...@familiesomers.nl> wrote: > Op 27-3-2013 21:50, Tr3wory schreef: >> Yes I know that, but based on this: >> http://qt-project.org/doc/qt-4.8/qitemeditorfactory.html#standard-editing-widgets >> I think it should work out of the box... > Why? LongLong is neither int nor unsigned int > > André > >> tr3w >> >> On Wed, Mar 27, 2013 at 9:03 PM, preeteesh kakkar >> <preeteesh.kak...@gmail.com> wrote: >>> This might help you --> >>> http://qt-project.org/doc/qt-4.8/itemviews-spinboxdelegate.html >>> >>> On Wed, Mar 27, 2013 at 3:01 PM, preeteesh kakkar >>> <preeteesh.kak...@gmail.com> wrote: >>>> 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 <t...@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 <t...@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@qt-project.org >>>>> http://lists.qt-project.org/mailman/listinfo/interest >>>> >> _______________________________________________ >> Interest mailing list >> Interest@qt-project.org >> http://lists.qt-project.org/mailman/listinfo/interest > > > -- > You like Qt? > I am looking for collegues to join me at i-Optics! > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest