API clean : bye bye opacity, wich is bas implemented in all cases
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=796900
This commit is contained in:
parent
b32216ac24
commit
1b15d951a9
22
applet.cpp
22
applet.cpp
@ -112,7 +112,6 @@ public:
|
|||||||
mainConfig(0),
|
mainConfig(0),
|
||||||
pendingConstraints(NoConstraint),
|
pendingConstraints(NoConstraint),
|
||||||
aspectRatioMode(Qt::KeepAspectRatio),
|
aspectRatioMode(Qt::KeepAspectRatio),
|
||||||
opacity(1.0),
|
|
||||||
kioskImmutable(false),
|
kioskImmutable(false),
|
||||||
immutable(false),
|
immutable(false),
|
||||||
hasConfigurationInterface(false),
|
hasConfigurationInterface(false),
|
||||||
@ -318,7 +317,6 @@ public:
|
|||||||
KConfigGroup *mainConfig;
|
KConfigGroup *mainConfig;
|
||||||
Plasma::Constraints pendingConstraints;
|
Plasma::Constraints pendingConstraints;
|
||||||
Qt::AspectRatioMode aspectRatioMode;
|
Qt::AspectRatioMode aspectRatioMode;
|
||||||
qreal opacity;
|
|
||||||
bool kioskImmutable : 1;
|
bool kioskImmutable : 1;
|
||||||
bool immutable : 1;
|
bool immutable : 1;
|
||||||
bool hasConfigurationInterface : 1;
|
bool hasConfigurationInterface : 1;
|
||||||
@ -400,7 +398,6 @@ void Applet::save(KConfigGroup* group) const
|
|||||||
//kDebug() << pluginName() << "geometry is" << geometry() << "pos is" << pos() << "bounding rect is" << boundingRect();
|
//kDebug() << pluginName() << "geometry is" << geometry() << "pos is" << pos() << "bounding rect is" << boundingRect();
|
||||||
group->writeEntry("geometry", geometry());
|
group->writeEntry("geometry", geometry());
|
||||||
group->writeEntry("zvalue", zValue());
|
group->writeEntry("zvalue", zValue());
|
||||||
group->writeEntry("opacity", d->opacity);
|
|
||||||
|
|
||||||
if (transform() == QTransform()) {
|
if (transform() == QTransform()) {
|
||||||
group->deleteEntry("transform");
|
group->deleteEntry("transform");
|
||||||
@ -438,8 +435,6 @@ void Applet::restore(KConfigGroup *c)
|
|||||||
if (c->readEntry("locked", false)) {
|
if (c->readEntry("locked", false)) {
|
||||||
setImmutable(true);
|
setImmutable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
setOpacity(c->readEntry("opacity", 1.0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Applet::saveState(KConfigGroup* group) const
|
void Applet::saveState(KConfigGroup* group) const
|
||||||
@ -918,12 +913,7 @@ void Applet::paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
|||||||
}
|
}
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
//Set opacity
|
|
||||||
if (d->opacity >= 0.1 && d->opacity <= 0.9) {
|
|
||||||
painter->setOpacity(d->opacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transform().isRotating()) {
|
if (transform().isRotating()) {
|
||||||
painter->setRenderHint(QPainter::SmoothPixmapTransform);
|
painter->setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
painter->setRenderHint(QPainter::Antialiasing);
|
painter->setRenderHint(QPainter::Antialiasing);
|
||||||
@ -1464,16 +1454,6 @@ void Applet::themeChanged()
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Applet::setOpacity( qreal opacity )
|
|
||||||
{
|
|
||||||
d->opacity = opacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal Applet::opacity() const
|
|
||||||
{
|
|
||||||
return d->opacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Plasma namespace
|
} // Plasma namespace
|
||||||
|
|
||||||
#include "applet.moc"
|
#include "applet.moc"
|
||||||
|
11
applet.h
11
applet.h
@ -539,17 +539,6 @@ class PLASMA_EXPORT Applet : public Widget
|
|||||||
**/
|
**/
|
||||||
Containment* containment() const;
|
Containment* containment() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the opacity of this Plasma::Applet
|
|
||||||
* @param opacity the new opacity
|
|
||||||
*/
|
|
||||||
void setOpacity( qreal opacity );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return opacity of this Applet
|
|
||||||
**/
|
|
||||||
qreal opacity() const;
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
/**
|
/**
|
||||||
* Emitted when the applet needs to take (or lose) keyboard focus.
|
* Emitted when the applet needs to take (or lose) keyboard focus.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright 2007 by Matt Broadstone <mbroadst@gmail.com>
|
* Copyright 2007 by Matt Broadstone <mbroadst@gmail.com>
|
||||||
* Copyright 2006-2007 Fredrik Höglund <fredrik@kde.org>
|
* Copyright 2006-2007 Fredrik Höglund <fredrik@kde.org>
|
||||||
* Copyright 2007 by Marco Martin <notmart@gmail.com>
|
* Copyright 2007 by Marco Martin <notmart@gmail.com>
|
||||||
* Copyright 2008 by Ménard Alexis <darktears31@gmail.com>
|
* Copyright 2008 by Alexis Ménard <darktears31@gmail.com>
|
||||||
*
|
*
|
||||||
* 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 Library General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* Copyright (C) 2007 by Siraj Razick <siraj@kde.org>
|
* Copyright (C) 2007 by Siraj Razick <siraj@kde.org>
|
||||||
* Copyright (C) 2007 by Riccardo Iaconelli <riccardo@kde.org>
|
* Copyright (C) 2007 by Riccardo Iaconelli <riccardo@kde.org>
|
||||||
* Copyright (C) 2007 by Matt Broadstone <mbroadst@gmail.com>
|
* Copyright (C) 2007 by Matt Broadstone <mbroadst@gmail.com>
|
||||||
* Copyright 2008 by Ménard Alexis <darktears31@gmail.com>
|
* Copyright 2008 by Alexis Ménard <darktears31@gmail.com>
|
||||||
*
|
*
|
||||||
* 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 Library General Public License as
|
* it under the terms of the GNU Library General Public License as
|
||||||
|
@ -55,7 +55,6 @@ class Widget::Private
|
|||||||
: minimumSize(0,0),
|
: minimumSize(0,0),
|
||||||
maximumSize(std::numeric_limits<qreal>::infinity(),
|
maximumSize(std::numeric_limits<qreal>::infinity(),
|
||||||
std::numeric_limits<qreal>::infinity()),
|
std::numeric_limits<qreal>::infinity()),
|
||||||
opacity(1.0),
|
|
||||||
wasMovable(false),
|
wasMovable(false),
|
||||||
toolTip(0)
|
toolTip(0)
|
||||||
{ }
|
{ }
|
||||||
@ -68,8 +67,6 @@ class Widget::Private
|
|||||||
QSizeF minimumSize;
|
QSizeF minimumSize;
|
||||||
QSizeF maximumSize;
|
QSizeF maximumSize;
|
||||||
|
|
||||||
qreal opacity;
|
|
||||||
|
|
||||||
bool wasMovable;
|
bool wasMovable;
|
||||||
|
|
||||||
bool shouldPaint(QPainter *painter, const QTransform &transform);
|
bool shouldPaint(QPainter *painter, const QTransform &transform);
|
||||||
@ -144,16 +141,6 @@ Widget::~Widget()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::setOpacity(qreal opacity)
|
|
||||||
{
|
|
||||||
d->opacity = opacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal Widget::opacity() const
|
|
||||||
{
|
|
||||||
return d->opacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::setCachePaintMode(CachePaintMode mode, const QSize &size)
|
void Widget::setCachePaintMode(CachePaintMode mode, const QSize &size)
|
||||||
{
|
{
|
||||||
setCacheMode(CacheMode(mode), size);
|
setCacheMode(CacheMode(mode), size);
|
||||||
@ -255,11 +242,7 @@ void Widget::addChild(Widget *w)
|
|||||||
|
|
||||||
void Widget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void Widget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
if (d->opacity < 1.0) {
|
/*
|
||||||
painter->setOpacity(painter->opacity() * d->opacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
NOTE: put this back if we end up needing to control when things paint due to, e.g. zooming.
|
NOTE: put this back if we end up needing to control when things paint due to, e.g. zooming.
|
||||||
if (!d->shouldPaint(painter, transform())) {
|
if (!d->shouldPaint(painter, transform())) {
|
||||||
return;
|
return;
|
||||||
|
@ -68,8 +68,6 @@ class PLASMA_EXPORT Widget : public QGraphicsWidget
|
|||||||
Q_PROPERTY( Qt::Orientations expandingDirections READ expandingDirections )
|
Q_PROPERTY( Qt::Orientations expandingDirections READ expandingDirections )
|
||||||
Q_PROPERTY( QRectF geometry READ geometry WRITE setGeometry )
|
Q_PROPERTY( QRectF geometry READ geometry WRITE setGeometry )
|
||||||
Q_PROPERTY( QSizeF size READ size WRITE resize )
|
Q_PROPERTY( QSizeF size READ size WRITE resize )
|
||||||
Q_PROPERTY( qreal opacity READ opacity WRITE setOpacity )
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum CachePaintMode {
|
enum CachePaintMode {
|
||||||
NoCacheMode,
|
NoCacheMode,
|
||||||
@ -153,9 +151,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE void addChild(Widget *widget);
|
Q_INVOKABLE void addChild(Widget *widget);
|
||||||
|
|
||||||
void setOpacity(qreal opacity);
|
|
||||||
qreal opacity() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the widget's cache paint mode and cache size.
|
* Sets the widget's cache paint mode and cache size.
|
||||||
* @param mode the new cache paint mode
|
* @param mode the new cache paint mode
|
||||||
|
Loading…
Reference in New Issue
Block a user