Questions tagged [qlabel]

The QLabel widget, part of the Qt framework, provides a text or image display.

No user interaction functionality is provided. The visual appearance of the label can be configured in various ways, and it can be used for specifying a focus mnemonic key for another widget.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

653 questions
1
vote
1 answer

QLabel Style Sheet not change before the execution of loop in pyqt5

I want to change the background color of my QLabel. On clicking the label, label connects to an event that sets the label color to Red and loop runs for 3 second after 3 seconds and completion on loops the color of label should change to Yellow This…
Zaid
  • 13
  • 4
1
vote
1 answer

PyQt5: QLabel.text() function causes app to crash

I'm new to PyQt5. I'm currently working on a calculator just for some practice, but for some reason, the app crashes when I use the eval() function in the QLabel().setText() function. Here's a sample snippet: import PyQt5.QtWidgets as qtw import…
Lenovo 360
  • 569
  • 1
  • 7
  • 27
1
vote
1 answer

why the text of label didn't show the result initialized in custom class?

There is the complete process: Create a project, choose Base class: QWidget, including .h .cpp .ui [Add New...] -> create a [ C++ class] -> choose base class: [QWidget], but named myLabel. Open mylabel.h, change QWidget of including file and parent…
NANAN
  • 13
  • 3
1
vote
2 answers

PyQt5: Append multiple strings to a single QLabel

I've been working on this project for a while now, and everything is working as should be except the final piece. Here is my code. The app takes a "number of passwords" input and a "length of passwords" input. When you click the "generate passwords"…
AmeriNam20
  • 103
  • 6
1
vote
1 answer

QLabel not keyboard focusable if textInteractionFlags are set

TThe issue is I have a QLabel and I want users to select the text from it via keyboard or mouse and be able to get the context menu for "Copy", "Select All" etc. So I set the interactionFlags QLabel::setTextInteractionFlags(Qt::TextSelectableByMouse…
Gurushant
  • 952
  • 6
  • 23
1
vote
1 answer

PyQt5: Avoid reducing multiple spaces in QLabel / QPlainTextEdit

In PyQt5, both QLabel and QPlainTextEdit Widgets appear to shrink multiple whitespaces in to one. Say if I set the label text to: "abc abc abc", text shown is "abc abc abc". Apparently, this is happening because of the default html formatting…
XYZ
  • 310
  • 2
  • 12
1
vote
1 answer

Pyside6, How do I resize a QLabel without loosing the size aspect ratio?

My issue goes excactly as in those related posts: How to Autoresize QLabel pixmap keeping ratio without using classes? PyQt Keeping QLabel Size Aspect Ratio Only difference is that I'm using Pyside instead of PyQt and that I've already found the…
Giorgos Xou
  • 1,461
  • 1
  • 13
  • 32
1
vote
1 answer

How does Qt handle label style with an invalid font family?

I am currently extending a Qt application written for the United States for use in Korea and China. I have used Qt Linguist with great success but some strings have lost all their styling. Specifically, they have lost their weight and size. If Qt…
IslandCow
  • 3,412
  • 3
  • 19
  • 24
1
vote
2 answers

PyQt5: How to Get Dimensions of Displayed Widgets

I have PyQt5 QLabels that expand/contract as the QMainWindow size changes. I want to get the dimensions of the QLabels when the QMainWindow is sized to anything other that its initial dimensions. The script below creates two QLabels in a…
slalomchip
  • 779
  • 2
  • 9
  • 25
1
vote
0 answers

how do I rotate a qlabel in py qt?

I'm trying to rotate a QLabel widget and can't find a proper way to do so. I managed to do so only if it contains an image, but not if it contains only text. Any ideas or suggestions?
Ben Akiva
  • 23
  • 4
1
vote
2 answers

How to display image in ratio as PreserveAspectFit in Qt Widgets

In qml, I can simply do this Image { anchors.fill: parent source: "/path/to/coo/image" fillMode: Image.PreserveAspectFit } I don't want to use QML due to its ties with JavaScript. How can I do this with Widgets ? I…
LightSith
  • 795
  • 12
  • 27
1
vote
1 answer

Selecting certain region based on BB coordinates in PyQt

I have created a simple GUI in Pyqt to upload a CSV file containing image path and bounding box coordinates values with a push button. And it has another push button which goes to the next image. And the label area to display an image with the…
iamkk
  • 135
  • 1
  • 16
1
vote
1 answer

How to align two widgets more closely in PyQt5 layouts?

How to align two widgets more closely? In my code, I want to align QLabel 1 and QLabel 2 more closely (i.e. QLabel 2 aligned just below the QLabel 1, with minimum spacing). import sys from PyQt5 import QtCore,QtGui,QtWidgets class…
tckraomuqnt
  • 470
  • 4
  • 17
1
vote
1 answer

How do I get a crop an image in a QLabel from it to be rounded?

I already tried to include it in the stylesheet with QLabel{border-radius : 5px;} But i keep getting the same Result Here's the code i wrote to generate that window : userPreview::userPreview(QString username, QString…
Anthony
  • 97
  • 5
1
vote
1 answer

Qt QLabel HTML font size fails badly

In my Qt application (uses Qt 4.7.0 from Ubuntu 10.10 Linux repository) i tried to use Qt::RichText QLabels using the following HTML: label_1->setText("size=64"); label_2->setText("
trenki
  • 7,133
  • 7
  • 49
  • 61