qlabel

Qt QImage to QPixmap Conversion loses Color Information for UI

好久不见. 提交于 2019-12-24 05:11:56
问题 I am trying to update a QPixmap on a QLabel in my main Qt UI. The following slot is called to do this with the "newImage" variable QImage ( because it's from a different thread ). The QImage is converted to someImage with convertFromImage ( I've also tried ::fromImage ). If I just save the QImage "newImage" to file, I get a green rectangle and red text that I draw with OpenCV earlier on, however, if I save the converted pixmap OR show the converted pixmap I lose the color for the rectangle

Adding a QSizeGrip to the corner of a QLabel

随声附和 提交于 2019-12-23 15:32:33
问题 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 going on. I've used the following code to generate this: m_sizeGrip = new QSizeGrip( this ); m_layout = new QHBoxLayout( this ); m_label = new QLabel( this ); m_layout->setContentsMargins( QMargins() ); m_layout->setSpacing( 0 ); m_layout->addWidget(

label displays sum of two QSpinBox (Python + Pyside)?

雨燕双飞 提交于 2019-12-23 05:09:38
问题 Could someone help me fix the code to display in the total column the sum of the two spinners 'Amount + Counter'. Currently the total label just displays the value of a single spinner. I need it to display the sum of both spinners. Any additional fixes or notes are welcome as I'm new to python. Thank you very much. BELOW IS THE FIXED WORKING CODE #!/usr/bin/python # -*- coding: utf-8 -*- import sys from PySide import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self): super

How to flip an image in Qt?

女生的网名这么多〃 提交于 2019-12-23 04:53:31
问题 I found that video on Youtube. It shows how to flip something called QML Flipable. I'm completely unfamiliar with QML so I have the following questions: 1) Is it possible to flip an ordinary QLabel like this? If yes how do I do that? 2) If it's not possible then how do I add that Flipable entity to my QMainWindow? Thanks, everyone 回答1: You could use the QGraphicsPixmap with your image , set the rotation center with setTransformOriginPoint and animate the transformation matrix with

QLabel showing an image inside a QScrollArea

旧巷老猫 提交于 2019-12-22 05:29:27
问题 I've successfully implemented a Image Viewer (for DICOM) in Qt. I can see the image and I can zoom in and out correctly. Now, I want to see scroll bars if the image is too big to show when I zoom in. I've used the UI. I placed a QScrollArea . Inside, the QLabel . The verticalScrollBarPolicy is ScrollBarAsNeeded . The horizontalScrollBarPolicy is ScrollBarAsNeeded . The problem is: it doesn't work. I zoom in, but no scrollbar appears. Second try: using a layout inside the QScrollArea. So now

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

时光总嘲笑我的痴心妄想 提交于 2019-12-21 03:49:41
问题 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 blue, which is hard to read on a dark background. I've tried customising it via a stylesheet such as: a { color: white; } QLabel!visited { color: white; } but this doesn't have any effect. The one thing that does seem to work is changing the

clickable event on QLabel in python using pyqt4?

余生颓废 提交于 2019-12-20 20:40:10
问题 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")) Form.resize(759, 598) font = QtGui.QFont() font.setPointSize(12) ... ... ... self.QPLabel = QtGui.QLabel(Form) self.QPLabel.setGeometry(QtCore.QRect(620, 420, 141, 20)) QtCore.QObject.connect(self.QPLabel, QtCore.SIGNAL(_fromUtf8("clicked()")), self.doSomething

QLabel and QPushButton align

三世轮回 提交于 2019-12-20 04:52:42
问题 I'm having a hard time aligning multiple qt widgets (label and push button). I want the widgets (colored green and red respectively) to line up. Any advice? #include <QVBoxLayout> #include <QLabel> #include <QPushButton> #include "ui_dialog.h" Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); QVBoxLayout * const layout = new QVBoxLayout(ui->scrollAreaWidgetContents); for(int i=0; i!=100; ++i) { QLabel *label = new QLabel(); layout->addWidget(label);

Make Qlabel clickable or double clickable in Qt

那年仲夏 提交于 2019-12-20 02:56:15
问题 I am beginner in Qt, now I want to make my label clickable, I have searched so much online, but no one gives my a real example of how they made it. So can someone teach me step by step? Now my basic thinking is creating a new .c file and new .h file respectively and then include them into my mainwindow.c and then connect it with the existing label in ui form. These are what I was trying to do, but can not make it. Hope someone can teach and better put the step picture in the command, thanks.

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

不想你离开。 提交于 2019-12-19 04:52:11
问题 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