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
222
votes
6 answers

QLabel: set color of text and background

How do I set color of text and background of a QLabel ?
Regof
  • 2,767
  • 4
  • 22
  • 24
97
votes
10 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,573
  • 2
  • 14
  • 18
65
votes
3 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.
  • 5,498
  • 3
  • 23
  • 42
27
votes
4 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
23
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,687
  • 7
  • 28
  • 36
21
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
  • 419
  • 2
  • 4
  • 7
21
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
  • 29,792
  • 6
  • 64
  • 93
20
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,671
  • 13
  • 52
  • 83
20
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
  • 12,993
  • 17
  • 57
  • 104
19
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,343
  • 4
  • 25
  • 44
14
votes
2 answers

How to embed URL link to QLabel

Clicking QLabel should open a default web browser with URL link specified. It is not happening yet. Why? A second question. Would it be possible to override the default blue color of the Label's font with something else? class…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
13
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
  • 1,051
  • 5
  • 14
  • 28
12
votes
4 answers

QLabel click event using Qt?

I'm new in Qt and have a question. I have QLabel and QLineEdit objects, and when QLabel text is clicked on, I want to set this text in QLineEdit. Also I have read that QLabel has not clicked signal. Can you explain how can I do this and write code…
Nicholas
  • 147
  • 1
  • 2
  • 6
12
votes
1 answer

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
  • 389
  • 2
  • 12
12
votes
3 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
  • 161
  • 2
  • 2
  • 5
1
2 3
43 44