panelconfigview is a subclass of configview
This commit is contained in:
parent
d44f0973d3
commit
7301f6d8b7
@ -36,27 +36,13 @@
|
|||||||
|
|
||||||
//////////////////////////////PanelConfigView
|
//////////////////////////////PanelConfigView
|
||||||
PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *panelView, QWindow *parent)
|
PanelConfigView::PanelConfigView(Plasma::Containment *containment, PanelView *panelView, QWindow *parent)
|
||||||
: QQuickView(parent),
|
: ConfigView(containment, parent),
|
||||||
m_containment(containment),
|
m_containment(containment),
|
||||||
m_panelView(panelView)
|
m_panelView(panelView)
|
||||||
{
|
{
|
||||||
|
|
||||||
setFlags(Qt::FramelessWindowHint);
|
setFlags(Qt::FramelessWindowHint);
|
||||||
//FIXME: problem on nvidia, all windows should be transparent or won't show
|
|
||||||
setColor(Qt::transparent);
|
|
||||||
setTitle(i18n("%1 Settings", m_containment->title()));
|
|
||||||
|
|
||||||
|
|
||||||
if (!m_containment->corona()->package().isValid()) {
|
|
||||||
qWarning() << "Invalid home screen package";
|
|
||||||
}
|
|
||||||
|
|
||||||
setResizeMode(QQuickView::SizeViewToRootObject);
|
|
||||||
|
|
||||||
engine()->rootContext()->setContextProperty("panel", panelView);
|
|
||||||
engine()->rootContext()->setContextProperty("configDialog", this);
|
|
||||||
setSource(QUrl::fromLocalFile(panelView->corona()->package().filePath("panelconfigurationui")));
|
|
||||||
syncGeometry();
|
|
||||||
connect(containment, &Plasma::Containment::formFactorChanged,
|
connect(containment, &Plasma::Containment::formFactorChanged,
|
||||||
this, &PanelConfigView::syncGeometry);
|
this, &PanelConfigView::syncGeometry);
|
||||||
}
|
}
|
||||||
@ -65,6 +51,12 @@ PanelConfigView::~PanelConfigView()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PanelConfigView::init()
|
||||||
|
{
|
||||||
|
setSource(QUrl::fromLocalFile(m_containment->corona()->package().filePath("panelconfigurationui")));
|
||||||
|
syncGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
void PanelConfigView::syncGeometry()
|
void PanelConfigView::syncGeometry()
|
||||||
{
|
{
|
||||||
if (!m_containment) {
|
if (!m_containment) {
|
||||||
@ -91,22 +83,5 @@ void PanelConfigView::syncGeometry()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//To emulate Qt::WA_DeleteOnClose that QWindow doesn't have
|
|
||||||
void PanelConfigView::hideEvent(QHideEvent *ev)
|
|
||||||
{
|
|
||||||
QQuickWindow::hideEvent(ev);
|
|
||||||
deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelConfigView::resizeEvent(QResizeEvent *re)
|
|
||||||
{
|
|
||||||
if (!rootObject()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
rootObject()->setWidth(re->size().width());
|
|
||||||
rootObject()->setHeight(re->size().height());
|
|
||||||
QQuickWindow::resizeEvent(re);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include "moc_panelconfigview.cpp"
|
#include "moc_panelconfigview.cpp"
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#ifndef PANELCONFIGVIEW_H
|
#ifndef PANELCONFIGVIEW_H
|
||||||
#define PANELCONFIGVIEW_H
|
#define PANELCONFIGVIEW_H
|
||||||
|
|
||||||
|
#include "configview.h"
|
||||||
#include <QQuickItem>
|
#include <QQuickItem>
|
||||||
#include <QQuickView>
|
#include <QQuickView>
|
||||||
#include <QJSValue>
|
#include <QJSValue>
|
||||||
@ -36,7 +37,7 @@ namespace Plasma {
|
|||||||
|
|
||||||
//TODO: this should be a subclass of ConfigView currently in the scriptengine
|
//TODO: this should be a subclass of ConfigView currently in the scriptengine
|
||||||
//TODO: that class should be moved here
|
//TODO: that class should be moved here
|
||||||
class PanelConfigView : public QQuickView
|
class PanelConfigView : public ConfigView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -44,13 +45,11 @@ public:
|
|||||||
PanelConfigView(Plasma::Containment *interface, PanelView *panelView, QWindow *parent = 0);
|
PanelConfigView(Plasma::Containment *interface, PanelView *panelView, QWindow *parent = 0);
|
||||||
virtual ~PanelConfigView();
|
virtual ~PanelConfigView();
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void syncGeometry();
|
void syncGeometry();
|
||||||
|
|
||||||
protected:
|
|
||||||
void hideEvent(QHideEvent *ev);
|
|
||||||
void resizeEvent(QResizeEvent *re);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Plasma::Containment *m_containment;
|
Plasma::Containment *m_containment;
|
||||||
PanelView *m_panelView;
|
PanelView *m_panelView;
|
||||||
|
@ -167,6 +167,7 @@ void PanelView::showPanelController()
|
|||||||
{
|
{
|
||||||
if (!m_panelConfigView) {
|
if (!m_panelConfigView) {
|
||||||
m_panelConfigView = new PanelConfigView(containment(), this);
|
m_panelConfigView = new PanelConfigView(containment(), this);
|
||||||
|
m_panelConfigView->init();
|
||||||
}
|
}
|
||||||
m_panelConfigView->show();
|
m_panelConfigView->show();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user