Results 1 to 5 of 5

Thread: Recive the form post with QWebKit?

  1. #1
    Join Date
    Aug 2009
    Location
    Brasil
    Posts
    2
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Recive the form post with QWebKit?

    Its possible?
    In my app i want show a HTML form in a QWebPage and recive the post of this.It's possible? Or i need a external code (like perl or PHP) for this?
    How be the action propriety? Javascript is necessary?
    Who class can recive the post in QT?

  2. #2
    Join Date
    Jul 2008
    Location
    London, UK
    Posts
    11
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Recive the form post with QWebKit?

    Hi Cochise,

    I have an answer and a question for everyone.

    If you derive a class from QWebPage and add your own acceptNavigationRequest like this

    Qt Code:
    1. class MyWebPage : public QWebPage
    2. {
    3. public:
    4. MyWebPage(QObject *p_parent = 0);
    5.  
    6. protected:
    7. virtual bool acceptNavigationRequest ( QWebFrame * frame, const QNetworkRequest & request, NavigationType type );
    8. };
    To copy to clipboard, switch view to plain text mode 

    Then when the user submits a form acceptNavigationRequest will be called with type set to NavigationTypeFormSubmitted.

    If you look in the QNetworkRequest you should be able to find the URL and other information relating to the form submission.

    Now, here is my question. The request object will have headers, url etc but I can't get the POST information which is in the body of the HTTP request.

    This works fine for GET form submissions as the form key/value pairs are encoded in the URL and available via request.url().encodedQueryItems()

    Sooo... How do I get to the body information in the QNetworkRequest from an HTML "POST" form submission.

    Yours,
    Matthew.

  3. The following user says thank you to burnttoy for this useful post:

    cochise (26th August 2009)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Recive the form post with QWebKit?

    Maybe you should get rid of the form and use real Qt widgets there? You can embed such a "form" into QWebView using WebKit's plugin infrastructure if you really have to have the form as part of the webpage.
    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.


  5. #4
    Join Date
    Aug 2009
    Location
    Brasil
    Posts
    2
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Recive the form post with QWebKit?

    nice. I will try this.
    But...
    what is the max size of the url in the QWebKit?

    and wysota. I no wanna a html model for data input because it's more simple for thirty party contribuitions.
    The program is a RPG sheet manager, then i intent create a unique code for making any sheet is possible. And if the sheets are in html is possible add functions for this like experience calculate of characters with javascript. And the apparency of the sheets is very customizable.

    It's my first really program after exercises and examples.
    Tanks folks.
    Last edited by cochise; 26th August 2009 at 06:49.

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    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: Recive the form post with QWebKit?

    Quote Originally Posted by cochise View Post
    and wysota. I no wanna a html model for data input because it's more simple for thirty party contribuitions.
    More simple than what?

    And if the sheets are in html is possible add functions for this like experience calculate of characters with javascript. And the apparency of the sheets is very customizable.
    I'd use Designer for designing and QUiLoader and QtScript for the logic and have the same functionality without reaching my left ear with my right foot.
    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. http POST with form encoding
    By srikanth_trulyit in forum Qt Programming
    Replies: 1
    Last Post: 10th June 2009, 10:16

Tags for this Thread

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.