您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

starwelsamountfield.h 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright (c) 2011-2015 The Starwels developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef STARWELS_QT_STARWELSAMOUNTFIELD_H
  5. #define STARWELS_QT_STARWELSAMOUNTFIELD_H
  6. #include "amount.h"
  7. #include <QWidget>
  8. class AmountSpinBox;
  9. QT_BEGIN_NAMESPACE
  10. class QValueComboBox;
  11. QT_END_NAMESPACE
  12. /** Widget for entering starwels amounts.
  13. */
  14. class StarwelsAmountField: public QWidget
  15. {
  16. Q_OBJECT
  17. // ugly hack: for some unknown reason CAmount (instead of qint64) does not work here as expected
  18. // discussion: https://github.com/bitcoin/bitcoin/pull/5117
  19. Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true)
  20. public:
  21. explicit StarwelsAmountField(QWidget *parent = 0);
  22. CAmount value(bool *value=0) const;
  23. void setValue(const CAmount& value);
  24. /** Set single step in satoshis **/
  25. void setSingleStep(const CAmount& step);
  26. /** Make read-only **/
  27. void setReadOnly(bool fReadOnly);
  28. /** Mark current value as invalid in UI. */
  29. void setValid(bool valid);
  30. /** Perform input validation, mark field as invalid if entered value is not valid. */
  31. bool validate();
  32. /** Change unit used to display amount. */
  33. void setDisplayUnit(int unit);
  34. /** Make field empty and ready for new input. */
  35. void clear();
  36. /** Enable/Disable. */
  37. void setEnabled(bool fEnabled);
  38. /** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907),
  39. in these cases we have to set it up manually.
  40. */
  41. QWidget *setupTabChain(QWidget *prev);
  42. Q_SIGNALS:
  43. void valueChanged();
  44. protected:
  45. /** Intercept focus-in event and ',' key presses */
  46. bool eventFilter(QObject *object, QEvent *event);
  47. private:
  48. AmountSpinBox *amount;
  49. QValueComboBox *unit;
  50. private Q_SLOTS:
  51. void unitChanged(int idx);
  52. };
  53. #endif // STARWELS_QT_STARWELSAMOUNTFIELD_H