Есть у QLabel есть одна особенность. Её минимальный размер определяется текстом, который в неё записан. Это приводит к тому что длинный текст принудительно увеличивает ширину интерфейса.
В большинстве случаев это выглядит плохо.
Как с этим бороться?
🔸 Обрезать текст заранее, задав лимит по длине строки. В этом случае мы теряем часть визуальной информации. Не всегда угадаешь нужный размер. В разных OS шрифт используется разный.
🔸 Делать перенос строки. Тогда мы получим изменение размера в другую сторону, что тоже поломает интерфейс.
🔸 Переопределить paintEvent() и сделать кастомный рендеринг текста. Можно, но слишком сложно для такой задачи.
Проще всего обрезать текст под текущий размер виджета используя класс QFontMetrics.
Он имеет готовый метод elidedText(), который просто вызываем по событию resizeEvent.
Я также добавил установку ToolTip чтобы всегда можно было увидеть полный текст при наведении курсора.
🌎 Код здесь
#qt#source
🚀 Morgan Stanley's Bitcoin Trust Launches with Strong Inflows on NYSE Arca
Morgan Stanley's Bitcoin Trust (MSBT) made its debut on the NYSE Arca on Wednesday, attracting $30.6 million in first-day inflows and generating approximately $34 million in trading volume. According to NS3.AI, as of April 8, MSBT held 444.4 Bitcoin, valued at around $31.7 million, and offered the lowest fee among U.S. spot Bitcoin ETF competitors. This marks the first spot Bitcoin ETF launched by a U.S. bank. On the same day, BlackRock's IBIT led with $40 million in inflows. Data from Farside indicates that total net outflows across U.S. spot Bitcoin ETFs amounted to $124.5 million on Wednesday.
#Bitcoin#ETF#MorganStanley#NYSEArca#Cryptocurrency#Finance#Investment#BlackRock#CryptoMarket#SpotBitcoin#BTC
🚀 Bitwise Amends Spot Hyperliquid ETF Proposal with SEC
Bitwise Asset Management has submitted a second amendment for its proposed spot Hyperliquid ETF to the U.S. Securities and Exchange Commission as of April 10. According to NS3.AI, the amendment outlines a 0.67% annual management fee and introduces Flowdesk and Wintermute as approved HYPE trading counterparties, while removing A1 from the list. Anchorage Digital Bank remains the custodian for the fund. The ETF is set to trade on NYSE Arca under the ticker BHYP, with plans to stake the majority of its HYPE holdings while maintaining a 30% liquidity reserve for redemptions.
#Bitwise#AssetManagement#HyperliquidETF#SEC#Amendment#ManagementFee#Flowdesk#Wintermute#A1#AnchorageDigitalBank#NYSEArca#BHYP#HYPE#LiquidityReserve#Redemptions