qt-designer

How to make a Qt Widget grow with the window size?

你离开我真会死。 提交于 2019-11-26 10:20:38
问题 I want to have a small QFormLayout that grows to fill its parent widget. I created a new .ui file using the QWidget template in Qt Designer. I put a QFormLayout inside that \'window\', then put some controls inside that QFormLayout . This all works reasonably well, but the QFormLayout always stays at the size I set in Qt Designer. I would like the QFormLayout to fill its parent widget and grow/shrink with it. How can I accomplish that? 回答1: In Designer, activate the centralWidget and assign a

Understanding form layout mechanisms in Qt

谁说胖子不能爱 提交于 2019-11-26 10:16:43
问题 Qt has a flexible and powerful layout mechanism to handle view of desktop application\'s windows. But it is so flexible, that it nearly cannot be understood, when something goes wrong and needs fine tuning. And so powerful, that it can beat anyone in their tries to overwhelm Qt\'s opinion of how form should look. So, can anyone explain, or provide articles, or source of Qt\'s positioning mechanisms? I\'m trying to force the QLabel , QPushButton and QTableView , marked by trailing underscores

Load whole *ui file in an frame/widget of another *.ui file

我们两清 提交于 2019-11-26 08:38:22
问题 I am developing a small user interface for a home-project. I created a *.ui file with QT-Designer. This is my main window with some navigations buttons, labels and so on. Now I am struggeling to load another *.ui (for example with content) in the frame or widget of the main window when I click on navgation buttons. I am using pyqt4 and I have to implement it with python on an raspberry pi. I also used the search but I did not find an working solution for my problem. Maybe it is really easy

Replace QWidget objects at runtime

妖精的绣舞 提交于 2019-11-26 08:36:34
问题 In my application I have to replace all QLineEdit elements with customized QLineEdit. To do that there are different solutions: Modify the generated py file from pyuic4 and replace there all QLineEdit objects with my one LineEdit. This solution is not really the best, because every time I run pyuic4 I lose the modification I did into the generated output file. Write a new class that search recursively inside my window or dialog for QLineEdit widget types and replace them with my one LineEdit.

Customising code of Qt designer widget?

人走茶凉 提交于 2019-11-26 08:36:12
问题 I need to add some features to a graphics widget in a form I created using the Qt Designer. For example I would normally do something like this: class custom_gv(QGraphicsView): def __init__(self): super().__init__() def zoom(self): # custom code here But in this case the graphics view is a part of the window I made in Qt Designer. I know you can use the \"promote to\" feature in Qt designer but I don\'t know how to utilise that in code, especially considering that I use this method to use Qt

Linking a qtDesigner .ui file to python/pyqt?

佐手、 提交于 2019-11-26 07:54:25
问题 So if I go into QtDesigner and build a UI, it\'ll be saved as a .ui file. How can I make this as a python file or use this in python? 回答1: Another way to use .ui in your code is: from PyQt4 import QtCore, QtGui, uic class MyWidget(QtGui.QWidget) ... #somewhere in constructor: uic.loadUi('MyWidget.ui', self) both approaches are good. Do not forget, that if you use Qt resource files (extremely useful) for icons and so on, you must compile it too: pyrcc4.exe -o ui/images_rc.py ui/images/images

PyQt: No error msg (traceback) on exit

好久不见. 提交于 2019-11-26 07:48:03
问题 My PyQt application no longer prints the error (stderr?) to the console. I use QtDesigner and import the UI like this: from PyQt5 import QtCore, QtGui, QtWidgets import sys from PyQt5.uic import loadUiType Ui_MainWindow, QMainWindow = loadUiType(\"test.ui\") class Main(QMainWindow, Ui_MainWindow): \"\"\"Main window\"\"\" def __init__(self,parent=None): super(Main, self).__init__(parent) self.setupUi(self) self.pushButton.clicked.connect(self.testfunc) def testfunc(self): print(9/0) if __name_

How to insert video in ui file which made at qt designer?

不问归期 提交于 2019-11-26 07:45:02
问题 I want to insert video in blue box(ui image) but I don\'t know how to insert video file. My code is here. I don\'t know how to add video... Just know example that make video player ... import sys from PyQt5 import QtWidgets from PyQt5 import QtGui from PyQt5 import uic from PyQt5 import QtCore from PyQt5.QtCore import QDir, Qt, QUrl, pyqtSlot from PyQt5.QtMultimedia import QMediaContent, QMediaPlayer from PyQt5.QtMultimediaWidgets import QVideoWidget from PyQt5.QtWidgets import (QApplication,