|
1 | 1 | # PyQt Animated LineEdit
|
2 | 2 |
|
3 |
| -[](https://pypi.org/project/pyqt-animated-line-edit) |
| 3 | +[](https://pypi.org/project/pyqt-animated-line-edit) |
4 | 4 | [](https://github.com/marcohenning/pyqt-animated-line-edit)
|
5 | 5 | [](https://github.com/marcohenning/pyqt-animated-line-edit/blob/master/LICENSE)
|
6 | 6 | [](https://github.com/marcohenning/pyqt-animated-line-edit)
|
@@ -34,17 +34,59 @@ class Window(QMainWindow):
|
34 | 34 | super().__init__(parent=None)
|
35 | 35 |
|
36 | 36 | # AnimatedLineEdit
|
37 |
| - self.username = AnimatedLineEdit('Username', self) |
38 |
| - self.username.setBorderRadius(2) |
39 |
| - self.username.setPlaceholderFontSizeInner(10) |
40 |
| - self.username.setPlaceholderFontSizeOuter(8) |
41 |
| - self.username.setPadding(QMargins(12, 0, 12, 0)) |
| 37 | + self.animated_line_edit = AnimatedLineEdit('Username', self) |
| 38 | + self.animated_line_edit.setBorderRadius(2) |
| 39 | + self.animated_line_edit.setPlaceholderFontSizeInner(10) |
| 40 | + self.animated_line_edit.setPlaceholderFontSizeOuter(8) |
| 41 | + self.animated_line_edit.setPadding(QMargins(12, 0, 12, 0)) |
42 | 42 | ```
|
43 | 43 |
|
44 | 44 | ## Documentation
|
45 | 45 |
|
46 | 46 | > **IMPORTANT:** <br>Styling of the widget must not be done by setting the stylesheet manually as the widget calculates the stylesheet itself and overrides it. Use the provided methods such as `setBackgroundColor()`, `setHoveredBackgroundColor()`, `setFocusedBackgroundColor()` and `setDisabledBackgroundColor()` instead.
|
47 | 47 |
|
| 48 | +* **Setting the placeholder text:** |
| 49 | +```python |
| 50 | +animated_line_edit.setPlaceholderText('Username') |
| 51 | +``` |
| 52 | + |
| 53 | +* **Setting the placeholder font family:** |
| 54 | +```python |
| 55 | +animated_line_edit.setPlaceholderFontFamily('Arial') |
| 56 | +``` |
| 57 | + |
| 58 | +* **Setting the placeholder font size (inside position):** |
| 59 | +```python |
| 60 | +animated_line_edit.setPlaceholderFontSizeInner(14) |
| 61 | +``` |
| 62 | + |
| 63 | +* **Setting the placeholder font size (outside position):** |
| 64 | +```python |
| 65 | +animated_line_edit.setPlaceholderFontSizeOuter(12) |
| 66 | +``` |
| 67 | + |
| 68 | +* **Setting the placeholder color (affects both positions if no color is set for the outside position):** |
| 69 | +```python |
| 70 | +animated_line_edit.setPlaceholderColor(QColor(0, 0, 0)) |
| 71 | +``` |
| 72 | + |
| 73 | +* **Setting the placeholder color (outside position):** |
| 74 | +```python |
| 75 | +animated_line_edit.setPlaceholderColorOutside(QColor(0, 0, 0)) |
| 76 | +``` |
| 77 | + |
| 78 | +* **Setting the placeholder transition duration:** |
| 79 | +```python |
| 80 | +animated_line_edit.setTransitionDuration(500) |
| 81 | +``` |
| 82 | + |
| 83 | +* **Setting the placeholder transition easing curve:** |
| 84 | +```python |
| 85 | +animated_line_edit.setEasingCurve(QEasingCurve.Type.Linear) |
| 86 | +``` |
| 87 | + |
| 88 | +**<br>All methods:** |
| 89 | + |
48 | 90 | | Method | Description |
|
49 | 91 | |---------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
|
50 | 92 | | `setPlaceholderText(self, text: str)` | Set the text displayed as placeholder |
|
|
0 commit comments