Results 1 to 2 of 2

Thread: problem in reimplementing Create window in QwebView

  1. #1
    Join Date
    Mar 2010
    Posts
    63
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded Qt Jambi
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default problem in reimplementing Create window in QwebView

    Hi,
    I am trying to reimplement Createwindow() in QWebview.I am unable to set cookie in rawheader.I am getting value in QDebug.But on checking it wireshrak i can see no header set with URL.I normaly use same code to set cookie in QWebView.
    But i m faing proble in only creating window.

    I also tried setHeader with knowheader.But same result.Plase see code and tell me where i am wrong

    Qt Code:
    1. QWebView* customweb::createWindow(QWebPage::WebWindowType type)
    2. {
    3.  
    4. switch(type)
    5.  
    6. {
    7.  
    8. case QWebPage::WebBrowserWindow: // The window is a regular web browser window
    9. {
    10.  
    11. {QString cookie;
    12. for(int i=0;i<cookiejar.count();i++)
    13. {
    14. cookie=cookie+ QString(cookiejar.at(i)).replace(":","")+";";
    15.  
    16. }
    17.  
    18.  
    19.  
    20. QNetworkRequest req;
    21.  
    22. req.setUrl(webpage->page_networkrequest.url());
    23. // req.setRawHeader(QByteArray("Cookie:"),QVariant(cookie).toByteArray());
    24. req.setRawHeader(QByteArray("cookie"),QVariant(cookie).toByteArray());
    25.  
    26. abc=new customweb(cookiejar);
    27.  
    28. QString as23=webpage->page_networkrequest.url().toString();
    29.  
    30. qDebug(QString("mohit ").toLatin1()+QString(req.rawHeader("cookie")).toLatin1() );\
    31.  
    32. abc->load(req);
    33.  
    34. abc->show();
    35. return abc;
    36.  
    37. }
    38.  
    39. }
    40. break;
    41.  
    42. default:
    43. //QMessageBox::information(NULL, "Type", "other");
    44. break;
    45.  
    46. }
    47.  
    48. return new QWebView(NULL);
    49. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 26th November 2010 at 10:42. Reason: missing [code] tags

  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: problem in reimplementing Create window in QwebView

    How about using setHeader() instead of setRawHeader()? I could guess your cookie header gets cleared by the internals of WebKit that checks the cookie jar on its own.
    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. Replies: 9
    Last Post: 16th May 2010, 16:21
  2. problem reimplementing mouseMoveEvent
    By jhowland in forum Qt Programming
    Replies: 2
    Last Post: 6th April 2010, 20:18
  3. Embed QWebView into non-QT Win32 window (whole window)
    By sonusingh in forum Qt Programming
    Replies: 0
    Last Post: 29th January 2010, 11:40
  4. Problem reimplementing QWidget::keyPressEvent
    By jiveaxe in forum Qt Programming
    Replies: 2
    Last Post: 22nd September 2008, 12:02
  5. Problem reimplementing QSpinBox in a custom widget
    By hvengel in forum Qt Programming
    Replies: 1
    Last Post: 30th March 2006, 08:12

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.