Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can i add a button and qlineedit here?
Forum Updated to NodeBB v4.3 + New Features

How can i add a button and qlineedit here?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 848 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    import sys
    from PyQt4.QtGui import *
    from PyQt4.QtCore import *
    import mysql.connector
    from PyQt4.QtSql import *
    class Example(QWidget):

    def __init__(self): 
        super(Example, self).__init__() 
         
        self.initUI() 
         
    def initUI(self):        
        hbox = QHBoxLayout(self)  
        topleft = QFrame() 
        topleft.setFrameShape(QFrame.StyledPanel) 
        bottom = QFrame() 
        bottom.setFrameShape(QFrame.StyledPanel)
    
            
        splitter1 = QSplitter(Qt.Horizontal) 
        db = QSqlDatabase.addDatabase("QMYSQL")
    
        db.setHostName("localhost")
        db.setDatabaseName("incoming_mac")
        db.setUserName("root")
        db.setPassword("admingelo")
        db.open()
    
        projectModel = QSqlQueryModel()
        projectModel.setQuery("select * from incoming_mac_records",db)
    
        projectView = QTableView()
        projectView.setModel(projectModel)
        projectView.resizeColumnsToContents()
        projectView = QTableView()
        projectView.setModel(projectModel)
        projectView.resizeColumnsToContents()
        splitter1.addWidget(projectView)
        splitter1.setSizes([150,500]) 
        splitter2 = QSplitter(Qt.Vertical)
        splitter2.addWidget(splitter1)
        hbox.addWidget(splitter2)
        
        self.setLayout(hbox) 
        QApplication.setStyle(QStyleFactory.create('Cleanlooks')) 
         
        self.setGeometry(50, 50, 1200, 700) 
    
        self.setWindowTitle('QSplitter demo') 
        self.show() 
    

    def main():
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())
    if name == 'main':
    main()

    jsulmJ 1 Reply Last reply
    0
    • ? A Former User

      import sys
      from PyQt4.QtGui import *
      from PyQt4.QtCore import *
      import mysql.connector
      from PyQt4.QtSql import *
      class Example(QWidget):

      def __init__(self): 
          super(Example, self).__init__() 
           
          self.initUI() 
           
      def initUI(self):        
          hbox = QHBoxLayout(self)  
          topleft = QFrame() 
          topleft.setFrameShape(QFrame.StyledPanel) 
          bottom = QFrame() 
          bottom.setFrameShape(QFrame.StyledPanel)
      
              
          splitter1 = QSplitter(Qt.Horizontal) 
          db = QSqlDatabase.addDatabase("QMYSQL")
      
          db.setHostName("localhost")
          db.setDatabaseName("incoming_mac")
          db.setUserName("root")
          db.setPassword("admingelo")
          db.open()
      
          projectModel = QSqlQueryModel()
          projectModel.setQuery("select * from incoming_mac_records",db)
      
          projectView = QTableView()
          projectView.setModel(projectModel)
          projectView.resizeColumnsToContents()
          projectView = QTableView()
          projectView.setModel(projectModel)
          projectView.resizeColumnsToContents()
          splitter1.addWidget(projectView)
          splitter1.setSizes([150,500]) 
          splitter2 = QSplitter(Qt.Vertical)
          splitter2.addWidget(splitter1)
          hbox.addWidget(splitter2)
          
          self.setLayout(hbox) 
          QApplication.setStyle(QStyleFactory.create('Cleanlooks')) 
           
          self.setGeometry(50, 50, 1200, 700) 
      
          self.setWindowTitle('QSplitter demo') 
          self.show() 
      

      def main():
      app = QApplication(sys.argv)
      ex = Example()
      sys.exit(app.exec_())
      if name == 'main':
      main()

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Gelo What exactly is the problem?
      If you need a button then create one and add it the layout, same for line edit.
      And what do you mean with "here"? Where do you want to add them?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      ? 1 Reply Last reply
      3
      • jsulmJ jsulm

        @Gelo What exactly is the problem?
        If you need a button then create one and add it the layout, same for line edit.
        And what do you mean with "here"? Where do you want to add them?

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @jsulm Already figure it out thank you so much :)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved