[Interest] QLineEdit and QTableWidget
Rene Decartes
rene.decartes.too at gmail.com
Tue Jul 7 04:40:46 CEST 2015
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.
More information about the Interest
mailing list