-
-
Save mk0x9/29da2dfa829627b2db94 to your computer and use it in GitHub Desktop.
ForeignWindow attachment problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bb/cascades/Application> | |
#include <bb/cascades/QmlDocument> | |
#include <bb/cascades/AbstractPane> | |
#include <bb/cascades/ForeignWindow> | |
#include <screen/screen.h> | |
#include "app.hpp" | |
using namespace bb::cascades; | |
void App::foreignWindowAttached(unsigned long windowHandle, | |
const QString &windowGroup, const QString &windowId) { | |
qDebug() << "window handle: " << windowHandle << ", window group: " | |
<< windowGroup << ", window ID: " << windowId; | |
return; | |
} | |
void App::foreignAttachDetach(bool state) { | |
if (state) { | |
qDebug() << "Attached"; | |
} else { | |
qDebug() << "Detached"; | |
} | |
} | |
App::App() { | |
QmlDocument *qml = QmlDocument::create("main.qml"); | |
qml->setContextProperty("cs", this); | |
AbstractPane *root = qml->createRootNode<AbstractPane>(); | |
Application::setScene(root); | |
ForeignWindow *foreignWindow = root->findChild<ForeignWindow *>( | |
"foreignWindow"); | |
if (!foreignWindow) { | |
qWarning() << "Not found foreign window. FAIL"; | |
} else { | |
qWarning() << "Found foreign window. SUCCESS"; | |
} | |
QString winGroup = foreignWindow->windowGroup(); | |
QString winId = foreignWindow->windowId(); | |
qDebug() << "window group: " << winGroup << ", window id: " << winId; | |
QObject::connect(foreignWindow, | |
SIGNAL(windowAttached(unsigned long, const QString &, const QString &)), | |
this, | |
SLOT(foreignWindowAttached(unsigned long, const QString &, const QString &))); | |
QObject::connect(foreignWindow, SIGNAL(attachedChanged(bool)), this, | |
SLOT(foreignAttachDetach(bool))); | |
screen_context_t m_screen_cxt; | |
screen_window_t m_screen_wnd; | |
screen_create_context(&m_screen_cxt, SCREEN_APPLICATION_CONTEXT); | |
screen_create_window_type(&m_screen_wnd, m_screen_cxt, SCREEN_CHILD_WINDOW); | |
screen_join_window_group(m_screen_wnd, winGroup.toAscii().constData()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef APP_H | |
#define APP_H | |
#include <QtCore/QObject> | |
#include <QtCore/QMetaType> | |
#include <bb/cascades/Event> | |
#include <bb/cascades/UiObject> | |
#include <bb/cascades/Control> | |
class App : public QObject | |
{ | |
Q_OBJECT | |
public: | |
App(); | |
public slots: | |
Q_INVOKABLE void foreignWindowAttached(unsigned long, const QString &, const QString &); | |
Q_INVOKABLE void foreignAttachDetach(bool state); | |
}; | |
#endif // ifndef APP_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NavigatorPrivate::NavigatorPrivate - width=768 | |
NavigatorPrivate::NavigatorPrivate - height=1280 | |
NavigatorPrivate::NavigatorPrivate - angle=0 | |
BpsEventDispatcher::processBpsEvents() - thread started | |
### Server Thread: STARTED | |
startScreenEventThread(SUCCESS) | |
### PPS Thread: STARTED (8) | |
/pps: 17 | |
/pps/services: 17 | |
/pps/services/automation: 17 | |
/pps/services/automation/framework: 13 | |
NavigatorPrivate::setAllowedOrientation - allow=1 | |
Found foreign window. SUCCESS | |
window group: "mainWindow-48279741-0" , window id: "" | |
NavigatorPrivate::handleBpsEvent: Event received: navigator active. WindowGroupID: mainWindow-48279741-0 | |
NavigatorPrivate::handleBpsEvent - window state | |
NavigatorPrivate::handleWindowStateEvent - fullscreen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bb.cascades 1.0 | |
Page { | |
content: Container { | |
preferredWidth: 768 | |
preferredHeight: 1280 | |
background: Color.create ("#262626") | |
layout: StackLayout { | |
leftPadding: 20 | |
rightPadding: 20 | |
topPadding: 20 | |
bottomPadding: 20 | |
} | |
ForeignWindow { | |
id: foreignWindow | |
objectName: "foreignWindow" | |
visible: attached | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment