Results 1 to 4 of 4

Thread: How Do I Refresh a View if the Delegate Changes its Display Format?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: How Do I Refresh a View if the Delegate Changes its Display Format?

    You could have also used something in MainWindow ctor like -
    Qt Code:
    1. connect(m_button, SIGNAL(clicked()), this, SLOT(toggleFormat()));
    2. // and in MainWindow::toggleFormat()
    3. MainWindow::toggleFormat()
    4. { del->toggleFormat();
    5. m_view->update();
    6. }
    To copy to clipboard, switch view to plain text mode 

    This would keep the work of delegate to only render. I dont think it was good that delegate tells view to update. I guess its the controller / creator's job.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: How Do I Refresh a View if the Delegate Changes its Display Format?

    In the real application the signal to change date or duration format comes from outside of the affected view (I just put it there for the example). I could connect that signal to a view slot as you suggest and, yes, it probably is neater. Thanks for the thought.

Similar Threads

  1. Date format is not display
    By sosanjay in forum Qt Programming
    Replies: 2
    Last Post: 9th November 2009, 10:26
  2. Replies: 1
    Last Post: 15th April 2009, 09:00
  3. How to constantly refresh time on a view
    By salmanmanekia in forum Qt Programming
    Replies: 5
    Last Post: 23rd June 2008, 12:44
  4. [model/view] slow refresh on big table
    By lauranger in forum Qt Programming
    Replies: 4
    Last Post: 3rd March 2008, 21:40
  5. Replies: 9
    Last Post: 7th November 2006, 15:10

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.