本文整理汇总了Python中PySide2.QtCore.QObject.setObjectName方法的典型用法代码示例。如果您正苦于以下问题:Python QObject.setObjectName方法的具体用法?Python QObject.setObjectName怎么用?Python QObject.setObjectName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2.QtCore.QObject
的用法示例。
在下文中一共展示了QObject.setObjectName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testEmpty
# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import setObjectName [as 别名]
def testEmpty(self):
#QObject.objectName('')
name = ''
obj = QObject()
obj.setObjectName(name)
self.assertEqual(name, obj.objectName())
示例2: testSimple
# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import setObjectName [as 别名]
def testSimple(self):
#QObject.objectName(string)
name = 'object1'
obj = QObject()
obj.setObjectName(name)
self.assertEqual(name, obj.objectName())
示例3: testConnection
# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import setObjectName [as 别名]
def testConnection(self):
o = TestObject(0)
c = QObject()
c.setObjectName("child")
self._child = None
o.childrenChanged.connect(self.childrenChanged)
o.addChild(c)
self.assertEquals(self._child.objectName(), "child")
示例4: testUtf8
# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import setObjectName [as 别名]
def testUtf8(self):
translator = QTranslator()
translator.load(os.path.join(self.trdir, 'trans_russian.qm'))
self.app.installTranslator(translator)
obj = QObject()
obj.setObjectName(obj.tr('Hello World!'))
self.assertEqual(obj.objectName(), py3k.unicode_('привет мир!'))
示例5: testLatin
# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import setObjectName [as 别名]
def testLatin(self):
#Set string value to Latin
translator = QTranslator()
translator.load(os.path.join(self.trdir, 'trans_latin.qm'))
self.app.installTranslator(translator)
obj = QObject()
obj.setObjectName(obj.tr('Hello World!'))
self.assertEqual(obj.objectName(), py3k.unicode_('Orbis, te saluto!'))
示例6: testQStringDefault
# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import setObjectName [as 别名]
def testQStringDefault(self):
obj = QObject()
obj.setObjectName('foo')
self.assertEqual(obj.objectName(), py3k.unicode_('foo'))
obj.setObjectName(py3k.unicode_('áâãà'))
self.assertEqual(obj.objectName(), py3k.unicode_('áâãà'))
obj.setObjectName(None)
self.assertEqual(obj.objectName(), py3k.unicode_(''))
示例7: testUnicode
# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import setObjectName [as 别名]
def testUnicode(self):
name = py3k.unicode_('não')
#FIXME Strange error on upstream when using equal(name, obj)
obj = QObject()
obj.setObjectName(name)
self.assertEqual(obj.objectName(), name)