Hi,
I found a curious problem when I embed an Cocoa WebView into the QDialog.
The sample code is that
#include <QtGui/QtGui>
#include <Cocoa/Cocoa.h>
#include <WebKit/WebKit.h>
#include <QMacCocoaViewContainer>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QDialog qDialog;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSRect rect = {{0, 0},{qDialog.frameSize().width(),
qDialog.frameSize().height()}};
WebView *webView = [[WebView alloc] initWithFrame:rect frameName:nil
groupName:nil];
QMacCocoaViewContainer macCocoaViewContainer(webView, &qDialog);
QHBoxLayout hBoxlayout;
hBoxlayout.addWidget(&macCocoaViewContainer);
qDialog.setLayout(&hBoxlayout);
[[static_cast<WebView *> (macCocoaViewContainer.cocoaView()) mainFrame]
loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString
stringWithString:@"http://www.google.com"]]]];
qDialog.resize(800,600);
macCocoaViewContainer.show();
qDialog.show();//This works rightly, and it could show the
http://www.google.com web page.
//But when it is changed to qDialog.exec(), the web page could
not be showed. Why?
[pool release];
return app.exec();
}
This code could work rightly and it will show the "www.google.com" web page
embedded in the dialog. However when I change the qDialog.show() to
qDialog.exec(), the web page could not showed.
The qDialog.exec() is our required, please check this sample code.
Thanks,
Rui.
_________________________________________________________________
MSN热搜榜,每天最In的信息资讯和热点排行让您一览无余!
http://top.msn.com.cn_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback