you need to pass the right flags to the listwidget item as in attached. i didn't look at the logic, but guess you can take it from here
(check out the fixme's too) -----Original Message----- From: Bo Peng [mailto:[EMAIL PROTECTED] Sent: Fri 9/7/07 5:28 To: LyX Mechanics Subject: Please help implement a list of checkboxes in the embedding dialog. Dear all, I have removed the AUTO feature of embedding so the status of a file is easy now: embedded or not. Consequently, I have removed the embedding status radio boxes and would like to have a QListView or QTableView that holds a list of files with a check box before each item. Can anyone do this for me? Many thanks in advance. Bo
Index: src/frontends/qt4/GuiEmbeddedFiles.cpp =================================================================== --- src/frontends/qt4/GuiEmbeddedFiles.cpp (revision 20120) +++ src/frontends/qt4/GuiEmbeddedFiles.cpp (working copy) @@ -62,10 +62,10 @@ // go to the first selected item controller().goTo(files[idx]); } - + // FIXME, Bo this does nothing bool mode = false; for (; it != it_end; ++it) { - int idx = filesLW->row(*it); + //int idx = filesLW->row(*it); if (mode) { mode = true; continue; @@ -93,6 +93,9 @@ EmbeddedFiles::EmbeddedFileList::const_iterator it_end = files.end(); for (; it != it_end; ++it) { QListWidgetItem * item = new QListWidgetItem(toqstr(it->inzipName())); + item->setFlags(Qt::ItemIsUserCheckable | + Qt::ItemIsSelectable | Qt::ItemIsEnabled); + item->setCheckState(Qt::Checked); if (!it->valid()) item->setTextColor(INVALID_COLOR); else if(it->embedded()) @@ -148,11 +151,13 @@ void GuiEmbeddedFilesDialog::set_embedding_status(bool embed) { - EmbeddedFiles & files = controller().embeddedFiles(); + // FIXME: Bo, this is not used + //EmbeddedFiles & files = controller().embeddedFiles(); QList<QListWidgetItem *> selection = filesLW->selectedItems(); for (QList<QListWidgetItem*>::iterator it = selection.begin(); it != selection.end(); ++it) { - int row = filesLW->row(*it); + // FIXME: Bo, this is not used + //int row = filesLW->row(*it); // FIXME: mark buffer dirty if(embed) (*it)->setTextColor(EMBEDDED_COLOR);