qt-designer

Generate .h and .cpp from .ui file

跟風遠走 提交于 2019-11-29 03:05:18
问题 Suppose I have the file about.ui . How can I make the "about.h" and the "about.cpp" from my .ui file? I have to create a .moc file too? How can I compile this after the creaton to see if all ocurred correctly? 回答1: If automatic generation does not work (like in my case) you can use uic to generate the header file manually. uic file.ui > file.h 回答2: You don't. The about.ui generates a ui_about.h which you include in your own about.h You then create you own class deriving from this class class

PyQt5 - HOW to start the designer

て烟熏妆下的殇ゞ 提交于 2019-11-28 23:06:17
Feeling really stupid, right now, but the title says it all: How do you start the QtDesigner? I've installed PyQt5 via pip and I believe to have identified the directory it's been installed in as C:\Users\%username%\AppData\Local\Programs\Python\Python36\Lib\site-packages\PyQt5 Now what? There are a lot of .pyd files, some .dll's, too, but nothing executable (well, except a QtWebEngineProcess.exe in ...\site-packages\PyQt5\Qt\bin , but that doesn't sound like what I'm looking for. The latest PyQt5 wheels (which can be installed via pip) only contain what's necessary for running applications,

Qt Layout on QMainWindow

孤者浪人 提交于 2019-11-28 22:29:28
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. Georg Schölly You don't have to create a QVBoxLayout manually. Just select your central QWidget and press a make-layout button. Jaime Ivan Cervantes If you want to do it with code instead of

Controls insist on being too large, and won't resize, in QtDesigner

[亡魂溺海] 提交于 2019-11-28 21:35:40
I made a "widget" in Qt Designer with about a dozen controls organized into horiz. and vert. layouts. Oddly, every horizontal layout wants to be some large size, about 400 px wide, when the whole form is set to be 275px wide. Buttons etc contained within are too wide for the form. When I resize the widget form vertically or horizontally (sometimes with the max width turned off) the various layouts won't resize. Manually setting widths (or min widths, or max widths) may affect the sizes of the controls, but not their spacing within the layout. Spacers inserted to keep some controls at the top

Style sheets / Qt Designer support for high dpi screens?

六月ゝ 毕业季﹏ 提交于 2019-11-28 20:43:49
Today I have ported my application from Qt5.5 to Qt5.6RC. Running it on my high dpi screen the widgets appeared tiny. After reading this and setting QT_AUTO_SCREEN_SCALE_FACTOR to "1" at least it is usable again. However they say : In the longer term, the application should be adapted to run unmodified: 1) Always use the qreal versions of the QPainter drawing API. 2) Size windows and dialogs in relation to the screen size. 3) Replace hard-coded sizes in layouts and drawing code by values calculated from font metrics or screen size. Not all style sheet attributes support em (".. from font

Auto-expanding layout with Qt-Designer

我的未来我决定 提交于 2019-11-28 15:04:00
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? 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 QVBoxLayout should now stretch to fit the window and will resize automatically when the entire window is resized.

MVC design with Qt Designer and PyQt / PySide

北城余情 提交于 2019-11-28 14:52:13
问题 Python newbie coming from Java (+SWT/Windowbuilder) and am having difficulty working out how to properly code a large desktop app in Python/Qt4(QtDesigner)/PySide. I would like to keep any view logic in a controller class outside the .ui file (and it's .py conversion). Firstly as then the logic is independent of GUI framework and secondly as the .ui and resultant .py file get overwritten on any changes!. Only examples I've found add action code to a monolithic MainWindow.py (generated from ui

Drag n Drop Button and Drop-down menu PyQt/Qt designer

耗尽温柔 提交于 2019-11-28 12:57:56
I would like to know the "best practice" to change the behavior of some buttons to do the following: I want with a click to appear a menu. Or when you drag this same button you could drop it in another and this will "draw" a line connecting them. Here is an Example: The idea is to connect those "jack" buttons to any other "input" buttons. I was using the Qt designer and I realize that the buttons properties only the "acceptDrops" property is listed, but I can't make it work. Signals/Slots doesn't list something about dragging or dropping. So I think that the only way to do it is creating a

Initially hidden control in Qt Creator

眉间皱痕 提交于 2019-11-28 11:53:36
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? You can't. The visible property seems to be voluntarily removed from the property editor of Qt Designer and you can't

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

天大地大妈咪最大 提交于 2019-11-28 11:41:29
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 file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Widget(QtGui.QWidget): def