Есть у QLabel есть одна особенность. Её минимальный размер определяется текстом, который в неё записан. Это приводит к тому что длинный текст принудительно увеличивает ширину интерфейса.
В большинстве случаев это выглядит плохо.
Как с этим бороться?
🔸 Обрезать текст заранее, задав лимит по длине строки. В этом случае мы теряем часть визуальной информации. Не всегда угадаешь нужный размер. В разных OS шрифт используется разный.
🔸 Делать перенос строки. Тогда мы получим изменение размера в другую сторону, что тоже поломает интерфейс.
🔸 Переопределить paintEvent() и сделать кастомный рендеринг текста. Можно, но слишком сложно для такой задачи.
Проще всего обрезать текст под текущий размер виджета используя класс QFontMetrics.
Он имеет готовый метод elidedText(), который просто вызываем по событию resizeEvent.
Я также добавил установку ToolTip чтобы всегда можно было увидеть полный текст при наведении курсора.
🌎 Код здесь
#qt#source
The symbol ¶ was commonly used in Medieval manuscripts to indicate a new paragraph.
Since there were no standards for indenting or spacing at the time, specialized scribes known as rubricators marked paragraphs (beginning of a different train of thought within the author's narrative) with these ornate symbols, often drawn in red ink.
The symbol ¶ has largely fallen out of common use but remains a symbol for paragraph breaks in formatting tools.
Take the quiz below to find out what this symbol is called
Tap ❤️
@languagetrivia#theory#symbol
https://wiki.python.org/moin/PythonDecorators
This page largely documents the history of the process of adding #decorators to #Python.
If you're just interested in what decorators or the '@' #symbol mean in Python, see the Wikipedia page .http://en.wikipedia.org/wiki/Python_syntax_and_semantics#Decorators or PEP 318.
The @ symbol has many nicknames across different languages.
For example:
➖In Russian, it’s known as собака (sobaka), meaning “dog”
➖In German, it’s called Affenschwanz, meaning “monkey’s tail”
➖In Turkish, it’s known as kuyruklu a, meaning “a with a tail”
➖In Finnish, it’s called kissanhäntä, meaning “cat’s tail”
What does the Italian name for this symbol mean?
A. Monkey
B. Snail
C. Dog
D. Spider
Check out the first comment of the quiz below to see the right answer.
@languagetrivia#across_languages#symbol
The ampersand (&) symbol has a rich history intertwined with the evolution of the English alphabet. Originally, it was a ligature of the Latin word “et,” meaning “and.” Over time, this symbol became so integral to writing that it was included as the 27th character in the English alphabet, following ‘Z’. When reciting the alphabet, people would conclude with “X, Y, Z, and per se and,” which translates to “and, by itself, and.” This phrase was eventually slurred together into the single term “ampersand.”
Source
Tap ❤️ if you found this interesting
@languagetrivia#theory#term#symbol#etymology
In the world of printing and journalism, the exclamation mark (!) has earned a variety of colorful nicknames. One of these humorous terms compares its shape to a specific part of a dog’s anatomy.
Sometimes an exclamation mark is humorously referred to as “a dog’s [what]"?
A) Tail 🐕
B) Nose 👃
C) Bone 🦴
D) C*ck🍆
Take the quiz below to find out
@languagetrivia#punctuation#symbol#slang
#javascript#ecmascript_proposals#es2015#es2019#es6#es7#esnext#javascript#js#polyfill#ponyfill#promise#proposal#proposals#shim#symbol#weakmap
core-js is a modular JavaScript library that provides polyfills for modern ECMAScript features up to 2024, including promises, symbols, collections, iterators, typed arrays, and many web standards like URL and structuredClone. It lets you use new JavaScript features in older browsers by loading only the needed parts without polluting the global namespace. It integrates well with tools like Babel and swc for optimized polyfilling. This helps you write modern, compatible code that runs smoothly across different environments, improving development efficiency and user experience. You can customize polyfill usage and even build your own tailored version for your project.
https://github.com/zloirock/core-js