Project

General

Profile

modal WMessageBox and Qt

Added by Robert Graebert over 10 years ago

Hi,

I have been playing around with model message boxes and I am having trouble when Qt is also present:

1) I insert a WMessageBox::show in the greet function of the hello.wt sample to show a MessageBox. Everything works fine and I can click the Ok button to exit the MessageBox

2) When I try the same thing with the helloqt.wt project, I get the messagebox, but clicking ok does not lead to event processing.

FYI I use Qt 4.7.4 on Windows.

One possible issue could be that my Qt version is built against VS 2008 and I building Wt in VS 2012. If you think this could be the cause, I can see if I can build a VS 2012 version of Qt.

Thanks,

Robert


Replies (4)

RE: modal WMessageBox and Qt - Added by Koen Deforche over 10 years ago

Hey,

That'sost likely a bug in wtwithqt lib. Can you file an issue?

As a workaround may I suggest to connect signals and show() the dialog?

Koen

RE: modal WMessageBox and Qt - Added by Robert Graebert over 10 years ago

Hi Koen,

I am not quite sure how I would connect the signals. (using the Wt or Qt way?)

Anyway, I built Qt fresh for VS 2012 and I get the same result. I have also attempted to simplify the issues and it seems to be related qtwithqt. (I removed the QObjects and just called messagebox in propagateGreet.

Looking at the stack, the two version are quite different:

hello.wt.exe!Wt::DispatchThread::doEvent() Line 141

hello.wt.exe!Wt::DispatchThread::myExec() Line 85

hello.wt.exe!Wt::DispatchThread::run() Line 70

QtCore4.dll!QThreadPrivate::start(void * arg) Line 298

msvcr110.dll!_callthreadstartex() Line 354

msvcr110.dll!_threadstartex(void * ptd) Line 332

kernel32.dll!BaseThreadInitThunk12()

ntdll.dll!_RtlUserThreadStart@8()

ntdll.dll!__RtlUserThreadStart@8()

and

hello.wt.exe!Wt::WebSession::handleRequest(Wt::WebSession::Handler & handler) Line 1486

hello.wt.exe!Wt::WebController::handleRequest(Wt::WebRequest * request) Line 661

hello.wt.exe!boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest ::operator()(Wt::WebController p, Wt::WebRequest * a1) Line 166

hello.wt.exe!boost::_bi::list2<boost::_bi::value<Wt::WebController ,boost::_bi::value<http::server::HTTPRequest> >::operator()<boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest ,boost::_bi::list0>(boost::bi::type_formal, boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest> & f, boost::bi::list0 & a, int_formal) Line 314

hello.wt.exe!boost::_bi::bind_t<void,boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest ,boost::_bi::list2<boost::_bi::value<Wt::WebController>,boost::_bi::value<http::server::HTTPRequest *> > >::operator()() Line 21

hello.wt.exe!boost::asio::asio_handler_invoke<boost::_bi::bind_t<void,boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest ,boost::_bi::list2<boost::_bi::value<Wt::WebController>,boost::_bi::value<http::server::HTTPRequest *> > > >(boost::_bi::bind_t<void,boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest ,boost::_bi::list2<boost::_bi::value<Wt::WebController>,boost::_bi::value<http::server::HTTPRequest *> > > function, ...) Line 65

hello.wt.exe!boost_asio_handler_invoke_helpers::invoke<boost::_bi::bind_t<void,boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest ,boost::_bi::list2<boost::_bi::value<Wt::WebController>,boost::_bi::value<http::server::HTTPRequest *> > >,boost::_bi::bind_t<void,boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest ,boost::_bi::list2<boost::_bi::value<Wt::WebController>,boost::_bi::value<http::server::HTTPRequest *> > > >(boost::_bi::bind_t<void,boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest ,boost::_bi::list2<boost::_bi::value<Wt::WebController>,boost::_bi::value<http::server::HTTPRequest *> > > & function, boost::_bi::bind_t<void,boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest ,boost::_bi::list2<boost::_bi::value<Wt::WebController>,boost::_bi::value<http::server::HTTPRequest *> > > & context) Line 39

hello.wt.exe!boost::asio::detail::completion_handler<boost::_bi::bind_t<void,boost::_mfi::mf1<void,Wt::WebController,Wt::WebRequest ,boost::_bi::list2<boost::_bi::value<Wt::WebController>,boost::bi::value<http::server::HTTPRequest *> > > >::do_complete(boost::asio::detail::win_iocp_io_service * owner, boost::asio::detail::win_iocp_operation * base, const boost::system::error_code &formal, unsigned int_formal) Line 67

hello.wt.exe!boost::asio::detail::win_iocp_operation::complete(boost::asio::detail::win_iocp_io_service & owner, const boost::system::error_code & ec, unsigned int bytes_transferred) Line 45

hello.wt.exe!boost::asio::detail::win_iocp_io_service::do_one(bool block, boost::system::error_code & ec) Line 405

hello.wt.exe!boost::asio::detail::win_iocp_io_service::run(boost::system::error_code & ec) Line 161

hello.wt.exe!boost::asio::io_service::run() Line 59

hello.wt.exe!Wt::WIOService::run() Line 161

hello.wt.exe!boost::_mfi::mf0<void,Wt::WIOService>::operator()(Wt::WIOService * p) Line 50

hello.wt.exe!boost::_bi::list1<boost::_bi::value<Wt::WIOService *> >::operator()<boost::_mfi::mf0<void,Wt::WIOService>,boost::_bi::list0>(boost::bi::type_formal, boost::_mfi::mf0<void,Wt::WIOService> & f, boost::bi::list0 & a, int_formal) Line 254

hello.wt.exe!boost::_bi::bind_t<void,boost::_mfi::mf0<void,Wt::WIOService>,boost::_bi::list1<boost::_bi::value<Wt::WIOService *> > >::operator()() Line 21

hello.wt.exe!boost::detail::thread_data<boost::_bi::bind_t<void,boost::_mfi::mf0<void,Wt::WIOService>,boost::_bi::list1<boost::_bi::value<Wt::WIOService *> > > >::run() Line 118

hello.wt.exe!boost::`anonymous namespace'::thread_start_function(void *)

msvcr110.dll!_callthreadstartex() Line 354

msvcr110.dll!_threadstartex(void * ptd) Line 332

kernel32.dll!BaseThreadInitThunk12()

ntdll.dll!_RtlUserThreadStart@8()

ntdll.dll!__RtlUserThreadStart@8()

As I am not using anything from Qt for this example, the problem seems to stem from wtwithqt.

I will post an issue. Let me know if you have any other thoughts.

Thanks,

Robert

RE: modal WMessageBox and Qt - Added by Koen Deforche over 10 years ago

Hey,

You need to connect a signal to WDialog::finished() and then show() the dialog. This will create a modal dialog without blocking the main event loop --- to the user it is entirely the same result.

Regards,

koen

RE: modal WMessageBox and Qt - Added by Robert Graebert over 10 years ago

Got it. That did work for asynchronous. Getting synchronous dialogs to work, would be great.

    (1-4/4)