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

  • <tfoot id='Plc44'></tfoot>
  • <small id='Plc44'></small><noframes id='Plc44'>

        <bdo id='Plc44'></bdo><ul id='Plc44'></ul>

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

      3. 如何獲取 QTableView 右鍵單擊??索引

        How to get QTableView right clicked index(如何獲取 QTableView 右鍵單擊??索引)
        <i id='9zvsR'><tr id='9zvsR'><dt id='9zvsR'><q id='9zvsR'><span id='9zvsR'><b id='9zvsR'><form id='9zvsR'><ins id='9zvsR'></ins><ul id='9zvsR'></ul><sub id='9zvsR'></sub></form><legend id='9zvsR'></legend><bdo id='9zvsR'><pre id='9zvsR'><center id='9zvsR'></center></pre></bdo></b><th id='9zvsR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='9zvsR'><tfoot id='9zvsR'></tfoot><dl id='9zvsR'><fieldset id='9zvsR'></fieldset></dl></div>
          <tbody id='9zvsR'></tbody>

              1. <small id='9zvsR'></small><noframes id='9zvsR'>

                  <bdo id='9zvsR'></bdo><ul id='9zvsR'></ul>
                  <tfoot id='9zvsR'></tfoot>
                • <legend id='9zvsR'><style id='9zvsR'><dir id='9zvsR'><q id='9zvsR'></q></dir></style></legend>
                  本文介紹了如何獲取 QTableView 右鍵單擊??索引的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  下面的代碼創建了一個帶有 QTableView 視圖的對話框.左鍵單擊 onLeftClick 函數會獲得一個 QModelIndex index.此 QModelIndex 稍后用于打印左鍵單擊單元格的行號和列號.

                  The code below creates a single dialog with a QTableView view. On left-click the onLeftClickfunction gets an QModelIndex index. This QModelIndex is used later to print the row and column numbers of the left-clicked cell.

                  如何獲取被右鍵單擊的單元格的QModelIndex索引?

                  How to get the QModelIndex index of the cell that was right-clicked?

                  from PyQt5.QtGui import *
                  from PyQt5.QtWidgets import *
                  from PyQt5.QtCore import *
                  app = QApplication([])
                  
                  
                  class Dialog(QDialog):
                      def __init__(self, parent=None):
                          super(Dialog, self).__init__(parent)
                          self.setLayout(QVBoxLayout())
                          self.view = QTableView(self)
                          self.view.setSelectionBehavior(QTableWidget.SelectRows)
                          self.view.setContextMenuPolicy(Qt.CustomContextMenu)
                          self.view.customContextMenuRequested.connect(self.onRightClick)
                          self.view.clicked.connect(self.onLeftClick)
                  
                          self.view.setModel(QStandardItemModel(4, 4))
                          for each in [(row, col, QStandardItem('item %s_%s' % (row, col))) for row in range(4) for col in range(4)]:
                              self.view.model().setItem(*each)
                  
                          self.layout().addWidget(self.view)
                          self.resize(500, 250)
                          self.show()
                  
                      def onRightClick(self, qPoint):
                          sender = self.sender()
                          for index in self.view.selectedIndexes():
                              print 'onRightClick selected index.row: %s, selected index.column: %s' % (index.row(), index.column())
                  
                      def onLeftClick(self, index):
                          print 'onClick index.row: %s, index.row: %s' % (index.row(), index.column())
                  
                  
                  dialog = Dialog()
                  app.exec_()
                  

                  推薦答案

                  你必須使用 QAbstractScrollArea (QTableViewindexAt() 方法代碼>):

                  You have to use the indexAt() method of the QAbstractScrollArea (QTableView):

                  def onRightClick(self, qPoint):
                      index = self.view.indexAt(qPoint)
                      if index.isValid():
                          print('onClick index.row: %s, index.col: %s' % (index.row(), index.column()))
                  

                  這篇關于如何獲取 QTableView 右鍵單擊??索引的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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時顯示進度條?)
                • <small id='CFhBI'></small><noframes id='CFhBI'>

                      • <bdo id='CFhBI'></bdo><ul id='CFhBI'></ul>
                      • <legend id='CFhBI'><style id='CFhBI'><dir id='CFhBI'><q id='CFhBI'></q></dir></style></legend>

                            <tfoot id='CFhBI'></tfoot>
                              <tbody id='CFhBI'></tbody>

                            <i id='CFhBI'><tr id='CFhBI'><dt id='CFhBI'><q id='CFhBI'><span id='CFhBI'><b id='CFhBI'><form id='CFhBI'><ins id='CFhBI'></ins><ul id='CFhBI'></ul><sub id='CFhBI'></sub></form><legend id='CFhBI'></legend><bdo id='CFhBI'><pre id='CFhBI'><center id='CFhBI'></center></pre></bdo></b><th id='CFhBI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CFhBI'><tfoot id='CFhBI'></tfoot><dl id='CFhBI'><fieldset id='CFhBI'></fieldset></dl></div>
                            主站蜘蛛池模板: 99热精品在线 | 四虎影院在线播放 | 色小姐综合网 | 亚洲视频免费 | 天堂一区二区三区 | 91看片免费 | 在线观看久草 | 毛片一区二区 | 亚洲网站在线 | 久久久成人一区二区免费影院 | 国产福利在线 | 天天躁日日躁狠狠躁白人 | 中文字幕亚洲一区 | 九九伊人sl水蜜桃色推荐 | 亚洲性人人天天夜夜摸 | 小草久久久久久久久爱六 | www一级片| 国产精品精品视频一区二区三区 | 精品久久久久久久久久久久久久久久久 | 国产精品99 | 青青草一区二区三区 | 99欧美精品 | 亚洲一区视频在线 | 狠狠躁夜夜躁人人爽天天高潮 | 一级毛片免费完整视频 | 看片地址| 国产精品成人一区 | 97精品国产97久久久久久免费 | 日韩精品在线播放 | 国产999精品久久久影片官网 | 亚洲综合在线一区二区 | 我要看一级片 | 隔壁老王国产在线精品 | 午夜视频免费在线观看 | 在线色网 | 亚洲综合色 | 日韩精品一区在线观看 | 久久久91精品国产一区二区三区 | 狠狠爱一区二区三区 | 亚洲草草视频 | 黄色片视频网站 |