Como criar PyQt5 QTableWidget no Qt Designer

Neste artigo, queremos aprender a criar PyQt5 QTableWidget em Qt Designer, para criar a tabela em pyqt5 com Qt Designer precisamos usar QTableWidget classe, classe QTableWidget fornece item baseado exibição de tabela com o modelo padrão determinado. Os widgets de tabela fornecem mídia de exibição de painel padrão para aplicativos. Os itens no  QTableWidget  são fornecidos pelo QTableWidgetItem.

Você precisa abrir seu Qt Designer no PyQt5, porque queremos criar tablewidget usando Qt Designer, você pode simplesmente escrever  pyqt5designer  em seu terminal, após abrir o Qt Designer

você precisa criar uma janela Widgets . agora adicionamos widgets no Qt Designer.

  • Adicionar QVBoxLayout no Qt Designer
  • Adicione um item QTableWidget em QVBoxLayout

Agora você pode adicionar linhas, colunas e também itens em seu QTableWidget. clique com o botão direito no painel do widget e clique em  Editar item , e a partir daí você pode adicionar colunas. então isso é

nossas colunas.

Estas são as linhas para qtablewidget.

Estas são as entradas para qtablewidget.

Alternativamente, você pode adicionar estilos ao QTableWidget clicando com o botão direito do mouse no tablewidget e escolhendo Alterar folha de estilo.

QTableWidget {

background-color:rgb(255, 255, 0)
  



}

E aqui está o nosso design.

Depois de concluir o projeto, você precisa salvar seu projeto, a extensão será. arquivo ui . Agora é hora de nossa conversão. ui  submetido. arquivo py . Existem duas maneiras de fazer isso, a primeira maneira é carregar o arquivo ui, a segunda maneira é converter o arquivo .ui em um arquivo .py, queremos usar o segundo. para converter um arquivo ui em um arquivo python, precisamos usar o módulo pyuic5 , este módulo está localizado na pasta Scripts de sua instalação python, você precisa copiar o arquivo ui na pasta Scripts de seu amigo de instalação python. em seguida, abra o terminal na pasta de scripts e execute este comando.
 

pyuic5 tablewidget.ui -o tablewidgetex.py -x

E aqui está o código convertido.

# -*- coding: utf-8 -*-

