qt-designer

Qt 5.7 QDockWidget default size

限于喜欢 提交于 2020-01-17 12:37:28
问题 I am trying to have following setup: at start (when main window is opened) I want to have 2 QDockWidgets at left with width 400px and height 1/2 (each) of QMainWindows height. At the left, 3 QDockWidgets with width 400px and height 1/3 (each) of QMainWindows height. All of 5 widgets have to be resizable . That means using setFixSize() won't work in this case. So far I've tried changing Geometry>Width and Gemetry>Height in designed -> didn't work. Then I tried using resize() in main window

Catching events within QtDesigner generated widget

烂漫一生 提交于 2020-01-16 09:12:04
问题 I'm trying to make an app that would allow to manipulate some objects within QGraphicsView/QGraphicScene using the mouse (adding, moving, resizing, etc.). The UI is generated from QtDesigner. All examples that I googled show that mouse events are handled from within main application class. However, if there are more widgets that deal with mouse events, I thought that it would be wise to keep the mouse logic within those widgets separately. I tried to follow this advice with separate class,

How to find only those properties of a widget which are shown in the Qt Designer?

﹥>﹥吖頭↗ 提交于 2020-01-15 10:28:50
问题 How can I find only those properties of a widget (e.g. QPushButton) which Qt Designer shows in the Property Editor ? I can find all properties including those which are not shown in the Qt Designer using the following code: // Print all available properties of a Widget: qDebug()<<qPrintable("Widget: QPushButton"); QObject *object = new QPushButton; const QMetaObject *metaobject = object->metaObject(); for (int i=0; i<metaobject->propertyCount(); ++i) { QMetaProperty metaproperty = metaobject-

pyqtgraph.opengl VS OpenGL.GL - how to display axis at PyQt5 OpenGL embedded widget

牧云@^-^@ 提交于 2020-01-14 03:38:07
问题 How to interact with PyQt5.QtWidgets openGLWidget using pyqtgraph.opengl instead of OpenGL.GL ? I need to make a next graphical output to openGLWidget on the PyQt5 form: def plot_line(line): pl_line = np.array(line) color = (0.0, 0.0, 200.0, 0.5) newline = gl.GLLinePlotItem(pos=pl_line, color=color, width=5, antialias=False) w.addItem(newline) w.show() line1 = [(-33.13, 1004.82, -125.7), (21.38, 1059.32, -162.03)] plot_line(line1) Here I have an example where I have a UI with a button and

QIcon.fromTheme not displaying icon in PyQt

你离开我真会死。 提交于 2020-01-13 07:58:51
问题 I am having troubles to display the icon of a QAction selected from the current icon theme. I made the ui with Qt designer and exported it with pyuic4 sample.ui > sample.py . After setting the icon from the theme with self.actionSample.setIcon(QtGui.QIcon.fromTheme(_fromUtf8("document-open"))) , I get the following source code : from PyQt4 import QtCore, QtGui import sys try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_MainWindow(object): def

qt how to know that a pushbutton is clicked?

大兔子大兔子 提交于 2020-01-13 05:36:07
问题 I'm trying to do a program which makes some operations with sounds. My question is that I have 3 Play pushbutton and 3 label. I want that whichever I click on the Play button, the sound whose name is in the label that is near the pushbutton should play. I have a play slot without any parameter. So, how can I connect to every play button with every label respectively? Actually, I can write 3 different play function, but since I have some other functions, it will be too long and confusing. Also

AttributeError: 'Ui_MainWindow' object has no attribute 'setCentralWidget'

…衆ロ難τιáo~ 提交于 2020-01-10 07:42:33
问题 I am still working on the GUI for my Database and now i have a different error: Traceback (most recent call last): File "G:\Python\Database Kast Thuis\PyQt Test\MainMenu_ui.py", line 84, in <module> ex = Ui_MainWindow() File "G:\Python\Database Kast Thuis\PyQt Test\MainMenu_ui.py", line 16, in __init__ self.setupUi(self) File "G:\Python\Database Kast Thuis\PyQt Test\MainMenu_ui.py", line 55, in setupUi MainWindow.setCentralWidget(self.centralwidget) AttributeError: 'Ui_MainWindow' object has

pyside widget run with threading.Thread class

醉酒当歌 提交于 2020-01-06 07:07:27
问题 I have obtained a widget from a QtDesigner and converted .ui file to .py file by pyside. now I want that widget to organize a database and an apart threading.Thread (in same module) to open and read database and send to UDP. the fact that I know how to deal with all these apartly but when bringing together it is hard. should I use thread as a class inside my widget class which is: def setupUi(self, Form): ... def retranslateUi(self, Form): ... if __name__ == "__main__": ... Form.show() and

Accessing GUI elements from outside the GUI class

允我心安 提交于 2020-01-04 06:00:08
问题 I'm hoping someone can help me with a Qt designer question. I'm trying to modify GUI elements from outside the class calling the GUI file. I've set up example code showing the structure of my programs. My goal is to get func2 , in the main program (or another class) to change the main window's statusbar. from PyQt4 import QtCore, QtGui from main_gui import Ui_Main from about_gui import Ui_About #main_gui and about_gui are .py files generated by designer and pyuic class StartQT4(QtGui

Qt Designer doesn't load my custom widget plugin

与世无争的帅哥 提交于 2020-01-03 15:29:08
问题 I'm reading the book "C++ GUI Programming with Qt4", and I've reached the topic of Integrating Custom Widgets with Qt Designer. I've built the example project outlined there (the icon editor plugin), and I get a file called 'libiconeditorplugin.so', and I've copied it to '/usr/lib/qt4/plugins/designer/'. But when I start Qt Creator I don't see the icon editor widget in the widget box. The only thing I've done differently from the book is I removed the DESTDIR from the .pro file because it had