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
6
votes
1 answer

QListWidgetItem - adjust width and height to content

I have got a QListWidgetItem, which has a QWidget and some QLabels. The height of the labels (imageLabel, titleLabel and descriptionLabel) varies depending on the text length. So does the height of the QWidget, which leds to different sizes in…
Niklas
  • 23,674
  • 33
  • 131
  • 170
6
votes
4 answers

How to Autoresize QLabel pixmap keeping ratio without using classes?

We are making a GUI using PyQt and Qt Designer. Now we need that an image(pixmap) placed in a QLabel rescales nicely keeping ratio when the window is resized. I've been reading other questions/answers but all of them use extended classes. As we are…
user3061177
  • 111
  • 1
  • 8
6
votes
1 answer

Switching between multiple ui forms in Qt

I am developing the user interface for a embedded device. I have created about 30 ui forms. You have first the Welcome form which loads the database and connects automatically to the available known wifi and all those start up functions. Once…
gfernandes
  • 1,156
  • 3
  • 12
  • 29
6
votes
1 answer

Moving object with mouse

I use Qt and I want to move some object with mouse. For example, user clicks on object and drag this object to another place of window. How I can do it? I tried mouseMoveEvent: void QDropLabel::mouseMoveEvent(QMouseEvent *ev) { …
LosYear
  • 423
  • 2
  • 6
  • 14
5
votes
4 answers

Changing font size of all QLabel objects PyQt5

I had written a gui using PyQt5 and recently I wanted to increase the font size of all my QLabels to a particular size. I could go through the entire code and individually and change the qfont. But that is not efficient and I thought I could just…
Jeff Boker
  • 803
  • 1
  • 9
  • 25
5
votes
1 answer

Vertical size of a QLabel with wordWrap enabled

I have a QLabel in a QVBoxLayout. Most of the times, it only has one line of text, but sometimes, the text can be too long to fit in one line. So I have to enable wordWrap. I want the label to be as (vertically) small as possible, thus I set…
Tobias Leupold
  • 1,512
  • 1
  • 16
  • 41
5
votes
1 answer

How can I have a QLabel exactly the size of the QPixmap it is showing?

I need some advice concerning Layouts in QT/PyQt. What I want to achieve is to have an image displayed, centered, scaled correctly, taking the most space it can while keeping its aspect ratio. That can easily be done using this: class…
Plotin
  • 53
  • 1
  • 5
5
votes
2 answers

PyQt Fading a QLabel

I'm currently trying to fade a specific QLabel in and out. My first try was to use the setAlphaChannel, however this just didn't work. My current approach is to use a for-loop and set the stylesheet of the QLabel. Sadly this makes a unverifiable…
pxBn
  • 53
  • 1
  • 4
5
votes
4 answers

Make QLabel clickable

I have a Qlabel filled with QPixmap and I want to start a process/function once this label clicked. I had extended QLabel class as follows: from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * class…
Francisco Cunha
  • 355
  • 1
  • 4
  • 14
5
votes
2 answers

How to prevent QLabel from unnecessary word-wrapping?

I need to display text with a QLabel with following requirements: Word wrapping Expand from small width to full width according to the length of the text while the label takes a single line Always full width while the label takes multiple…
tetsurom
  • 113
  • 1
  • 7
5
votes
2 answers

PyQt: place scaled image in centre of label

I am using QPixmap for displaying images of different sizes on a label. I have used the following code to display the image(s): myPixmap = QtGui.QPixmap(os.path.join("data", "images", image_name)) myScaledPixmap =…
sundar_ima
  • 3,604
  • 8
  • 33
  • 52
5
votes
1 answer

How to get the text color of a QLabel?

I'm wondering how to get the text color of a specific QLabel. I'm setting text color earlier in my code an need to read it out again later to determine which action to take...
user3100895
  • 51
  • 1
  • 3
5
votes
1 answer

How to right align rich text (HTML) in a Qt/PyQt/PySide QLabel?

I have a simple task. I want to right align richtext (HTML) in a Qt or PyQt or PySide QLabel. The QLabel works fine until I resize the widget making it smaller than the text length. At that point, the text to the right gets cut off. The QLabel…
LozzerJP
  • 856
  • 1
  • 8
  • 23
5
votes
1 answer

Displaying a video stream in QLabel with PySide

Can anybody point me in the right direction on how to create a new QMovie "provider" in PySide? I have a video stream that I want to display as simply as possible (no audio, just a sequence of frames with an unknown and variable framerate). This…
StFS
  • 1,639
  • 2
  • 15
  • 31
4
votes
1 answer

Adding a QSizeGrip to the corner of a QLabel

I'm attempting to produce a widget that consists of a text display that can be resized by the user grabbing the lower right corner. So far I've been able to generate this: I've applied a red background to the layout to make it more obvious what's…
user360907
1 2
3
43 44