qt-designer

Replacing the existing MainWindow with a new window with Python, PyQt, Qt Designer

允我心安 提交于 2019-12-04 05:41:58
I'm new to Python GUI programming I'm have trouble making a GUI app. I have a main window with only a button widget on it. What i want to know is how to replace the existing window with a new window when an event occurs (such as a button click). An answer to a similar question here Replace CentralWidget in MainWindow , suggests using QStackedWidgets but they did not use Qt Designer to make their GUI apps whereas I have two .py files, one is the main window file and the other of window that i want to show after a button press take place, hence i don't know how to combine these two in my main.py

Using a custom PySide2 widget in Qt Designer

99封情书 提交于 2019-12-04 05:22:42
问题 I'm searching for a way to use custom widgets in Qt Designer written with Qt for Python (PySide2) effectively. I found out, that it is possible to design the GUI with the base widget, then just swap out the class to my custom widget in the UI File and informing the QUiLoader about the subclass loader.registerCustomWidget(MyMainWindow) , but then opening it again in Qt Designer doesn't work that well. I read in this similar question for PyQt that you have to write a Plugin for the custom

PyQt5 to PySide2, loading UI-Files in different classes

不问归期 提交于 2019-12-04 04:17:43
问题 I have a python application which runs under python3.6 and is using PyQt5 for loading Ui windows. These windows were created with Qt Designer 5.9.4. The Code below shows a working example with PyQt5. Now i want to have exactly the same functionality but with PySide2. For now, I couldn't work out how to load an Ui File and use its objects (buttons, tables etc.) in a separate class. For example: by clicking a button in the first window/class, a second window apears which functions are defined

PyInstaller + UI Files - FileNotFoundError: [Errno 2] No such file or directory:

瘦欲@ 提交于 2019-12-04 01:26:18
I'm trying to export my .py script to .exe using PyInstaller, which has dependencies on .ui files which were created using Qt Designer. I can confirm that my .py script works just fine when running it through PyCharm - I'm able to see the GUI I've created with the .ui files. However, when I export my .py script to .exe and launch it, I recieve the following errors in the command line: C:\Users\giranm>"C:\Users\giranm\PycharmProjects\PyQt Tutorial\dist\secSearch_demo.exe" Traceback (most recent call last): File "secSearch_demo.py", line 13, in <module> File "site-packages\PyQt4\uic\__init__.py"

Hello world in pyqt?

给你一囗甜甜゛ 提交于 2019-12-03 20:53:00
Currently I'm using pycharm to develop python web application. I want to develop desktop application with QT framework. I've installed pyqt. I've searched about hello world in pyqt and find this: from PyQt4 import QtGui, QtCore class Window(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.button = QtGui.QPushButton('Test', self) self.button.clicked.connect(self.handleButton) layout = QtGui.QVBoxLayout(self) layout.addWidget(self.button) def handleButton(self): print ('Hello World') if __name__ == '__main__': import sys app = QtGui.QApplication(sys.argv) window = Window()

Qt Designer: how to add custom slot and code to a button

ぐ巨炮叔叔 提交于 2019-12-03 18:59:44
问题 I use Qt4 Designer and I want that when I click on the "yes" button, some code will execute. And when I click on the "no", some other code will be execute. How can I do it? 回答1: Click on the Edit Signal/Slots tool. Create a connection for your button. For this, select your button in the designer by pressing on it with the left button of the mouse. Move the mouse to some place in the main window to create a connection with the main window (it is like a red line with a earth connection). When

Qt designer: How to add widget to a layout in the designer when the layout appears infinitely thin?

旧城冷巷雨未停 提交于 2019-12-03 14:28:01
问题 I am using Qt Designer, and I would like to move a couple of top-level widgets into a horizontal layout. I have dragged a "Horizontal Layout" object into the form. I am now attempting to drag the desired widgets into the layout. Unfortunately, the new Horizontal Layout widget is infinitely thin: ... and I cannot drag my "Import Progress" label widget or my progress bar widget into the new horizontal layout widget. Note that when I attempt to drag the desired widgets over the new horizontal

Qt get children from layout

家住魔仙堡 提交于 2019-12-03 11:34:51
问题 I try to hide all widgets in layout. But looks like findChildren doesn't work for layout. Here's my sample code: QLayout * layout = widget -> findChild<QLayout *> (layoutName); QList<QWidget *> list = layout -> findChildren<QWidget *> (); cout << list.size() << endl; size is 0, but inside this layout I have a few widgets. But the same code works fine if I try to get widgets from parent widget. How I can get them from appropriate layout? 回答1: The layout does not "inject" itself in the parent

How to organize classes in pyqt GUI programming

怎甘沉沦 提交于 2019-12-03 09:48:49
I have constructed a main window GUI using qt designer and pyqt. As the program grows more complex, using only one class may result in too many methods and attributes to manage. I figured that I should construct new classes in order to make things more manageable. My first question is, how do I know when do I add a new class for my application? Is there any rule of thumb as a general guide? Is it a good idea to add a new class for new windows/tabs? My second question is, if I added new classes for my application, how do my new class gain access to the Ui_MainWindow design file that I designed

Qt Charts and Data Visualization widgets

穿精又带淫゛_ 提交于 2019-12-03 07:51:08
I have installed Qt 5.7 in order to try Qt Charts and Qt Data Visualization but I cannot find new widgets neither in Qt Designer nor in Qt Creator. Any suggestions what should I do so new widgets appear in designer? I was having exactly the same problem today. It looks like the QT Designer plugins of QT Charts are not part of the package by default. I ended up downloading the designer plugin sources from github https://github.com/qtproject/qtcharts/tree/5.7/plugins/designer This consists of just 5 files. You should then be able to open the designer.pro project in Qt Creator and compile it.