Results 1 to 2 of 2

Thread: update dockwidget contents

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    248
    Thanks
    29
    Thanked 15 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default update dockwidget contents

    hi,

    in one application, we are using QDockWindows to show different aspects/data of a loaded file.
    The user can choose to create as many DockWidgets of the various available DOckWidgets, and he can place them where he likes.
    The problem now is what to do when the user opens a new file.
    In that case, the old content would have to be discarded and new content displayed,
    Qt Code:
    1. without the docking arrangement being destroyed.
    To copy to clipboard, switch view to plain text mode 

    ATM, the docking widgets get their data from a single pointer to a file-instance.
    it would be straight forward to zero that pointer, and simply assign one to the new instance. But how?

    1)
    a global signal UpdatePtr could be sent to all dockwidgets.
    Not sure about that one. Would

    emit UpdatePtr(newptr);
    delete oldptr;

    leave everyone enought time to really discard the old ptr?

    2)
    a global function that returns a ptr. That way, we would have to update one ptr instance only.
    Not really a fan of global functions.

    In either case, what do you think?

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

    Default Re: update dockwidget contents

    In a single threaded program the signal call will not return until all the connected slots have been executed unless you use queued connections. Queued connections will be deferred until the event loop.

    Another option is to use the same "file-instance" object to load the new file: the pointer doesn't change but you need to signal the views to refresh.

Similar Threads

  1. QFileSystemModel - Incremental update/pre-emptive update
    By johnnyturbo3 in forum Qt Programming
    Replies: 0
    Last Post: 2nd September 2011, 13:56
  2. Replies: 2
    Last Post: 29th September 2010, 17:44
  3. update tab's title when contents change
    By alexei in forum Newbie
    Replies: 3
    Last Post: 27th September 2010, 07:10
  4. printing of dockWidget contents
    By user in forum Qt Programming
    Replies: 7
    Last Post: 18th May 2008, 23:07
  5. promote the contents of a dockwidget!
    By notsonerdysunny in forum Qt Tools
    Replies: 1
    Last Post: 30th July 2007, 05:17

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.