qt-designer

How to edit QtDesigner widget class? [duplicate]

左心房为你撑大大i 提交于 2019-12-11 17:56:09
问题 This question already has answers here : How do I use promote to in Qt Designer in pyqt4? (1 answer) Customising code of Qt designer widget? (1 answer) Closed 11 months ago . I'm using PyQt5 Designer for my project. I converted UI file into py with pyuic and imported it into my code. Right now I'm struggling with editing class that was made by QtDesigner for my widget. I'm trying to create new class(Canvas) and inherit it from App.canvas class that is written in test.py(pyuic file) and then

Unable to open Qt form (*.ui) files from Visual Studio

依然范特西╮ 提交于 2019-12-11 17:13:55
问题 I am unable to open QT form file (*.ui) from a Visual Studio 2008 Qt project. I'm using Qt 4.5.0. I get the the following error: The file test.ui cannot be opened with Qt 4 form editor. Try converting the file using uic.exe 回答1: I had the same symptoms, and the solution was to remove the top line of the ui file (once open with a text editor) Surprising that Qt does not support well formed xml... Meilleures Salutations 回答2: Are you sure that your *.ui file are in the qt4 format and not in the

Make QHorizontalLayout expand inside QFrame

谁说胖子不能爱 提交于 2019-12-11 11:18:22
问题 I have a widget hierarchy like this, with a frame (in order to set a background color behind the buttons and label) and a horizontal layout as its direct child. However, the horizontal layout (red frame in below screenshot of Qt Designer) does not take up the whole space inside the frame. How can I do that? Changing the property "layoutSizeConstraint" does not work. The label is already set to "Expanding" in horizontal direction, but still it keeps its size – I can resize the horizontal

Qt: Align controls that are in separate layouts

无人久伴 提交于 2019-12-11 10:44:13
问题 On a form designed with Qt Designer, I have two QGroupBoxes with a bunch of controls in each of them. Both group boxes have nearly the same contents (QLineEdits with associated labels). What I want to do, however, is to align the controls together, as if they were part of the same grid layout. But since they are in separate containers, they can't share the same layout, and I don't want to give them a fixed width. Is there a way to do it in Qt Designer? If not, is there a way to do it in code?

In pyqt, button click connect not working in the new window

人盡茶涼 提交于 2019-12-11 10:01:03
问题 I have two windows in my code first I want to open class first() window which contains btn1. When I click btn1, I want to open a new window and replace it with my previous window (i.e. open new window in the current window itself) so upon clicking btn1, a new window of class second() is showing up which contains btn2. Now when I press btn2, I want to print "hi" on terminal but somehow the connect slot or something is not working. Can you please help me out? Here's my code class first

installEventFilter in PyQt5

社会主义新天地 提交于 2019-12-11 09:12:05
问题 I'm trying to implement an event in PyQT5, but i get this error: TypeError: installEventFilter(self, QObject): argument 1 has unexpected type 'MainWindow_EXEC' This is my code import sys from time import sleep from PyQt5 import QtCore, QtWidgets from view_cortes2 import Ui_cortes2enter class MainWindow_EXEC(): def __init__(self): app = QtWidgets.QApplication(sys.argv) cortes2 = QtWidgets.QMainWindow() self.ui = Ui_cortes2() self.ui.setupUi(cortes2) self.flag = 0 self.ui.ledit_corteA

slightly customized widget for PyQt4 with qtdesigner

▼魔方 西西 提交于 2019-12-11 08:09:01
问题 I am creating an application with PyQt4 and I want to use qtDesigner to design the layout. The application contains a QGraphicView, for which I want to implement panning and zomming per mouse. The only way I know how to do that is deriving from QGraphicView overwriting the "mouse*" functions to do the panning and zooming. Now I want to use this new custom widget with qtdesigner. googling I find that I could write a "custom widget plugin" for qtdesigner. While it does not seem to be to

Painting in a QLabel with paintEvent

好久不见. 提交于 2019-12-11 07:20:01
问题 I want to paint a rectangle in a certain label, I made a GUI with QtDesigner that generates the whole GUI code in one class called "class Ui_MainWindow(QMainWindow):" and I am using three tabs in my window. I had a problem using the QMouseEvent on my labels, I found a solution using this code from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import Qt import sys import cv2 from PyQt5.QtWidgets import QMainWindow, QWidget, QLabel from PyQt5.QtGui import QPixmap, QImage class Ui

How to convert .ui to py in windows ?

自作多情 提交于 2019-12-11 05:49:53
问题 I followed this link to convert .ui to .py using python in windows but its not working.I tried installing pyuic4 but its not working. Is there any tools or libraries in python for doing it? Please suggest . 回答1: why not just import it? import sys from PyQt4 import QtGui, uic app = QtGui.QApplication(sys.argv) widget = uic.loadUi('demo.ui') widget.show() sys.exit(app.exec_()) ps: sorry i cant answer in comment section. my reputation too low 来源: https://stackoverflow.com/questions/40354127/how

PyQt5: Using QtDesigner, how do you connect a signal with a slot/callable defined in a module

旧街凉风 提交于 2019-12-11 03:24:06
问题 I am a total beginner with PyQt5, please excuse my ignorance I am trying to connect a push button with a function that I defined import sys from PyQt5 import QtGui, QtWidgets,uic def PrintSomething (): print("Hello world") if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) window = uic.loadUi("Auto.ui") window.show() sys.exit(app.exec_()) In order to do the above I added a slot to the MainWindow using QtDesigner ..as seen in the picture and then I connected the Pressed signal