summaryrefslogtreecommitdiffstats
path: root/tools/qml
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2011-01-10 05:29:03 (GMT)
committerJoona Petrell <joona.t.petrell@nokia.com>2011-01-10 05:43:38 (GMT)
commit7aae8a569809208318ad06017eda39c860c1b2a9 (patch)
tree00381cbde57e5ee69dd8f0d9871997e3934ff204 /tools/qml
parentcbf6bfbff8c0643bc82bb2456214994931052bd6 (diff)
downloadQt-7aae8a569809208318ad06017eda39c860c1b2a9.zip
Qt-7aae8a569809208318ad06017eda39c860c1b2a9.tar.gz
Qt-7aae8a569809208318ad06017eda39c860c1b2a9.tar.bz2
Add no warnings label to qmlviewer warnings window
Small developer usability improvement Task-number: Reviewed-by: Bea Lam
Diffstat (limited to 'tools/qml')
-rw-r--r--tools/qml/loggerwidget.cpp15
-rw-r--r--tools/qml/loggerwidget.h4
2 files changed, 18 insertions, 1 deletions
diff --git a/tools/qml/loggerwidget.cpp b/tools/qml/loggerwidget.cpp
index f601d95..fb4fedc 100644
--- a/tools/qml/loggerwidget.cpp
+++ b/tools/qml/loggerwidget.cpp
@@ -45,6 +45,8 @@
#include <QActionGroup>
#include <QMenu>
#include <QPlainTextEdit>
+#include <QLabel>
+#include <QVBoxLayout>
#ifdef Q_WS_MAEMO_5
# include <QScrollArea>
# include <QVBoxLayout>
@@ -83,6 +85,14 @@ LoggerWidget::LoggerWidget(QWidget *parent) :
setCentralWidget(m_plainTextEdit);
#endif
+ m_noWarningsLabel = new QLabel(m_plainTextEdit);
+ m_noWarningsLabel->setText(tr("(No warnings)"));
+ m_noWarningsLabel->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(m_noWarningsLabel);
+ m_plainTextEdit->setLayout(layout);
+ connect(m_plainTextEdit, SIGNAL(textChanged()), this, SLOT(updateNoWarningsLabel()));
+
readSettings();
setupPreferencesMenu();
}
@@ -207,4 +217,9 @@ void LoggerWidget::setupPreferencesMenu()
}
}
+void LoggerWidget::updateNoWarningsLabel()
+{
+ m_noWarningsLabel->setVisible(m_plainTextEdit->toPlainText().length() == 0);
+}
+
QT_END_NAMESPACE
diff --git a/tools/qml/loggerwidget.h b/tools/qml/loggerwidget.h
index 13c319f..27d4d0b 100644
--- a/tools/qml/loggerwidget.h
+++ b/tools/qml/loggerwidget.h
@@ -48,6 +48,7 @@
QT_BEGIN_NAMESPACE
class QPlainTextEdit;
+class QLabel;
class QMenu;
class QAction;
@@ -66,6 +67,7 @@ public:
public slots:
void append(const QString &msg);
+ void updateNoWarningsLabel();
private slots:
void warningsPreferenceChanged(QAction *action);
@@ -86,7 +88,7 @@ private:
QMenu *m_preferencesMenu;
QAction *m_showWidgetAction;
QPlainTextEdit *m_plainTextEdit;
-
+ QLabel *m_noWarningsLabel;
enum ConfigOrigin { CommandLineOrigin, SettingsOrigin };
ConfigOrigin m_visibilityOrigin;
Visibility m_visibility;