number_input.h 775 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // This file is part of Desktop App Toolkit,
  2. // a set of libraries for developing nice desktop applications.
  3. //
  4. // For license and copyright information please follow this link:
  5. // https://github.com/desktop-app/legal/blob/master/LEGAL
  6. //
  7. #pragma once
  8. #include "ui/widgets/fields/masked_input_field.h"
  9. namespace style {
  10. struct InputField;
  11. } // namespace style
  12. namespace Ui {
  13. class NumberInput final : public MaskedInputField {
  14. public:
  15. NumberInput(
  16. QWidget *parent,
  17. const style::InputField &st,
  18. rpl::producer<QString> placeholder,
  19. const QString &value,
  20. int limit);
  21. void changeLimit(int limit);
  22. protected:
  23. void correctValue(
  24. const QString &was,
  25. int wasCursor,
  26. QString &now,
  27. int &nowCursor) override;
  28. private:
  29. int _limit = 0;
  30. };
  31. } // namespace Ui