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

qlabel has wrong sizeHint() when wordwrap is enabled

I have a custom QLabel with wordwrap enabled. When resizing MyWidget, it wraps but the sizeHint() still returns the original height. I tried the fix from this post: QLabel cutting off text on resize but the sizeHint() of the label still returns the…
user2246120
  • 1,453
  • 2
  • 17
  • 38
4
votes
1 answer

Word Wrapping Qt Qlabel text in a HTML element

Intro: I am trying to draw paginated forum posts in QT. Some of my initial efforts resulted in a QFrame with nested labels (a screenshot is shown here). Since then I have had to intermix quotes with regular text and I need dynamic labels to do that…
Hassan Syed
  • 20,075
  • 11
  • 87
  • 171
3
votes
2 answers

QPixmap maintain aspect ratio

I'm writing a program that will allow me to upload photos to TUMBLR via their API, I've got the uploading working (thanks to you guys). I've put a 'queueBox' on the side of the GUI, which displays the image names, and they are stored in a…
Anteara
  • 729
  • 3
  • 14
  • 33
3
votes
1 answer

Scaling QLabel to accommodate the contained text and nothing more

I’m subclassing QLabel and inserting it into a QVBoxLayout and I’m having a problem with the size. The following screenshot is how my application currently looks: The yellow widget on the top is my QLabel, and the layout is the default one. I’d…
user360907
3
votes
1 answer

Problems using QMovie with GIF animation in a QLabel

I have searched some solution for my problem and nothing... I'm using a QMovie with a GIF animation in one QLabel for a loading status, ok? It's simple and i learned in this link: GIF animation in Qt, this works perfectly when i open a menu, for…
Adriano Leal
  • 316
  • 1
  • 5
  • 20
3
votes
2 answers

QLabel setMinimumHeight After Custom WordWrap Qt.TextWrapAnywhere PyQt5 ( Full responsive With/Without Emoji )

I want Qt.TextWrapAnywhere for my QLabel in a Layout. I followed This instruction.My code is also same to give a minimal code from PyQt5.QtCore import Qt from PyQt5.QtGui import QPainter from PyQt5.QtWidgets import QApplication, QLabel, QMainWindow,…
Hacker6914
  • 247
  • 1
  • 9
3
votes
1 answer

PyQt5 Mouse Tracking Over QLabel Object

I am using PyQt5 to create an application. The application has a MainWindow with several widgets. One of the widgets is a QLabel object that displays a video. I want to track the cursor and display the cursor coordinates as I mouse over the video…
slalomchip
  • 779
  • 2
  • 9
  • 25
3
votes
1 answer

How to make a multiline QLabel elide the last line, be constrained by a max height, but also shrink if text doesn't fill to max height?

EDIT: Updated with working example and example screenshots of current and desired behavior. Description I'm trying to get a multiline QLabel to have these behaviors: It should expand to fill available width. If its text is longer than it can show,…
Jay
  • 510
  • 6
  • 17
3
votes
5 answers

Qt create and QLabel, why is there an error?

I'm using Qt creator 2.0.1, and when entering this line: #include I get the following error: QLabel: No such file or directory Why is that? And, how can I include a label in this case? UPDATE @maverik showed me how to solve the QLabel…
Simplicity
  • 47,404
  • 98
  • 256
  • 385
3
votes
1 answer

PyQt5 how to update QLabel as an animation

I want to use my qlabel as a countdown. Basically when countdown is called the label changes " 3 2 1 begin", with 1 second gap in-between . however, if I do this: def nextSound(self): self.mainLabel.setText("3") sleep(1) …
J_yang
  • 2,672
  • 8
  • 32
  • 61
3
votes
1 answer

Create and Updating Multiple QLabel in PYQT4

How can I create a number of (say 56) labels within a widget in a loop? Say I have a list called column: column = ['a','b','c','d',.......'y','z'] What I did is: class ApplicationWindow_1(QWidget): def __init__(self,parent = None): …
gu_lv
  • 65
  • 10
3
votes
2 answers

Change background color of a QLabel for a specific time

I have in my Qt code a QLabel with a defined background color. I would in a function to change the background color for one second only and then set it back to the original color. I thought about using a sleep() function but is there a way to do…
E.F
  • 199
  • 1
  • 1
  • 10
3
votes
1 answer

Which QLabel was pressed by mousePressEvent

How can I get in method on_product_clicked where QLabel is a mousePressEvent? In the current example I see three images in the form. When I click the second image I need to have number 2 in the on_product_clicked method. product_images =…
Oleg T.
  • 594
  • 6
  • 16
3
votes
1 answer

How to load an image with QLabel in PySide2

I'm a beginner in coding and python. I read that tkinter is a bit to "basic" if you want to develop an application which is a a bit more complicated and PyQt is problematic for licencing. This is why I chose PySide2 in order to develop this kind of…
ecjb
  • 5,169
  • 12
  • 43
  • 79
3
votes
1 answer

PyQt resize QMovie with proper anti-aliasing

I created a QLabel and set it's movie to a QMovie object with an animated gif. Then in the resizeEvent of my app I resize and move the label, so that it is centered/fit to the layout. This works fine but the movie has a lot of fine lines which get…
Spencer
  • 1,931
  • 1
  • 21
  • 44