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.

579 questions
196
votes
6 answers

QLabel: set color of text and background

How do I set color of text and background of a QLabel ?
Regof
  • 2,487
  • 3
  • 19
  • 20
82
votes
6 answers

Qt: resizing a QLabel containing a QPixmap while keeping its aspect ratio

I use a QLabel to display the content of a bigger, dynamically changing QPixmap to the user. It would be nice to make this label smaller/larger depending on the space available. The screen size is not always as big as the QPixmap. How can I modify…
marvin2k
  • 1,413
  • 2
  • 13
  • 18
54
votes
2 answers

QLabel auto multiple lines

For example, we have a QLabel with MaximumWidth set to 400. When we try to display some text with pixel width more than 400, it's shown cut off. Is there any way to make QLabel display this string in multiple lines without using QFontMetrics or the…
Ruslan F.
  • 4,550
  • 3
  • 19
  • 36
23
votes
3 answers

“text-overflow” for a QLabel’s text rendering in QT

I have got a QLabel element in a widget which can be resized. The text can overflow boundaries, so I need, for the application to look more elegant, some way to make the text generate an ellipsis (...) after the last totally visible word in the…
user1598585
19
votes
2 answers

clickable event on QLabel in python using pyqt4?

I am working in python GUI using pyqt4 library and new with signal and slots. I don't know how to put event on label name QPLabel. Here is my code : class Ui_Form(object): def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form")) …
Zeb
  • 2,347
  • 5
  • 25
  • 33
19
votes
1 answer

Insert clickable link in QLabel and detect click on this link to provoke an action

I would like to handle a click to the link in this application of mine: When I click on the "Output File" link, I would like to be able to generate an action in my application. As of today, the link is described like this in the rich text…
Gui13
  • 11,951
  • 16
  • 49
  • 98
18
votes
1 answer

qlabel centering

I have a qlabel L inside a qwidget W. L is vertically and horizontally aligned. When I resize W, L doesn't get centered. Is this expected? What's a good implementation to have L centered again?
aqua boy
  • 379
  • 2
  • 3
  • 7
17
votes
1 answer

Qt - How to get the pixel length of a string in a QLabel?

I have a QLabel of a fixed width. I need to check (periodically) that the entire string fits inside the QLabel at its current width, so I can resize it appropriately. To do this, I need to obtain the 'pixel length' of the string. (The total amount…
Anti Earth
  • 4,172
  • 11
  • 45
  • 79
17
votes
4 answers

How do I customise the appearance of links in QLabels using style sheets?

I have a QLabel with a Qt stylesheet that sets a dark background: QLabel { background: black; color: white; } This works fine until I add text with an embedded URL and set the Qt::TextFormat to Qt::RichText. The link displays as the default dark…
the_mandrill
  • 27,460
  • 4
  • 58
  • 90
16
votes
1 answer

PyQt give color to a specific element

This might be an easy question, but I'm trying to give a color to a specific QLabel in my application and it doesn't work. The code I tried is the following : nom_plan_label =…
Johanna
  • 1,203
  • 4
  • 24
  • 42
12
votes
1 answer

Is there any way to set the visibility of QLabel in Qt Designer

I'm trying to make a QLabel not visible by default in Qt Designer. I can hard code it but I was wondering if there was a way to set this using the designer. m_uiForm.aLabel->setVisible(false);
Robert Whitley
  • 981
  • 3
  • 13
  • 28
11
votes
0 answers

QLabel vs QGraphicsView performance

I am learning QT and I am puzzled by the difference in performance of QLabel and QGraphics view while panning. I read a huge 36Mpixels (D800) jpeg file into either QLabel or QGraphics objects and try to drag the full scale image with…
Alex
  • 380
  • 2
  • 12
10
votes
2 answers

How to enable anti-aliasing on Qlabel?

My QLabels look quite ugly, it seems that there's no anti-aliasing. How can I enable this feature (assuming it's available)?
laurent
  • 79,308
  • 64
  • 256
  • 389
10
votes
2 answers

Displaying a standard icon and text in QLabel

I want to display a standard warning icon along with some description text in QLabel in pyqt. Qlabel doesn't have setIcon function. So how could I do that? Any help would be appreciated.
Ram Kumar
  • 131
  • 2
  • 2
  • 4
9
votes
2 answers

Get Plain text from a QLabel with Rich text

I have a QLabel that contains rich text. I want to extract just the actual (visible) 'text' from the QLabel, and none of the code for formatting. I essentially need a function similiar to the '.toPlainText' method of other Qt Widgets. I can not…
Anti Earth
  • 4,172
  • 11
  • 45
  • 79
1
2 3
38 39