[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/soc-parley/parley/practice
From: David Capel <wot.narg () gmail ! com>
Date: 2008-06-05 8:17:25
Message-ID: 1212653845.012191.8912.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 817084 by capel:
Using svgs as layouts now works. Layouts are in layout.svgz and independent widgets \
are in widgets.svgz. Once things stabilize a bit I'll draw up documentation for \
those files (for themeing use).
The svg percent bar works -- it is the first example of the upcoming themeing system.
Known bug: when resizing the window, the svg resizes to match the previous window \
size instead of the current one. Something is interacting wierdly with the qt \
function I'm using...
TODO: more svg stuff. I need to make (or have made ;) ) a more complex layout svg to \
work with. change the prompt to svg text instead of a label?
M +1 -3 CMakeLists.txt
D defaulttheme/background.svgz
D defaulttheme/card.svg
D defaulttheme/layout.svg
AM defaulttheme/layout.svgz
M defaulttheme/widgets.svgz
M +3 -6 parleypracticemainwindow.cpp
M +8 -6 statistics.cpp
M +1 -0 statistics.h
--- branches/work/soc-parley/parley/practice/CMakeLists.txt #817083:817084
@@ -45,9 +45,7 @@
install(TARGETS parleypractice DESTINATION ${BIN_INSTALL_DIR} )
install(FILES parleypracticeui.rc
DESTINATION ${DATA_INSTALL_DIR}/parleypractice/)
-install( FILES defaulttheme/card.svg
- defaulttheme/layout.svg
- defaulttheme/background.svgz
+install( FILES defaulttheme/layout.svgz
defaulttheme/widgets.svgz
DESTINATION ${DATA_INSTALL_DIR}/parley/defaulttheme/ )
** branches/work/soc-parley/parley/practice/defaulttheme/layout.svgz #property \
svn:mime-type + application/octet-stream
--- branches/work/soc-parley/parley/practice/parleypracticemainwindow.cpp \
#817083:817084 @@ -65,7 +65,7 @@
QGraphicsSvgItem * backgroundsvg = new QGraphicsSvgItem();
KSvgRenderer * krenderer = new KSvgRenderer();
- krenderer->load(KStandardDirs::locate("data", \
"parley/defaulttheme/background.svgz")); + \
krenderer->load(KStandardDirs::locate("data", "parley/defaulttheme/layout.svgz")); \
backgroundsvg->setSharedRenderer(krenderer); scene->addItem(backgroundsvg);
m_backgroundRect = backgroundsvg->boundingRect();
@@ -107,11 +107,7 @@
QGraphicsProxyWidget * ginput = scene->addWidget(input);
Statistics * stats = new Statistics(this);
- backgroundsvg->setElementId("progress_bar_background");
- QRectF progress_bar_background = backgroundsvg->boundingRect();
- kDebug() << progress_bar_background << backgroundsvg->boundingRect();
- backgroundsvg->setElementId("");
- SvgBarStatistics * barstats = new SvgBarStatistics(progress_bar_background);
+ SvgBarStatistics * barstats = new \
SvgBarStatistics(backgroundsvg->renderer()->boundsOnElement("progress_bar_background"));
scene->addItem(barstats);
connect(stats, SIGNAL(signalUpdateDisplay(Statistics*)), barstats, \
SLOT(slotUpdateDisplay(Statistics*)));
connect(m_manager, SIGNAL(signalExpressionChanged(KEduVocExpression*)), stats, \
SLOT(slotSetExpression(KEduVocExpression*))); @@ -199,6 +195,7 @@
gpromptAndInput->setPos(m_backgroundRect.width() / 2.0, \
m_backgroundRect.height() / 2.0); //gstdbutton->setPos(10, 200); // we'll ignore the \
button for now.
+ //backgroundsvg->setVisible(false);
setupGUI();
--- branches/work/soc-parley/parley/practice/statistics.cpp #817083:817084
@@ -48,16 +48,17 @@
}
SvgBarStatistics::SvgBarStatistics(const QRectF& background, QGraphicsItem * parent)
- : QGraphicsSvgItem(parent)
+ : QGraphicsSvgItem(parent),
+ m_backgroundRect(background)
{
- m_backgroundRect = background;
KSvgRenderer * krenderer = new KSvgRenderer();
krenderer->load(KStandardDirs::locate("data", \
"parley/defaulttheme/widgets.svgz")); setSharedRenderer(krenderer);
setElementId("progress_bar");
setPos(m_backgroundRect.x(), m_backgroundRect.y());
- kDebug() << m_backgroundRect.x() << m_backgroundRect.y() << x() << y();
- scale(boundingRect().width()/m_backgroundRect.width(), 1);
+ scale((m_backgroundRect.width())/boundingRect().width(), 1.0);
+ kDebug() << boundingRect() << scenePos();
+ setZValue(10); // higher than the rest
}
SvgBarStatistics::~SvgBarStatistics()
@@ -218,8 +219,9 @@
void SvgBarStatistics::slotUpdateDisplay(Statistics*stats)
{
- kDebug() << boundingRect() << stats->percentCorrect() / \
(boundingRect().width() / m_backgroundRect.width());
- scale(boundingRect().width() / (m_backgroundRect.width() * \
stats->percentCorrect()), 1); + kDebug() << boundingRect();
+ kDebug() << stats->percentCorrect() << "*" << m_backgroundRect.width() << "/" << \
mapToScene(boundingRect()).boundingRect().width() << "="; + \
scale((m_backgroundRect.width() * \
stats->percentCorrect())/mapToScene(boundingRect()).boundingRect().width(), 1.0); }
--- branches/work/soc-parley/parley/practice/statistics.h #817083:817084
@@ -196,6 +196,7 @@
public slots:
/// Refreshes the GUI display.
void slotUpdateDisplay(Statistics*);
+
private:
QRectF m_backgroundRect;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic