Merge branch 'master' into plasma/mart/PageRow

This commit is contained in:
Marco Martin 2012-08-14 15:54:47 +02:00
commit 3d2083be1a
6 changed files with 40 additions and 16 deletions

View File

@ -70,8 +70,13 @@ FrameSvgItem::~FrameSvgItem()
void FrameSvgItem::setImagePath(const QString &path) void FrameSvgItem::setImagePath(const QString &path)
{ {
if (m_frameSvg->imagePath() == path)
return;
m_frameSvg->setImagePath(path); m_frameSvg->setImagePath(path);
m_frameSvg->setElementPrefix(m_prefix); m_frameSvg->setElementPrefix(m_prefix);
emit imagePathChanged();
update(); update();
} }
@ -83,8 +88,13 @@ QString FrameSvgItem::imagePath() const
void FrameSvgItem::setPrefix(const QString &prefix) void FrameSvgItem::setPrefix(const QString &prefix)
{ {
if (m_prefix == prefix)
return;
m_frameSvg->setElementPrefix(prefix); m_frameSvg->setElementPrefix(prefix);
m_prefix = prefix; m_prefix = prefix;
emit prefixChanged();
update(); update();
} }
@ -100,7 +110,11 @@ FrameSvgItemMargins *FrameSvgItem::margins() const
void FrameSvgItem::setEnabledBorders(const Plasma::FrameSvg::EnabledBorders borders) void FrameSvgItem::setEnabledBorders(const Plasma::FrameSvg::EnabledBorders borders)
{ {
if (m_frameSvg->enabledBorders() == borders)
return;
m_frameSvg->setEnabledBorders(borders); m_frameSvg->setEnabledBorders(borders);
emit enabledBordersChanged();
} }
Plasma::FrameSvg::EnabledBorders FrameSvgItem::enabledBorders() const Plasma::FrameSvg::EnabledBorders FrameSvgItem::enabledBorders() const

View File

@ -73,14 +73,14 @@ class FrameSvgItem : public QDeclarativeItem
/** /**
* Theme relative path of the svg, like "widgets/background" * 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 * prefix for the 9 piece svg, like "pushed" or "normal" for the button
* see http://techbase.kde.org/Development/Tutorials/Plasma/ThemeDetails * see http://techbase.kde.org/Development/Tutorials/Plasma/ThemeDetails
* for a list of paths and prefixes * 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 * The margins of the frame, read only
@ -97,7 +97,7 @@ class FrameSvgItem : public QDeclarativeItem
* LeftBorder * LeftBorder
* RightBorder * RightBorder
*/ */
Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders WRITE setEnabledBorders) Q_PROPERTY(Plasma::FrameSvg::EnabledBorders enabledBorders READ enabledBorders WRITE setEnabledBorders NOTIFY enabledBordersChanged)
public: public:
FrameSvgItem(QDeclarativeItem *parent=0); FrameSvgItem(QDeclarativeItem *parent=0);
@ -119,6 +119,11 @@ public:
void geometryChanged(const QRectF &newGeometry, void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry); const QRectF &oldGeometry);
signals:
void imagePathChanged();
void prefixChanged();
void enabledBordersChanged();
private Q_SLOTS: private Q_SLOTS:
void doUpdate(); void doUpdate();

View File

@ -266,7 +266,7 @@ void FullScreenWindow::syncMainItemToView()
m_mainItem.data()->setProperty("height", m_view->height()); m_mainItem.data()->setProperty("height", m_view->height());
if (m_declarativeItemContainer) { if (m_declarativeItemContainer) {
m_view->resize(m_declarativeItemContainer->size().toSize()); m_declarativeItemContainer->resize(m_view->size());
m_view->setSceneRect(m_declarativeItemContainer->geometry()); m_view->setSceneRect(m_declarativeItemContainer->geometry());
} else { } else {
QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()), QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()),

View File

@ -47,8 +47,9 @@ import "." 0.1
Item { Item {
id: root 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 title: titleBar.children
property alias content: contentItem.children property alias content: contentItem.children
@ -110,9 +111,7 @@ Item {
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {
id: dialog id: dialog
width: mainItem.width + margins.left + margins.right anchors.fill: parent
height: mainItem.height + margins.top + margins.bottom
anchors.centerIn: parent
imagePath: "dialogs/background" imagePath: "dialogs/background"
state: "closed" state: "closed"
@ -121,10 +120,14 @@ Item {
Item { Item {
id: mainItem id: mainItem
x: dialog.margins.left anchors {
y: dialog.margins.top fill: parent
width: theme.defaultFont.mSize.width * 40 leftMargin: dialog.margins.left
height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 8 topMargin: dialog.margins.top
rightMargin: dialog.margins.right
bottomMargin: dialog.margins.bottom
}
// Consume all key events that are not processed by children // Consume all key events that are not processed by children

View File

@ -76,8 +76,8 @@ FocusScope {
//Plasma extension //Plasma extension
property Item currentTab property Item currentTab
implicitWidth: tabBarLayout.implicitWidth + backgroundFrame.margins.left + backgroundFrame.margins.right + (buttonFrame.margins.left + buttonFrame.margins.right)*tabBarLayout.children.length implicitWidth: layout.implicitWidth + backgroundFrame.margins.left + backgroundFrame.margins.right
implicitHeight: tabBarLayout.implicitHeight + backgroundFrame.margins.top + backgroundFrame.margins.bottom + buttonFrame.margins.top + buttonFrame.margins.bottom implicitHeight: layout.implicitHeight + backgroundFrame.margins.top + backgroundFrame.margins.bottom
PlasmaCore.FrameSvgItem { PlasmaCore.FrameSvgItem {
id: backgroundFrame id: backgroundFrame

View File

@ -112,6 +112,7 @@ Item {
var visibleChildCount = childCount var visibleChildCount = childCount
var contentWidth = 0 var contentWidth = 0
var contentHeight = 0 var contentHeight = 0
var maxChildWidth = 0
if (childCount != 0) { if (childCount != 0) {
//not too much efficient but the loop over children needs to be done two times to get the proper child width //not too much efficient but the loop over children needs to be done two times to get the proper child width
for (var i = 0; i < childCount; ++i) { for (var i = 0; i < childCount; ++i) {
@ -137,7 +138,8 @@ Item {
child.height = root.height child.height = root.height
if (child.implicitWidth != undefined) { if (child.implicitWidth != undefined) {
contentWidth = Math.max(contentWidth + i*10, (child.implicitWidth + buttonFrame.margins.left*2 + buttonFrame.margins.right*2) * childCount) maxChildWidth = Math.max(maxChildWidth, child.implicitWidth)
contentWidth = Math.max(contentWidth + i*10, (maxChildWidth + buttonFrame.margins.left + buttonFrame.margins.right) * childCount)
contentHeight = Math.max(contentHeight, (child.implicitHeight + buttonFrame.margins.top + buttonFrame.margins.bottom)) contentHeight = Math.max(contentHeight, (child.implicitHeight + buttonFrame.margins.top + buttonFrame.margins.bottom))
} }
} }