Merge remote-tracking branch 'origin/KDE/4.10' into frameworks
Conflicts: cmake/modules/FindKDE4Internal.cmake [ON vs TRUE] experimental/libkdeclarative/kdeclarative.cpp [include changes] kdecore/CMakeLists.txt [kshareddatacache.cpp exception support, but file moved] kdecore/kernel/kcmdlineargs.cpp [+1 option, but qi18n] kdeui/widgets/ktextedit.cpp [moc] kdewebkit/kwebpage.cpp [QUrl] kfile/kfilewidget.cpp [QUrl] kfile/kurlnavigatortogglebutton.cpp [QT_NO_ACCESSIBILITY] kinit/kinit.cpp [document path] kio/kfile/kurlrequester.cpp [KDE::icon] kio/kio/kprotocolmanager.cpp [kded5] kio/kio/krun.cpp [document path] kioslave/ftp/ftp.cpp [QUrl] kioslave/http/kcookiejar/CMakeLists.txt [upd file resurrected] kioslave/http/kcookiejar/kcookiescfg.upd [resurrected] kioslave/http/kcookiejar/kcookiewin.cpp [KVBox porting] mimetypes/kde.xml [kexi gone] nepomuk/core/resourcedata.cpp [deleted] nepomuk/test/CMakeLists.txt [deleted] plasma/private/packages.cpp [Plasma::Applet::NoBackground] tier1/kjs/src/kjs/jsonstringify.cpp [unsigned int] tier1/solid/src/solid/CMakeLists.txt [hello udisks2]
This commit is contained in:
commit
e7e77f118a
@ -135,10 +135,10 @@ Containment::Containment(const QString &packagePath, uint appletId, const QVaria
|
||||
|
||||
Containment::~Containment()
|
||||
{
|
||||
delete d;
|
||||
// Applet touches our dptr if we are a containment and is the superclass (think of dtors)
|
||||
// so we reset this as we exit the building
|
||||
Applet::d->isContainment = false;
|
||||
delete d;
|
||||
}
|
||||
|
||||
void Containment::init()
|
||||
|
@ -171,9 +171,8 @@ void DataContainer::setNeedsToBeStored(bool store)
|
||||
|
||||
DataEngine* DataContainer::getDataEngine()
|
||||
{
|
||||
QObject *o = NULL;
|
||||
QObject *o = this;
|
||||
DataEngine *de = NULL;
|
||||
o = this;
|
||||
while (de == NULL)
|
||||
{
|
||||
o = dynamic_cast<QObject *> (o->parent());
|
||||
|
@ -281,8 +281,6 @@ void Dialog::syncToGraphicsWidget()
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
QSize maxSize = desktop->availableGeometry(desktop->screenNumber(this)).size();
|
||||
|
||||
graphicsWidget->setMaximumSize(maxSize - QSize(left + right, top + bottom).boundedTo(graphicsWidget->effectiveSizeHint(Qt::MaximumSize).toSize()));
|
||||
|
||||
setMinimumSize(0, 0);
|
||||
setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
|
||||
|
12
framesvg.cpp
12
framesvg.cpp
@ -860,22 +860,26 @@ void FrameSvgPrivate::generateFrameBackground(FrameData *frame)
|
||||
if (frame->stretchBorders) {
|
||||
if (frame->enabledBorders & FrameSvg::LeftBorder || frame->enabledBorders & FrameSvg::RightBorder) {
|
||||
if (q->hasElement(prefix % "left") &&
|
||||
frame->enabledBorders & FrameSvg::LeftBorder) {
|
||||
frame->enabledBorders & FrameSvg::LeftBorder &&
|
||||
contentHeight > 0) {
|
||||
q->paint(&p, QRect(leftOffset, contentTop, frame->leftWidth, contentHeight), prefix % "left");
|
||||
}
|
||||
|
||||
if (q->hasElement(prefix % "right") &&
|
||||
frame->enabledBorders & FrameSvg::RightBorder) {
|
||||
frame->enabledBorders & FrameSvg::RightBorder &&
|
||||
contentHeight > 0) {
|
||||
q->paint(&p, QRect(rightOffset, contentTop, frame->rightWidth, contentHeight), prefix % "right");
|
||||
}
|
||||
}
|
||||
|
||||
if (frame->enabledBorders & FrameSvg::TopBorder || frame->enabledBorders & FrameSvg::BottomBorder) {
|
||||
if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix % "top")) {
|
||||
if (frame->enabledBorders & FrameSvg::TopBorder && q->hasElement(prefix % "top") &&
|
||||
contentWidth > 0) {
|
||||
q->paint(&p, QRect(contentLeft, topOffset, contentWidth, frame->topHeight), prefix % "top");
|
||||
}
|
||||
|
||||
if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix % "bottom")) {
|
||||
if (frame->enabledBorders & FrameSvg::BottomBorder && q->hasElement(prefix % "bottom") &&
|
||||
contentWidth > 0) {
|
||||
q->paint(&p, QRect(contentLeft, bottomOffset, contentWidth, frame->bottomHeight), prefix % "bottom");
|
||||
}
|
||||
}
|
||||
|
@ -305,6 +305,26 @@ QRect Style::subControlRect(ComplexControl control, const QStyleOptionComplex *o
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CC_ScrollBar: {
|
||||
const bool hasButtons = d->scrollbar->hasElement("arrow-up");
|
||||
switch (subControl) {
|
||||
//If one of the arrows is missing, don't reserve space for them
|
||||
case SC_ScrollBarAddLine:
|
||||
if (!hasButtons) {
|
||||
rect.setRect(0,0,0,0);
|
||||
}
|
||||
break;
|
||||
|
||||
case SC_ScrollBarSubLine:
|
||||
if (!hasButtons) {
|
||||
rect.setRect(0,0,0,0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -331,11 +351,21 @@ int Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWi
|
||||
switch (metric) {
|
||||
case PM_ScrollBarExtent: {
|
||||
d->createScrollbar();
|
||||
const QSizeF hintSize = d->scrollbar->elementSize("hint-scrollbar-size");
|
||||
const QStyleOptionSlider *scrollOption = qstyleoption_cast<const QStyleOptionSlider *>(option);
|
||||
|
||||
if (scrollOption && scrollOption->orientation == Qt::Vertical) {
|
||||
return d->scrollbar->elementSize("arrow-down").width() + 2;
|
||||
if (hintSize.isEmpty()) {
|
||||
return d->scrollbar->elementSize("arrow-down").width() + 2;
|
||||
} else {
|
||||
return hintSize.width();
|
||||
}
|
||||
} else {
|
||||
return d->scrollbar->elementSize("arrow-left").height() + 2;
|
||||
if (hintSize.isEmpty()) {
|
||||
return d->scrollbar->elementSize("arrow-left").height() + 2;
|
||||
} else {
|
||||
return hintSize.height();
|
||||
}
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
@ -46,7 +46,7 @@ class PluginLoaderPrivate;
|
||||
* default PluginLoader implementation will be used. The reimplemented version should
|
||||
* not do more than simply returning a loaded plugin. It should not init() it, and it should not
|
||||
* hang on to it. The associated methods will be called only when a component of Plasma
|
||||
* needs to load a _new_ plugin. (e.g. DataEngine does it's own caching).
|
||||
* needs to load a _new_ plugin. (e.g. DataEngine does its own caching).
|
||||
*
|
||||
* @author Ryan Rix <ry@n.rix.si>
|
||||
* @since 4.6
|
||||
|
@ -236,21 +236,22 @@ void AppletHandle::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
|
||||
QLinearGradient g(QPoint(0, 0), QPoint(m_decorationRect.width(), 0));
|
||||
//fading out panel
|
||||
if (m_rect.height() > qreal(minimumHeight()) * 1.25) {
|
||||
if (m_applet->backgroundHints() != Plasma::NoBackground &&
|
||||
m_rect.height() > qreal(minimumHeight()) * 1.25) {
|
||||
if (m_buttonsOnRight) {
|
||||
qreal opaquePoint =
|
||||
(m_background->marginSize(LeftMargin) - translation) / m_decorationRect.width();
|
||||
//kDebug() << "opaquePoint" << opaquePoint
|
||||
// << m_background->marginSize(LeftMargin) << m_decorationRect.width();
|
||||
g.setColorAt(0.0, Qt::transparent);
|
||||
g.setColorAt(qMax(0.0, opaquePoint - 0.05), Qt::transparent); //krazy:exclude=qminmax
|
||||
g.setColorAt(qMax(0.0, opaquePoint - 0.01), Qt::transparent); //krazy:exclude=qminmax
|
||||
g.setColorAt(opaquePoint, transparencyColor);
|
||||
g.setColorAt(1.0, transparencyColor);
|
||||
} else {
|
||||
qreal opaquePoint =
|
||||
1 - ((m_background->marginSize(RightMargin) + translation) / m_decorationRect.width());
|
||||
g.setColorAt(1.0, Qt::transparent);
|
||||
g.setColorAt(opaquePoint + 0.05, Qt::transparent);
|
||||
g.setColorAt(opaquePoint + 0.01, Qt::transparent);
|
||||
g.setColorAt(qMax(qreal(0), opaquePoint), transparencyColor);
|
||||
g.setColorAt(0.0, transparencyColor);
|
||||
}
|
||||
@ -863,6 +864,41 @@ bool AppletHandle::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
|
||||
{
|
||||
if (watched == m_applet && event->type() == QEvent::GraphicsSceneHoverLeave) {
|
||||
hoverLeaveEvent(static_cast<QGraphicsSceneHoverEvent*>(event));
|
||||
} else if (watched == m_applet && event->type() == QEvent::GraphicsSceneMousePress) {
|
||||
QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent *>(event);
|
||||
|
||||
QPointF pos = mapFromScene(me->scenePos());
|
||||
if (m_applet->contentsRect().contains(pos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
me->setPos(pos);
|
||||
mousePressEvent(me);
|
||||
return true;
|
||||
} else if (watched == m_applet && event->type() == QEvent::GraphicsSceneMouseRelease) {
|
||||
if (m_pressedButton == NoButton) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent *>(event);
|
||||
|
||||
QPointF pos = mapFromScene(me->scenePos());
|
||||
me->setPos(pos);
|
||||
mouseReleaseEvent(me);
|
||||
return true;
|
||||
} else if (watched == m_applet && event->type() == QEvent::GraphicsSceneMouseMove) {
|
||||
if (m_pressedButton == NoButton) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QGraphicsSceneMouseEvent *me = static_cast<QGraphicsSceneMouseEvent *>(event);
|
||||
|
||||
QPointF pos = mapFromScene(me->scenePos());
|
||||
|
||||
|
||||
me->setPos(pos);
|
||||
mouseMoveEvent(me);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -986,7 +1022,7 @@ void AppletHandle::startFading(FadeType anim, const QPointF &hoverPos, bool pres
|
||||
|
||||
m_animType = anim;
|
||||
//kDebug() << "animating for " << time << "ms";
|
||||
if (m_animType == FadeIn) {
|
||||
if (m_animType == FadeIn && propAnim) {
|
||||
propAnim->setDirection(QAbstractAnimation::Forward);
|
||||
propAnim->start();
|
||||
} else if (propAnim) {
|
||||
@ -1029,29 +1065,32 @@ void AppletHandle::calculateSize()
|
||||
qreal marginLeft, marginTop, marginRight, marginBottom;
|
||||
m_background->getMargins(marginLeft, marginTop, marginRight, marginBottom);
|
||||
|
||||
if (m_buttonsOnRight) {
|
||||
//put the rect on the right of the applet
|
||||
m_rect = QRectF(m_applet->size().width(), top, handleWidth, handleHeight);
|
||||
} else {
|
||||
//put the rect on the left of the applet
|
||||
m_rect = QRectF(-handleWidth, top, handleWidth, handleHeight);
|
||||
int leftShadowWidth = m_background->elementSize("hint-left-shadow").width();
|
||||
int rightShadowWidth = m_background->elementSize("hint-right-shadow").width();
|
||||
|
||||
//no precise hint? let's go for heuristics
|
||||
if (leftShadowWidth <= 0) {
|
||||
leftShadowWidth = marginLeft/1.6;
|
||||
}
|
||||
if (rightShadowWidth <= 0) {
|
||||
rightShadowWidth = marginRight/1.6;
|
||||
}
|
||||
|
||||
if (m_applet->contentsRect().height() > qreal(minimumHeight()) * 1.25) {
|
||||
int addedMargin = marginLeft / 2;
|
||||
if (m_applet->backgroundHints() == Plasma::NoBackground) {
|
||||
leftShadowWidth = 0;
|
||||
rightShadowWidth = 0;
|
||||
}
|
||||
if (m_buttonsOnRight) {
|
||||
//put the rect on the right of the applet
|
||||
m_rect = QRectF(m_applet->size().width() - rightShadowWidth + HANDLE_MARGIN, top, handleWidth, handleHeight);
|
||||
} else {
|
||||
//put the rect on the left of the applet
|
||||
m_rect = QRectF(-handleWidth + leftShadowWidth - HANDLE_MARGIN, top, handleWidth, handleHeight);
|
||||
}
|
||||
|
||||
// now we check to see if the shape is smaller than the contents,
|
||||
// and that the shape is not just the bounding rect; in those cases
|
||||
// we have a shaped guy and we draw a full panel;
|
||||
// TODO: allow applets to mark when they have translucent areas and
|
||||
// should therefore skip this test?
|
||||
if (!m_applet->shape().contains(m_applet->contentsRect())) {
|
||||
QPainterPath p;
|
||||
p.addRect(m_applet->boundingRect());
|
||||
if (m_applet->shape() != p) {
|
||||
addedMargin = m_applet->contentsRect().width() / 2;
|
||||
}
|
||||
}
|
||||
if (m_applet->backgroundHints() != Plasma::NoBackground &&
|
||||
m_applet->contentsRect().height() > qreal(minimumHeight()) * 1.25) {
|
||||
int addedMargin = HANDLE_MARGIN;
|
||||
|
||||
if (m_buttonsOnRight) {
|
||||
marginLeft += addedMargin;
|
||||
|
@ -31,6 +31,7 @@ public:
|
||||
ContainmentActionsPrivate(KService::Ptr service, ContainmentActions *containmentActions) :
|
||||
q(containmentActions),
|
||||
containmentActionsDescription(service),
|
||||
package(0),
|
||||
initialized(false),
|
||||
needsConfig(false),
|
||||
containment(0)
|
||||
|
@ -44,7 +44,8 @@ public:
|
||||
bottomMargin(0),
|
||||
noBorderPadding(false),
|
||||
stretchBorders(false),
|
||||
tileCenter(false)
|
||||
tileCenter(false),
|
||||
composeOverBorder(false)
|
||||
{
|
||||
ref(svg);
|
||||
}
|
||||
|
@ -161,8 +161,12 @@ void ThemePackage::initPackage(Package *package)
|
||||
package->addDirectoryDefinition("dialogs", "dialogs/", i18n("Images for dialogs"));
|
||||
package->addFileDefinition("dialogs/background", "dialogs/background.svg",
|
||||
i18n("Generic dialog background"));
|
||||
package->addFileDefinition("dialogs/background", "dialogs/background.svgz",
|
||||
i18n("Generic dialog background"));
|
||||
package->addFileDefinition("dialogs/shutdowndialog", "dialogs/shutdowndialog.svg",
|
||||
i18n("Theme for the logout dialog"));
|
||||
package->addFileDefinition("dialogs/shutdowndialog", "dialogs/shutdowndialog.svgz",
|
||||
i18n("Theme for the logout dialog"));
|
||||
|
||||
package->addDirectoryDefinition("wallpapers", "wallpapers/", i18n("Wallpaper packages"));
|
||||
package->addDirectoryDefinition("animations", "animations/", i18n("Animation scripts"));
|
||||
@ -170,45 +174,77 @@ void ThemePackage::initPackage(Package *package)
|
||||
package->addDirectoryDefinition("widgets", "widgets/", i18n("Images for widgets"));
|
||||
package->addFileDefinition("widgets/background", "widgets/background.svg",
|
||||
i18n("Background image for widgets"));
|
||||
package->addFileDefinition("widgets/background", "widgets/background.svgz",
|
||||
i18n("Background image for widgets"));
|
||||
package->addFileDefinition("widgets/clock", "widgets/clock.svg",
|
||||
i18n("Analog clock face"));
|
||||
package->addFileDefinition("widgets/clock", "widgets/clock.svgz",
|
||||
i18n("Analog clock face"));
|
||||
package->addFileDefinition("widgets/panel-background", "widgets/panel-background.svg",
|
||||
i18n("Background image for panels"));
|
||||
package->addFileDefinition("widgets/panel-background", "widgets/panel-background.svgz",
|
||||
i18n("Background image for panels"));
|
||||
package->addFileDefinition("widgets/plot-background", "widgets/plot-background.svg",
|
||||
i18n("Background for graphing widgets"));
|
||||
package->addFileDefinition("widgets/plot-background", "widgets/plot-background.svgz",
|
||||
i18n("Background for graphing widgets"));
|
||||
package->addFileDefinition("widgets/tooltip", "widgets/tooltip.svg",
|
||||
i18n("Background image for tooltips"));
|
||||
package->addFileDefinition("widgets/tooltip", "widgets/tooltip.svgz",
|
||||
i18n("Background image for tooltips"));
|
||||
|
||||
package->addDirectoryDefinition("opaque/dialogs", "opaque/dialogs/", i18n("Opaque images for dialogs"));
|
||||
package->addFileDefinition("opaque/dialogs/background", "opaque/dialogs/background.svg",
|
||||
i18n("Opaque generic dialog background"));
|
||||
package->addFileDefinition("opaque/dialogs/background", "opaque/dialogs/background.svgz",
|
||||
i18n("Opaque generic dialog background"));
|
||||
package->addFileDefinition("opaque/dialogs/shutdowndialog", "opaque/dialogs/shutdowndialog.svg",
|
||||
i18n("Opaque theme for the logout dialog"));
|
||||
package->addFileDefinition("opaque/dialogs/shutdowndialog", "opaque/dialogs/shutdowndialog.svgz",
|
||||
i18n("Opaque theme for the logout dialog"));
|
||||
|
||||
package->addDirectoryDefinition("opaque/widgets", "opaque/widgets/", i18n("Opaque images for widgets"));
|
||||
package->addFileDefinition("opaque/widgets/panel-background", "opaque/widgets/panel-background.svg",
|
||||
i18n("Opaque background image for panels"));
|
||||
package->addFileDefinition("opaque/widgets/panel-background", "opaque/widgets/panel-background.svgz",
|
||||
i18n("Opaque background image for panels"));
|
||||
package->addFileDefinition("opaque/widgets/tooltip", "opaque/widgets/tooltip.svg",
|
||||
i18n("Opaque background image for tooltips"));
|
||||
package->addFileDefinition("opaque/widgets/tooltip", "opaque/widgets/tooltip.svgz",
|
||||
i18n("Opaque background image for tooltips"));
|
||||
|
||||
package->addDirectoryDefinition("locolor/dialogs", "locolor/dialogs/",
|
||||
i18n("Low color images for dialogs"));
|
||||
package->addFileDefinition("locolor/dialogs/background", "locolor/dialogs/background.svg",
|
||||
i18n("Low color generic dialog background"));
|
||||
package->addFileDefinition("locolor/dialogs/background", "locolor/dialogs/background.svgz",
|
||||
i18n("Low color generic dialog background"));
|
||||
package->addFileDefinition("locolor/dialogs/shutdowndialog", "locolor/dialogs/shutdowndialog.svg",
|
||||
i18n("Low color theme for the logout dialog"));
|
||||
package->addFileDefinition("locolor/dialogs/shutdowndialog", "locolor/dialogs/shutdowndialog.svgz",
|
||||
i18n("Low color theme for the logout dialog"));
|
||||
|
||||
package->addDirectoryDefinition("locolor/widgets", "locolor/widgets/", i18n("Images for widgets"));
|
||||
package->addFileDefinition("locolor/widgets/background", "locolor/widgets/background.svg",
|
||||
i18n("Low color background image for widgets"));
|
||||
package->addFileDefinition("locolor/widgets/background", "locolor/widgets/background.svgz",
|
||||
i18n("Low color background image for widgets"));
|
||||
package->addFileDefinition("locolor/widgets/clock", "locolor/widgets/clock.svg",
|
||||
i18n("Low color analog clock face"));
|
||||
package->addFileDefinition("locolor/widgets/clock", "locolor/widgets/clock.svgz",
|
||||
i18n("Low color analog clock face"));
|
||||
package->addFileDefinition("locolor/widgets/panel-background", "locolor/widgets/panel-background.svg",
|
||||
i18n("Low color background image for panels"));
|
||||
package->addFileDefinition("locolor/widgets/panel-background", "locolor/widgets/panel-background.svgz",
|
||||
i18n("Low color background image for panels"));
|
||||
package->addFileDefinition("locolor/widgets/plot-background", "locolor/widgets/plot-background.svg",
|
||||
i18n("Low color background for graphing widgets"));
|
||||
package->addFileDefinition("locolor/widgets/plot-background", "locolor/widgets/plot-background.svgz",
|
||||
i18n("Low color background for graphing widgets"));
|
||||
package->addFileDefinition("locolor/widgets/tooltip", "locolor/widgets/tooltip.svg",
|
||||
i18n("Low color background image for tooltips"));
|
||||
package->addFileDefinition("locolor/widgets/tooltip", "locolor/widgets/tooltip.svgz",
|
||||
i18n("Low color background image for tooltips"));
|
||||
|
||||
package->addFileDefinition("colors", "colors", i18n("KColorScheme configuration file"));
|
||||
|
||||
|
@ -38,6 +38,7 @@ class ClientPrivate : public QObject
|
||||
public:
|
||||
ClientPrivate(Client *client)
|
||||
: q(client),
|
||||
readerThread(0),
|
||||
error(Client::NoError) {}
|
||||
|
||||
public slots:
|
||||
|
@ -45,6 +45,7 @@ public:
|
||||
DeclarativeWidgetPrivate(DeclarativeWidget *parent)
|
||||
: q(parent),
|
||||
engine(0),
|
||||
scriptEngine(0),
|
||||
component(0),
|
||||
root(0),
|
||||
delay(false)
|
||||
@ -61,6 +62,10 @@ public:
|
||||
void scheduleExecutionEnd();
|
||||
void minimumWidthChanged();
|
||||
void minimumHeightChanged();
|
||||
void maximumWidthChanged();
|
||||
void maximumHeightChanged();
|
||||
void preferredWidthChanged();
|
||||
void preferredHeightChanged();
|
||||
|
||||
|
||||
DeclarativeWidget *q;
|
||||
@ -160,13 +165,28 @@ void DeclarativeWidgetPrivate::finishExecute()
|
||||
q->setLayout(0);
|
||||
qreal minimumWidth = 0;
|
||||
qreal minimumHeight = 0;
|
||||
qreal maximumWidth = 0;
|
||||
qreal maximumHeight = 0;
|
||||
qreal preferredWidth = 0;
|
||||
qreal preferredHeight = 0;
|
||||
if (object) {
|
||||
minimumWidth = object->property("minimumWidth").toReal();
|
||||
minimumHeight = object->property("minimumHeight").toReal();
|
||||
object->setProperty("width", q->size().width());
|
||||
object->setProperty("height", q->size().height());
|
||||
|
||||
minimumWidth = object->property("minimumWidth").toReal();
|
||||
minimumHeight = object->property("minimumHeight").toReal();
|
||||
QObject::connect(object, SIGNAL(minimumWidthChanged()), q, SLOT(minimumWidthChanged()));
|
||||
QObject::connect(object, SIGNAL(minimumHeightChanged()), q, SLOT(minimumHeightChanged()));
|
||||
|
||||
maximumWidth = object->property("maximumWidth").toReal();
|
||||
maximumHeight = object->property("maximumHeight").toReal();
|
||||
QObject::connect(object, SIGNAL(maximumWidthChanged()), q, SLOT(maximumWidthChanged()));
|
||||
QObject::connect(object, SIGNAL(maximumHeightChanged()), q, SLOT(maximumHeightChanged()));
|
||||
|
||||
preferredWidth = object->property("preferredWidth").toReal();
|
||||
preferredHeight = object->property("preferredHeight").toReal();
|
||||
QObject::connect(object, SIGNAL(preferredWidthChanged()), q, SLOT(preferredWidthChanged()));
|
||||
QObject::connect(object, SIGNAL(preferredHeightChanged()), q, SLOT(preferredHeightChanged()));
|
||||
}
|
||||
|
||||
if (minimumWidth > 0 && minimumHeight > 0) {
|
||||
@ -174,6 +194,18 @@ void DeclarativeWidgetPrivate::finishExecute()
|
||||
} else {
|
||||
q->setMinimumSize(-1, -1);
|
||||
}
|
||||
|
||||
if (maximumWidth > 0 && maximumHeight > 0) {
|
||||
q->setMaximumSize(maximumWidth, maximumHeight);
|
||||
} else {
|
||||
q->setMaximumSize(-1, -1);
|
||||
}
|
||||
|
||||
if (preferredWidth > 0 && preferredHeight > 0) {
|
||||
q->setPreferredSize(preferredWidth, preferredHeight);
|
||||
} else {
|
||||
q->setPreferredSize(-1, -1);
|
||||
}
|
||||
}
|
||||
emit q->finished();
|
||||
}
|
||||
@ -190,6 +222,30 @@ void DeclarativeWidgetPrivate::minimumHeightChanged()
|
||||
q->setMinimumHeight(minimumHeight);
|
||||
}
|
||||
|
||||
void DeclarativeWidgetPrivate::maximumWidthChanged()
|
||||
{
|
||||
qreal maximumWidth = root->property("maximumWidth").toReal();
|
||||
q->setMaximumWidth(maximumWidth);
|
||||
}
|
||||
|
||||
void DeclarativeWidgetPrivate::maximumHeightChanged()
|
||||
{
|
||||
qreal maximumHeight = root->property("maximumHeight").toReal();
|
||||
q->setMaximumHeight(maximumHeight);
|
||||
}
|
||||
|
||||
void DeclarativeWidgetPrivate::preferredWidthChanged()
|
||||
{
|
||||
qreal preferredWidth = root->property("preferredWidth").toReal();
|
||||
q->setPreferredWidth(preferredWidth);
|
||||
}
|
||||
|
||||
void DeclarativeWidgetPrivate::preferredHeightChanged()
|
||||
{
|
||||
qreal preferredHeight = root->property("preferredHeight").toReal();
|
||||
q->setPreferredHeight(preferredHeight);
|
||||
}
|
||||
|
||||
DeclarativeWidget::DeclarativeWidget(QGraphicsWidget *parent)
|
||||
: QGraphicsWidget(parent),
|
||||
d(new DeclarativeWidgetPrivate(this))
|
||||
|
@ -131,6 +131,10 @@ private:
|
||||
Q_PRIVATE_SLOT(d, void scheduleExecutionEnd())
|
||||
Q_PRIVATE_SLOT(d, void minimumWidthChanged())
|
||||
Q_PRIVATE_SLOT(d, void minimumHeightChanged())
|
||||
Q_PRIVATE_SLOT(d, void maximumWidthChanged())
|
||||
Q_PRIVATE_SLOT(d, void maximumHeightChanged())
|
||||
Q_PRIVATE_SLOT(d, void preferredWidthChanged())
|
||||
Q_PRIVATE_SLOT(d, void preferredHeightChanged())
|
||||
};
|
||||
|
||||
} // namespace Plasma
|
||||
|
@ -814,16 +814,34 @@ QPixmap IconWidgetPrivate::decoration(const QStyleOptionGraphicsItem *option, bo
|
||||
QIcon::Mode mode = option->state & QStyle::State_Enabled ? QIcon::Normal : QIcon::Disabled;
|
||||
QIcon::State state = option->state & QStyle::State_Open ? QIcon::On : QIcon::Off;
|
||||
|
||||
QSize finalSize(iconSize.toSize());
|
||||
//for small sizes, use a standard size
|
||||
if (finalSize.width() < KIconLoader::SizeSmallMedium) {
|
||||
finalSize = QSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
|
||||
} else if (finalSize.width() < KIconLoader::SizeMedium) {
|
||||
finalSize = QSize(KIconLoader::SizeSmallMedium, KIconLoader::SizeSmallMedium);
|
||||
} else if (finalSize.width() < KIconLoader::SizeLarge) {
|
||||
finalSize = QSize(KIconLoader::SizeMedium, KIconLoader::SizeMedium);
|
||||
}
|
||||
|
||||
if (iconSvg) {
|
||||
if (iconSvgElementChanged || iconSvgPixmap.size() != iconSize.toSize()) {
|
||||
iconSvg->resize(iconSize);
|
||||
//even the svg is returned at standard sizes because:
|
||||
// * it may have a version optimized for that size
|
||||
// * look aligned with other icons
|
||||
iconSvg->resize(finalSize);
|
||||
iconSvgPixmap = iconSvg->pixmap(iconSvgElement);
|
||||
iconSvgElementChanged = false;
|
||||
}
|
||||
result = iconSvgPixmap;
|
||||
} else {
|
||||
const QSize size = icon.actualSize(iconSize.toSize(), mode, state);
|
||||
result = icon.pixmap(size, mode, state);
|
||||
QSize size(iconSize.toSize());
|
||||
//the QIcon isn't filled with available sizes, return a near standard size for small pixmaps
|
||||
if (!icon.availableSizes().isEmpty()) {
|
||||
finalSize = icon.actualSize(iconSize.toSize(), mode, state);
|
||||
}
|
||||
|
||||
result = icon.pixmap(finalSize, mode, state);
|
||||
}
|
||||
|
||||
if (usePressedEffect) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user