# Form implementation generated from 
# reading ui file 'tabelwidget.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this 
# file will be lost when pyuic5 is
# run again.  Do not edit this file unless you 
# know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(435, 313)
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(Form)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.tableWidget = QtWidgets.QTableWidget(Form)
        self.tableWidget.setStyleSheet("QTableWidget {\n"
"\n"
"background-color:rgb(255, 255, 0)\n"
"  \n"
"\n"
"\n"
"\n"
"}")
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(4)
        self.tableWidget.setRowCount(3)
        item = QtWidgets.QTableWidgetItem()
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.NoBrush)
        item.setForeground(brush)
        self.tableWidget.setVerticalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setVerticalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setVerticalHeaderItem(2, item)
        item = QtWidgets.QTableWidgetItem()
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        self.tableWidget.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        self.tableWidget.setHorizontalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        self.tableWidget.setHorizontalHeaderItem(2, item)
        item = QtWidgets.QTableWidgetItem()
        font = QtGui.QFont()
        font.setPointSize(12)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        self.tableWidget.setHorizontalHeaderItem(3, item)
        item = QtWidgets.QTableWidgetItem()
        brush = QtGui.QBrush(QtGui.QColor(255, 0, 0))
        brush.setStyle(QtCore.Qt.NoBrush)
        item.setForeground(brush)
        self.tableWidget.setItem(0, 0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(0, 1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(0, 2, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(0, 3, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(1, 0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(1, 1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(1, 2, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(1, 3, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(2, 0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(2, 1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(2, 2, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setItem(2, 3, item)
        self.verticalLayout.addWidget(self.tableWidget)
        self.verticalLayout_2.addLayout(self.verticalLayout)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "PyQt5 TableWidget"))
        item = self.tableWidget.verticalHeaderItem(0)
        item.setText(_translate("Form", "1"))
        item = self.tableWidget.verticalHeaderItem(1)
        item.setText(_translate("Form", "2"))
        item = self.tableWidget.verticalHeaderItem(2)
        item.setText(_translate("Form", "3"))
        item = self.tableWidget.horizontalHeaderItem(0)
        item.setText(_translate("Form", "Name"))
        item = self.tableWidget.horizontalHeaderItem(1)
        item.setText(_translate("Form", "Email"))
        item = self.tableWidget.horizontalHeaderItem(2)
        item.setText(_translate("Form", "Phone"))
        item = self.tableWidget.horizontalHeaderItem(3)
        item.setText(_translate("Form", "Address"))
        __sortingEnabled = self.tableWidget.isSortingEnabled()
        self.tableWidget.setSortingEnabled(False)
        item = self.tableWidget.item(0, 0)
        item.setText(_translate("Form", "Parwiz"))
        item = self.tableWidget.item(0, 1)
        item.setText(_translate("Form", "par@gmail.com"))
        item = self.tableWidget.item(0, 2)
        item.setText(_translate("Form", "5656565"))
        item = self.tableWidget.item(0, 3)
        item.setText(_translate("Form", "This is address"))
        item = self.tableWidget.item(1, 0)
        item.setText(_translate("Form", "John Doe"))
        item = self.tableWidget.item(1, 1)
        item.setText(_translate("Form", "john@gmail.com"))
        item = self.tableWidget.item(1, 2)
        item.setText(_translate("Form", "2323232"))
        item = self.tableWidget.item(1, 3)
        item.setText(_translate("Form", "This is address"))
        item = self.tableWidget.item(2, 0)
        item.setText(_translate("Form", "New Name"))
        item = self.tableWidget.item(2, 1)
        item.setText(_translate("Form", "new@gmail.com"))
        item = self.tableWidget.item(2, 2)
        item.setText(_translate("Form", "34342323"))
        item = self.tableWidget.item(2, 3)
        item.setText(_translate("Form", "New Address"))
        self.tableWidget.setSortingEnabled(__sortingEnabled)


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Form = QtWidgets.QWidget()
    ui = Ui_Form()
    ui.setupUi(Form)
    Form.show()
    sys.exit(app.exec_())
    

Agora execute o código completo e aqui estão os resultados.


 

What is GEEK

Buddha Community

Landscapes Website Design | Nature Landscapes Website Designer

Most landscapers think of their website as an online brochure. In reality of consumers have admitted to judging a company’s credibility based on their web design, making your website a virtual sales rep capable of generating massive amounts of leads and sales. If your website isn’t actively increasing leads and new landscaping contracts, it may be time for a redesign.

DataIT Solutions specializes in landscape website designing that are not only beautiful but also rank well in search engine results and convert your visitors into customers. We’ve specialized in the landscaping industry for over 10 years, and we look at your business from an owner’s perspective.

Why use our Landscapes for your landscape design?

  • Superior experience
  • Friendly personal service
  • Choice of design layout
  • Budget sensitive designs
  • Impartial product choice and advice
  • Planting and lighting designs

Want to talk about your website?
If you are a gardener or have a gardening company please do not hesitate to contact us for a quote.
Need help with your website?
Get in touch

#nature landscapes website design #landscapes website design #website design #website designing #website designer #designer

Juned Ghanchi

1621315250

Designing Mobile Apps using the latest UI Design Principles

The mobile technology world is growing at the speed of light, and the apps have become an integral part of our daily life. We can now see an influx of technology with tools that can help create mobile apps. All of them are becoming more accessible and hence people are getting on their first app making journeys. Since the mobile app industry is getting bigger and better than ever, businesses from all corners of the world are trying to develop mobile apps for their operations and marketing. Designing a mobile app for businesses is the first step, though. Company owners are in charge of the basic look and feel of the designed product. With a brilliant mobile app design, one can establish a relationship between app and user very well.

Read Blog Here: https://www.indianappdevelopers.com/blog/designing-mobile-apps-using-latest-ui-design-principles/

#designing mobile apps #ui design principles #mobile ui design #mobile app design #ui design #app design

Security Website Design

As web developers, we strive to meet your specific needs by creating a website that is user-friendly and remains relevant to the current design trends. This ensures that your website grabs the attention of your audience and keeps you ahead of your competitors.

DataIT Solutions team of experts works collaboratively to create ideas that can meet your requirements. Our Website Designing Company believes in High-Quality Professional Website Designing for your Security Website Designing. Our designers have experience in working on a wide array of projects, including websites of the next generation. We listen to your needs and then deliver.

Our Expertise includes:

  • Dot Net Development
  • PHP Development
  • HTML5 Development
  • IOS App Development
  • Android App Development
  • Website Security services

Our team of experts has the expertise, knowledge, and skills to take control and dominate the web design industry over the next couple of years. They are on hand to listen to your ideas, goals, and help you to have a website that is unique and works with your business and brand.

Looking for a better design? Need a professional web design?
Get in touch with our, Web Design Professional experts.

#security website design #security website designing #security website designer #website designer #website designing #website design

How To Make Marvelous Microcopy: 7 Surefire Tips

Good microcopy is one of the fastest ways to improve an interface. Try doing an audit on your UI with these tips to see how it stands up.

1) Use personal pronouns

Address the reader instead of just talking out loud. Use the word you. People pay more attention when you talk directly to them.

#design #web-design #product-design #ux-design #ui-design #design-principles #microcopy #ux-writing

UI/UX Design Principles: Guide to Perfect App Designing Process - TopDevelopers.co

Following the app design process and UI/UX design principles rightly guide UI/UX designers to purvey app designs that help in developing efficient mobile apps.
In this article, we will discuss a perfect app designing process that will help you build a mobile app with a great design that attracts the targeted audience and increases user engagement, hence boosting the conversion rate for an app.

#role of ui & ux design in app development #app design tips to follow #ui/ux design strategies #app designing process #ui/ux designers #ui design