Drag&Drop from lineEdit to pushbutton in PyQt5 [duplicate] - python-3.x

This question already has an answer here:
PyQt4 - Dragging and dropping files into QPushButton
(1 answer)
Closed 3 years ago.
I want to drag plain text from lineEdit widget to drop pushbutton label in PyQt5. Here is the code:
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(873, 663)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButton2= QtWidgets.QPushButton(self.centralwidget)
self.pushButton2.setGeometry(QtCore.QRect(280, 40, 93, 28))
self.pushButton2.setObjectName("pushButton2")
self.pushButton2.setAcceptDrops(True)
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(120, 200, 113, 22))
self.lineEdit.setObjectName("lineEdit")
MainWindow.setCentralWidget(self.centralwidget)
self.lineEdit.setDragEnabled(True)
self.retranslateUi(MainWindow)
class pushButton2(QtWidgets.QPushButton):
def __init__(self, title, parent):
super().__init__(title, parent)
self.setAcceptDrops(True)
def dragEnterEvent(self, event):
if event.mimeData().hasFormat('text/plain'):
event.accept()
else:
event.ignore()
def dropEvent(self, event):
self.setText(event.mimeData().text())
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.pushButton2.setText(_translate("MainWindow", "PushButton2"))
self.lineEdit.setText(_translate("MainWindow", "k"))
if __name__ == "__main__":
if not QtWidgets.QApplication.instance():
app = QtWidgets.QApplication(sys.argv)
else:
app = QtWidgets.QApplication.instance()
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
app.exec_()
I would expect to drag text from lineEdit to show as pushbutton label but it did not accepted , why ?

Try it:
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
# class pushButton2(QtWidgets.QPushButton):
class PushButton(QtWidgets.QPushButton): # <---
def __init__(self, title, parent):
super().__init__(title, parent)
self.setAcceptDrops(True)
def dragEnterEvent(self, e):
if e.mimeData().hasFormat('text/plain'):
e.accept()
else:
e.ignore()
def dropEvent(self, e):
self.setText(e.mimeData().text())
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(873, 663)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
# self.pushButton2= QtWidgets.QPushButton(self.centralwidget)
self.pushButton2 = PushButton("PushButton2", self.centralwidget) # <---
self.pushButton2.setGeometry(QtCore.QRect(120, 140, 93, 28))
self.pushButton2.setObjectName("pushButton2")
# self.pushButton2.setAcceptDrops(True)
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(120, 200, 113, 22))
self.lineEdit.setObjectName("lineEdit")
MainWindow.setCentralWidget(self.centralwidget)
self.lineEdit.setDragEnabled(True)
self.retranslateUi(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.pushButton2.setText(_translate("MainWindow", "PushButton2"))
self.lineEdit.setText(_translate("MainWindow", "k"))
class ExampleApp(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
if __name__ == "__main__":
if not QtWidgets.QApplication.instance():
app = QtWidgets.QApplication(sys.argv)
else:
app = QtWidgets.QApplication.instance()
MainWindow = ExampleApp()
MainWindow.show()
app.exec_()

Related

How to close QDialog Window with pushButton?

i am currently working on this gui project. and i create a settings window but i cant make it close after pushing the buttons. i tried use self.close(), self.accept(), self.reject() methods. When i click the button nothing happens. Here is my code, which is simplified :
from PyQt5.QtWidgets import (QLineEdit, QWidget, QMenu, QMenuBar, QAction,
QMainWindow, QApplication, QDialog, QPushButton, QVBoxLayout)
from PyQt5.QtCore import QSize, QRect, QMetaObject, QCoreApplication, QObject, Qt
class Ui_Dialog(QDialog):
def __init__(self):
super(Ui_Dialog, self).__init__()
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(100, 100)
self.verticalLayout= QVBoxLayout(Dialog)
self.lineEdit = QLineEdit(Dialog)
self.lineEdit.setObjectName("lineEdit")
self.verticalLayout.addWidget(self.lineEdit)
self.pushButton = QPushButton(Dialog)
self.pushButton.setObjectName("pushButton")
self.verticalLayout.addWidget(self.pushButton)
self.pushButton_2 = QPushButton(Dialog)
self.pushButton_2.setObjectName("pushButton_2")
self.verticalLayout.addWidget(self.pushButton_2)
self.pushButton.clicked.connect(self.close)
self.pushButton_2.clicked.connect(self.save)
self.retranslateUi(Dialog)
QMetaObject.connectSlotsByName(Dialog)
def save(self):
global setting
setting = self.lineEdit.text()
self.done(1)
self.accept()
self.deleteLater()
self.destroy()
self.reject()
self.close()
def retranslateUi(self, Dialog):
_translate = QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Settings"))
self.pushButton_2.setText(_translate("Dialog", "Save"))
self.pushButton.setText(_translate("Dialog", "Cancel"))
class Ui_MainWindow(QObject):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1250, 609)
MainWindow.setMinimumSize(QSize(833, 600))
self.centralWidget = QWidget(MainWindow)
MainWindow.setCentralWidget(self.centralWidget)
self.centralWidget.setObjectName("centralwidget")
self.menubar = QMenuBar(MainWindow)
self.menubar.setGeometry(QRect(0, 0, 906, 21))
self.menubar.setObjectName("menubar")
self.menuOptions = QMenu(self.menubar)
self.menuOptions.setObjectName("menuOptions")
MainWindow.setMenuBar(self.menubar)
self.actionSettings = QAction(MainWindow)
self.actionSettings.setObjectName("actionSettings")
self.menuOptions.addAction(self.actionSettings)
self.menubar.addAction(self.menuOptions.menuAction())
self.actionSettings.triggered.connect(self.preferences)
self.retranslateUi(MainWindow)
QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "closinDialogSample"))
self.menuOptions.setTitle(_translate("MainWindow", "Options"))
self.actionSettings.setText(_translate("MainWindow", "Settings"))
def preferences(self):
self.preferences_dialog = QDialog()
self.preferences_dialog.ui = Ui_Dialog()
self.preferences_dialog.ui.setupUi(self.preferences_dialog)
self.preferences_dialog.setAttribute(Qt.WA_DeleteOnClose)
self.preferences_dialog.setModal(True)
self.preferences_dialog.show()
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
MainWindow = QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
Thank you for reading.

