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)
{
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

View File

@ -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();

View File

@ -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()),

View File

@ -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

View File

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

View File

@ -112,6 +112,7 @@ Item {
var visibleChildCount = childCount
var contentWidth = 0
var contentHeight = 0
var maxChildWidth = 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
for (var i = 0; i < childCount; ++i) {
@ -137,7 +138,8 @@ Item {
child.height = root.height
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))
}
}