allow a subclass to define the default screen for the panel at runtime
CCBUG:262558
This commit is contained in:
parent
365be18057
commit
13164dd664
@ -19,6 +19,8 @@
|
||||
|
||||
#include "scriptengine.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
@ -135,7 +137,7 @@ QScriptValue ScriptEngine::createContainment(const QString &type, const QString
|
||||
if (c) {
|
||||
if (type == "panel") {
|
||||
// some defaults
|
||||
c->setScreen(0);
|
||||
c->setScreen(env->defaultPanelScreen());
|
||||
c->setLocation(Plasma::TopEdge);
|
||||
}
|
||||
c->updateConstraints(Plasma::AllConstraints | Plasma::StartupCompletedConstraint);
|
||||
@ -173,6 +175,11 @@ QScriptValue ScriptEngine::wrap(Containment *c)
|
||||
return v;
|
||||
}
|
||||
|
||||
int ScriptEngine::defaultPanelScreen() const
|
||||
{
|
||||
return qApp ? qApp->desktop()->primaryScreen() : 0;
|
||||
}
|
||||
|
||||
ScriptEngine *ScriptEngine::envFor(QScriptEngine *engine)
|
||||
{
|
||||
QObject *object = engine->globalObject().toQObject();
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
QScriptValue wrap(Plasma::Applet *w);
|
||||
virtual QScriptValue wrap(Plasma::Containment *c);
|
||||
QScriptValue wrap(Containment *c);
|
||||
virtual int defaultPanelScreen() const;
|
||||
|
||||
static bool isPanel(const Plasma::Containment *c);
|
||||
static ScriptEngine *envFor(QScriptEngine *engine);
|
||||
|
Loading…
Reference in New Issue
Block a user