Results 1 to 2 of 2

Thread: Model Items do not updated

Threaded View

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

    Default Model Items do not updated

    Hi,

    in mainwindow
    Qt Code:
    1. public slots:
    2. void itemAded ( QStandardItem * );
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. MainWindow::MainWindow()
    2. {
    3.  
    4. mQOgreWidget = new QOgreWidget(this);
    5.  
    6. setCentralWidget(mQOgreWidget);
    7.  
    8. createModel();
    9. createDockWidget();
    10.  
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void MainWindow::createDockWidget()
    2. {
    3. listView = new QListView(dockWidgetContents_8);
    4. listView->setObjectName(QString::fromUtf8("listView"));
    5. listView->setGeometry(QRect(0, 0, 281, 290));
    6. listView->setModel( model );
    7. connect( model, SIGNAL( itemChanged( QStandardItem * )),
    8. this, SLOT( itemChanged( QStandardItem * )));
    9. connect( model, SIGNAL( itemAded( QStandardItem * )),
    10. mQOgreWidget, SLOT( itemAded( QStandardItem * )));
    11. connect( mQOgreWidget, SIGNAL( itemAded( QStandardItem * )), this, SLOT( itemAded( QStandardItem * ) ));
    To copy to clipboard, switch view to plain text mode 
    in my class QOgrerenderWidget .h
    i defined my sognal itemAded like that
    Qt Code:
    1. public slots:
    2. void add_object();
    3. signals :
    4. void itemAded( QStandardItem * );
    To copy to clipboard, switch view to plain text mode 
    in QOgrerenderWidget .cpp
    Qt Code:
    1. void QOgreRenderWindow::mousePressEvent(QMouseEvent* evt)
    2. {
    3.  
    4. if(evt->button() == Qt::LeftButton)
    5. {
    6. add_object();
    7. }
    8. }
    9. void QOgreRenderWindow::add_object(double offsetX ,double offsetY)
    10. {
    11. /////////////////////////////////////////////
    12. code to add object
    13. it work very good
    14. ///////////////////////////////////////////////////////
    15. QStandardItem *item=new QStandardItem(QString ("Marker %0").arg(nb));
    16. emit itemAded(item);
    To copy to clipboard, switch view to plain text mode 
    and in Qogrewidget i make like that
    Qt Code:
    1. QOgreRenderWindow * orw0 = new QOgreRenderWindow(QString("View2"),mSceneMgr,mRoot,nb_cam,wi0,hi0, mNode);
    To copy to clipboard, switch view to plain text mode 


    i can add the object with any problem
    but the item do not added

    edit :
    problem is resolved when i add many view
    Last edited by rimie23; 8th June 2012 at 19:16.

Similar Threads

  1. relaional model not updated
    By vincentb in forum Qt Programming
    Replies: 0
    Last Post: 8th December 2010, 14:11
  2. Adding new items to model (MVC)
    By Urvin in forum Qt Programming
    Replies: 1
    Last Post: 7th November 2010, 07:54
  3. transfering items from one model to the other
    By ru_core in forum Qt Programming
    Replies: 4
    Last Post: 27th June 2008, 08:44
  4. removing model Items
    By gyre in forum Newbie
    Replies: 2
    Last Post: 25th November 2007, 20:10
  5. Moving items within a model
    By iswm in forum Qt Programming
    Replies: 1
    Last Post: 11th April 2007, 08:29

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.