qt-designer

How can I allow user resize on elements within the window using Qt designer?

跟風遠走 提交于 2019-12-01 05:29:09
问题 I want to allow a user using my application to be able to drag a boundary between two widgets in my window which will resize the two (i.e. you drag it down and the top one will get bigger while the bottom gets smaller, and vice-versa). Is there anything in Qt designer that will allow a user to resize an element in the window, within certain constraints? Thank you 回答1: What you're describing is called a QSplitter widget. In Qt Designer, you can create one by selecting 2 or more widgets , and

Drag and drop with pyqt5 (SIGNAL)

落花浮王杯 提交于 2019-12-01 04:56:52
问题 I am trying to get drag and drop (with images or files) working for my listwidget in pyqt5. I can find a lot of examples with pyqt4, but there is one part that does not work in the newer version: In the "dropevent": self.emit(QtCore.SIGNAL("dropped"), links) and in the MainForm: self.connect(self.view, QtCore.SIGNAL("dropped"), self.pictureDropped) I read a lot of posts but can't seem to find an answer how this should be written down with pyqt5. Could anyone please help me with this? link to

Qt Designer - How to connect a signal to a static function?

廉价感情. 提交于 2019-12-01 04:12:41
问题 Okay I'm using Qt Designer to build a GUI. I've managed to figure out how to make the menuBar and I've added some actions to the bar, but now I need to connect the actions to make them do something. Specifically, on my file menu, I have the simple open action. I want this action to run a function that calls my QFileDialog and so on, but I don't know how to do this. So, how do I connect my actionOpen to my static function? I am using the latest Qt, 5.0.2 I'm a little frustrated here. This is

Implementing LED in PyQt Designer

时光总嘲笑我的痴心妄想 提交于 2019-12-01 00:40:36
I am new to PyQt and QtDesigner. I want to add an LED in my GUI. can anyone kindly suggest How can I add LED in my GUI and change its color in my application? I have implemented a green/red LED indicator in my application "Grid Control", please have a look at the code on Github it may give you some ideas. I have defined two LED icons in my resource file as follows: ICON_RED_LED = ":/icons/led-red-on.png" ICON_GREEN_LED = ":/icons/green-led-on.png" The icon can activated like this: self.ui.labelStatusFan1.setPixmap(QtGui.QPixmap(ICON_RED_LED)) Also, by using signals, the icon can be activated

How to change the caption of a button in a QDialogButtonBox?

白昼怎懂夜的黑 提交于 2019-11-30 17:29:19
I have added a QDialogButtonBox button with the default Cancel and OK buttons. Is there a way to change the caption of these buttons? For example, OK should become Run . You will have to do some slight coding in your cpp file: ui->buttonBox->button(QDialogButtonBox::Ok)->setText("Run"); ui->buttonBox->button(QDialogButtonBox::Cancel)->setText("Exit"); Note that you may also need to include the QPushButton header: #include <QPushButton> Update: Did not notice the pyqt tag. I'm not familiar with Python (and PyQt in particular), but I think this should do the job: self.ui.buttonBox.button

PyQt: how to load multiple .ui Files from Qt Designer

久未见 提交于 2019-11-30 15:39:39
I want to add startup window that when I click button, it will open another window and close current window. For each window, it has seperated UI which created from Qt Designer in .ui form. I load both .ui file via uic.loadUiType() . The first window(first UI) can normally show its UI but when I click button to go to another window, another UI (second UI) doesn't work. It likes open blank window. Another problem is if I load first UI and then change to second UI (delete that Class and change to another Class, also delete uic.loadUiType()), the second UI still doesn't work (show blank window)

Inserting an image in GUI using QT Designer

不想你离开。 提交于 2019-11-30 11:35:27
I am new to QtDesigner. I wanted to know how to insert an image in the GUI using QT Designer. I am trying to add a logo. Help would be appreciated. You can start inserting a label. Next, you right click on it an then click "change rich text...". A new window will pop-up. Click on the figure Icon "Insert figure". Now, you have to create a resource file. Click on the Pencil button. Next, click on the "New resource file" button. Choose a name and a folder (your working directory would be a good choice) to save it. Now, click on the "Add prefix" button. Choose a name for it. Then, click on the

A .py file which compiled from .qrc file( using pyside-rcc ) does not work

徘徊边缘 提交于 2019-11-30 09:18:49
问题 I am working on python project and I have a problem with my .py file which complied from .qrc file. First, let I explain briefly about my project. I created my project GUI in QtDesigner and also use the image in the GUI. Then, I generate .py from .ui file using pyside-uic and generate .py file from .qrc file using pyside-rcc. The problem is when I use the .py file (an image file), images does not show in my GUI. Is anybody knows how to solve this problem? Thank you for all your answer. :) Ps.

Change rectangular Qt button to round

不打扰是莪最后的温柔 提交于 2019-11-30 07:07:55
I'm trying to create a round button in Qt. A simple form with a single button QPushButton was created in designer. I'm attempting to turn this into a round button using setMask() . As soon as setMask() is applied the button disappeares. Does a custom widget need to be created to make a round button? #include "mainwindow.h" #include "ui_mainwindow.h" #include <QMessageBox> #include <QtGui/QPushButton> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->pushButton->setText("Test Text"); ui->pushButton->setFixedHeight(200); ui->pushButton

How to create new PyQt4 windows from an existing window?

為{幸葍}努か 提交于 2019-11-30 05:22:46
I've been trying to call a new window from an existing one using python3 and Qt4. I've created two windows using Qt Designer (the main application and another one), and I've converted the .ui files generated by Qt Designer into .py scripts - but I can't seem to create new windows from the main application. I tried doing this: ############### MAIN APPLICATION SCRIPT ################ from PyQt4 import QtCore, QtGui import v2 try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: _fromUtf8 = lambda s: s class Ui_Form(object): def setupUi(self, Form): Form.setObjectName(_fromUtf8("Form"))