On Thu, Mar 28, 2013 at 11:18 AM, André Somers <an...@familiesomers.nl> wrote: > Op 28-3-2013 11:13, Tr3wory schreef: > >> 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 > > Well, I think the issue is that QSpinBox is limited to an int range, so it > can't be used for qlonglong. > > For your case, I think I would make a simple proxy model based on > QIdentityProxyModel that adapts the data type from longlong to int when > possible and where desirable. That should only take a couple of loc. I don't > think it will be easy to coax the driver into using int instead of longlong. > > André >
Thank you for the tip, the QIdentityProxyModel looks promising. And yes, the QSpinBox is not good enough for qlonglong in general. What about a QLineEdit with a proper input mask? tr3w _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest