make painters on random pixmaps work; you still need to take of things like calling end()
BUG:266018
This commit is contained in:
parent
2435f1cc6a
commit
08fae507f1
@ -21,6 +21,10 @@
|
|||||||
|
|
||||||
#include <QtCore/QSharedData>
|
#include <QtCore/QSharedData>
|
||||||
|
|
||||||
|
#include <QPixmap>
|
||||||
|
Q_DECLARE_METATYPE(QPixmap*)
|
||||||
|
Q_DECLARE_METATYPE(QPixmap)
|
||||||
|
|
||||||
#define DECLARE_SELF(Class, __fn__) \
|
#define DECLARE_SELF(Class, __fn__) \
|
||||||
Class* self = qscriptvalue_cast<Class*>(ctx->thisObject()); \
|
Class* self = qscriptvalue_cast<Class*>(ctx->thisObject()); \
|
||||||
if (!self) { \
|
if (!self) { \
|
||||||
|
@ -50,6 +50,14 @@ static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
|||||||
{
|
{
|
||||||
if (ctx->argumentCount() > 0) {
|
if (ctx->argumentCount() > 0) {
|
||||||
QPaintDevice *device = qscriptvalue_cast<QPaintDevice*>(ctx->argument(0));
|
QPaintDevice *device = qscriptvalue_cast<QPaintDevice*>(ctx->argument(0));
|
||||||
|
if (!device) {
|
||||||
|
QPixmap *pixmap = qscriptvalue_cast<QPixmap *>(ctx->argument(0));
|
||||||
|
if (pixmap) {
|
||||||
|
return newPainter(eng, new QPainter(pixmap));
|
||||||
|
} else {
|
||||||
|
return newPainter(eng, new QPainter());
|
||||||
|
}
|
||||||
|
}
|
||||||
return newPainter(eng, new QPainter(device));
|
return newPainter(eng, new QPainter(device));
|
||||||
} else {
|
} else {
|
||||||
return newPainter(eng, new QPainter());
|
return newPainter(eng, new QPainter());
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
#include "backportglobal.h"
|
#include "backportglobal.h"
|
||||||
#include "plasmoid/appletinterface.h"
|
#include "plasmoid/appletinterface.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QPixmap*)
|
|
||||||
Q_DECLARE_METATYPE(QPixmap)
|
|
||||||
|
|
||||||
static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
|
||||||
{
|
{
|
||||||
if (ctx->argumentCount() == 1 && ctx->argument(0).isString()) {
|
if (ctx->argumentCount() == 1 && ctx->argument(0).isString()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user