[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/train-clock
From: Sebastian Kügler <sebas () kde ! org>
Date: 2008-06-27 1:13:43
Message-ID: 1214529223.634267.27035.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 824979 by sebas:
Use semantically correct contentsRect() to base the sizing foo upon
M +9 -9 clock.cpp
--- trunk/playground/base/plasma/applets/train-clock/clock.cpp #824978:824979
@@ -95,7 +95,7 @@
// Set default spacings
m_horizontalSpacing = 4;
m_verticalSpacing = 3;
- m_margin = 2;
+ m_margin = 10;
// take the size of the top half of the '0' number
// to calculate the aspect ratio when drawing
@@ -104,9 +104,9 @@
setFailedToLaunch(true, i18n("The train-clock SVG file has no element \
e0-p1")); return;
}
- m_contentSize = QSizeF(150, 50);
+ m_contentSize = QSizeF(125, 50);
resize(m_contentSize);
- setMinimumSize(QSizeF(55, 22));
+ setMinimumSize(QSizeF(27, 11));
dataEngine("time")->connectSource(m_timezone, this, 6000, \
Plasma::AlignToMinute); updateSizes();
}
@@ -261,8 +261,8 @@
void Clock::updateSizes()
{
- m_maxHeight = qMin((int)(geometry().size().height()), m_timeRect.height());
- m_maxWidth = (int)(geometry().size().width()-(m_margin*2));
+ m_maxHeight = qMin((int)(contentsRect().height()), m_timeRect.height());
+ m_maxWidth = (int)(contentsRect().width()-(m_margin*2));
if (m_maxHeight*3 > m_maxWidth) {
m_maxHeight =(int)(m_maxWidth/3);
@@ -278,7 +278,7 @@
m_timeRect.setWidth((int)(((m_timeRect.height()-m_verticalSpacing)/2) \
*1.4*4+(6*m_horizontalSpacing))); } // small enough now.
- m_timeRect = QRect(QPoint(0, 0), geometry().size().toSize());
+ m_timeRect = QRect(QPoint(0, 0), contentsRect().size().toSize());
m_dateRect = QRect(0, 0, 0, 0);
if (m_showDate || m_showTimezone) {
@@ -288,8 +288,8 @@
int smallerHeight = qRound(m_timeRect.height() - (fm.height() + \
m_margin*3));
m_timeRect.setHeight(smallerHeight); // Resize the timeRect if we have to \
paint some text below. m_dateRect.setY(smallerHeight);
- m_dateRect.setHeight((int)(geometry().size().height()));
- m_dateRect.setWidth((int)(geometry().size().width()-m_margin));
+ m_dateRect.setHeight((int)(contentsRect().height()));
+ m_dateRect.setWidth((int)(contentsRect().width()-m_margin));
}
// enforce natural aspect ratio
QSize elSize = m_defaultElementSize;
@@ -340,7 +340,7 @@
}
offset += (m_elWidth+m_horizontalSpacing) * digitNumber; // Add space taken by \
digit
- offset += (int)(( geometry().size().width()-(m_elWidth*4 + m_horizontalSpacing*4 \
+ m_elWidth/1.7 - m_margin*2)) /2); // Align to center + offset += (int)(( \
contentsRect().width()-(m_elWidth*4 + m_horizontalSpacing*4 + m_elWidth/1.7 - \
m_margin*2)) /2); // Align to center
if (digitNumber > 2) { // There's a smaller gap between hours and minutes ...
offset -= m_elWidth;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic