Results 1 to 2 of 2

Thread: listview problem (i need help)

  1. #1
    Join Date
    Apr 2012
    Posts
    101
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default listview problem (i need help)

    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
    Qt Code:
    1. OgreWidget::add_object(/*Ogre::Real*/double offsetX ,/*Ogre::Real*/double offsetY)
    2. {
    3. .................................................
    4. model= new QStandardItemModel();
    5. int i=1;
    6. for(itr = result.begin() ;itr != result.end();++itr)
    7. {
    8. if(itr->movable)
    9. {
    10.  
    11. MarkerNode->_setDerivedPosition(mouseRay.getPoint(itr->distance));
    12. MarkerNode->setScale(0.1f, 0.1f, 0.1f);
    13. QStandardItem *item=new QStandardItem(QString ("Marker %0").arg(i));
    14. model->appendRow(item);
    15. i++;
    16.  
    17. }
    18. }
    19.  
    20. }
    To copy to clipboard, switch view to plain text mode 
    and in my_interface.cpp, i create my list view
    Qt Code:
    1. list_O = new QToolButton(page_13);
    2. list_O->setGeometry(QRect(30, 210, 101, 31));
    3. list_O->setText(QApplication::translate("MainWindow", "Object Liste", 0, QApplication::UnicodeUTF8));
    4. listView =new QListView(list_O);
    To copy to clipboard, switch view to plain text mode 
    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?

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: listview problem (i need help)

    WHY CROSS POST WHEN YOU ARE GETTING RESPONSES?
    http://www.qtforum.org/article/37916...-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!
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. should i use listview ?
    By rimie23 in forum Qt Programming
    Replies: 20
    Last Post: 9th May 2012, 22:40
  2. QML Listview Highlight image problem
    By vikaspachdha in forum Qt Quick
    Replies: 0
    Last Post: 2nd November 2011, 09:14
  3. Replies: 0
    Last Post: 26th October 2011, 12:44
  4. qml listview
    By Le_B in forum Qt Quick
    Replies: 1
    Last Post: 25th May 2011, 13:01
  5. listview
    By addu in forum Qt Programming
    Replies: 2
    Last Post: 11th May 2009, 12:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.