qlabel

Modify alpha channel transparency of a windowless QLabel

坚强是说给别人听的谎言 提交于 2019-12-02 02:27:40
I have a very small Qt application that uses labels to display a jpeg image without first putting it in a window. (I got a lot of help from Display QImage with QtGui ) Now I would like to change the alpha channel of this jpeg to make the image partially transparent. I have tried the following without any luck int main (int argc, char *argv[]) { QApplication app(argc, argv); QLabel label (0, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); label.resize(1280,720); label.setPixmap(QPixmap("test.jpg")); label.setScaledContents(true); // This line should set the alpha transparency to 50% label

Modify alpha channel transparency of a windowless QLabel

对着背影说爱祢 提交于 2019-12-02 01:41:23
问题 I have a very small Qt application that uses labels to display a jpeg image without first putting it in a window. (I got a lot of help from Display QImage with QtGui) Now I would like to change the alpha channel of this jpeg to make the image partially transparent. I have tried the following without any luck int main (int argc, char *argv[]) { QApplication app(argc, argv); QLabel label (0, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); label.resize(1280,720); label.setPixmap(QPixmap(

Image Viewer GUI fails to properly map coordinates for mouse press event

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 14:01:06
I am trying to piece together PyQt5 based image viewer Python code from various sources and extend capability to crop regions of interest (ROI) within loaded images. The issue is that the mapped coordinates and mouse clicks consider scroll bar and menu bar when determining pixel locations. Following is the code that loads image and provide bounding box capability, but I cannot seem to draw/crop boxes accurately due to the offset. from PyQt5.QtCore import QDir, Qt from PyQt5.QtGui import QImage, QPainter, QPalette, QPixmap from PyQt5.QtWidgets import (QAction, QApplication, QFileDialog, QLabel,

PyQt5 label cut off

百般思念 提交于 2019-12-01 11:54:16
问题 When I run this program, parts of my label gets cut off. Is there any way to fix this? I'm guessing it has to do with setFont, because when I remove l1.setFont all the text shows. If possible, please list solutions that doesn't alter the GUI too much. import sys from PyQt5 import QtGui, QtWidgets, QtCore, Qt from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * class App(QtWidgets.QMainWindow): def __init__(self): super(App, self).__init__() self.setWindowTitle(

Displaying Integers on QLabels?

偶尔善良 提交于 2019-12-01 11:28:52
Basically i'm making a simple calculator program to understand the basics of C++ GUI however I get an error message leading to the line of code I have in the void MainWindow::addx() to label -> setText(c); with an error message of: invalid user-defined conversion from 'int' to 'const QString&'[-fpermissive] I really don't know what that error message means I assume it means I cant display an integer on a label. I just wanted to know if I am able to display an integer on my label or do I have to use a different widget. class MainWindow() { int a, b, c; QLabel * label; ... }; void MainWindow:

displaying image using a label

此生再无相见时 提交于 2019-12-01 09:02:38
问题 I have converted a numpy array into a pixmap to display it on a label within my GUI. When I run the program, the GUI closes for some reason (no error messages). height, width = input_image.shape bytesPerLine = 3 * width qImg = QtGui.QImage(input_image.data, width, height, bytesPerLine, QtGui.QImage.Format_RGB888) pixmap01 = QtGui.QPixmap.fromImage(qImg) self.pixmap_image = QtGui.QPixmap(pixmap01) self.ui.label_imageDisplay.setPixmap(self.pixmap_image) self.ui.label_imageDisplay.setAlignment

Moving object with mouse

落花浮王杯 提交于 2019-12-01 04:00:15
问题 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) { this->move(ev->pos()); } but unfortunately object moves very strange way. It jumps from place to place. QDropLabel inherits QLabel. Also it has given a pixmap. I tried to do it with different objects, but result is same. 回答1: Your movable widget must have a QPoint

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

荒凉一梦 提交于 2019-11-30 18:23:52
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 QLabel: <a href="http://google.fr"><span style=" text-decoration: underline; color:#0000ff;">Output File"</span></a> (generated by Qt Designer) When clicked, it will open the default web browser to go to Google. That's not what I want; I'd like something like: <a href="#browse_output"><span style=" text-decoration: underline; color:#0000ff;">Output File"<

QPixmap maintain aspect ratio

心已入冬 提交于 2019-11-30 16:10:23
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 QListWidget. I've put this in my Main Class' constructor: def __init__(self): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.queueBox.itemClicked.connect(self.displayPhoto) and I have this method: def displayPhoto(self, item): tempName = (item.text()) print tempName self.myLabel.setPixmap(QtGui.QPixmap(_fromUtf8(directory + '\\' + tempName))) ##

Displaying a video stream in QLabel with PySide

久未见 提交于 2019-11-30 15:48:52
问题 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 example seems perfect except that my video is coming from an unconventional source. It's not a file but a network stream in a format that is not standardized. I can easily write code that receives each frame and my idea is to create a "QMovie provider