as titile saying, i 'm going to wrote a qt plugin in maya2012 which a widget can embed web browse, but it don't working!
maya'saying // Error: Unable to dynamically load : D:/test_mll/test_web/release/test_web.mll
but when i replacing QLabel to QWebView widget in code, and the plugin is success in working.
need somehelp!
here is my code:-------------------------------------
#include "test_web.h"
#include
#include
#include
QPointer test_web::web;
const MString test_web::commandName("test_web");
MStatus test_web::doIt( const MArgList& )
//
// 函数描述:
// 网络核心的测试函数。
{
if( web.isNull() ) {
web = new QMainWindow();
//QLabel *label = new QLabel("this is my label!");
//web->setCentralWidget( label );
QWebView *webView = new QWebView();
webView->load(QUrl("http://www.sohu.com"));
web->setCentralWidget( webView );
web->show();
}
else
{
web->showNormal();
web->raise();
}
//MGlobal::displayInfo(MString("here is ok!"));
return MS::kSuccess;
}
void test_web::cleanup()
//
// 函数描述:
// 清除插件的残余。
//
{
if( !web.isNull() ) delete web;
}
// ==========================================================================
//
// Plugin load/unload
//
// ==========================================================================
MStatus initializePlugin(MObject plugin)
{
MStatus st;
MFnPlugin pluginFn(plugin, "Autodesk, Inc.", "1.0", "Any", &st);
if (!st) {
MGlobal::displayError(
MString("test_web - could not initialize plugin: ")
+ st.errorString()
);
return st;
}
// Register the command.
st = pluginFn.registerCommand(test_web::commandName, test_web::creator);
if (!st) {
MGlobal::displayError(
MString("test_web - could not register '")
+ test_web::commandName + "' command: "
+ st.errorString()
);
return st;
}
return st;
}
MStatus uninitializePlugin(MObject plugin)
{
MStatus st;
MFnPlugin pluginFn(plugin, "Autodesk, Inc.", "1.0", "Any", &st);
if (!st) {
MGlobal::displayError(
MString("test_web - could not uninitialize plugin: ")
+ st.errorString()
);
return st;
}
// Make sure that there is no UI left hanging around.
test_web::cleanup();
// Deregister the command.
st = pluginFn.deregisterCommand(test_web::commandName);
if (!st) {
MGlobal::displayError(
MString("test_web - could not deregister '")
+ test_web::commandName + "' command: "
+ st.errorString()
);
return st;
}
return st;
}
