Results 1 to 5 of 5

Thread: problem with QWebView::show()

  1. #1
    Join Date
    Jul 2011
    Location
    Kraków / Poland
    Posts
    32
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11
    Thanks
    1

    Default problem with QWebView::show()

    Hi.
    I have class inherited from QThread. I am using QWebPage in there, for my developers purpose, I getting QWebPage from QWebView, but when I am calling function QWebView::show(), my program is terminated with error:
    Qt Code:
    1. [xcb] Unknown request in queue while dequeuing
    2. [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
    3. [xcb] Aborting, sorry about that.
    4. N: /var/tmp/portage/x11-libs/libX11-1.5.0/work/libX11-1.5.0/src/xcb_io.c:178: dequeue_pending_request: Warunek zapewnienia `!xcb_xlib_unknown_req_in_deq' nie został spełniony.
    5. The program has unexpectedly finished.
    To copy to clipboard, switch view to plain text mode 
    My header file:
    Qt Code:
    1. ...
    2. #include <QThread>
    3. #include <QtWebKit>
    4.  
    5. class myclass : public QThread
    6. {
    7. ....
    8. Q_OBJECT
    9. public:
    10. explicit myclass();
    11. ...
    12. protected:
    13. Logger *logger;
    14. QEventLoop loop;
    15. Settings *mySettings;
    16.  
    17. public slots:
    18. void pageLoading() { loop.exec(); }
    19. }
    To copy to clipboard, switch view to plain text mode 
    source file:
    Qt Code:
    1. myclass::myclass()
    2. {
    3. logger = Logger::getInstance();
    4. mySettings = Settings::getInstance();
    5. QWebView *view = new QWebView();
    6. logger->Info("Showing QWebView");
    7. view->show();
    8. myPage = view->page();
    9.  
    10. connect(myPage->networkAccessManager(), SIGNAL(finished(QNetworkReply*)), &loop, SLOT(quit()));
    11. connect(myPage,SIGNAL(loadStarted()), this, SLOT(pageLoading()));
    12. }
    To copy to clipboard, switch view to plain text mode 
    I deleted line with view->show(); and my program is working fine.
    My class has type of abstract. I inherit her in dynamic library. Am I doing something wrong, or it's problem with libX11?

  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: problem with QWebView::show()

    QWebView is a GUI component and should only be used from the GUI (main) thread.
    You almost certainly don't need a thread here anyway.

  3. #3
    Join Date
    Jul 2011
    Location
    Kraków / Poland
    Posts
    32
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: problem with QWebView::show()

    I know that, I am creating QWebView and showing in main thread (it's in the constructor, not in run() function), and it's crashing anyway when I'm calling QWebView::show().
    I need threads for other things.

    Edit:
    I changed public QThread to public QObject and it's still crashing with this same error
    Last edited by januszmk; 21st July 2012 at 12:47.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: problem with QWebView::show()

    Which version of Qt are you using? Could you prepare a minimal compilable example reproducing your problem?
    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. #5
    Join Date
    Jul 2011
    Location
    Kraków / Poland
    Posts
    32
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: problem with QWebView::show()

    ok, sorry, I am doing this in another thread, but it's not this object, just object in 2 levels up.
    so problem solved. thanks

Similar Threads

  1. QWebview doesn't show phonetic symbols
    By herend in forum Qt Programming
    Replies: 3
    Last Post: 24th November 2011, 11:34
  2. QWebView doesn't show JPEG images on a clean XP machine
    By mentalmushroom in forum Qt Programming
    Replies: 46
    Last Post: 12th August 2011, 23:41
  3. Problem with QwebView
    By moh.gup@gmail.com in forum Qt Programming
    Replies: 3
    Last Post: 17th September 2010, 15:22
  4. Howto select/show a QWebElement in QWebview
    By nightghost in forum Qt Programming
    Replies: 1
    Last Post: 2nd September 2010, 13:51
  5. Problem With QWebView
    By ivi2501 in forum Qt Programming
    Replies: 8
    Last Post: 2nd August 2009, 20:37

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.