Skip to content

Commit

Permalink
Added focus rpl event to time input.
Browse files Browse the repository at this point in the history
  • Loading branch information
23rd committed Aug 11, 2021
1 parent 8ff42a8 commit 4fcddb5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ui/widgets/time_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ TimeInput::TimeInput(
+ pointer->x()
- _hour->x();
setFocused(true);
_focuses.fire({});
};
};
const auto blurred = [=] {
Expand Down Expand Up @@ -320,6 +321,10 @@ rpl::producer<> TimeInput::submitRequests() const {
return _submitRequests.events();
}

rpl::producer<> TimeInput::focuses() const {
return _focuses.events();
}

void TimeInput::paintEvent(QPaintEvent *e) {
Painter p(this);

Expand Down
2 changes: 2 additions & 0 deletions ui/widgets/time_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class TimeInput final : public RpWidget {
bool setFocusFast();
rpl::producer<QString> value() const;
rpl::producer<> submitRequests() const;
rpl::producer<> focuses() const;
QString valueCurrent() const;
void showError();

Expand Down Expand Up @@ -61,6 +62,7 @@ class TimeInput final : public RpWidget {
object_ptr<TimePart> _minute;
rpl::variable<QString> _value;
rpl::event_stream<> _submitRequests;
rpl::event_stream<> _focuses;

style::cursor _cursor = style::cur_default;
Animations::Simple _a_borderShown;
Expand Down

0 comments on commit 4fcddb5

Please sign in to comment.