improve UI zoom UX

di1ara 2026-03-05 12:56:35 -05:00
parent 62982a41fc
commit 1376b4667e
3 changed files with 14 additions and 7 deletions

View File

@ -102,12 +102,12 @@ class AggTrade(Struct, frozen=True):
a: int # Aggregate trade ID a: int # Aggregate trade ID
p: float # Price p: float # Price
q: float # Quantity with all the market trades q: float # Quantity with all the market trades
nq: float # Normal quantity without the trades involving RPI orders
f: int # First trade ID f: int # First trade ID
l: int # noqa Last trade ID l: int # noqa Last trade ID
T: int # Trade time T: int # Trade time
m: bool # Is the buyer the market maker? m: bool # Is the buyer the market maker?
M: bool|None = None # Ignore M: bool|None = None # Ignore
nq: float|None = None # Normal quantity without the trades involving RPI orders
async def stream_messages( async def stream_messages(

View File

@ -179,6 +179,8 @@ class CompleterView(QTreeView):
self.set_font_size(_font.px_size) self.set_font_size(_font.px_size)
self.setIndentation(_font.px_size) self.setIndentation(_font.px_size)
self.setFont(_font.font) self.setFont(_font.font)
# tell Qt our size hint changed so it recalculates layout
self.updateGeometry()
def resize_to_results( def resize_to_results(
self, self,
@ -657,6 +659,9 @@ class SearchWidget(QtWidgets.QWidget):
if hasattr(self.view, 'update_fonts'): if hasattr(self.view, 'update_fonts'):
self.view.update_fonts() self.view.update_fonts()
# tell Qt our size hint changed so it recalculates layout
self.updateGeometry()
def focus(self) -> None: def focus(self) -> None:
self.show() self.show()
self.bar.focus() self.bar.focus()

View File

@ -95,12 +95,14 @@ class GlobalZoomEventFilter(QObject):
return True # consume event return True # consume event
# Zoom out: Ctrl+Shift+Minus # Zoom out: Ctrl+Shift+Minus
elif key == Qt.Key.Key_Minus: # Note: On some keyboards Shift+Minus produces '_' (Underscore)
elif key in (Qt.Key.Key_Minus, Qt.Key.Key_Underscore):
self.main_window.zoom_out() self.main_window.zoom_out()
return True # consume event return True # consume event
# Reset zoom: Ctrl+Shift+0 # Reset zoom: Ctrl+Shift+0
elif key == Qt.Key.Key_0: # Note: On some keyboards Shift+0 produces ')' (ParenRight)
elif key in (Qt.Key.Key_0, Qt.Key.Key_ParenRight):
self.main_window.reset_zoom() self.main_window.reset_zoom()
return True # consume event return True # consume event
@ -248,10 +250,10 @@ class MainWindow(QMainWindow):
# zoom level for UI scaling (1.0 = 100%, 1.5 = 150%, etc) # zoom level for UI scaling (1.0 = 100%, 1.5 = 150%, etc)
# Change this value to set the default startup zoom level # Change this value to set the default startup zoom level
self._zoom_level: float = 4.0 # Start at 200% zoom self._zoom_level: float = 1.0 # Start at 100% (normal)
self._min_zoom: float = 0.5 self._min_zoom: float = 0.5
self._max_zoom: float = 10.0 self._max_zoom: float = 3.0 # Reduced from 10.0 to prevent extreme cropping
self._zoom_step: float = 1.0 self._zoom_step: float = 0.2 # 20% per keypress
# event filter for global zoom shortcuts # event filter for global zoom shortcuts
self._zoom_filter: GlobalZoomEventFilter | None = None self._zoom_filter: GlobalZoomEventFilter | None = None