First I am sorry because I am very poor at QT.
I have a menu dialog with users listed that calls a destin dialog, both within different classes.
Destin dialog allows the user to select items, as this thread explained to me and go back to my menu dialog (while closing the destin window) and brings back selected items that I list on the menu dialog.
Then before calling again Destin I want to identify the entries of the menu that are on the destin model to highlight them as already selected.
So I go thru the menu dialog for entries to highlight.
Destinataires Destinataires_dlg( this );
if ( model->rowCount() > 3 )
{
for ( int i = 3; i < model->rowCount(); i++ )
{
// find entry to highlight from the menu model
s = model->rows.at(i);
// then I should find the same entry in destin model to mark it as selected
// but I don't know how to do that in QT4, worked very well in QT3
// here I have to do a loop to search s in destinataires_dlg.model
// and highlight it
row = Destinataires_dlg.model->rowCount();
Destinataires_dlg.model->insertRow( row );
Destinataires_dlg.model->setData(model->index(row, 0), s );
}
}
Destinataires Destinataires_dlg( this );
if ( model->rowCount() > 3 )
{
for ( int i = 3; i < model->rowCount(); i++ )
{
// find entry to highlight from the menu model
s = model->rows.at(i);
// then I should find the same entry in destin model to mark it as selected
// but I don't know how to do that in QT4, worked very well in QT3
// here I have to do a loop to search s in destinataires_dlg.model
// and highlight it
row = Destinataires_dlg.model->rowCount();
Destinataires_dlg.model->insertRow( row );
Destinataires_dlg.model->setData(model->index(row, 0), s );
}
}
To copy to clipboard, switch view to plain text mode
nb in qt3 the code was :
if ( qRecap->count() > 3 )
{
for ( int i = 3; i < qRecap->count(); i++ )
{
QListBoxItem *itemQRecap = qRecap->item( i );
for ( int j = 0; j < Destinataires_dlg.qDestinCount(); j++ )
{
QListBoxItem *itemQDestin = Destinataires_dlg.qDestinItem( j );
// si item de destinataires est dans le recapitulatif, on le selectionne
if ( itemQRecap->text() == itemQDestin->text() )
Destinataires_dlg.qDestinSelect( itemQDestin );
}
}
}
if ( qRecap->count() > 3 )
{
for ( int i = 3; i < qRecap->count(); i++ )
{
QListBoxItem *itemQRecap = qRecap->item( i );
for ( int j = 0; j < Destinataires_dlg.qDestinCount(); j++ )
{
QListBoxItem *itemQDestin = Destinataires_dlg.qDestinItem( j );
// si item de destinataires est dans le recapitulatif, on le selectionne
if ( itemQRecap->text() == itemQDestin->text() )
Destinataires_dlg.qDestinSelect( itemQDestin );
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks