From 9c1b38d66f79a953bfdec37cea96b8aa128a0229 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 23 May 2018 06:59:36 -0400 Subject: Add the NativeEmbedWidget.h file to git (forgot to include previously) --- .../src-desktop/src-widgets/NativeEmbedWidget.h | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h (limited to 'src-qt5/core/lumina-desktop-unified') diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h new file mode 100644 index 00000000..f9cc52b7 --- /dev/null +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/src-widgets/NativeEmbedWidget.h @@ -0,0 +1,49 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2018, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _DESKTOP_WINDOW_EMBED_WIDGET_H +#define _DESKTOP_WINDOW_EMBED_WIDGET_H +#include + +class NativeEmbedWidget : public QObject{ + Q_OBJECT +private: + QWidget *embedW; + QWindow *_window; + NativeWindowObject *WIN; + +private slots: + void visibleChanged(bool show){ WIN->setProperty(NativeWindowObject::Visible, show); } + void windowTitleChanged(QString title){ WIN->setProperty(NativeWindowObject::Title, title); } + void heightChanged(int val){ qDebug() << "Got Wndow Height change:" << val; } //WIN->setProperty(NativeWindowObject::Size, QSize(WIN->property(NativeWindowObject::Size).toSize().width(),val) ); } + void widthChanged(int val){ qDebug() << "Got Wndow Width change:" << val; } // WIN->setProperty(NativeWindowObject::Size, QSize(val, WIN->property(NativeWindowObject::Size).toSize().height()) ); } + void xChanged(int val){ qDebug() << "Got Window X changed:" << val; } + void yChanged(int val){ qDebug() << "Got Window Y changed:" << val; } + + +public: + NativeEmbedWidget(QWidget *parent, NativeWindowObject *obj) : QObject(parent){ + WIN = obj; + _window = QWindow::fromWinId(WIN->id()); + embedW = QWidget::createWindowContainer(_window, parent); + //Setup all the internal connections + connect(_window, SIGNAL(visibleChanged(bool)), this, SLOT(visibleChanged(bool)) ); + connect(_window, SIGNAL(windowTitleChanged(const QString&)), this, SLOT(windowTitleChanged(const QString&)) ); + connect(_window, SIGNAL(widthChanged(int)), this, SLOT(widthChanged(int)) ); + connect(_window, SIGNAL(heightChanged(int)), this, SLOT(heightChanged(int)) ); + connect(_window, SIGNAL(xChanged(int)), this, SLOT(xChanged(int)) ); + connect(_window, SIGNAL(yChanged(int)), this, SLOT(yChanged(int)) ); + } + ~NativeEmbedWidget(){} + + QWidget* widget(){ return embedW; } + +public slots: + void activateWindow(){ _window->requestActivate(); } + +}; + +#endif -- cgit