Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. load uic file
Forum Updated to NodeBB v4.3 + New Features

load uic file

Scheduled Pinned Locked Moved Unsolved Qt for Python
6 Posts 2 Posters 652 Views
  • 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.
  • M Offline
    M Offline
    MaMo
    wrote on last edited by MaMo
    #1

    I have found the following topic, which i would like to adopt in part:
    https://forum.qt.io/topic/124028/display-custom-list-of-files-in-qtreeview-using-qfilesystemmodel-or-qabstractitemmodel/6

    Can someone please tell me how to convert the code so that the data is output to a specified UI file?

    JonBJ 1 Reply Last reply
    0
    • M MaMo

      I have found the following topic, which i would like to adopt in part:
      https://forum.qt.io/topic/124028/display-custom-list-of-files-in-qtreeview-using-qfilesystemmodel-or-qabstractitemmodel/6

      Can someone please tell me how to convert the code so that the data is output to a specified UI file?

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @MaMo
      There is no output or data in that topic. It's just about displaying files in a treeview. What is "a specified UI file"? What does your title "load uic file" mean?

      M 1 Reply Last reply
      0
      • M Offline
        M Offline
        MaMo
        wrote on last edited by MaMo
        #3

        I have created a complex window with qt designer with a treeview. This is saved as a UI file. Now i would like to know how i can integrate this file into the code from the other topic.

        JonBJ 1 Reply Last reply
        0
        • JonBJ JonB

          @MaMo
          There is no output or data in that topic. It's just about displaying files in a treeview. What is "a specified UI file"? What does your title "load uic file" mean?

          M Offline
          M Offline
          MaMo
          wrote on last edited by
          #4

          @JonB
          Sorry, wrong comment was linked. I corrected the link above now.

          1 Reply Last reply
          0
          • M MaMo

            I have created a complex window with qt designer with a treeview. This is saved as a UI file. Now i would like to know how i can integrate this file into the code from the other topic.

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by JonB
            #5

            @MaMo
            From your .ui file you either generate a .py file from it or you dynamically load it at runtime (https://doc.qt.io/qtforpython-6/tutorials/basictutorial/uifiles.html). Either way you end up with a QTreeView or a class derived from it. You then call treeView.setModel(theFileSystemModel) at runtime to connect the view to the model (https://doc.qt.io/qtforpython-5/PySide2/QtWidgets/QTreeView.html#detailed-description).

            1 Reply Last reply
            1
            • M Offline
              M Offline
              MaMo
              wrote on last edited by
              #6

              I have always integrated the ui as follows:

              from PyQt5 import QtWidgets, QtCore, uic
              
              
              class ListMovies(QtWidgets.QMainWindow):
                  def __init__(self):
                      super().__init__()
              
                      uic.loadUi("GUI\GUI_Movies.ui", self)
              
                      self.readAllMoviesButton.clicked.connect(self.on_read_all_entry)
                      self.readMainMoviesButton.clicked.connect(self.on_read_main_entry)
                      self.updateListButton.clicked.connect(self.on_update_list)
                      self.addListButton.clicked.connect(self.on_add_list)
                      self.newEntryButton.clicked.connect(self.on_new_entry)
                      self.saveCsvButton.clicked.connect(self.on_save_csv)
                      self.saveXlsButton.clicked.connect(self.on_save_xls)
              
                      # self.actionSave.triggered.connect(self.on_save)
              
                      self.moviesTable.itemDoubleClicked.connect(self.OpenLink)
              
                      self.progressBar.hide()
              
                      ui_width = self.width()
                      ui_height = self.height()
              
                      # self.setFixedWidth(ui_width)
                      # self.setFixedHeight(ui_height)
              
                      xy = fc.center_window(self, ui_width, ui_height)
                      self.move(int(xy[0]), int(xy[1]))
              
                      self.show()
              

              Can someone please tell me how to insert it exactly into the code linked above?
              Maybe someone can even give me the right lines of code?

              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