Hi friends,
I am using the QListView to list given of the data base. The clic problem is when I in the white part of the screen where an item does not exist, of the error:
"Segmentation fault (core dumped)"
and the closed application and.
QSqlQuery queryViatura( QUERY_LISTVIATURES ); /* Query Sql */
lstViewViaturaDisponivel->clear();
while(queryViatura.next())
{
lstViewViaturaDisponivel->setColumnWidthMode( 0, QListView::Maximum );
lstViewViaturaDisponivel->adjustColumn( 0 );
lstViewViaturaDisponivel->setColumnWidth( 0, 140 );
lstViewViaturaDisponivel->setColumnWidth( 1, 300 );
lstViewViaturaDisponivel->setColumnWidth( 2, 200 );
lstViewViaturaDisponivel->insertItem( new QListViewItem( lstViewViaturaDisponivel,
queryViatura.value( 0 ).toString(),
queryViatura.value( 1 ).toString(),
queryViatura.value( 2 ).toString()
));
}
QObject::connect(lstViewViaturaDisponivel, SIGNAL( clicked( QListViewItem * ) ), this, SLOT( selectViewItemViaturasEmpenha( QListViewItem *) ) );
void ViaturaDisponivelForm::selectViewItemViaturasEmpen ha( QListViewItem *item )
{
globalVtrEmpenha = item->text(0);
cout << "E-193 ==> ListViewViaturaEmpenha item selecionado " << globalVtrEmpenha << endl;
}
Bookmarks