Есть у QLabel есть одна особенность. Её минимальный размер определяется текстом, который в неё записан. Это приводит к тому что длинный текст принудительно увеличивает ширину интерфейса.
В большинстве случаев это выглядит плохо.
Как с этим бороться?
🔸 Обрезать текст заранее, задав лимит по длине строки. В этом случае мы теряем часть визуальной информации. Не всегда угадаешь нужный размер. В разных OS шрифт используется разный.
🔸 Делать перенос строки. Тогда мы получим изменение размера в другую сторону, что тоже поломает интерфейс.
🔸 Переопределить paintEvent() и сделать кастомный рендеринг текста. Можно, но слишком сложно для такой задачи.
Проще всего обрезать текст под текущий размер виджета используя класс QFontMetrics.
Он имеет готовый метод elidedText(), который просто вызываем по событию resizeEvent.
Я также добавил установку ToolTip чтобы всегда можно было увидеть полный текст при наведении курсора.
🌎 Код здесь
#qt#source
How transactions will take place in the BLC Market
We are creating a transparent system, where the whole process is visible:
— responses to the task
— active deals
— completed tasks
— disputed situations
All stages are recorded inside the interface.
The user sees:
what is happening now
at what stage the task is
who is involved
This is the basis of trust within the platform.
#transactions#freelance
FAQ | BUY
Uniswap Expands Crypto-to-Fiat Options
Uniswap collaborates with Robinhood, MoonPay, and Transak to enable seamless crypto-to-fiat transactions. Users across 180+ countries can convert crypto and deposit funds directly into bank accounts via the mobile wallet. This feature will soon be available on the browser extension and web version. For more details, visit Leviathan News.
#Uniswap#Crypto#Robinhood#MoonPay#Transak#Banking#Fiat#DEX#Blockchain#Finance#Tech#Global#Innovation#Payments#Wallet#Transactions#Defi#Onboarding#CryptoAdoption#VC
Major Crypto Transactions Reported Today
🚨 Massive Transfers Alert:
- 50M #MELANIA ($63M) from unknown wallet to unknown wallet. Details
- 16M #XLM ($5.26M) shifted between #Coinbase deposits and withdrawals. Details
- 164M #USDT ($164.3M) sent to Tether Treasury.
Meanwhile, Argentina's President Javier Milei denies promoting a crypto scam, stating, "I didn't promote it, I shared it." Source
#Crypto#MELANIA#XLM#USDT#Coinbase#Argentina#JavierMilei#WhaleAlert#Tether#Bitcoin#Singapore#DBS#CryptoRegulation#CryptoScam#Blockchain#Finance#Transactions#Wallets#Bullish#Treasury