[Interest] QLineEdit and QTableWidget

Tony Rietwyk tony at rightsoft.com.au
Tue Jul 7 17:03:52 CEST 2015


Hi allen, 

> what i really want is to be able to
> attach multiple persons rather a single one with each item in the (say,
> household) widget. so i thought to use a single column table widget and
> follow the spreadsheet example to create the table, delegate and item
> widgets putting the above line edit each item widget.....

I'm confused by your last line.  Do you want separate line edits to appear
on each row (create each and use view.setItemWidget), or just the current
row (delegate should be doing this already?), or hovering over the previous
to current row? 

But the start of your requirement sounds more like a combo box that
automatically adds items.  So instead of the delegate creating an edit box
on the current string item, it creates a combo box instead and the item's
value is a string list of people? 

Hope that helps, 

Tony


> -----Original Message-----
> From: interest-bounces+tony=rightsoft.com.au at qt-project.org
> [mailto:interest-bounces+tony=rightsoft.com.au at qt-project.org] On Behalf
> Of Rene Decartes
> Sent: Tuesday, 7 July 2015 12:41 PM
> To: interest at qt-project.org
> Subject: [Interest] QLineEdit and QTableWidget
> 
> hello,
> 
> i rather green at using qt. jumping right in, i had a qlineedit on a
widget that is
> basically coded as:
> 
> People::createPersonEdit()
> {
>     personEdit = new QLineEdit ;
>     personLabel = new QLabel( tr( "&Person:" ) ) ;
>     personLabel->setBuddy( personEdit ) ;
> 
>     personModel = new QSqlQueryModel( this ) ;
>     personModel->setQuery( "SELECT number , name FROM someTable
> WHERE number > -1 ORDER BY name" ) ;
> 
>     personCompleter = new QCompleter( this ) ;
>     personCompleter->setModel( personModel ) ;
> 
>     personView = new QTableView ;
>     personCompleter->setPopup( personView ) ;
> 
>     int width = personView->columnWidth( 0  ) ;
>     width += personView->columnWidth( 1  ) ;
> 
>     personView->setColumnHidden( 0 , true ) ;
>     personView->setColumnWidth( 1 , width ) ;
> 
>     personEdit->setCompleter( personCompleter ) ;
> 
>     connect( personEdit , SIGNAL( editingFinished() ) ,
>              this , SLOT( personValidate() ) ) ; } what i really want is
to be able to
> attach multiple persons rather a single one with each item in the (say,
> household) widget. so i thought to use a single column table widget and
> follow the spreadsheet example to create the table, delegate and item
> widgets putting the above line edit each item widget.....
> 
> but it is turning out to be convoluted (for me!) am i approaching this
correctly?
> 
> --
> allen
> 
> There are 10 kinds of people. Those who do understand binary code, and
> those who do not.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list