Skip to content

Commit

Permalink
Handle backspace when typing in numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
macumber committed Jan 30, 2015
1 parent f451ab1 commit 1666408
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
17 changes: 13 additions & 4 deletions openstudiocore/src/openstudio_lib/ScheduleDayView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,7 @@ void DaySchedulePlotArea::mouseMoveEvent(QMouseEvent * event)

m_keyboardInputText->setPlainText("Enter Value");
double textX = m_currentHoverItem->hCenterPos() - 2 * LINEWIDTH;
double textY = m_currentHoverItem->vCenterPos() - 2 * LINEWIDTH;
double textY = m_currentHoverItem->vCenterPos() - 1.5 * LINEWIDTH;
m_keyboardInputText->setPos(textX, textY);

setFocus();
Expand Down Expand Up @@ -1749,7 +1749,7 @@ void DaySchedulePlotArea::mouseMoveEvent(QMouseEvent * event)

m_keyboardInputText->setPlainText("Enter Value");
double textX = m_currentHoverItem->hCenterPos() - 2 * LINEWIDTH;
double textY = m_currentHoverItem->vCenterPos() - 2 * LINEWIDTH;
double textY = m_currentHoverItem->vCenterPos() - 1.5 * LINEWIDTH;
m_keyboardInputText->setPos(textX, textY);

setFocus();
Expand Down Expand Up @@ -1856,7 +1856,16 @@ void DaySchedulePlotArea::keyPressEvent(QKeyEvent * event)
m_keyboardInputValue.append(event->text());
m_keyboardInputText->setPlainText("-");
double textX = m_currentHoverItem->hCenterPos() - 2 * LINEWIDTH;
double textY = m_currentHoverItem->vCenterPos() - 2 * LINEWIDTH;
double textY = m_currentHoverItem->vCenterPos() - 1.5 * LINEWIDTH;
m_keyboardInputText->setPos(textX, textY);
}
else if (event->key() == Qt::Key_Backspace)
{
m_keyboardInputValue.chop(1);

m_keyboardInputText->setPlainText(m_keyboardInputValue);
double textX = m_currentHoverItem->hCenterPos() - 2 * LINEWIDTH;
double textY = m_currentHoverItem->vCenterPos() - 1.5* LINEWIDTH;
m_keyboardInputText->setPos(textX, textY);
}
else if( event->key() == Qt::Key_0 ||
Expand All @@ -1875,7 +1884,7 @@ void DaySchedulePlotArea::keyPressEvent(QKeyEvent * event)
m_keyboardInputValue.append(event->text());
m_keyboardInputText->setPlainText(m_keyboardInputValue);
double textX = m_currentHoverItem->hCenterPos() - 2 * LINEWIDTH;
double textY = m_currentHoverItem->vCenterPos() - 2 * LINEWIDTH;
double textY = m_currentHoverItem->vCenterPos() - 1.5 * LINEWIDTH;
m_keyboardInputText->setPos(textX, textY);
}
}
Expand Down
7 changes: 7 additions & 0 deletions openstudiocore/src/openstudio_lib/SchedulesView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1623,6 +1623,13 @@ ScheduleRuleView::ScheduleRuleView(bool isIP,

nameHLayout->addWidget(colorWidget);

QString priorityString("Priority ");
priorityString.append(QString::number(m_scheduleRule.ruleIndex() + 1));
QLabel * priorityLabel = new QLabel(priorityString);
nameHLayout->addWidget(priorityLabel);

nameHLayout->addSpacing(10);

m_nameEditField = new OSLineEdit();
m_nameEditField->bind(m_scheduleRule,"name");
nameHLayout->addWidget(m_nameEditField);
Expand Down

3 comments on commit 1666408

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

86121908_copy_schedule (macumber) - x86_64-Linux-Ubuntu-14.04-clang-3.5: OK (2163 of 2190 tests passed)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

86121908_copy_schedule (macumber) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: Build Failed

Build Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

86121908_copy_schedule (macumber) - i386-Windows-7-VisualStudio-12: OK (2174 of 2190 tests passed)

Build Badge Test Badge

Please sign in to comment.