PDA

View Full Version : listview problem (i need help)



rimie23
10th May 2012, 18:19
Hi, it's me again
i want to make listview,where it add new item when i add an object for that
i define my model like that
in ogrewidget.cpp


OgreWidget::add_object(/*Ogre::Real*/double offsetX ,/*Ogre::Real*/double offsetY)
{
.................................................
model= new QStandardItemModel();
int i=1;
for(itr = result.begin() ;itr != result.end();++itr)
{
if(itr->movable)
{

MarkerNode->_setDerivedPosition(mouseRay.getPoint(itr->distance));
MarkerNode->setScale(0.1f, 0.1f, 0.1f);
QStandardItem *item=new QStandardItem(QString ("Marker %0").arg(i));
model->appendRow(item);
i++;

}
}

}

and in my_interface.cpp, i create my list view


list_O = new QToolButton(page_13);
list_O->setGeometry(QRect(30, 210, 101, 31));
list_O->setText(QApplication::translate("MainWindow", "Object Liste", 0, QApplication::UnicodeUTF8));
listView =new QListView(list_O);


but it still do not make to me the list
what i forget to do
how i pass my list_view (in the class my_interface) to the add object in class ogrewidget?

amleto
10th May 2012, 19:03
WHY CROSS POST WHEN YOU ARE GETTING RESPONSES?
http://www.qtforum.org/article/37916/code-to-create-listview-de-not-work.html

at least have the decency to make reference to the responses you have already had so that you dont waste other peoples' time going over old ground.



listView =new QListView(list_O);
What are you trying to do??? That will make list_O, which is a toolbutton, the parent of the listview, and therefore the listview will be INSIDE the toolbutton!