Merge branch 'master' into plasma/declarative
This commit is contained in:
commit
4081aea62b
@ -39,10 +39,15 @@ public:
|
|||||||
|
|
||||||
void setDeclarativeItem(QDeclarativeItem *item)
|
void setDeclarativeItem(QDeclarativeItem *item)
|
||||||
{
|
{
|
||||||
|
if (m_declarativeItem) {
|
||||||
|
m_declarativeItem.data()->removeSceneEventFilter(this);
|
||||||
|
}
|
||||||
m_declarativeItem = item;
|
m_declarativeItem = item;
|
||||||
static_cast<QGraphicsItem *>(item)->setParentItem(this);
|
static_cast<QGraphicsItem *>(item)->setParentItem(this);
|
||||||
setMinimumWidth(item->implicitWidth());
|
setMinimumWidth(item->implicitWidth());
|
||||||
setMinimumHeight(item->implicitHeight());
|
setMinimumHeight(item->implicitHeight());
|
||||||
|
resize(item->width(), item->height());
|
||||||
|
item->installSceneEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDeclarativeItem *declarativeItem() const
|
QDeclarativeItem *declarativeItem() const
|
||||||
@ -59,6 +64,15 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::GraphicsSceneResize) {
|
||||||
|
resize(watched->boundingRect().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
return QGraphicsWidget::sceneEventFilter(watched, event);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWeakPointer<QDeclarativeItem> m_declarativeItem;
|
QWeakPointer<QDeclarativeItem> m_declarativeItem;
|
||||||
};
|
};
|
||||||
@ -67,6 +81,7 @@ DialogProxy::DialogProxy(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
m_dialog = new Plasma::Dialog();
|
m_dialog = new Plasma::Dialog();
|
||||||
|
m_flags = m_dialog->windowFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogProxy::~DialogProxy()
|
DialogProxy::~DialogProxy()
|
||||||
@ -146,22 +161,22 @@ void DialogProxy::setVisible(const bool visible)
|
|||||||
{
|
{
|
||||||
if (m_dialog->isVisible() != visible) {
|
if (m_dialog->isVisible() != visible) {
|
||||||
m_dialog->setVisible(visible);
|
m_dialog->setVisible(visible);
|
||||||
|
if (visible) {
|
||||||
|
m_dialog->setWindowFlags(m_flags);
|
||||||
|
m_dialog->raise();
|
||||||
|
}
|
||||||
emit visibleChanged();
|
emit visibleChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogProxy::showPopup(QGraphicsObject *item)
|
QPoint DialogProxy::popupPosition(QGraphicsObject *item) const
|
||||||
{
|
{
|
||||||
if (m_dialog->isVisible()) {
|
|
||||||
m_dialog->hide();
|
|
||||||
} else {
|
|
||||||
Plasma::Corona *corona = qobject_cast<Plasma::Corona *>(item->scene());
|
Plasma::Corona *corona = qobject_cast<Plasma::Corona *>(item->scene());
|
||||||
if (corona) {
|
if (corona) {
|
||||||
m_dialog->move(corona->popupPosition(item, m_dialog->size()));
|
return corona->popupPosition(item, m_dialog->size());
|
||||||
|
} else {
|
||||||
|
return QPoint();
|
||||||
}
|
}
|
||||||
m_dialog->show();
|
|
||||||
}
|
|
||||||
emit visibleChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -185,6 +200,17 @@ void DialogProxy::setY(int y)
|
|||||||
m_dialog->move(m_dialog->pos().x(), y);
|
m_dialog->move(m_dialog->pos().x(), y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DialogProxy::windowFlags() const
|
||||||
|
{
|
||||||
|
return (int)m_dialog->windowFlags();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogProxy::setWindowFlags(const int flags)
|
||||||
|
{
|
||||||
|
m_flags = (Qt::WindowFlags)flags;
|
||||||
|
m_dialog->setWindowFlags((Qt::WindowFlags)flags);
|
||||||
|
}
|
||||||
|
|
||||||
bool DialogProxy::eventFilter(QObject *watched, QEvent *event)
|
bool DialogProxy::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (watched == m_dialog && event->type() == QEvent::Move) {
|
if (watched == m_dialog && event->type() == QEvent::Move) {
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWeakPointer>
|
#include <QWeakPointer>
|
||||||
|
#include <QPoint>
|
||||||
|
|
||||||
class QGraphicsObject;
|
class QGraphicsObject;
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ class DialogProxy : public QObject
|
|||||||
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
|
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
|
||||||
Q_PROPERTY(int x READ x WRITE setX NOTIFY positionChanged)
|
Q_PROPERTY(int x READ x WRITE setX NOTIFY positionChanged)
|
||||||
Q_PROPERTY(int y READ y WRITE setY NOTIFY positionChanged)
|
Q_PROPERTY(int y READ y WRITE setY NOTIFY positionChanged)
|
||||||
|
Q_PROPERTY(int windowFlags READ windowFlags WRITE setWindowFlags)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum WidgetAttribute {
|
enum WidgetAttribute {
|
||||||
@ -60,7 +62,11 @@ public:
|
|||||||
int y() const;
|
int y() const;
|
||||||
void setY(int y);
|
void setY(int y);
|
||||||
|
|
||||||
Q_INVOKABLE void showPopup(QGraphicsObject *item);
|
//FIXME: passing an int is ugly
|
||||||
|
int windowFlags() const;
|
||||||
|
void setWindowFlags(const int);
|
||||||
|
|
||||||
|
Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item) const;
|
||||||
//FIXME:: Qt::WidgetAttribute should be already
|
//FIXME:: Qt::WidgetAttribute should be already
|
||||||
Q_INVOKABLE void setAttribute(int attribute, bool on);
|
Q_INVOKABLE void setAttribute(int attribute, bool on);
|
||||||
|
|
||||||
@ -77,6 +83,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Plasma::Dialog *m_dialog;
|
Plasma::Dialog *m_dialog;
|
||||||
|
Qt::WindowFlags m_flags;
|
||||||
DeclarativeItemContainer *m_declarativeItemContainer;
|
DeclarativeItemContainer *m_declarativeItemContainer;
|
||||||
QWeakPointer<QGraphicsObject> m_mainItem;
|
QWeakPointer<QGraphicsObject> m_mainItem;
|
||||||
};
|
};
|
||||||
|
@ -71,6 +71,7 @@ FrameSvgItem::~FrameSvgItem()
|
|||||||
void FrameSvgItem::setImagePath(const QString &path)
|
void FrameSvgItem::setImagePath(const QString &path)
|
||||||
{
|
{
|
||||||
m_frameSvg->setImagePath(path);
|
m_frameSvg->setImagePath(path);
|
||||||
|
m_frameSvg->setElementPrefix(m_prefix);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,12 +84,13 @@ QString FrameSvgItem::imagePath() const
|
|||||||
void FrameSvgItem::setPrefix(const QString &prefix)
|
void FrameSvgItem::setPrefix(const QString &prefix)
|
||||||
{
|
{
|
||||||
m_frameSvg->setElementPrefix(prefix);
|
m_frameSvg->setElementPrefix(prefix);
|
||||||
|
m_prefix = prefix;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FrameSvgItem::prefix() const
|
QString FrameSvgItem::prefix() const
|
||||||
{
|
{
|
||||||
return m_frameSvg->prefix();
|
return m_prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameSvgItemMargins *FrameSvgItem::margins() const
|
FrameSvgItemMargins *FrameSvgItem::margins() const
|
||||||
|
@ -88,6 +88,7 @@ private Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
Plasma::FrameSvg *m_frameSvg;
|
Plasma::FrameSvg *m_frameSvg;
|
||||||
FrameSvgItemMargins *m_margins;
|
FrameSvgItemMargins *m_margins;
|
||||||
|
QString m_prefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ void SvgItem::setSvg(Plasma::Svg *svg)
|
|||||||
disconnect(m_svg.data(), 0, this, 0);
|
disconnect(m_svg.data(), 0, this, 0);
|
||||||
}
|
}
|
||||||
m_svg = svg;
|
m_svg = svg;
|
||||||
connect(svg, SIGNAL(repaintNeeded()), this, SLOT(update()));
|
connect(svg, SIGNAL(repaintNeeded()), this, SLOT(updateNeeded()));
|
||||||
connect(svg, SIGNAL(repaintNeeded()), this, SIGNAL(naturalSizeChanged()));
|
connect(svg, SIGNAL(repaintNeeded()), this, SIGNAL(naturalSizeChanged()));
|
||||||
connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged()));
|
connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged()));
|
||||||
emit naturalSizeChanged();
|
emit naturalSizeChanged();
|
||||||
@ -115,6 +115,11 @@ void SvgItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
|
|||||||
painter->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothTransform);
|
painter->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SvgItem::updateNeeded()
|
||||||
|
{
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
#include "svgitem_p.moc"
|
#include "svgitem_p.moc"
|
||||||
|
@ -54,6 +54,9 @@ public:
|
|||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void naturalSizeChanged();
|
void naturalSizeChanged();
|
||||||
|
|
||||||
|
protected Q_SLOTS:
|
||||||
|
void updateNeeded();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWeakPointer<Plasma::Svg> m_svg;
|
QWeakPointer<Plasma::Svg> m_svg;
|
||||||
QString m_elementID;
|
QString m_elementID;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright 2009 Aaron Seigo <aseigo@kde.org>
|
* Copyright 2009 Aaron Seigo <aseigo@kde.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
* published by the Free Software Foundation; either version 2, or
|
* published by the Free Software Foundation; either version 2, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright 2009 Aaron Seigo <aseigo@kde.org>
|
* Copyright 2009 Aaron Seigo <aseigo@kde.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
* published by the Free Software Foundation; either version 2, or
|
* published by the Free Software Foundation; either version 2, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
|
@ -373,6 +373,15 @@ Plasma::Extender *AppletInterface::extender() const
|
|||||||
return m_appletScriptEngine->extender();
|
return m_appletScriptEngine->extender();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppletInterface::setAssociatedApplication(const QString &string)
|
||||||
|
{
|
||||||
|
applet()->setAssociatedApplication(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString AppletInterface::associatedApplication() const
|
||||||
|
{
|
||||||
|
return applet()->associatedApplication();
|
||||||
|
}
|
||||||
|
|
||||||
void AppletInterface::gc()
|
void AppletInterface::gc()
|
||||||
{
|
{
|
||||||
|
@ -77,6 +77,7 @@ class AppletInterface : public QObject
|
|||||||
Q_PROPERTY(int apiVersion READ apiVersion CONSTANT)
|
Q_PROPERTY(int apiVersion READ apiVersion CONSTANT)
|
||||||
Q_PROPERTY(QRectF rect READ rect)
|
Q_PROPERTY(QRectF rect READ rect)
|
||||||
Q_PROPERTY(QSizeF size READ size)
|
Q_PROPERTY(QSizeF size READ size)
|
||||||
|
Q_PROPERTY(QString associatedApplication WRITE setAssociatedApplication READ associatedApplication)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AppletInterface(AbstractJsAppletScript *parent);
|
AppletInterface(AbstractJsAppletScript *parent);
|
||||||
@ -285,6 +286,9 @@ enum IntervalAlignment {
|
|||||||
static AppletInterface *extract(QScriptEngine *engine);
|
static AppletInterface *extract(QScriptEngine *engine);
|
||||||
inline Plasma::Applet *applet() const { return m_appletScriptEngine->applet(); }
|
inline Plasma::Applet *applet() const { return m_appletScriptEngine->applet(); }
|
||||||
|
|
||||||
|
void setAssociatedApplication(const QString &string);
|
||||||
|
QString associatedApplication() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void releaseVisualFocus();
|
void releaseVisualFocus();
|
||||||
void configNeedsSaving();
|
void configNeedsSaving();
|
||||||
|
@ -1,39 +1,20 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
** This file is part of the Qt Script Generator.
|
||||||
**
|
**
|
||||||
** This file is part of the plugins of the Qt Toolkit.
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
**
|
**
|
||||||
** This file may be used under the terms of the GNU General Public
|
** Contact: Nokia Corporation info@qt.nokia.com
|
||||||
** License version 2.0 as published by the Free Software Foundation
|
|
||||||
** and appearing in the file LICENSE.GPL included in the packaging of
|
|
||||||
** this file. Please review the following information to ensure GNU
|
|
||||||
** General Public Licensing requirements will be met:
|
|
||||||
** http://trolltech.com/products/qt/licenses/licensing/opensource/
|
|
||||||
**
|
**
|
||||||
** If you are unsure which license is appropriate for your use, please
|
** GNU Lesser General Public License Usage
|
||||||
** review the following information:
|
** This file may be used under the terms of the GNU Lesser General Public
|
||||||
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
|
** License version 2.1 as published by the Free Software Foundation
|
||||||
** or contact the sales department at sales@trolltech.com.
|
** and appearing in the file LICENSE.LGPL included in the packaging of
|
||||||
**
|
** this file. Please review the following information to ensure the GNU
|
||||||
** In addition, as a special exception, Trolltech gives you certain
|
** Lesser General Public License version 2.1 requirements will be met:
|
||||||
** additional rights. These rights are described in the Trolltech GPL
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
** Exception version 1.0, which can be found at
|
|
||||||
** http://www.trolltech.com/products/qt/gplexception/ and in the file
|
|
||||||
** GPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Trolltech, as the sole copyright
|
|
||||||
** holder for Qt Designer, grants users of the Qt/Eclipse Integration
|
|
||||||
** plug-in the right for the Qt/Eclipse Integration to link to
|
|
||||||
** functionality provided by Qt Designer and its related libraries.
|
|
||||||
**
|
|
||||||
** Trolltech reserves all rights not expressly granted herein.
|
|
||||||
**
|
|
||||||
** Trolltech ASA (c) 2007
|
|
||||||
**
|
|
||||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|
||||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
**
|
**
|
||||||
|
** Copyright (C) 2011 Nokia. All rights reserved
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef QTSCRIPTEXTENSIONS_GLOBAL_H
|
#ifndef QTSCRIPTEXTENSIONS_GLOBAL_H
|
||||||
#define QTSCRIPTEXTENSIONS_GLOBAL_H
|
#define QTSCRIPTEXTENSIONS_GLOBAL_H
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright 2009 Aaron Seigo <aseigo@kde.org>
|
* Copyright 2009 Aaron Seigo <aseigo@kde.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
* published by the Free Software Foundation; either version 2, or
|
* published by the Free Software Foundation; either version 2, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright 2009 Aaron Seigo <aseigo@kde.org>
|
* Copyright 2009 Aaron Seigo <aseigo@kde.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
* published by the Free Software Foundation; either version 2, or
|
* published by the Free Software Foundation; either version 2, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user