Results 1 to 2 of 2

Thread: What design fits my situation?

  1. #1
    Join Date
    Feb 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default What design fits my situation?

    I have a webview widget and I want to perform actions in a linear style to a web page. The problem is that I can't return to the code after I finish loading a url in the view, so how would I go back and finish executing everything? (C++)

    Pseudo-code:
    Qt Code:
    1. perform some tasks
    2. webview loads a url
    3. do stuff to page
    4. webview loads another url
    5. do stuff again
    To copy to clipboard, switch view to plain text mode 

    The loading happens concurrently, so for example the page will start loading and then it will already try to manipulate it and then load another page.

  2. #2
    Join Date
    Nov 2009
    Posts
    129
    Thanks
    4
    Thanked 29 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: What design fits my situation?

    Quote Originally Posted by caelestis View Post
    I
    Qt Code:
    1. perform some tasks
    2. webview loads a url
    3. do stuff to page
    4. webview loads another url
    5. do stuff again
    To copy to clipboard, switch view to plain text mode 
    Start an event loop.
    Send a signal to slot firstStep.

    In slot firstStep:
    Perform some tasks.
    Connect signal QWebView::loadFinished to slot secondStep.
    Call QWebView::load.
    return;

    In slot secondStep:
    Do stuff to page.
    Connect signal QWebView::loadFinished to slot thirdStep.
    Call QWebView::load.
    return;

    In slot thirdStep:
    Do stuff again.
    return.

Similar Threads

  1. C++/QT Design
    By xmeister in forum Newbie
    Replies: 6
    Last Post: 2nd April 2009, 02:39
  2. Replies: 3
    Last Post: 5th October 2008, 23:41
  3. mv design
    By sonuani in forum Newbie
    Replies: 1
    Last Post: 4th April 2008, 08:26
  4. qwt on qt design
    By peace_comp in forum Qwt
    Replies: 1
    Last Post: 29th March 2008, 21:22
  5. Splitting data so it fits into datagrams
    By toratora in forum Qt Programming
    Replies: 4
    Last Post: 27th April 2007, 18:01

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.