From abdf74ca5a6d058e0326afddbb04d5067b831d06 Mon Sep 17 00:00:00 2001 From: "Sean C. Rhea" Date: Thu, 3 May 2007 23:30:56 +0000 Subject: [PATCH] use QLineEdit instead of QLabel in CP plot to avoid resizing bug --- src/gui/MainWindow.cpp | 22 +++++++++++++++------- src/gui/MainWindow.h | 6 +++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 03094977a..4fc136132 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -175,12 +175,21 @@ MainWindow::MainWindow(const QDir &home) : window = new QWidget; vlayout = new QVBoxLayout; QHBoxLayout *cpintPickerLayout = new QHBoxLayout; - cpintTimeLabel = new QLabel(tr("Interval Duration:"), window); - cpintTodayLabel = new QLabel(tr("Today:"), window); - cpintAllLabel = new QLabel(tr("All Rides:"), window); + QLabel *cpintTimeLabel = new QLabel(tr("Interval Duration:"), window); + cpintTimeValue = new QLineEdit("0 s"); + QLabel *cpintTodayLabel = new QLabel(tr("Today:"), window); + cpintTodayValue = new QLineEdit("0 watts"); + QLabel *cpintAllLabel = new QLabel(tr("All Rides:"), window); + cpintAllValue = new QLineEdit("0 watts"); + cpintTimeValue->setReadOnly(true); + cpintTodayValue->setReadOnly(true); + cpintAllValue->setReadOnly(true); cpintPickerLayout->addWidget(cpintTimeLabel); + cpintPickerLayout->addWidget(cpintTimeValue); cpintPickerLayout->addWidget(cpintTodayLabel); + cpintPickerLayout->addWidget(cpintTodayValue); cpintPickerLayout->addWidget(cpintAllLabel); + cpintPickerLayout->addWidget(cpintAllValue); cpintPlot = new CpintPlot(home.path()); vlayout->addWidget(cpintPlot); vlayout->addLayout(cpintPickerLayout); @@ -640,11 +649,10 @@ void MainWindow::pickerMoved(const QPoint &pos) { double minutes = cpintPlot->invTransform(QwtPlot::xBottom, pos.x()); - cpintTimeLabel->setText(tr("Interval Duration: %1") - .arg(interval_to_str(60.0*minutes))); - cpintTodayLabel->setText(tr("Today: %1 watts").arg( + cpintTimeValue->setText(interval_to_str(60.0*minutes)); + cpintTodayValue->setText(tr("%1 watts").arg( curve_to_point(minutes, cpintPlot->getThisCurve()))); - cpintAllLabel->setText(tr("All Rides: %1 watts").arg( + cpintAllValue->setText(tr("%1 watts").arg( curve_to_point(minutes, cpintPlot->getAllCurve()))); } diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h index 2f9d41573..33f1f926d 100644 --- a/src/gui/MainWindow.h +++ b/src/gui/MainWindow.h @@ -69,9 +69,9 @@ class MainWindow : public QMainWindow QTextEdit *weeklySummary; AllPlot *allPlot; CpintPlot *cpintPlot; - QLabel *cpintTimeLabel; - QLabel *cpintTodayLabel; - QLabel *cpintAllLabel; + QLineEdit *cpintTimeValue; + QLineEdit *cpintTodayValue; + QLineEdit *cpintAllValue; QwtPlotPicker *picker; QSlider *smoothSlider; QLineEdit *smoothLineEdit;