From 7294f46ec0c5ea07e438c45a069a618ceb6e17a9 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 23 Jun 2010 12:15:36 +0200 Subject: forgot to cleanup the code a bit after adding Maemo5 support --- tools/qml/loggerwidget.cpp | 4 ++-- tools/qml/qmlruntime.cpp | 8 ++++---- tools/qml/texteditautoresizer_maemo5.h | 17 ++++------------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp index 71d20e8..8aa029f 100644 --- a/tools/qml/loggerwidget.cpp +++ b/tools/qml/loggerwidget.cpp @@ -63,7 +63,7 @@ LoggerWidget::LoggerWidget(QWidget *parent) : setWindowTitle(tr("Warnings")); m_plainTextEdit = new QPlainTextEdit(); - + #ifdef Q_WS_MAEMO_5 new TextEditAutoResizer(m_plainTextEdit); setAttribute(Qt::WA_Maemo5StackedWindow); @@ -71,7 +71,7 @@ LoggerWidget::LoggerWidget(QWidget *parent) : area->setWidget(m_plainTextEdit); area->setWidgetResizable(true); setCentralWidget(area); -#else +#else setCentralWidget(m_plainTextEdit); #endif readSettings(); diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 090ca2a..3a8af60 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -254,9 +254,9 @@ public: sizeWidth->setValue(s.width()); sizeHeight->setValue(s.height()); } -#endif +#endif } - + void showffmpegOptions(bool b) { #ifdef Q_WS_MAEMO_5 @@ -268,7 +268,7 @@ public: ffmpegOptions->setVisible(b); #endif } - + void showRateOptions(bool b) { #ifdef Q_WS_MAEMO_5 @@ -297,7 +297,7 @@ public: idx = 6; else idx = 7; - rateCombo->setCurrentIndex(idx); + rateCombo->setCurrentIndex(idx); #else if (rate == 24) hz24->setChecked(true); diff --git a/tools/qml/texteditautoresizer_maemo5.h b/tools/qml/texteditautoresizer_maemo5.h index 2b9a5f9..bb5567a 100644 --- a/tools/qml/texteditautoresizer_maemo5.h +++ b/tools/qml/texteditautoresizer_maemo5.h @@ -61,7 +61,7 @@ public: connect(parent, SIGNAL(textChanged()), this, SLOT(textEditChanged())); connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(textEditChanged())); - + textEditChanged(); } @@ -87,36 +87,27 @@ void TextEditAutoResizer::textEditChanged() const QRect cr = edit->contentsRect(); edit->setMinimumHeight(qMax(70, s.height() + (fr.height() - cr.height() - 1))); - -// QString s1; -// QDebug ts(&s1); -// ts << "DOC: " << s << " CURSOR: " << cursor << " MINH: " << edit->minimumHeight(); -// fprintf(stderr, "%s\n", qPrintable(s1)); // make sure the cursor is visible in case we have a QAbstractScrollArea parent QPoint pos = edit->pos(); QWidget *pw = edit->parentWidget(); - while (pw) { + while (pw) { if (qobject_cast(pw)) break; pw = pw->parentWidget(); } - + if (pw) { QScrollArea *area = static_cast(pw); QPoint scrollto = area->widget()->mapFrom(edit, cursor.center()); QPoint margin(10 + cursor.width(), 2 * cursor.height()); - + if (QAbstractKineticScroller *scroller = area->property("kineticScroller").value()) { scroller->ensureVisible(scrollto, margin.x(), margin.y()); } else { area->ensureVisible(scrollto.x(), scrollto.y(), margin.x(), margin.y()); } } -// QDebug ts(&s2); -// ts << "ENSURE VIS: " << pos << " + " << cursor.center() << "(pos + cursor.center())" << scroller->isEnabled() << area; -// ts << "PW: " << pw << " PPW: " << (pw ? pw->parentWidget() : 0); //ENSURE VIS: " << pos << " + " << cursor.center() << "(pos + cursor.center())" << scroller->isEnabled() << area; -// fprintf(stderr, "%s\n", qPrintable(s2)); } #endif -- cgit v0.12