summaryrefslogtreecommitdiffstats
path: root/tests/manual/qlocale/miscellaneous.cpp
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-02-22 14:38:58 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-02-23 14:32:38 (GMT)
commitb0909ad9254a772abb5d91f2a179446e643c0fca (patch)
treeb472f74e6b647aabac1146bca88082f381855b96 /tests/manual/qlocale/miscellaneous.cpp
parent81fe6eac7530ad508bf54e7996cbdc9e2f0cb5d1 (diff)
downloadQt-b0909ad9254a772abb5d91f2a179446e643c0fca.zip
Qt-b0909ad9254a772abb5d91f2a179446e643c0fca.tar.gz
Qt-b0909ad9254a772abb5d91f2a179446e643c0fca.tar.bz2
Improved qlocale manualtest
Reviewed-by: trustme
Diffstat (limited to 'tests/manual/qlocale/miscellaneous.cpp')
-rw-r--r--tests/manual/qlocale/miscellaneous.cpp45
1 files changed, 27 insertions, 18 deletions
diff --git a/tests/manual/qlocale/miscellaneous.cpp b/tests/manual/qlocale/miscellaneous.cpp
index a1a3139..0b2250a 100644
--- a/tests/manual/qlocale/miscellaneous.cpp
+++ b/tests/manual/qlocale/miscellaneous.cpp
@@ -42,14 +42,13 @@
MiscWidget::MiscWidget()
{
- QGridLayout *l = new QGridLayout(this);
+ QGridLayout *l = new QGridLayout;
- textToQuoteLabel = new QLabel("Text to quote:");
- standardQuotedTextLabel = new QLabel("Standard quotes:");
- alternateQuotedTextLabel = new QLabel("Alternate quotes:");
- textToQuote = new QLineEdit("some text");
- standardQuotedText = new QLineEdit;
- alternateQuotedText = new QLineEdit;
+ createLineEdit("Text to quote:", &textToQuoteLabel, &textToQuote);
+ createLineEdit("Standard quotes:", &standardQuotedTextLabel, &standardQuotedText);
+ createLineEdit("Alternate quotes:", &alternateQuotedTextLabel, &alternateQuotedText);
+ textToQuote->setText("some text");
+ createLineEdit("Text direction:", &textDirectionLabel, &textDirection);
l->addWidget(textToQuoteLabel, 0, 0);
l->addWidget(textToQuote, 0, 1);
@@ -57,27 +56,37 @@ MiscWidget::MiscWidget()
l->addWidget(standardQuotedText, 0, 3);
l->addWidget(alternateQuotedTextLabel, 1, 2);
l->addWidget(alternateQuotedText, 1, 3);
+ l->addWidget(textDirectionLabel, 2, 0);
+ l->addWidget(textDirection, 2, 1, 1, 3);
connect(textToQuote, SIGNAL(textChanged(QString)), this, SLOT(updateQuotedText(QString)));
- update(QLocale());
-}
-
-void MiscWidget::update(const QLocale locale)
-{
- currentLocale = locale;
- updateQuotedText(textToQuote->text());
+ QVBoxLayout *v = new QVBoxLayout(this);
+ v->addLayout(l);
+ v->addStretch();
}
void MiscWidget::updateQuotedText(QString str)
{
- standardQuotedText->setText(currentLocale.quoteString(str));
- alternateQuotedText->setText(currentLocale.quoteString(str, QLocale::AlternateQuotation));
+ standardQuotedText->setText(locale().quoteString(str));
+ alternateQuotedText->setText(locale().quoteString(str, QLocale::AlternateQuotation));
}
void MiscWidget::localeChanged(QLocale locale)
{
- update(locale);
+ setLocale(locale);
+ updateQuotedText(textToQuote->text());
+ textDirection->setText(locale.textDirection() == Qt::LeftToRight ? "Left To Right" : "Right To Left");
}
-
+void MiscWidget::createLineEdit(const QString &label, QLabel **labelWidget, QLineEdit **lineEditWidget)
+{
+ QLabel *lbl = new QLabel(label);
+ QLineEdit *le = new QLineEdit;
+ le->setReadOnly(true);
+ lbl->setBuddy(le);
+ if (labelWidget)
+ *labelWidget = lbl;
+ if (lineEditWidget)
+ *lineEditWidget = le;
+}