How can I connect Qcombobox with Qlineedit to import data from xml file ?



  • import xml.etree.ElementTree as et
    from PyQt5 import QtCore, QtGui, QtWidgets

    class Ui_TabWidget_Walls(object):

    def changeText(self):
    
        base_path = os.path.dirname(os.path.realpath(__file__))
        xml_file = os.path.join(base_path, "Data\\MaterialTemplates_v4.xml")
        tree = et.parse(xml_file)
        root = tree.getroot()
    
        for child in root:
    
            if (child.tag.split("}")[1]) == "Material":
    
                for children in child:
                    if (children.tag.split("}")[1]) == "density":
                        d = children.text
                self.lineEdit_18.setText(d)
    
    
    def Data(self):
    
        base_path = os.path.dirname(os.path.realpath(__file__))
        xml_file = os.path.join(base_path, "Data\\MaterialTemplates_v4.xml")
    
        tree = et.parse(xml_file)
        root = tree.getroot()
    
        for child in root:
    
            if (child.tag.split("}")[1]) == "Material":
    
                for children in child:
                    #   print (children.tag)
    
                    if (children.tag.split("}")[1]) == "name":
                        n = children.text
                        print(n)
                    if (children.tag.split("}")[1]) == "density":
                        d = children.text
                        print(d)
    
                        self.comboBox_Wall1.addItem(n)
                        #   self.lineEdit_18.setText(d)
    
                        self.comboBox_Wall1.activated['QString'].connect(self.changeText)
                        QtCore.QMetaObject.connectSlotsByName(TabWidget_Walls)
    
    def setupUi(self, TabWidget_Walls):
        TabWidget_Walls.setObjectName("TabWidget_Walls")
        TabWidget_Walls.resize(494, 493)
        TabWidget_Walls.setTabShape(QtWidgets.QTabWidget.Triangular)
        self.tab = QtWidgets.QWidget()
        self.tab.setObjectName("tab")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.tab)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.label_14 = QtWidgets.QLabel(self.tab)
        self.label_14.setObjectName("label_14")
        self.gridLayout_2.addWidget(self.label_14, 7, 0, 1, 1)
        self.label_16 = QtWidgets.QLabel(self.tab)
        self.label_16.setObjectName("label_16")
        self.gridLayout_2.addWidget(self.label_16, 9, 0, 1, 1)
        self.lineEdit_17 = QtWidgets.QLineEdit(self.tab)
        self.lineEdit_17.setObjectName("lineEdit_17")
        self.gridLayout_2.addWidget(self.lineEdit_17, 7, 1, 1, 1)
        self.label_18 = QtWidgets.QLabel(self.tab)
        self.label_18.setObjectName("label_18")
        self.gridLayout_2.addWidget(self.label_18, 8, 0, 1, 1)
        self.lineEdit_13 = QtWidgets.QLineEdit(self.tab)
        self.lineEdit_13.setText("")
        self.lineEdit_13.setObjectName("lineEdit_13")
        self.gridLayout_2.addWidget(self.lineEdit_13, 8, 1, 1, 1)
        self.lineEdit_14 = QtWidgets.QLineEdit(self.tab)
        self.lineEdit_14.setObjectName("lineEdit_14")
        self.gridLayout_2.addWidget(self.lineEdit_14, 9, 1, 1, 1)
        self.pushButton_Wall1 = QtWidgets.QPushButton(self.tab)
        self.pushButton_Wall1.setObjectName("pushButton_Wall1")
    
        self.pushButton_Wall1.clicked.connect(self.Data)
    
        self.gridLayout_2.addWidget(self.pushButton_Wall1, 0, 1, 1, 1)
        self.comboBox_Wall1 = QtWidgets.QComboBox(self.tab)
        self.comboBox_Wall1.setObjectName("comboBox_Wall1")
        self.comboBox_Wall1.addItem("")
        self.gridLayout_2.addWidget(self.comboBox_Wall1, 1, 1, 1, 1)
        self.lineEdit_18 = QtWidgets.QLineEdit(self.tab)
        self.lineEdit_18.setObjectName("lineEdit_18")
        self.gridLayout_2.addWidget(self.lineEdit_18, 10, 1, 1, 1)
        self.label_13 = QtWidgets.QLabel(self.tab)
        self.label_13.setObjectName("label_13")
        self.gridLayout_2.addWidget(self.label_13, 11, 0, 1, 1)
        self.lineEdit_16 = QtWidgets.QLineEdit(self.tab)
        self.lineEdit_16.setObjectName("lineEdit_16")
        self.gridLayout_2.addWidget(self.lineEdit_16, 11, 1, 1, 1)
        self.label_15 = QtWidgets.QLabel(self.tab)
        self.label_15.setObjectName("label_15")
        self.gridLayout_2.addWidget(self.label_15, 12, 0, 1, 1)
        self.label_17 = QtWidgets.QLabel(self.tab)
        self.label_17.setObjectName("label_17")
        self.gridLayout_2.addWidget(self.label_17, 10, 0, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(self.tab)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout_2.addWidget(self.buttonBox, 13, 0, 1, 2)
        self.lineEdit_15 = QtWidgets.QLineEdit(self.tab)
        self.lineEdit_15.setObjectName("lineEdit_15")
        self.gridLayout_2.addWidget(self.lineEdit_15, 12, 1, 1, 1)
        self.label_25 = QtWidgets.QLabel(self.tab)
        self.label_25.setObjectName("label_25")
        self.gridLayout_2.addWidget(self.label_25, 0, 0, 3, 1)
        self.lineEdit = QtWidgets.QLineEdit(self.tab)
        self.lineEdit.setObjectName("lineEdit")
        self.gridLayout_2.addWidget(self.lineEdit, 2, 1, 1, 1)
        TabWidget_Walls.addTab(self.tab, "")
        self.tab1 = QtWidgets.QWidget()
        self.tab1.setObjectName("tab1")
        self.gridLayout_3 = QtWidgets.QGridLayout(self.tab1)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.buttonBox_2 = QtWidgets.QDialogButtonBox(self.tab1)
        self.buttonBox_2.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox_2.setObjectName("buttonBox_2")
        self.gridLayout_3.addWidget(self.buttonBox_2, 9, 0, 1, 2)
        self.pushButton_Wall2 = QtWidgets.QPushButton(self.tab1)
        self.pushButton_Wall2.setObjectName("pushButton_Wall2")
        self.gridLayout_3.addWidget(self.pushButton_Wall2, 0, 1, 1, 1)
        self.comboBox_Wall1_3 = QtWidgets.QComboBox(self.tab1)
        self.comboBox_Wall1_3.setObjectName("comboBox_Wall1_3")
        self.comboBox_Wall1_3.addItem("")
        self.gridLayout_3.addWidget(self.comboBox_Wall1_3, 1, 1, 1, 1)
        self.label_44 = QtWidgets.QLabel(self.tab1)
        self.label_44.setObjectName("label_44")
        self.gridLayout_3.addWidget(self.label_44, 3, 0, 1, 1)
        self.lineEdit_40 = QtWidgets.QLineEdit(self.tab1)
        self.lineEdit_40.setText("")
        self.lineEdit_40.setObjectName("lineEdit_40")
        self.gridLayout_3.addWidget(self.lineEdit_40, 4, 1, 1, 1)
        self.label_42 = QtWidgets.QLabel(self.tab1)
        self.label_42.setObjectName("label_42")
        self.gridLayout_3.addWidget(self.label_42, 4, 0, 1, 1)
        self.lineEdit_38 = QtWidgets.QLineEdit(self.tab1)
        self.lineEdit_38.setObjectName("lineEdit_38")
        self.gridLayout_3.addWidget(self.lineEdit_38, 3, 1, 1, 1)
        self.lineEdit_42 = QtWidgets.QLineEdit(self.tab1)
        self.lineEdit_42.setObjectName("lineEdit_42")
        self.gridLayout_3.addWidget(self.lineEdit_42, 5, 1, 1, 1)
        self.label_46 = QtWidgets.QLabel(self.tab1)
        self.label_46.setObjectName("label_46")
        self.gridLayout_3.addWidget(self.label_46, 6, 0, 1, 1)
        self.label_45 = QtWidgets.QLabel(self.tab1)
        self.label_45.setObjectName("label_45")
        self.gridLayout_3.addWidget(self.label_45, 7, 0, 1, 1)
        self.lineEdit_41 = QtWidgets.QLineEdit(self.tab1)
        self.lineEdit_41.setObjectName("lineEdit_41")
        self.gridLayout_3.addWidget(self.lineEdit_41, 6, 1, 1, 1)
        self.label_43 = QtWidgets.QLabel(self.tab1)
        self.label_43.setObjectName("label_43")
        self.gridLayout_3.addWidget(self.label_43, 5, 0, 1, 1)
        self.lineEdit_37 = QtWidgets.QLineEdit(self.tab1)
        self.lineEdit_37.setObjectName("lineEdit_37")
        self.gridLayout_3.addWidget(self.lineEdit_37, 7, 1, 1, 1)
        self.lineEdit_39 = QtWidgets.QLineEdit(self.tab1)
        self.lineEdit_39.setObjectName("lineEdit_39")
        self.gridLayout_3.addWidget(self.lineEdit_39, 8, 1, 1, 1)
        self.label_41 = QtWidgets.QLabel(self.tab1)
        self.label_41.setObjectName("label_41")
        self.gridLayout_3.addWidget(self.label_41, 8, 0, 1, 1)
        self.lineEdit_2 = QtWidgets.QLineEdit(self.tab1)
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.gridLayout_3.addWidget(self.lineEdit_2, 2, 1, 1, 1)
        self.label_47 = QtWidgets.QLabel(self.tab1)
        self.label_47.setObjectName("label_47")
        self.gridLayout_3.addWidget(self.label_47, 0, 0, 3, 1)
        TabWidget_Walls.addTab(self.tab1, "")
        self.tab_4 = QtWidgets.QWidget()
        self.tab_4.setObjectName("tab_4")
        self.gridLayout = QtWidgets.QGridLayout(self.tab_4)
        self.gridLayout.setObjectName("gridLayout")
        self.lineEdit_32 = QtWidgets.QLineEdit(self.tab_4)
        self.lineEdit_32.setObjectName("lineEdit_32")
        self.gridLayout.addWidget(self.lineEdit_32, 3, 1, 1, 1)
        self.label_36 = QtWidgets.QLabel(self.tab_4)
        self.label_36.setObjectName("label_36")
        self.gridLayout.addWidget(self.label_36, 3, 0, 1, 1)
        self.label_34 = QtWidgets.QLabel(self.tab_4)
        self.label_34.setObjectName("label_34")
        self.gridLayout.addWidget(self.label_34, 4, 0, 1, 1)
        self.label_38 = QtWidgets.QLabel(self.tab_4)
        self.label_38.setObjectName("label_38")
        self.gridLayout.addWidget(self.label_38, 6, 0, 1, 1)
        self.comboBox_Wall1_4 = QtWidgets.QComboBox(self.tab_4)
        self.comboBox_Wall1_4.setObjectName("comboBox_Wall1_4")
        self.comboBox_Wall1_4.addItem("")
        self.gridLayout.addWidget(self.comboBox_Wall1_4, 1, 1, 1, 1)
        self.pushButton_Wall3 = QtWidgets.QPushButton(self.tab_4)
        self.pushButton_Wall3.setObjectName("pushButton_Wall3")
        self.gridLayout.addWidget(self.pushButton_Wall3, 0, 1, 1, 1)
        self.lineEdit_34 = QtWidgets.QLineEdit(self.tab_4)
        self.lineEdit_34.setText("")
        self.lineEdit_34.setObjectName("lineEdit_34")
        self.gridLayout.addWidget(self.lineEdit_34, 4, 1, 1, 1)
        self.lineEdit_36 = QtWidgets.QLineEdit(self.tab_4)
        self.lineEdit_36.setObjectName("lineEdit_36")
        self.gridLayout.addWidget(self.lineEdit_36, 5, 1, 1, 1)
        self.lineEdit_31 = QtWidgets.QLineEdit(self.tab_4)
        self.lineEdit_31.setObjectName("lineEdit_31")
        self.gridLayout.addWidget(self.lineEdit_31, 7, 1, 1, 1)
        self.label_37 = QtWidgets.QLabel(self.tab_4)
        self.label_37.setObjectName("label_37")
        self.gridLayout.addWidget(self.label_37, 7, 0, 1, 1)
        self.label_35 = QtWidgets.QLabel(self.tab_4)
        self.label_35.setObjectName("label_35")
        self.gridLayout.addWidget(self.label_35, 5, 0, 1, 1)
        self.lineEdit_33 = QtWidgets.QLineEdit(self.tab_4)
        self.lineEdit_33.setObjectName("lineEdit_33")
        self.gridLayout.addWidget(self.lineEdit_33, 8, 1, 1, 1)
        self.lineEdit_35 = QtWidgets.QLineEdit(self.tab_4)
        self.lineEdit_35.setObjectName("lineEdit_35")
        self.gridLayout.addWidget(self.lineEdit_35, 6, 1, 1, 1)
        self.buttonBox_3 = QtWidgets.QDialogButtonBox(self.tab_4)
        self.buttonBox_3.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox_3.setObjectName("buttonBox_3")
        self.gridLayout.addWidget(self.buttonBox_3, 9, 0, 1, 2)
        self.label_33 = QtWidgets.QLabel(self.tab_4)
        self.label_33.setObjectName("label_33")
        self.gridLayout.addWidget(self.label_33, 8, 0, 1, 1)
        self.lineEdit_3 = QtWidgets.QLineEdit(self.tab_4)
        self.lineEdit_3.setText("")
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.gridLayout.addWidget(self.lineEdit_3, 2, 1, 1, 1)
        self.label_39 = QtWidgets.QLabel(self.tab_4)
        self.label_39.setObjectName("label_39")
        self.gridLayout.addWidget(self.label_39, 0, 0, 3, 1)
        TabWidget_Walls.addTab(self.tab_4, "")
        self.tab_5 = QtWidgets.QWidget()
        self.tab_5.setObjectName("tab_5")
        self.gridLayout_4 = QtWidgets.QGridLayout(self.tab_5)
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.pushButton_Wall4_2 = QtWidgets.QPushButton(self.tab_5)
        self.pushButton_Wall4_2.setObjectName("pushButton_Wall4_2")
        self.gridLayout_4.addWidget(self.pushButton_Wall4_2, 0, 1, 1, 1)
        self.label_22 = QtWidgets.QLabel(self.tab_5)
        self.label_22.setObjectName("label_22")
        self.gridLayout_4.addWidget(self.label_22, 3, 0, 1, 1)
        self.comboBox_Wall1_5 = QtWidgets.QComboBox(self.tab_5)
        self.comboBox_Wall1_5.setObjectName("comboBox_Wall1_5")
        self.comboBox_Wall1_5.addItem("")
        self.gridLayout_4.addWidget(self.comboBox_Wall1_5, 1, 1, 1, 1)
        self.label_20 = QtWidgets.QLabel(self.tab_5)
        self.label_20.setObjectName("label_20")
        self.gridLayout_4.addWidget(self.label_20, 4, 0, 1, 1)
        self.label_21 = QtWidgets.QLabel(self.tab_5)
        self.label_21.setObjectName("label_21")
        self.gridLayout_4.addWidget(self.label_21, 5, 0, 1, 1)
        self.lineEdit_24 = QtWidgets.QLineEdit(self.tab_5)
        self.lineEdit_24.setObjectName("lineEdit_24")
        self.gridLayout_4.addWidget(self.lineEdit_24, 5, 1, 1, 1)
        self.lineEdit_22 = QtWidgets.QLineEdit(self.tab_5)
        self.lineEdit_22.setText("")
        self.lineEdit_22.setObjectName("lineEdit_22")
        self.gridLayout_4.addWidget(self.lineEdit_22, 4, 1, 1, 1)
        self.lineEdit_20 = QtWidgets.QLineEdit(self.tab_5)
        self.lineEdit_20.setObjectName("lineEdit_20")
        self.gridLayout_4.addWidget(self.lineEdit_20, 3, 1, 1, 1)
        self.label_23 = QtWidgets.QLabel(self.tab_5)
        self.label_23.setObjectName("label_23")
        self.gridLayout_4.addWidget(self.label_23, 7, 0, 1, 1)
        self.label_19 = QtWidgets.QLabel(self.tab_5)
        self.label_19.setObjectName("label_19")
        self.gridLayout_4.addWidget(self.label_19, 8, 0, 1, 1)
        self.label_24 = QtWidgets.QLabel(self.tab_5)
        self.label_24.setObjectName("label_24")
        self.gridLayout_4.addWidget(self.label_24, 6, 0, 1, 1)
        self.lineEdit_23 = QtWidgets.QLineEdit(self.tab_5)
        self.lineEdit_23.setObjectName("lineEdit_23")
        self.gridLayout_4.addWidget(self.lineEdit_23, 6, 1, 1, 1)
        self.lineEdit_19 = QtWidgets.QLineEdit(self.tab_5)
        self.lineEdit_19.setObjectName("lineEdit_19")
        self.gridLayout_4.addWidget(self.lineEdit_19, 7, 1, 1, 1)
        self.buttonBox_4 = QtWidgets.QDialogButtonBox(self.tab_5)
        self.buttonBox_4.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox_4.setObjectName("buttonBox_4")
        self.gridLayout_4.addWidget(self.buttonBox_4, 9, 0, 1, 2)
        self.lineEdit_21 = QtWidgets.QLineEdit(self.tab_5)
        self.lineEdit_21.setObjectName("lineEdit_21")
        self.gridLayout_4.addWidget(self.lineEdit_21, 8, 1, 1, 1)
        self.lineEdit_4 = QtWidgets.QLineEdit(self.tab_5)
        self.lineEdit_4.setText("")
        self.lineEdit_4.setObjectName("lineEdit_4")
        self.gridLayout_4.addWidget(self.lineEdit_4, 2, 1, 1, 1)
        self.label_40 = QtWidgets.QLabel(self.tab_5)
        self.label_40.setObjectName("label_40")
        self.gridLayout_4.addWidget(self.label_40, 0, 0, 3, 1)
        TabWidget_Walls.addTab(self.tab_5, "")
    
        self.retranslateUi(TabWidget_Walls)
        TabWidget_Walls.setCurrentIndex(0)
    
    
    def retranslateUi(self, TabWidget_Walls):
        _translate = QtCore.QCoreApplication.translate
        TabWidget_Walls.setWindowTitle(_translate("TabWidget_Walls", "EnergyADE"))
        self.label_14.setText(_translate("TabWidget_Walls", "Area"))
        self.label_16.setText(_translate("TabWidget_Walls", "U-Value"))
        self.lineEdit_17.setPlaceholderText(_translate("TabWidget_Walls", "m²"))
        self.label_18.setText(_translate("TabWidget_Walls", "Thickness"))
        self.lineEdit_13.setPlaceholderText(_translate("TabWidget_Walls", "m"))
        self.lineEdit_14.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m²)"))
        self.pushButton_Wall1.setText(_translate("TabWidget_Walls", "click on to choose from catalog"))
        self.comboBox_Wall1.setItemText(0, _translate("TabWidget_Walls", "other"))
        self.lineEdit_18.setPlaceholderText(_translate("TabWidget_Walls", "kg/m³"))
        self.label_13.setText(_translate("TabWidget_Walls", "Conductivity"))
        self.lineEdit_16.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m)"))
        self.label_15.setText(_translate("TabWidget_Walls", "Heat Capacity"))
        self.label_17.setText(_translate("TabWidget_Walls", "Density"))
        self.lineEdit_15.setPlaceholderText(_translate("TabWidget_Walls", "J/K"))
        self.label_25.setText(_translate("TabWidget_Walls", "Material Name"))
        self.lineEdit.setPlaceholderText(_translate("TabWidget_Walls", "name"))
        TabWidget_Walls.setTabText(TabWidget_Walls.indexOf(self.tab), _translate("TabWidget_Walls", "Wall 1"))
        self.pushButton_Wall2.setText(_translate("TabWidget_Walls", "click on to choose from catalog"))
        self.comboBox_Wall1_3.setItemText(0, _translate("TabWidget_Walls", "other"))
        self.label_44.setText(_translate("TabWidget_Walls", "Area"))
        self.lineEdit_40.setPlaceholderText(_translate("TabWidget_Walls", "m"))
        self.label_42.setText(_translate("TabWidget_Walls", "Thickness"))
        self.lineEdit_38.setPlaceholderText(_translate("TabWidget_Walls", "m²"))
        self.lineEdit_42.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m²)"))
        self.label_46.setText(_translate("TabWidget_Walls", "Density"))
        self.label_45.setText(_translate("TabWidget_Walls", "Conductivity"))
        self.lineEdit_41.setPlaceholderText(_translate("TabWidget_Walls", "kg/m³"))
        self.label_43.setText(_translate("TabWidget_Walls", "U-Value"))
        self.lineEdit_37.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m)"))
        self.lineEdit_39.setPlaceholderText(_translate("TabWidget_Walls", "J/K"))
        self.label_41.setText(_translate("TabWidget_Walls", "Heat Capacity"))
        self.lineEdit_2.setPlaceholderText(_translate("TabWidget_Walls", "name"))
        self.label_47.setText(_translate("TabWidget_Walls", "Material Name"))
        TabWidget_Walls.setTabText(TabWidget_Walls.indexOf(self.tab1), _translate("TabWidget_Walls", "Wall 2"))
        self.lineEdit_32.setPlaceholderText(_translate("TabWidget_Walls", "m²"))
        self.label_36.setText(_translate("TabWidget_Walls", "Area"))
        self.label_34.setText(_translate("TabWidget_Walls", "Thickness"))
        self.label_38.setText(_translate("TabWidget_Walls", "Density"))
        self.comboBox_Wall1_4.setItemText(0, _translate("TabWidget_Walls", "other"))
        self.pushButton_Wall3.setText(_translate("TabWidget_Walls", "click on to choose from catalog"))
        self.lineEdit_34.setPlaceholderText(_translate("TabWidget_Walls", "m"))
        self.lineEdit_36.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m²)"))
        self.lineEdit_31.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m)"))
        self.label_37.setText(_translate("TabWidget_Walls", "Conductivity"))
        self.label_35.setText(_translate("TabWidget_Walls", "U-Value"))
        self.lineEdit_33.setPlaceholderText(_translate("TabWidget_Walls", "J/K"))
        self.lineEdit_35.setPlaceholderText(_translate("TabWidget_Walls", "kg/m³"))
        self.label_33.setText(_translate("TabWidget_Walls", "Heat Capacity"))
        self.lineEdit_3.setPlaceholderText(_translate("TabWidget_Walls", "name"))
        self.label_39.setText(_translate("TabWidget_Walls", "Material Name"))
        TabWidget_Walls.setTabText(TabWidget_Walls.indexOf(self.tab_4), _translate("TabWidget_Walls", "Wall 3"))
        self.pushButton_Wall4_2.setText(_translate("TabWidget_Walls", "click on to choose from catalog"))
        self.label_22.setText(_translate("TabWidget_Walls", "Area"))
        self.comboBox_Wall1_5.setItemText(0, _translate("TabWidget_Walls", "other"))
        self.label_20.setText(_translate("TabWidget_Walls", "Thickness"))
        self.label_21.setText(_translate("TabWidget_Walls", "U-Value"))
        self.lineEdit_24.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m²)"))
        self.lineEdit_22.setPlaceholderText(_translate("TabWidget_Walls", "m"))
        self.lineEdit_20.setPlaceholderText(_translate("TabWidget_Walls", "m²"))
        self.label_23.setText(_translate("TabWidget_Walls", "Conductivity"))
        self.label_19.setText(_translate("TabWidget_Walls", "Heat Capacity"))
        self.label_24.setText(_translate("TabWidget_Walls", "Density"))
        self.lineEdit_23.setPlaceholderText(_translate("TabWidget_Walls", "kg/m³"))
        self.lineEdit_19.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m)"))
        self.lineEdit_21.setPlaceholderText(_translate("TabWidget_Walls", "J/K"))
        self.lineEdit_4.setPlaceholderText(_translate("TabWidget_Walls", "name"))
        self.label_40.setText(_translate("TabWidget_Walls", "Material Name"))
        TabWidget_Walls.setTabText(TabWidget_Walls.indexOf(self.tab_5), _translate("TabWidget_Walls", "Wall 4"))
    

    if name == "main":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    TabWidget_Walls = QtWidgets.QTabWidget()
    ui = Ui_TabWidget_Walls()
    ui.setupUi(TabWidget_Walls)
    TabWidget_Walls.show()
    sys.exit(app.exec_())


  • Qt Champions 2018

    @MomoAlex Can you please explain what exactly you're asking?
    "ow can I connect Qcombobox with Qlineedit" - what do you mean with "connect" here?



  • @jsulm I have a xml-file with different material types and their properties like density. I have imported the data from the file and put the material types in combobox_wall1 and I would like to have the density in lineedit_18 when I choose any kind of material types from the drop down box. I did the connection between combobox_wall1 and lineedit_18 as showen in the code but and when I choose any material type it comes just the last number for density for the last material type. If you like I can send you the xml file to understand that more and I'm sorry if you didn't understand me I still beginner with programming


  • Qt Champions 2018



  • @jsulm I tried it and became the same issue

                    self.comboBox_Wall1.activated['QString'].connect(self.changeText)

  • Qt Champions 2018

    @MomoAlex In the code you posted I don't see where you're using selected entry from combo box to find the correct density.



  • @jsulm

    def changeText(self):

    base_path = os.path.dirname(os.path.realpath(__file__))
    xml_file = os.path.join(base_path, "Data\\MaterialTemplates_v4.xml")
    tree = et.parse(xml_file)
    root = tree.getroot()
    
    for child in root:
    
        if (child.tag.split("}")[1]) == "Material":
    
            for children in child:
                if (children.tag.split("}")[1]) == "density":
                    d = children.text
            self.lineEdit_18.setText(d)
    

    def Data(self):

    base_path = os.path.dirname(os.path.realpath(__file__))
    xml_file = os.path.join(base_path, "Data\\MaterialTemplates_v4.xml")
    
    tree = et.parse(xml_file)
    root = tree.getroot()
    
    for child in root:
    
        if (child.tag.split("}")[1]) == "Material":
    
            for children in child:
                #   print (children.tag)
    
                if (children.tag.split("}")[1]) == "name":
                    n = children.text
                    print(n)
     
                    self.comboBox_Wall1.addItem(n)
           
    
                    self.comboBox_Wall1.activated['QString'].connect(self.changeText)

  • Qt Champions 2018

    @MomoAlex said in How can I connect Qcombobox with Qlineedit to import data from xml file ?:

    self.comboBox_Wall1.activated['QString'].connect(self.changeText)

    Why do you execute this in a loop? You only need to connect once.
    And I still don't see where you use the selected text (from combo box) to find the correct density?
    You get that text as parameter from activated signal, so change your slot to

    def changeText(self, selectedText):
    

    and use selectedText to find the dencity which belongs to it.



  • <?xml version="1.0"?>

    -<MaterialTemplates xmlns="http://teaser.material" version="0.4">

    -<Material material_id="5b853868-855d-11e6-9874-2cd444b2e704">

    <name>EPS035</name>

    <density>20.0</density>

    <thermal_conduc>0.035</thermal_conduc>

    <heat_capac>1.0</heat_capac>

    </Material>

    -<Material material_id="0abaa039-83ff-11e6-b385-2cd444b2e704">

    <name>Tiledroof</name>

    <density>1700.0</density>

    <thermal_conduc>1.3</thermal_conduc>

    <heat_capac>0.84</heat_capac>

    </Material>

    -<Material material_id="0abbb1a0-83ff-11e6-9986-2cd444b2e704">

    <name>Glas1995_2015AluoderStahlfensterIsolierverglasung</name>

    <density>0.0</density>

    <thermal_conduc>0.067</thermal_conduc>

    <heat_capac>0.0</heat_capac>

    </Material>

    -<Material material_id="0abaa02d-83ff-11e6-8456-2cd444b2e704">

    <name>SparrenmitDaemmung</name>

    <density>50.0</density>

    <thermal_conduc>0.07</thermal_conduc>

    <heat_capac>1.0</heat_capac>

    </Material>

    -<Material material_id="0abb8a84-83ff-11e6-bd05-2cd444b2e704">

    <name>Schaumglas</name>

    <density>120.0</density>

    <thermal_conduc>0.04</thermal_conduc>

    <heat_capac>1.0</heat_capac>

    </Material>

    -<Material material_id="0abaee5a-83ff-11e6-a1cb-2cd444b2e704">

    <name>Lehmputz</name>

    <density>1700.0</density>

    <thermal_conduc>0.8</thermal_conduc>

    <heat_capac>1.0</heat_capac>

    </Material>

    -<Material material_id="0abb1554-83ff-11e6-bed8-2cd444b2e704">

    <name>Beton</name>

    <density>1300.0</density>

    <thermal_conduc>1.15</thermal_conduc>

    <heat_capac>1.0</heat_capac>

    </Material>

    -<Material material_id="0abaee50-83ff-11e6-8083-2cd444b2e704">

    <name>Vollziegelmauerwerk</name>

    <density>1800.0</density>

    <thermal_conduc>0.81</thermal_conduc>

    <heat_capac>1.0</heat_capac>

    </Material>

    -<Material material_id="0abbb19b-83ff-11e6-95f9-2cd444b2e704">

    <name>Glas1984_1994KunststofffensterIsolierverglasung</name>

    <density>0.0</density>

    <thermal_conduc>0.147</thermal_conduc>

    <heat_capac>0.0</heat_capac>

    </Material>

    -<Material material_id="0abac72e-83ff-11e6-aba6-2cd444b2e704">

    <name>Gypsumboard</name>

    <density>975.0</density>

    <thermal_conduc>0.6</thermal_conduc>

    <heat_capac>0.84</heat_capac>

    </Material>

    -<Material material_id="0aba790e-83ff-11e6-8468-2cd444b2e704">

    <name>WetterschaleausBeton</name>

    <density>2200.0</density>

    <thermal_conduc>1.65</thermal_conduc>

    <heat_capac>1.0</heat_capac>

    </Material>

    -<Material material_id="0aba7915-83ff-11e6-8883-2cd444b2e704">

    <name>Sandwichpaneel</name>

    <density>30.0</density>

    <thermal_conduc>0.04</thermal_conduc>

    <heat_capac>1.0</heat_capac>

    </Material>

    -<Material material_id="0abb8a82-83ff-11e6-8ff5-2cd444b2e704">

    <name>Kalkputz</name>

    <density>1600.0</density>

    <thermal_conduc>0.8</thermal_conduc>

    <heat_capac>1.0</heat_capac>



  • @jsulm yes it is exactly my problem..how can I do that?


  • Qt Champions 2018

    @MomoAlex said in How can I connect Qcombobox with Qlineedit to import data from xml file ?:

    how can I do that?

    Well, iterate over all Material elements and search for the one containing the given name. If you find one then take the dencity.



  • @jsulm could you give me example for it? I'm trying to solve it since 3 weeks but I still clueless



  • working on a fix for you @MomoAlex but one of your issues is that you are using the Designer to produce your code and the spews out some of the ugliest code I have ever seen -- I always strongly suggest that folks stop using it and learn to create that GUI from scratch it actually does not take that much longer and what you have when you are done is extremely easier to work with AND more importantly you have a better understanding of how to manipulate it to get it to do the things you want it to.



  • @Denni Thank you very much for your advice. I thought on the beginning that would be easier to use Qt Designer but at the end I lost a lot of time and as I said I still beginner and started with python for 2 months.



  • Okay using your program you have posted and using the data you have posted I get an error when it tries to parse your data can you please clean these up to make sure they are fully functional -- that will speed things up greatly



  • @Denni you can find them by this link:
    https://drive.google.com/drive/folders/1fnSGc91_pam86NBCgZ12_d66MUw-5I6O?usp=sharing
    thank you for your effort



  • @Denni Do you have something new?



  • Should have something soon-ish -- keep in mind this is a side gig for me not my main one ;) However I do have most of it rewritten just need to get the final pieces in place and make sure all the items are connected



  • Okay I have restructured your program throwing out all that unnecessary garbage that the designer barfs up and replaced it with a much more streamlined pythonic classified flow -- I have also included explanation text where I thought might be helpful -- I have done this to help teach you how to fish rather than just giving you the fish -- there are elements to this that could be expanded upon and/or altered depending on your needs but this should give you a solid ground floor to work from as well as a template to do other things with -- again do yourself a major favor and stop using that Designer the code it gurgitates looks just like programming vomit and is very difficult to work with and doing it without the designer is actually just as easy or easier. So here is that code hope it helps:

    import re
    from os  import path as osPath
    from sys import exit as sysExit
    
    import xml.etree.ElementTree as etETree
    
    from PyQt5.QtCore    import QSettings
    from PyQt5.QtWidgets import QApplication, QWidget, QTabWidget, QGridLayout, QDialogButtonBox, QVBoxLayout, QHBoxLayout
    from PyQt5.QtWidgets import QLabel, QLineEdit, QPushButton, QComboBox
    
    # This class is separate and as such could be removed and simply imported
    # it is done so that the MVC (Model-View-Controller) aspect of the program
    # can be maintained as well as to create an object that can be shared with
    # other programs without the need of rewriting or even copy/pasting
    class DataHandler:
        def __init__(self, SourcePath):
            self.Source = SourcePath
    
          # Establish Full Path to the Data Source
          # I have included this for completeness purposes mostly and because
          # it was mostly just a simple copy/paste for me to do so
            SourceFilePath = ''
            if len(SourcePath) > 0 and osPath.isfile(SourcePath):
                SourceFilePath = SourcePath
            else:
                SourceFilePath = str(QSettings('Company','Project').value('LastSource'))
    
            if len(SourceFilePath) == 0:
                SourceFilePath = self.SetDatabase()
            
            # If SourceFilePath is still empty the user has chosen not to supply a valid source abort the program 
            if len(SourceFilePath) < 1: 
                sysExit()
    
            QSettings('Company','Project').setValue('LastSource', SourceFilePath)
            self.__SourcePathName = SourceFilePath
    
        @property
        def Source(self):
            return self.__SourcePathName
    
        @Source.setter
        def Source(self, value):
            self.__SourcePathName = value
    
        # Again included for completeness purposes for this class and all that would be
        # needed is a button or file menu item to allow for choosing another file of course
        # some tweaking would be required since it was made to be totally generic
        # Lastly it was mostly just a simple copy/paste for me to do so 
        def SetSource(self):
            filter  = "ext(*.ext)"
            caption = "Please Select a Valid Source File"
            path    = str(QSettings('Company','Project').value('LastSource'))
            if len(path) > 0:
                path = osPath.dirname(path)
            else:
                path = str(QDir.currentPath())
    
            IsSource = False
            dbContinue = True
            while dbContinue:
                FindProj = QFileDialog()
                FindProj.setModal(True)
                FindProj.setFixedSize(FindProj.size())
                filePathName = FindProj.getOpenFileName(None, caption, path, filter )[0];
    
                # Is this a legitimate file
                if osPath.isfile(filePathName):
                    filPthNam, fileExt = ntSplitext(filePathName)
                    # Does it have a legitimate file extension
                    if fileExt == '.ext':
                        IsSource = True
    
                if not IsSource:
                    ValidMsg = QMessageBox()
                    ValidMsg.setIcon(QMessageBox.Warning)
                    ValidMsg.setWindowTitle('Project Source File')
                    ValidMsg.setText('This is not a Valid Source would you like to try again?')
                    ValidMsg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
                    ValidMsg.setDefaultButton(QMessageBox.No)
                    ValidMsg.setWindowFlags(Qt.WindowStaysOnTopHint)
    
                    MsgReply = ValidMsg.exec_()
                    if MsgReply == QMessageBox.No:
                        dbContinue = False
                        filePathName = ''
                else:
                    QSettings('Company','Project').setValue("LastSource",osPath.dirname(filePathName))
                    dbContinue = False
    
            return filePathName
            self.__SQLDef = value
        
        def ReadSource(self):
            try:
              # Read Source file into local Dictionaries as working with raw data is never
              # nice and can have unexpected results at times best to catch it early also it
              # means the rest of the code can be handled the same way regardless of what the
              # source was and all that needs to be changed is this function if the source
              # changes later on
                xmlTree = etETree.parse(self.Source)
                root = xmlTree.getroot()
    
              # Note keep in mind that this has been engineered to handle a specific XML file
              # layout and what it returns if the files format changes then this would need to
              # either be changed or augmented in some way          
                self.xmlData = {}
                for child in root:
                    MatId = child.attrib['material_id']
                    Idx = 0
                    Nodes = {}
                    for attrib in child:
                        Tag = re.sub(r'.*}',' ',child[Idx].tag).strip()
                        Txt = child[Idx].text
                        Nodes[Tag] = Txt
                        Idx += 1
                    self.xmlData[MatId] = Nodes.copy()
    
            except Exception as err:
                print("ERROR : ReadSource :",err)
                print("Source : [" + self.__SourcePathName + "]")
                sysExit()
    
        def GetCatalog(self):
          # The Catalog is simply a List of the Names found within our xmlData
          # Note might want to look into sorting this list alphabetically but
          # that might not be needed so did not do it
            Catalog = []
            for item in self.xmlData:
                MatItem = self.xmlData[item]
                Catalog.append(MatItem['name'])
    
            return Catalog
    
        def GetMatItem(self, MatName):
            for item in self.xmlData:
                MatItem = self.xmlData[item]
                if MatItem['name'] == MatName:
                    return MatItem
    
            return {}
    
    # We create a Tab Class (since they were all the same) so we can instantiate 
    # more than one of these without having to reproduce the wheel each time
    class Tab(QWidget):
        def __init__(self, parent, inTabId):
            QTabWidget.__init__(self, parent)
    
            self.TabId = inTabId
            self.MainWin = parent
    
          # Spacer Label used to create space where desired
          # there might a more pyqt5 way of doing this though
            self.lblSpcr = QLabel('                         ')
            
    ####### First GUI Section
          # Creating the Tab Box from Top Down to make it more Intuitive
    
          # Create the Load Catalog Button and give it an appropriate name 
          # also keep associated things named in-sync for easier referencing      
            self.btnCatLodr = QPushButton('Load Catalog')
            self.btnCatLodr.clicked.connect(self.LoadCatalog)
    
          # Note if the positioning of the button is desired to be more centered
          # then simply add another Stretch to the other side and play with the
          # Stretch values until you have it position more to your liking
            self.TopHHldr = QHBoxLayout()
            self.TopHHldr.addWidget(self.lblSpcr)
            self.TopHHldr.addWidget(self.btnCatLodr)
            self.TopHHldr.addStretch(1)
    
    ####### Second GUI Section
    
          # Next are the elements contained within the Grid as the other buttons do 
          # not benefit from the Grid and actually are not as easy to implement since
          # the Stretch works differently within the Grid
     
          # Next was the Catalog ComboBox with its Label gave it a more appropriate
          # name but also was not sure if its current label had been misplaced or not
            self.lblCatg =  QLabel('Catalog')
            self.cboCatg = QComboBox()
            self.cboCatg.activated['QString'].connect(self.MatChanged)
            self.cboCatg.setObjectName("cboCat")
            self.cboCatg.addItem('')
            self.cboCatg.setItemText(0, 'Plese Press Load Catalog')
    
          # Material and its Label
          # Note this is redundant since it gets displayed as the selection
          # for the combobox but you had it here so I included it
            self.lblMatl = QLabel('Material')
            self.ledMatl = QLineEdit()
            self.ledMatl.setPlaceholderText('Material Name')
    
          # Area and its Label
            self.lblArea = QLabel('Area')
            self.ledArea = QLineEdit()
            self.ledArea.setPlaceholderText('m²')
    
          # Thickness and its Label
            self.lblThck = QLabel('Thickness')
            self.ledThck = QLineEdit()
            self.ledThck.setPlaceholderText('m')
    
          # U-Value and its Label
            self.lblUVal = QLabel('U-Value')
            self.ledUVal = QLineEdit()
            self.ledUVal.setPlaceholderText('W/(K*m²)')
    
          # Density and its Label
            self.lblDens = QLabel('Density')
            self.ledDens = QLineEdit()
            self.ledDens.setPlaceholderText('kg/m³')
    
          # Conductivity and its Label
            self.lblCond = QLabel('Conductivity')
            self.ledCond = QLineEdit()
            self.ledCond.setPlaceholderText('W/(K*m)')
    
          # Heat Capacity and its Label
            self.lblHCap = QLabel('Heat Capacity')
            self.ledHCap = QLineEdit()
            self.ledHCap.setPlaceholderText('J/K')
    
          # Now we put all of these into our Grid
          # Note although not necessary, the reason for uniform abbreviation
          # lengths are to assist in easier readability as can be seen below
            self.TheGrid = QGridLayout()
            self.TheGrid.setObjectName("TheGrid")
            
            self.TheGrid.addWidget(self.lblSpcr, 0, 0)
            self.TheGrid.addWidget(self.lblCatg, 1, 0)
            self.TheGrid.addWidget(self.cboCatg, 1, 1)
    
            self.TheGrid.addWidget(self.lblSpcr, 2, 0)
            self.TheGrid.addWidget(self.lblMatl, 3, 0)
            self.TheGrid.addWidget(self.ledMatl, 3, 1)
    
            self.TheGrid.addWidget(self.lblSpcr, 4, 0)
            self.TheGrid.addWidget(self.lblArea, 5, 0)
            self.TheGrid.addWidget(self.ledArea, 5, 1)
    
            self.TheGrid.addWidget(self.lblSpcr, 6, 0)
            self.TheGrid.addWidget(self.lblThck, 7, 0)
            self.TheGrid.addWidget(self.ledThck, 7, 1)
    
            self.TheGrid.addWidget(self.lblSpcr, 8, 0)
            self.TheGrid.addWidget(self.lblUVal, 9, 0)
            self.TheGrid.addWidget(self.ledUVal, 9, 1)
    
            self.TheGrid.addWidget(self.lblSpcr,10, 0)
            self.TheGrid.addWidget(self.lblDens,11, 0)
            self.TheGrid.addWidget(self.ledDens,11, 1)
    
            self.TheGrid.addWidget(self.lblSpcr,12, 0)
            self.TheGrid.addWidget(self.lblCond,13, 0)
            self.TheGrid.addWidget(self.ledCond,13, 1)
    
            self.TheGrid.addWidget(self.lblSpcr,14, 0)
            self.TheGrid.addWidget(self.lblHCap,15, 0)
            self.TheGrid.addWidget(self.ledHCap,15, 1)
    
    ####### Third GUI Section
    
          # Next we make the buttons at the bottom of the screen
          # in such a way that we can use them later on more efficiently
          #
          # Note the cleaner implementation of these 2 buttons would have them
          # be outside the Tabs but since you included them inside then so have I
            self.btnOkay = QPushButton('Okay')
            self.btnOkay.setObjectName('btnOkay')
            self.btnOkay.clicked.connect(self.OkayPressed)
    
            self.btnCancel = QPushButton('Cancel')
            self.btnCancel.setObjectName('btnCancel')
            self.btnCancel.clicked.connect(self.CancelPressed)
    
            self.BtmHHldr = QHBoxLayout()
            self.BtmHHldr.addStretch(2)
            self.BtmHHldr.addWidget(self.btnOkay)
            self.BtmHHldr.addWidget(self.btnCancel)
    
    ####### Final GUI Section
    
          # Now we put our 3 major pieces into a Vertial Container
            self.VLayout = QVBoxLayout()
            self.VLayout.addWidget(self.lblSpcr)
            self.VLayout.addLayout(self.TopHHldr)
            self.VLayout.addLayout(self.TheGrid)
            self.VLayout.addStretch(1)
            self.VLayout.addLayout(self.BtmHHldr)
    
          # And we put that vertical container within our Widget
            self.setLayout(self.VLayout)
    
        def LoadCatalog(self):
          # This is implemented as such because parameters cannot 
          # be included within a connect statement and it allows for
          # easier autonomy
            self.MainWin.LoadCatalog(self.TabId)
    
        def MatChanged(self):
          # This is implemented as such because parameters cannot 
          # be included within a connect statement and it allows for 
          # easier autonomy
            self.MainWin.SelectnChngd(self.TabId)
    
        def OkayPressed(self):
          # Place Holder Function for the most part
            print('You pressed Okay')
    
        def CancelPressed(self):
          # Place Holder Function for the most part
            print('You pressed Cancel')
            sysExit()
    
    class MainTabWidget(QTabWidget):
        def __init__(self, SourceFile, parent=None):
            QTabWidget.__init__(self, parent)
    
            self.setObjectName("TabWidgetWalls")
            self.resize(494, 493)
            self.setTabShape(QTabWidget.Triangular)
    
            self.Source = DataHandler(SourceFile)
            self.SourceLoaded = False
    
            self.Tab = []
    
            self.Tab.append(Tab(self, 0))
            self.addTab(self.Tab[0], "Wall 1")
     
            self.Tab.append(Tab(self, 1))
            self.addTab(self.Tab[1], "Wall 2")
     
            self.Tab.append(Tab(self, 2))
            self.addTab(self.Tab[2], "Wall 3")
     
            self.Tab.append(Tab(self, 3))
            self.addTab(self.Tab[3], "Wall 4")
    
            self.setCurrentIndex(0)
    
      # These are located out here because they have less to do with the
      # GUI View and more to do with communicating with the Model and directing
      # the data to the GUI View -- aka this is sort-of the Controller
        def LoadCatalog(self, TabIdx):
            if not self.SourceLoaded:
              # Do Not want to do this more than once per file
              # If a load new file is added then SourceLoaded 
              # would be set to False within that routine however
              # if this is needed separately for each Tab then it
              # needs to be an array instead of just a value
                self.SourceLoaded = True
                self.Source.ReadSource()
    
            self.Catalog = self.Source.GetCatalog()
    
            self.Tab[TabIdx].cboCatg.clear()
            self.Tab[TabIdx].cboCatg.addItem('Make Selection')
            for MatName in self.Catalog:
                self.Tab[TabIdx].cboCatg.addItem(MatName)
    
        def SelectnChngd(self, TabIdx):
            MatName = self.Tab[TabIdx].cboCatg.currentText()
    
            self.MatItem = self.Source.GetMatItem(MatName)
    
            if 'name' in self.MatItem:
                self.Tab[TabIdx].ledMatl.setText(self.MatItem['name'])
    
            if 'area' in self.MatItem:
                self.Tab[TabIdx].ledArea.setText(self.MatItem['area'])
    
            if 'thickness' in self.MatItem:
                self.Tab[TabIdx].ledThck.setText(self.MatItem['thickness'])
    
            if 'u-value' in self.MatItem:
                self.Tab[TabIdx].ledUVal.setText(self.MatItem['u-value'])
    
            if 'density' in self.MatItem:
                self.Tab[TabIdx].ledDens.setText(self.MatItem['density'])
    
            if 'thermal_conduc' in self.MatItem:
                self.Tab[TabIdx].ledCond.setText(self.MatItem['thermal_conduc'])
    
            if 'heat_capac' in self.MatItem:
                self.Tab[TabIdx].ledHCap.setText(self.MatItem['heat_capac'])
    
    if __name__ == "__main__":
        MainThred = QApplication([])
    
      # I moved this here to simulate using sys.argv to receive
      # a command line file name however this could just as easily
      # be excluded and the user could be prompted using the class
      # method to give the program its source file or it could be
      # hard-coded into that class but then hard-coding anything
      # (like the below) is generally a bad idea
        base_path = osPath.dirname(osPath.realpath(__file__))
        SourceFile = osPath.join(base_path, "Data\\MaterialTemplates_v4.xml")
    
        MainGUI = MainTabWidget(SourceFile)
        MainGUI.show()
    
        sysExit(MainThred.exec_())
    

    P.S. Please let me know if this has helped anyone -- I do not need kudos but knowing that it actually helped someone is encouraging



  • @Denni
    that is really amazing and that helped me a lot. Thank you very much for making it easier for me and I would like to stay with you in contact if you don't mind.
    How could I improve my skills in Qt?



  • Feel free to reach out anytime djensen765@gmail.com

    How to improve your skills? Just keep working at it and do your best not to settle for second best. Put quality on the top of your list then just practice and think about what you are doing. Sometimes re-think about what you were doing and see if you might not have done it better. Do NOT adhere to that adage that "If it aint broke then dont fix it" because that thinking is what causes lots of issues later on -- like having the design of the worlds most sophisticated mode of travel being dictated to by the width of 2 horses rear-ends because sometimes just because it works does not mean it works well or is the best. Yes there is the need for the 80% solution but if you strive for the stars you just might end up on the moon but if you aim for a mud puddle you will definitely be knee deep in it.

    Lastly engineer your program to be as much Model-Controller-View as you can keeping each element as separate and self contained as possible this allows for easier plug-n-play of components later on allowing you to re-use perhaps whole classes of code for numerous projects. Also if you find yourself creating duplicate or even semi-similar code sections perhaps it ought to be made more generic and done once instead of twice (or more). Oh and help others sometimes the greatest learning comes from trying to teach someone else -- as the greatest teachers in the world are ones that constantly learn from their students.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.