Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-28 Thread Tr3wory
On Thu, Mar 28, 2013 at 3:50 PM, Tr3wory wrote: > The QIdentityProxyModel works like a charm, except: > - for empty table (rows()==0) the header is wrong > (https://bugreports.qt-project.org/browse/QTBUG-23572) > - when the program starts the header is also wrong until I click on it. > > For the f

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-28 Thread Tr3wory
On Thu, Mar 28, 2013 at 11:18 AM, André Somers wrote: > 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

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-28 Thread Tr3wory
Yes I'm aware of that, I'm just thinking about a new default for qlonglong, so others don't have the same issue. tr3w On Thu, Mar 28, 2013 at 2:52 PM, André Somers wrote: > Op 28-3-2013 14:42, Tr3wory schreef: >> Thank you for the tip, the QIdentityProxyModel looks promising. And >> yes, the QSp

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-28 Thread André Somers
Op 28-3-2013 14:42, Tr3wory schreef: > 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? Can be done. Note that you can supply your own editors to the model/views

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-28 Thread Tr3wory
On Thu, Mar 28, 2013 at 11:18 AM, André Somers 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 wou

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-28 Thread Mark Brand
> > 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

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-28 Thread André Somers
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 >

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-28 Thread Tr3wory
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::setNumericalPrecisi

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-28 Thread André Somers
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,

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-27 Thread Tr3wory
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... tr3w On Wed, Mar 27, 2013 at 9:03 PM, preeteesh kakkar wrote: > This might help you --> > http://qt-project.org/doc/qt-4.8/itemviews-spin

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-27 Thread preeteesh kakkar
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 lineed

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-27 Thread preeteesh kakkar
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 wrote: > A

Re: [Interest] Default delegate with QTableView and QSqlTableModel

2013-03-27 Thread Tr3wory
Another piece of information: the model->data(...) returns a QVariant::LongLong... tr3w On Wed, Mar 27, 2013 at 8:32 PM, Tr3wory 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. > > Eve