Results 1 to 20 of 21

Thread: should i use listview ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    82
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 9 Times in 9 Posts

    Default Re: should i use listview ?

    so you must have a crash when doing model->appendRow(item); in OgreWidget right ?
    if it s true it s just that you need that ogreWidget ask for the model pointer to Mainwindow, else how do you want OgreWidget to know what model is ?

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

    Default Re: should i use listview ?

    you need that ogreWidget ask for the model pointer to Mainwindow, else how do you want OgreWidget to know what model is ?
    how i do that (when i see the exemple in qt assistant it make just like that maybe because he is in the same class?)
    so how i said to ogre widget to applicate the model in mainwindows , but at first is my definition of the model in mainwinows true ?

  3. #3
    Join Date
    Nov 2010
    Posts
    82
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 9 Times in 9 Posts

    Default Re: should i use listview ?

    just create a set_model function(const QStandardItemModel *model) function in ogrewiget that will save the pointer value to a member variable
    then call it after you create the model in mainwindow (i suppose you create the ogrewidget in the same function as the model)

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

    Default Re: should i use listview ?

    i suppose you create the ogrewidget in the same function as the model)
    create model like that ?
    Qt Code:
    1. model->appendRow(item);
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: should i use listview ?

    Ok , i define my model like that
    in ogrewidget.cpp
    Qt Code:
    1. QStandardItemModel* 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. return model;
    20. }
    To copy to clipboard, switch view to plain text mode 
    and in my_interface.cpp
    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

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

    Default Re: should i use listview ?

    i want just to know what i forget to do

Similar Threads

  1. qml listview
    By Le_B in forum Qt Quick
    Replies: 1
    Last Post: 25th May 2011, 13:01
  2. subsection in listview
    By huluyige in forum Qt Quick
    Replies: 1
    Last Post: 25th February 2011, 10:26
  3. how do you reload a listView?
    By implor in forum Newbie
    Replies: 5
    Last Post: 16th May 2010, 22:21
  4. ListView problems
    By waitingforzion in forum Newbie
    Replies: 2
    Last Post: 26th December 2009, 00:24
  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
  •  
Qt is a trademark of The Qt Company.