How get text from QTextEdit in Pyqt5? [duplicate]

This question already has an answer here:
Get text from qtextedit and assign it to a variable
(1 answer)
Closed 2 years ago.
I need get text from QTextEdit, but have such trouble: Traceback (most recent call last):
File "main.py", line 28, in otpravit_naz
textboxValue = self.textEdit.text()
AttributeError: 'MyWin' object has no attribute 'textEdit'
This is my code(main.py):
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from test import *
import socket
sock = socket.socket()
class MyWin(QtWidgets.QMainWindow):
def __init__(self, parent=None):
QtWidgets.QWidget.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.ui.otpravit.clicked.connect(self.otpravit_naz)
def mbox(self, body, title='Error'):
dialog = QMessageBox(QMessageBox.Information, title, body)
dialog.exec_()
def otpravit_naz(self):
print("1")
textboxValue = self.textEdit.text()
print(textboxValue)
#sock.connect(('192.168.1.16', 9090))
sock.connect(("192.168.1.45", 9090))
sock.send(b'textboxValue')
sock.close()
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
myapp = MyWin()
myapp.show()
sys.exit(app.exec_())
And ui form:
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(517, 283)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
self.verticalLayoutWidget.setGeometry(QtCore.QRect(60, 20, 421, 201))
self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
self.verticalLayout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setSpacing(23)
self.verticalLayout.setObjectName("verticalLayout")
self.textEdit = QtWidgets.QTextEdit(self.verticalLayoutWidget)
self.textEdit.setObjectName("textEdit")
self.verticalLayout.addWidget(self.textEdit)
self.label = QtWidgets.QLabel(self.verticalLayoutWidget)
self.label.setLineWidth(0)
self.label.setMidLineWidth(0)
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)
self.list = QtWidgets.QComboBox(self.verticalLayoutWidget)
self.list.setObjectName("list")
self.list.addItem("")
self.list.addItem("")
self.list.addItem("")
self.verticalLayout.addWidget(self.list)
self.otpravit = QtWidgets.QPushButton(self.verticalLayoutWidget)
self.otpravit.setObjectName("otpravit")
self.verticalLayout.addWidget(self.otpravit)
self.verticalLayout.setStretch(0, 20)
self.verticalLayout.setStretch(1, 20)
self.verticalLayout.setStretch(2, 20)
self.verticalLayout.setStretch(3, 20)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 517, 21))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.label.setText(_translate("MainWindow", "Предмет:"))
self.list.setItemText(0, _translate("MainWindow", "Русский"))
self.list.setItemText(1, _translate("MainWindow", "Литература"))
self.list.setItemText(2, _translate("MainWindow", "Английский"))
self.otpravit.setText(_translate("MainWindow", "Отправить"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
If it very stupid troble, pls don't kick me
You're "installing" the GUI on the self.ui object, so every widget that is on the ui is actually accessible as self.ui.someWidget.
Also, QTextEdit doesn't have a text() property, but toPlainText():
def otpravit_naz(self):
print("1")
textboxValue = self.ui.textEdit.toPlainText()
print(textboxValue)
I suggest you to never edit the files generated with pyuic, but always use them as imported modules; read more on using Designer; also, be careful to set the main layout on the central widget, not on its children, and add everything to that layout, otherwise the children widgets could be hidden whenever the window is resized.

PyQT5 - setUnifiedTitleAndToolBarOnMac

I have a question about setUnifiedTitleAndToolBarOnMac . I understand this is only available for the QMainWindow.
Is there a way to propagate this to other widgets. With below code , the tile and toolbar of the QWidget is still displayed(twice).
class Ui_MainWindow(object):
def show_form(self):
self.EditLabel = QtWidgets.QWidget()
self.EditLabel.setWindowTitle('Form Title')
self.EditLabel.show()
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
MainWindow.setWindowTitle("MainWindow")
MainWindow.setUnifiedTitleAndToolBarOnMac(True)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setToolTip("")
self.centralwidget.setObjectName("centralwidget")
self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_2.setGeometry(QtCore.QRect(80, 210, 113, 32))
self.pushButton_2.setObjectName("pushButton_2")
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
self.pushButton_2.clicked.connect(self.show_form)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
self.pushButton_2.setText(_translate("MainWindow", "show"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
Looks like i can solve this by setting
self.EditLabel.setWindowFlags(Qt.Dialog)
That's good enough for what i wanted.

Global variable not working in dialog form

I show a dialog from main. In the dialog, I change the value of a global variable. But after the dialog closes, the global variable does not change the value.
I use PyQt5. Here is the code I call the dialog and change the variable value. I use varA to store dialog result.
def Clicked(self):
global varA
dialog = clssDialog()
dialog.exec_()
print(varA)
dialog ui
class clssDialog(QDialog):
def __init__(self):
super(clssDialog, self).__init__()
#some code
In dialog. I use:
def btnClosed(self):
global varA
varA=value
self.close()
Edit: Full code
main.py
from PyQt5 import QtCore, QtGui, QtWidgets
from dialog import *
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(219, 62)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setObjectName("pushButton")
self.pushButton.clicked.connect(self.Clicked)
self.verticalLayout.addWidget(self.pushButton)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.pushButton.setText(_translate("MainWindow", "Open form"))
def Clicked(self):
global varA
varA=""
dialog = clssDialog()
dialog.exec_()
print("value: " + varA)
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
dialog.py
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
class clssDialog(QDialog):
def __init__(self):
super(clssDialog, self).__init__()
self.verticalLayout = QtWidgets.QVBoxLayout(self)
self.verticalLayout.setObjectName("verticalLayout")
self.pushButton = QtWidgets.QPushButton(self)
self.pushButton.setObjectName("pushButton")
self.pushButton.clicked.connect(self.btnClosed)
self.verticalLayout.addWidget(self.pushButton)
self.setWindowTitle("Dialog")
self.pushButton.setText("Close")
def btnClosed(self):
global varA
varA="123"
self.close()
It is not recommended to change the file created in QT Designer.
It is not necessary or advisable to use global variables. I also recommend reading Why are global variables evil?
Try it:
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
#from dialog import *
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(219, 62)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setObjectName("pushButton")
self.pushButton.clicked.connect(self.Clicked)
self.verticalLayout.addWidget(self.pushButton)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.pushButton.setText(_translate("MainWindow", "Open form"))
# def Clicked(self):
# global varA
# varA=""
# dialog = ClssDialog()
# dialog.exec_()
# print("value: " + varA)
class ClssDialog(QDialog):
# def __init__(self):
# super(ClssDialog, self).__init__()
def __init__(self, parent=None):
super(ClssDialog, self).__init__(parent)
self.parent = parent
self.verticalLayout = QtWidgets.QVBoxLayout(self)
self.verticalLayout.setObjectName("verticalLayout")
self.pushButton = QtWidgets.QPushButton(self)
self.pushButton.setObjectName("pushButton")
self.pushButton.clicked.connect(self.btnClosed)
self.verticalLayout.addWidget(self.pushButton)
self.setWindowTitle("Dialog")
self.pushButton.setText("Close")
def btnClosed(self):
# global varA
self.parent.varA = "123"
self.close()
class ExampleApp(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
self.varA = ""
def Clicked(self):
# global varA
# varA=""
dialog = ClssDialog(self)
dialog.exec_()
print("value: " + self.varA)
if __name__ == "__main__":
app = QApplication(sys.argv)
view = ExampleApp()
view.show()
sys.exit(app.exec_())

Not able to update the button text when pyqt connect signal run the function

Here not able to set the text in button. If I don't call the external function then it updates the text but I don't want that.
I want to run the function and then update the button text. Can someone tell me how to update the button text when the signal is running the function?
It updates in the end not while running.
EDIT: I have added the external function that data from the uart.
def uart1_serial_read():
device = serial.Serial(uart1, baudrate=115200, bytesize=8, parity='N', stopbits=1,
timeout=None, xonxoff=False, rtscts=False, dsrdtr=False)
print('UART1: %s ' % device.name)
run = True
while run:
#print (ser.readline())
data=device.readline()
print(data)
if (data == TEST_END):
print("TEST DONE *****")
run = False
class Ui_MainWindow(object):
# I setup my gui function geometry size,
#def setupUi(self, MainWindow):
def retranslateUi:
self.pushButton_1.clicked.connect(self.run_iot_uart1)
def signal_uart1(self, MainWindow):
print("Calling signal here")
_translate = QtCore.QCoreApplication.translate
# set this button to test once its done
self.pushButton_1.setText(_translate("MainWindow", "Running"))
# This text doesn't update my button anyone can tell me why?
self.pushButton_83.setText(_translate("MainWindow", "Running"))
print("Green")
def run_iot_uart1(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
self.pushButton_1.setText(_translate("MainWindow", "start"))
#calling external function
uart1_serial_read()
self.signal_uart1(MainWindow)
Sorry, but I do not understand what is not being updated?
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.pushButton_1 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_1.clicked.connect(self.run_iot_uart1)
self.pushButton_1.setGeometry(QtCore.QRect(100, 50, 100, 50))
self.pushButton_83 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_83.setGeometry(QtCore.QRect(250, 50, 100, 50))
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
MainWindow.pushButton_1.setText(_translate("MainWindow", "Button_1"))
def signal_uart1(self, MainWindow):
print("Calling signal here")
_translate = QtCore.QCoreApplication.translate
# set this button to test once its done
self.pushButton_1.setText(_translate("MainWindow", "Running"))
# This text doesn't update my button anyone can tell me why?
self.pushButton_83.setText(_translate("MainWindow", "Running"))
print("Green")
def run_iot_uart1(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
self.pushButton_1.setText(_translate("MainWindow", "start")) # ???
#calling external function
self.signal_uart1(MainWindow)
class MainView(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
super(MainView, self).__init__(parent)
self.setupUi(self)
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
w = MainView()
w.show()
sys.exit(app.exec_())
Have you verified that reTranslateUi is being called and being called correctly? Also the retranslateUi method is indented further than the rest of the code. Can you provide the whole Ui_MainWindow class?

Resources