qt-designer

Create a widget to embed into QMainWindow

拥有回忆 提交于 2019-11-27 16:22:46
I have this task that I couldn't solve yet. Working with PyQt and Qt Creator. I want to embed a custom created widget created in QT Creator into another QMainWindow. 1) Steps I do: Create a Widget file in QT creator: 2) Save it as *.ui and apply this line to convert it to a *.py file: pyuic5 gen_settings.ui -o gen_settings.py 3) Open it and see that it starts with from PyQt5 import QtCore, QtGui, QtWidgets class Ui_gen_settings(object): def setupUi(self, gen_settings): gen_settings.setObjectName("gen_settings") 4) Which results in function call of course: TypeError: arguments did not match any

Qt Layout on QMainWindow

早过忘川 提交于 2019-11-27 14:33:31
问题 I designed a QMainWindow with QtCreator's designer. It consists of the default central widget (a QWidget ) which contains a QVBoxLayout with all the other widgets in it. Now everything I want, is that the QVBoxLayout automatically occupies the whole central widgets rectangle space. How can I do this? I didn't find any usable property neither in the central widgets properties nor the QVBoxLayout's ones. 回答1: You don't have to create a QVBoxLayout manually. Just select your central QWidget and

How do I create a custom slot in qt4 designer?

微笑、不失礼 提交于 2019-11-27 13:39:53
问题 Whenever I use the signal/slot editor dialog box, I have to choose from the existing list of slots. So the question is how do I create a custom named slot? 回答1: Unfortunately this is not possible in Qt4. In Qt3 you could create custom slots which where then implemented in the ui.h file. However, Qt4 does not use this file so custom slots are not supported. There is some discussion of this issue over on QtForum 回答2: This does seem to be possible in the version of Qt Designer 4.5.2, but it can

Auto-expanding layout with Qt-Designer

随声附和 提交于 2019-11-27 08:58:51
问题 I'm using the Qt Designer. I want to create a QVBoxLayout which will automatically expand to fill the whole window. The layout of the QVBoxLayout remains fixed. How can I cause the QVBoxLayout to expand and fill the entire window through the designer? 回答1: After creating your QVBoxLayout in Qt Designer, right-click on the background of your widget/dialog/window (not the QVBoxLayout , but the parent widget) and select Lay Out -> Lay Out in a Grid from the bottom of the context-menu. The

PyQt: How to switch widgets in QStackedWidget

扶醉桌前 提交于 2019-11-27 08:29:08
问题 I have two buttons ( wgtbtnA & wgtbtnB ) placed on two different pages ( page1 and page2 , respectively) inside a parent object (objectName: stackedWidget ). My dilemma is this: when I run the code, the arrows don't display in PyQt. Why? How do I alternate from page1 to page2 and vice-versa? Here is an image of runtime, which conveys what I am asking for: Qt Designer: I'd like to keep those small back arrows. Below is my code: # -*- coding: utf-8 -*- # Form implementation generated from

Initially hidden control in Qt Creator

我怕爱的太早我们不能终老 提交于 2019-11-27 06:34:28
问题 I want to make a group box shown only when a radio button is selected. I managed to do that by connecting the toggled(bool) signal of the radio button to the setShown(bool) slot of the group box. The problem is that the radio button is initially deselected but the group box is initially shown so I have to select/deselect the radio button to make it disappear. Is there any way I can make the group box initially invisible in Qt Creator Designer without having to do it in code? 回答1: You can't.

pyside connection Error “RuntimeError: Failed to connect signal clicked()”

六月ゝ 毕业季﹏ 提交于 2019-11-27 06:25:19
问题 from PySide.QtCore import * from PySide.QtGui import * import sys import stackwid class Dialog(QDialog,stackwid.Ui_Dialog): def __init__(self,parent = None): super(Dialog,self).__init__(parent) self.setupUi(self) self.camButton.clicked.connect(self.set()) def set(self): self.stackedWidget.setCurrentIndex(1) app = QApplication(sys.argv) form = Dialog() form.show() app.exec_() I wanted to connect clicked() signal emitted by camButton(PushButton) to slot which is a function set().This just does

ImportError: No module named 'resource_rc'

人盡茶涼 提交于 2019-11-27 06:23:53
问题 I made a simple program with PyQt GUI, and compiled '.ui' file. # Form implementation generated from reading ui file 'main.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.setEnabled(True) MainWindow.resize(441, 255) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,

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

和自甴很熟 提交于 2019-11-27 04:56:17
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, QFileDialog, QHBoxLayout, QLabel, QPushButton, QSizePolicy, QSlider, QStyle, QVBoxLayout, QWidget) dir

AttributeError: module 'PyQt5.QtGui' has no attribute 'QWidget'

a 夏天 提交于 2019-11-27 03:39:08
问题 So, I'm trying to make a UI for a python code I have, but keep stumbling up on problems... Right now, all the code does is make a window, with 2 texteditor boxes, and one button. When the button is pressed, it prints 'Test'. I used QTDesigner to make the UI, then PyQt5 to convert it to python, and edited the code. My code: # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'widget.ui' # # Created by: PyQt5 UI code generator 5.9 # # WARNING! All changes made in this