[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kwordquiz/src
From: Peter Hedlund <peter () peterandlinda ! com>
Date: 2010-10-27 22:31:07
Message-ID: 20101027223107.400C9AC899 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1190515 by hedlund:
A different, hopefully better, way to center align the flashcard text.
M +6 -2 kwqcardscene.cpp
--- trunk/KDE/kdeedu/kwordquiz/src/kwqcardscene.cpp #1190514:1190515
@@ -19,6 +19,8 @@
#include <QFontMetrics>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsDropShadowEffect>
+#include <QTextOption>
+#include <QTextDocument>
static const int cardWidth = 500;
static const int cardHeight = 300;
@@ -85,8 +87,10 @@
void KWQCardScene::setText(const QString &text)
{
- QString t = QString("<html><div align=center>%1</div></html>").arg(text);
- m_text->setHtml(t);
+ QTextOption option = m_text->document()->defaultTextOption();
+ option.setAlignment(Qt::AlignCenter);
+ m_text->document()->setDefaultTextOption(option);
+ m_text->setPlainText(text);
repositionText();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic