Peter Kümmel wrote:
Richard Heck wrote:
I tried to do something like this so I didn't have the same code in two
places:
QModelIndex & QCitationDialog::getSelectedIndex(QListView *) {
QModelIndexList const selIdx =
availableLV->selectionModel()->selectedIndexes();
if (selIdx.empty())
return QModelIndex(); //this is an invalid one.
return selIdx.first();
}
But that failed: warning: returns reference to temporary. Any ideas how
to avoid this and still return a reference? Or could I return a smart
returning "const QModelIndex &" should be save. But you could also
return may value, copying QModelIndex isn't that expensive. The Qt
code return often by value, QModelIndex was designed for this.
Unfortunately, I can't return const. I'll try returning by value.
Richard
--
==================================================================
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==================================================================
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto