久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='zFzf9'></bdo><ul id='zFzf9'></ul>
    <tfoot id='zFzf9'></tfoot>

      <legend id='zFzf9'><style id='zFzf9'><dir id='zFzf9'><q id='zFzf9'></q></dir></style></legend>

      <small id='zFzf9'></small><noframes id='zFzf9'>

      1. <i id='zFzf9'><tr id='zFzf9'><dt id='zFzf9'><q id='zFzf9'><span id='zFzf9'><b id='zFzf9'><form id='zFzf9'><ins id='zFzf9'></ins><ul id='zFzf9'></ul><sub id='zFzf9'></sub></form><legend id='zFzf9'></legend><bdo id='zFzf9'><pre id='zFzf9'><center id='zFzf9'></center></pre></bdo></b><th id='zFzf9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='zFzf9'><tfoot id='zFzf9'></tfoot><dl id='zFzf9'><fieldset id='zFzf9'></fieldset></dl></div>
      2. 為 QTableWidget 的列分配不同的寬度

        Assign different widths to columns of a QTableWidget(為 QTableWidget 的列分配不同的寬度)

        <small id='cmLFc'></small><noframes id='cmLFc'>

            <tbody id='cmLFc'></tbody>

            <i id='cmLFc'><tr id='cmLFc'><dt id='cmLFc'><q id='cmLFc'><span id='cmLFc'><b id='cmLFc'><form id='cmLFc'><ins id='cmLFc'></ins><ul id='cmLFc'></ul><sub id='cmLFc'></sub></form><legend id='cmLFc'></legend><bdo id='cmLFc'><pre id='cmLFc'><center id='cmLFc'></center></pre></bdo></b><th id='cmLFc'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='cmLFc'><tfoot id='cmLFc'></tfoot><dl id='cmLFc'><fieldset id='cmLFc'></fieldset></dl></div>
              <bdo id='cmLFc'></bdo><ul id='cmLFc'></ul>

                • <tfoot id='cmLFc'></tfoot>
                • <legend id='cmLFc'><style id='cmLFc'><dir id='cmLFc'><q id='cmLFc'></q></dir></style></legend>
                  本文介紹了為 QTableWidget 的列分配不同的寬度的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在 QT Designerpyqt5 中開發一個小界面,其中包括一個 QTableWidget 但我想分配不同的列的寬度,我找到了談論相同的主題,但我不知道在哪里插入他們提供的代碼,我不知道是不是因為版本,我很新在 QT 設計器中.

                  I'm developing a small interface in pyqt5 from QT Designer, this includes a QTableWidget but I want to assign different widths to the columns, I have found topics that talk about the same but I don't know exactly where to insert the code they provide, I don't know if it's because of the version, I'm quite new in QT Designer.

                  我會留下我提到的問題.

                  PyQt:如何設置不同的標題大小對于單個標題?

                  PyQt 設置列寬

                  我的文件結構如下:

                  app.py:存儲應用程序的功能

                  SGS.py: .ui文件轉換成.py

                  SGS.ui

                  我將生成表頭的 SGS.py 部分保留,因為它的價值.

                  I leave the SGS.py part where the table headers are generated for what it's worth.

                  item = self.TableDocs.horizontalHeaderItem(0)
                  item.setText(_translate("MainWindow", "IDsystem"))
                  item = self.TableDocs.horizontalHeaderItem(2)
                  item.setText(_translate("MainWindow", "IDpeople"))
                  item = self.TableDocs.horizontalHeaderItem(3)
                  item.setText(_translate("MainWindow", "Work"))
                  item = self.TableDocs.horizontalHeaderItem(4)
                  item.setText(_translate("MainWindow", "Hours"))
                  

                  我也留下了填寫表格的代碼

                  result = Cur.execute("SELECT idsystem,IDpeople,work,hours FROM workers")
                  self.TableDocs.setRowCount(0)
                  
                  for row_number, row_data in enumerate(result):
                      self.TableDocs.insertRow(row_number)
                      for column_number, data in enumerate(row_data):
                          self.TableDocs.setItem(row_number, column_number, QtWidgets.QTableWidgetItem(str(data)))
                  

                  推薦答案

                  從 ui 生成的 python 文件永遠不要被編輯.將其視為用于創建"接口的資源文件(如圖像或 json 文件).您無法通過 Designer 完成的所有操作都必須在您的應用程序代碼文件中實現.

                  The python file generated from the ui should never be edited. Consider it as a resource file (like an image or a json file) that is used to "create" the interface. Everything that you can't do from Designer you will have to implement in your application code files.

                  每當模型應用于項目視圖時,您都可以設置大小(或調整大小模式,例如自動調整大小,或拉伸"到可用寬度).由于您使用的是 QTableWidget(它具有其內部私有模型),因此您可以在界面中創建小部件后立即執行此操作,即在 setupUi (或 loadUi) 如果使用設計器文件.

                  You can set the size (or resize mode, for example automatic resizing, or the "stretching" to the available width) whenever a model is applied to the item view. Since you're using a QTableWidget (which has its internal private model), you can do that as soon as the widget is created in the interface, which is right after setupUi (or loadUi) if using a designer file.

                  為了設置部分的大小和行為,您需要訪問表格標題:列的水平標題,行的垂直標題.

                  In order to set the size and behavior of the sections, you need to access the table headers: the horizontal one for the columns, the vertical for the rows.

                  class MyWindow(QtWidgets.QMainWindow, Ui_MainWindow):
                      def __init__(self):
                          super(MyWindow, self).__init__()
                          self.setupUi(self)
                  
                          horizontalHeader = self.TableDocs.horizontalHeader()
                          # resize the first column to 100 pixels
                          horizontalHeader.resizeSection(0, 100)
                          # adjust the second column to its contents
                          horizontalHeader.setSectionResizeMode(
                              1, QtWidgets.QHeaderView.ResizeToContents)
                          # adapt the third column to fill all available space
                          horizontalHeader.setSectionResizeMode(
                              2, QtWidgets.QHeaderView.Stretch)
                  

                  請注意,如果您刪除一列并在同一位置插入另一列,則需要再次設置其部分大小或模式.

                  Note that if you remove a column and insert another one in the same place, you'll need to set its section size or mode once again.

                  這篇關于為 QTableWidget 的列分配不同的寬度的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)

                  <legend id='3MpKp'><style id='3MpKp'><dir id='3MpKp'><q id='3MpKp'></q></dir></style></legend>

                  <tfoot id='3MpKp'></tfoot>
                        <bdo id='3MpKp'></bdo><ul id='3MpKp'></ul>
                        • <small id='3MpKp'></small><noframes id='3MpKp'>

                          <i id='3MpKp'><tr id='3MpKp'><dt id='3MpKp'><q id='3MpKp'><span id='3MpKp'><b id='3MpKp'><form id='3MpKp'><ins id='3MpKp'></ins><ul id='3MpKp'></ul><sub id='3MpKp'></sub></form><legend id='3MpKp'></legend><bdo id='3MpKp'><pre id='3MpKp'><center id='3MpKp'></center></pre></bdo></b><th id='3MpKp'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3MpKp'><tfoot id='3MpKp'></tfoot><dl id='3MpKp'><fieldset id='3MpKp'></fieldset></dl></div>

                            <tbody id='3MpKp'></tbody>
                          1. 主站蜘蛛池模板: 日韩看片 | 天天综合久久 | 成人精品一区二区三区中文字幕 | 免费一区二区三区 | 国产午夜精品久久 | 国产目拍亚洲精品99久久精品 | 一区二区三区四区不卡视频 | 一区二区三区视频 | 国产精品美女一区二区三区 | 一区二区久久 | 黄频视频 | 精品一区二区三区在线视频 | 中文字幕视频免费 | 毛片毛片毛片毛片毛片 | 99精品欧美一区二区蜜桃免费 | 日本一区二区三区精品视频 | 日韩一区二区三区在线播放 | 久久精品成人 | 国产一二三视频在线观看 | 中文字幕一区二区三区乱码在线 | av一区二区三区在线观看 | 精品久久九 | 亚洲一区二区精品视频在线观看 | 国产精品久久久亚洲 | 中文二区 | 日韩资源 | 在线免费观看日本 | 国产精品久久久久久久模特 | 亚洲精品一区国语对白 | 日韩不卡一区二区三区 | 国产精品久久久久一区二区三区 | 国产亚洲精品久久午夜玫瑰园 | 91免费高清视频 | 男人av网 | 亚洲第1页| 欧美精品一区二区三区在线播放 | 成人欧美一区二区三区1314 | 国产美女黄色 | 日韩a | 国产精品久久久久久久久久久久久 | 成人午夜精品一区二区三区 |