Add title to WebWindowClass

This commit is contained in:
Ryan Huffman 2014-11-13 17:46:20 -08:00
parent 49563dbff7
commit 55612cc596
5 changed files with 10 additions and 8 deletions

View file

@ -159,7 +159,7 @@ GridTool = function(opts) {
var listeners = [];
var url = Script.resolvePath('html/gridControls.html');
var webView = new WebWindow(url, 200, 280);
var webView = new WebWindow('Grid', url, 200, 280);
horizontalGrid.addListener(function(data) {
webView.eventBridge.emitScriptEvent(JSON.stringify(data));

View file

@ -28,7 +28,8 @@ void ScriptEventBridge::emitScriptEvent(const QString& data) {
emit scriptEventReceived(data);
}
WebWindowClass::WebWindowClass(const QString& url, int width, int height)
WebWindowClass::WebWindowClass(const QString& title, const QString& url, int width, int height)
: QObject(NULL),
_window(new QWidget(NULL, Qt::Tool)),
_eventBridge(new ScriptEventBridge(this)) {
@ -59,8 +60,9 @@ QScriptValue WebWindowClass::constructor(QScriptContext* context, QScriptEngine*
QMetaObject::invokeMethod(WindowScriptingInterface::getInstance(), "doCreateWebWindow", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(WebWindowClass*, retVal),
Q_ARG(const QString&, file),
Q_ARG(int, context->argument(1).toInteger()),
Q_ARG(int, context->argument(2).toInteger()));
Q_ARG(QString, context->argument(1).toString()),
Q_ARG(int, context->argument(2).toInteger()),
Q_ARG(int, context->argument(3).toInteger()));
connect(engine, &QScriptEngine::destroyed, retVal, &WebWindowClass::deleteLater);

View file

@ -34,7 +34,7 @@ class WebWindowClass : public QObject {
Q_OBJECT
Q_PROPERTY(QObject* eventBridge READ getEventBridge)
public:
WebWindowClass(const QString& url, int width, int height);
WebWindowClass(const QString& title, const QString& url, int width, int height);
~WebWindowClass();
static QScriptValue constructor(QScriptContext* context, QScriptEngine* engine);

View file

@ -34,8 +34,8 @@ WindowScriptingInterface::WindowScriptingInterface() :
{
}
WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& url, int width, int height) {
return new WebWindowClass(url, width, height);
WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title, const QString& url, int width, int height) {
return new WebWindowClass(title, url, width, height);
}
QScriptValue WindowScriptingInterface::hasFocus() {

View file

@ -78,7 +78,7 @@ private slots:
void nonBlockingFormAccepted() { _nonBlockingFormActive = false; _formResult = QDialog::Accepted; emit nonBlockingFormClosed(); }
void nonBlockingFormRejected() { _nonBlockingFormActive = false; _formResult = QDialog::Rejected; emit nonBlockingFormClosed(); }
WebWindowClass* doCreateWebWindow(const QString& url, int width, int height);
WebWindowClass* doCreateWebWindow(const QString& title, const QString& url, int width, int height);
private:
WindowScriptingInterface();