Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, May 2008
a question on QTableModel::insertRows


Message 1 in thread

Hi all,

I'm reimplementing QTableModel::insertRows for a customized class inheriting QAbstractTableModel.

I want the method to insert different things based on different parameters into my data model. However, I don't think this is 
possible for insertRows since there is no place for me to pass any additional parameter to it

Could someone give me an advice?

Thanks

Yifei

Message 2 in thread

What are those different things?

Perhaps, you should insert some abstract rows, and then call setData for those rows. And finally call submit(), where you can analyze rowâs data and submit âdifferentâ things.

 

From: Yifei Li [mailto:yifli@xxxxxxx] 
Sent: Friday, May 16, 2008 10:08 AM
To: qt-interest@xxxxxxxxxxxxx
Subject: a question on QTableModel::insertRows

 

Hi all,

 

I'm reimplementing QTableModel::insertRows for a customized class inheriting QAbstractTableModel.

 

I want the method to insert different things based on different parameters into my data model. However, I don't think this is 

possible for insertRows since there is no place for me to pass any additional parameter to it

 

Could someone give me an advice?

 

Thanks

 

Yifei


Message 3 in thread

My table lets users view/edit input to the program. The first column in the table determines the data type in other columns. 
For example, if the value of the first column  is T, than other columns will have data of type MyClass<T> (a template class)

So I really can not insert any 'abstract' rows because even though I can make abstract values for columns other than the
first one, I still need specific type information from the first column. For example, only if I know the value of first column
is float, than I can use the default constructor of class MyClass<float> to initialize the value for other columns

Any ideas?

Thanks

Yifei 

  
 
  ----- Original Message ----- 
  From: ÐÐÑÐÐ ÐÐÑÐÑÐÐÐ 
  To: qt-interest@xxxxxxxxxxxxx 
  Sent: Friday, May 16, 2008 01:54
  Subject: RE: a question on QTableModel::insertRows


  What are those different things?

  Perhaps, you should insert some abstract rows, and then call setData for those rows. And finally call submit(), where you can analyze rowâs data and submit âdifferentâ things.

   

  From: Yifei Li [mailto:yifli@xxxxxxx] 
  Sent: Friday, May 16, 2008 10:08 AM
  To: qt-interest@xxxxxxxxxxxxx
  Subject: a question on QTableModel::insertRows

   

  Hi all,

   

  I'm reimplementing QTableModel::insertRows for a customized class inheriting QAbstractTableModel.

   

  I want the method to insert different things based on different parameters into my data model. However, I don't think this is 

  possible for insertRows since there is no place for me to pass any additional parameter to it

   

  Could someone give me an advice?

   

  Thanks

   

  Yifei

Message 4 in thread

I can suggest the following way.

Within insertRows() store somewhere new row with invalid variants in all columns â QVariant();

flags() should return no edition flag for all columns except first.

When user sets first column with setData(), you can initialize all other columns with appropriate objects and allow editing them via flags() .

 

From: Yifei Li [mailto:yifli@xxxxxxx] 
Sent: Friday, May 16, 2008 10:16 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: a question on QTableModel::insertRows

 

My table lets users view/edit input to the program. The first column in the table determines the data type in other columns. 

For example, if the value of the first column  is T, than other columns will have data of type MyClass<T> (a template class)

 

So I really can not insert any 'abstract' rows because even though I can make abstract values for columns other than the

first one, I still need specific type information from the first column. For example, only if I know the value of first column

is float, than I can use the default constructor of class MyClass<float> to initialize the value for other columns

 

Any ideas?

 

Thanks

 

Yifei 

 

  

 

----- Original Message ----- 

From: ÐÐÑÐÐ ÐÐÑÐÑÐÐÐ <mailto:uksus70@xxxxxxxxx>  

To: qt-interest@xxxxxxxxxxxxx 

Sent: Friday, May 16, 2008 01:54

Subject: RE: a question on QTableModel::insertRows

 

What are those different things?

Perhaps, you should insert some abstract rows, and then call setData for those rows. And finally call submit(), where you can analyze rowâs data and submit âdifferentâ things.

 

From: Yifei Li [mailto:yifli@xxxxxxx] 
Sent: Friday, May 16, 2008 10:08 AM
To: qt-interest@xxxxxxxxxxxxx
Subject: a question on QTableModel::insertRows

 

Hi all,

 

I'm reimplementing QTableModel::insertRows for a customized class inheriting QAbstractTableModel.

 

I want the method to insert different things based on different parameters into my data model. However, I don't think this is 

possible for insertRows since there is no place for me to pass any additional parameter to it

 

Could someone give me an advice?

 

Thanks

 

Yifei


Message 5 in thread

My table lets users view/edit input to the program. The first column in the table determines the data type in other columns. 
For example, if the value of the first column  is T, than other columns will have data of type MyClass<T> (a template class)

So I really can not insert any 'abstract' rows because even though I can make abstract values for columns other than the
first one, I still need specific type information from the first column. For example, only if I know the value of first column
is float, than I can use the default constructor of class MyClass<float> to initialize the value for other columns

Any ideas?

Thanks

Yifei 

  
 
  ----- Original Message ----- 
  From: ÐÐÑÐÐ ÐÐÑÐÑÐÐÐ 
  To: qt-interest@xxxxxxxxxxxxx 
  Sent: Friday, May 16, 2008 01:54
  Subject: RE: a question on QTableModel::insertRows


  What are those different things?

  Perhaps, you should insert some abstract rows, and then call setData for those rows. And finally call submit(), where you can analyze rowâs data and submit âdifferentâ things.

   

  From: Yifei Li [mailto:yifli@xxxxxxx] 
  Sent: Friday, May 16, 2008 10:08 AM
  To: qt-interest@xxxxxxxxxxxxx
  Subject: a question on QTableModel::insertRows

   

  Hi all,

   

  I'm reimplementing QTableModel::insertRows for a customized class inheriting QAbstractTableModel.

   

  I want the method to insert different things based on different parameters into my data model. However, I don't think this is 

  possible for insertRows since there is no place for me to pass any additional parameter to it

   

  Could someone give me an advice?

   

  Thanks

   

  Yifei