diff --git a/declarativeimports/core/framesvgitem.cpp b/declarativeimports/core/framesvgitem.cpp index 02c9d19e3..a42d6719d 100644 --- a/declarativeimports/core/framesvgitem.cpp +++ b/declarativeimports/core/framesvgitem.cpp @@ -70,8 +70,13 @@ FrameSvgItem::~FrameSvgItem() void FrameSvgItem::setImagePath(const QString &path) { + if (m_frameSvg->imagePath() == path) + return; + m_frameSvg->setImagePath(path); m_frameSvg->setElementPrefix(m_prefix); + + emit imagePathChanged(); update(); } @@ -83,8 +88,13 @@ QString FrameSvgItem::imagePath() const void FrameSvgItem::setPrefix(const QString &prefix) { + if (m_prefix == prefix) + return; + m_frameSvg->setElementPrefix(prefix); m_prefix = prefix; + + emit prefixChanged(); update(); } @@ -100,7 +110,11 @@ FrameSvgItemMargins *FrameSvgItem::margins() const void FrameSvgItem::setEnabledBorders(const Plasma::FrameSvg::EnabledBorders borders) { + if (m_frameSvg->enabledBorders() == borders) + return; + m_frameSvg->setEnabledBorders(borders); + emit enabledBordersChanged(); } Plasma::FrameSvg::EnabledBorders FrameSvgItem::enabledBorders() const diff --git a/declarativeimports/core/framesvgitem.h b/declarativeimports/core/framesvgitem.h index 7baf0cf3c..8182e3446 100644 --- a/declarativeimports/core/framesvgitem.h +++ b/declarativeimports/core/framesvgitem.h @@ -73,14 +73,14 @@ class FrameSvgItem : public QDeclarativeItem /** * Theme relative path of the svg, like "widgets/background" */ - Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath) + Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath NOTIFY imagePathChanged) /** * prefix for the 9 piece svg, like "pushed" or "normal" for the button * see http://techbase.kde.org/Development/Tutorials/Plasma/ThemeDetails * for a list of paths and prefixes */ - Q_PROPERTY(QString prefix READ prefix WRITE setPrefix) + Q_PROPERTY(QString prefix READ prefix WRITE setPrefix NOTIFY prefixChanged) /** * The margins of the frame, read only @@ -97,7 +97,7 @@ class FrameSvgItem : public QDeclarativeItem * LeftBorder * RightBorder */ - Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders WRITE setEnabledBorders) + Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders WRITE setEnabledBorders NOTIFY enabledBordersChanged) public: FrameSvgItem(QDeclarativeItem *parent=0); @@ -119,6 +119,11 @@ public: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); +signals: + void imagePathChanged(); + void prefixChanged(); + void enabledBordersChanged(); + private Q_SLOTS: void doUpdate(); diff --git a/declarativeimports/plasmacomponents/fullscreenwindow.cpp b/declarativeimports/plasmacomponents/fullscreenwindow.cpp index 231b591d3..576840b38 100644 --- a/declarativeimports/plasmacomponents/fullscreenwindow.cpp +++ b/declarativeimports/plasmacomponents/fullscreenwindow.cpp @@ -266,7 +266,7 @@ void FullScreenWindow::syncMainItemToView() m_mainItem.data()->setProperty("height", m_view->height()); if (m_declarativeItemContainer) { - m_view->resize(m_declarativeItemContainer->size().toSize()); + m_declarativeItemContainer->resize(m_view->size()); m_view->setSceneRect(m_declarativeItemContainer->geometry()); } else { QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()), diff --git a/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml b/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml index cbc7a50db..5771059a9 100644 --- a/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml +++ b/declarativeimports/plasmacomponents/platformcomponents/touch/Dialog.qml @@ -47,8 +47,9 @@ import "." 0.1 Item { id: root - width: dialog.width - height: dialog.height + + width: theme.defaultFont.mSize.width * 40 + height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 8 property alias title: titleBar.children property alias content: contentItem.children @@ -110,9 +111,7 @@ Item { PlasmaCore.FrameSvgItem { id: dialog - width: mainItem.width + margins.left + margins.right - height: mainItem.height + margins.top + margins.bottom - anchors.centerIn: parent + anchors.fill: parent imagePath: "dialogs/background" state: "closed" @@ -121,10 +120,14 @@ Item { Item { id: mainItem - x: dialog.margins.left - y: dialog.margins.top - width: theme.defaultFont.mSize.width * 40 - height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 8 + anchors { + fill: parent + leftMargin: dialog.margins.left + topMargin: dialog.margins.top + rightMargin: dialog.margins.right + bottomMargin: dialog.margins.bottom + } + // Consume all key events that are not processed by children diff --git a/declarativeimports/plasmacomponents/qml/ToolButton.qml b/declarativeimports/plasmacomponents/qml/ToolButton.qml index 80de4633f..fb8bf8425 100644 --- a/declarativeimports/plasmacomponents/qml/ToolButton.qml +++ b/declarativeimports/plasmacomponents/qml/ToolButton.qml @@ -52,7 +52,7 @@ Properties: Sets the font for the button. bool enabled: - Returns wether the button is currently enabled and receives user input. + Returns whether the button is currently enabled and receives user input. Signals: onClicked: diff --git a/declarativeimports/qtextracomponents/qimageitem.cpp b/declarativeimports/qtextracomponents/qimageitem.cpp index adc4debbe..45505e5cb 100644 --- a/declarativeimports/qtextracomponents/qimageitem.cpp +++ b/declarativeimports/qtextracomponents/qimageitem.cpp @@ -37,10 +37,15 @@ QImageItem::~QImageItem() void QImageItem::setImage(const QImage &image) { + bool oldImageNull = m_image.isNull(); m_image = image; update(); emit nativeWidthChanged(); emit nativeHeightChanged(); + emit imageChanged(); + if (oldImageNull != m_image.isNull()) { + emit nullChanged(); + } } QImage QImageItem::image() const @@ -143,5 +148,9 @@ void QImageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option painter->restore(); } +bool QImageItem::isNull() const +{ + return m_image.isNull(); +} #include "qimageitem.moc" diff --git a/declarativeimports/qtextracomponents/qimageitem.h b/declarativeimports/qtextracomponents/qimageitem.h index 0c358ec71..1aca6b809 100644 --- a/declarativeimports/qtextracomponents/qimageitem.h +++ b/declarativeimports/qtextracomponents/qimageitem.h @@ -26,11 +26,12 @@ class QImageItem : public QDeclarativeItem { Q_OBJECT - Q_PROPERTY(QImage image READ image WRITE setImage) + Q_PROPERTY(QImage image READ image WRITE setImage NOTIFY imageChanged) Q_PROPERTY(bool smooth READ smooth WRITE setSmooth) Q_PROPERTY(int nativeWidth READ nativeWidth NOTIFY nativeWidthChanged) Q_PROPERTY(int nativeHeight READ nativeHeight NOTIFY nativeHeightChanged) Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) + Q_PROPERTY(bool null READ isNull NOTIFY nullChanged) Q_ENUMS(FillMode) public: @@ -60,10 +61,14 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + bool isNull() const; + Q_SIGNALS: void nativeWidthChanged(); void nativeHeightChanged(); void fillModeChanged(); + void imageChanged(); + void nullChanged(); private: QImage m_image; diff --git a/declarativeimports/qtextracomponents/qpixmapitem.cpp b/declarativeimports/qtextracomponents/qpixmapitem.cpp index 9f573bcda..38a01de6f 100644 --- a/declarativeimports/qtextracomponents/qpixmapitem.cpp +++ b/declarativeimports/qtextracomponents/qpixmapitem.cpp @@ -37,10 +37,15 @@ QPixmapItem::~QPixmapItem() void QPixmapItem::setPixmap(const QPixmap &pixmap) { + bool oldPixmapNull = m_pixmap.isNull(); m_pixmap = pixmap; update(); emit nativeWidthChanged(); emit nativeHeightChanged(); + emit pixmapChanged(); + if (oldPixmapNull != m_pixmap.isNull()) { + emit nullChanged(); + } } QPixmap QPixmapItem::pixmap() const @@ -143,5 +148,9 @@ void QPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio painter->restore(); } +bool QPixmapItem::isNull() const +{ + return m_pixmap.isNull(); +} #include "qpixmapitem.moc" diff --git a/declarativeimports/qtextracomponents/qpixmapitem.h b/declarativeimports/qtextracomponents/qpixmapitem.h index ea91ac814..bc06219ee 100644 --- a/declarativeimports/qtextracomponents/qpixmapitem.h +++ b/declarativeimports/qtextracomponents/qpixmapitem.h @@ -26,11 +26,12 @@ class QPixmapItem : public QDeclarativeItem { Q_OBJECT - Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) + Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap NOTIFY pixmapChanged) Q_PROPERTY(bool smooth READ smooth WRITE setSmooth) Q_PROPERTY(int nativeWidth READ nativeWidth NOTIFY nativeWidthChanged) Q_PROPERTY(int nativeHeight READ nativeHeight NOTIFY nativeHeightChanged) Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) + Q_PROPERTY(bool null READ isNull NOTIFY nullChanged) Q_ENUMS(FillMode) public: @@ -60,10 +61,14 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + bool isNull() const; + Q_SIGNALS: void nativeWidthChanged(); void nativeHeightChanged(); void fillModeChanged(); + void pixmapChanged(); + void nullChanged(); private: QPixmap m_pixmap;