当前位置: 首页>>代码示例>>Python>>正文


Python QItemDelegate.sizeHint方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QItemDelegate.sizeHint方法的典型用法代码示例。如果您正苦于以下问题:Python QItemDelegate.sizeHint方法的具体用法?Python QItemDelegate.sizeHint怎么用?Python QItemDelegate.sizeHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QItemDelegate的用法示例。


在下文中一共展示了QItemDelegate.sizeHint方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sizeHint

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import sizeHint [as 别名]
 def sizeHint(self, option, index):
     fm = option.fontMetrics
     if index.column() in (MOD1, MOD2, MOD3):
         if self.mod is None:
             w = 0
             for mod in self.modifiers:
                 cw = fm.width(mod)
                 if cw > w:
                     w = cw
                     self.mod = mod
         else:
             w = fm.width(self.mod)
         return QSize(w+20, fm.height())
     elif index.column() == KEY:
         if self.key is None:
             w = 0
             for key in self.keys:
                 cw = fm.width(key)
                 if cw > w:
                     w = cw
                     self.key = key
         else:
             w = fm.width(self.key)
         return QSize(w+20, fm.height())
     return QItemDelegate.sizeHint(self, option, index)
开发者ID:koll00,项目名称:Gui_SM,代码行数:27,代码来源:shortcuts.py

示例2: sizeHint

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import sizeHint [as 别名]
	def sizeHint(self, option, index):
		fm = option.fontMetrics
		if index.column() in (SRC_ADDR, DST_ADDR):
			text = index.model().data(index).toString()
			document = QTextDocument()
			document.setDefaultFont(option.font)
			document.setHtml(text)
			#document.setPageSize(option.rect.size())
			return QSize(document.idealWidth() + 5, 1.3 * fm.height())
		return QItemDelegate.sizeHint(self, option, index)
开发者ID:grucha,项目名称:Sniffer,代码行数:12,代码来源:packets.py

示例3: sizeHint

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import sizeHint [as 别名]
 def sizeHint(self, option, index):
     if index.column() is self._column:
         return QSize(option.rect.size().width(), 25)
         
     return QItemDelegate.sizeHint(self, option, index)
开发者ID:hannesrauhe,项目名称:lunchinator,代码行数:7,代码来源:combobox_delegate.py

示例4: sizeHint

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import sizeHint [as 别名]
 def sizeHint( self, option, index ):
     " Returns the size hint in which the only height matters "
     origSize = QItemDelegate.sizeHint( self, option, index )
     self.lastHeight = origSize.height() + self.delta
     origSize.setHeight( self.lastHeight )
     return origSize
开发者ID:eaglexmw,项目名称:codimension,代码行数:8,代码来源:itemdelegates.py

示例5: sizeHint

# 需要导入模块: from PyQt4.QtGui import QItemDelegate [as 别名]
# 或者: from PyQt4.QtGui.QItemDelegate import sizeHint [as 别名]
    def sizeHint(self, opt, index):

        option = opt;
        sz = QItemDelegate.sizeHint(self, opt, index) + QSize(2, 2)
        return sz
开发者ID:maximerobin,项目名称:Ufwi,代码行数:7,代码来源:pages_list.py


注:本文中的PyQt4.QtGui.QItemDelegate.sizeHint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。