Results 1 to 2 of 2

Thread: Model Items do not updated

  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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Model Items do not updated

    Are you sure this problem was resolved when you added more views? The code you posted here doesn't make much sense. It seems you are confusing signals with slots.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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.