Wrap previewer type field syntax replacement in separate method#4563
Open
DaedalusIndigo wants to merge 4 commits intoankitects:mainfrom
Open
Wrap previewer type field syntax replacement in separate method#4563DaedalusIndigo wants to merge 4 commits intoankitects:mainfrom
DaedalusIndigo wants to merge 4 commits intoankitects:mainfrom
Conversation
Replace type field syntax as part of a separate function to allow easier patching by add-on developers.
Added DaedalusIndigo to the contributors list.
abdnh
reviewed
Feb 18, 2026
qt/aqt/browser/previewer.py
Outdated
| self._timer.stop() | ||
| self._timer = None | ||
|
|
||
| def type_ans_preview_filter(self, txt: str, type: str = "q") -> str: |
Collaborator
There was a problem hiding this comment.
Nitpick: let's pass the whole type string and improve the typing a bit by using Literal["question", "answer"]. You might also need to declare the same type for self._state in .open() to make mypy happy.
Author
There was a problem hiding this comment.
Sure! I was just trying to stay consistent with the native maybeTextInput method of the CardLayout class.
abdnh
approved these changes
Feb 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It is currently difficult to modify how the previewer handles type-in-the-answer fields because the substitution is done as a very tiny line within the large
_render_scheduledmethod. This PR adds atype_ans_preview_filtermethod that can easily be patched without affecting the entire renderer.