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


Python QtCore.QObject类代码示例

本文整理汇总了Python中PySide2.QtCore.QObject的典型用法代码示例。如果您正苦于以下问题:Python QObject类的具体用法?Python QObject怎么用?Python QObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testButtonClick

 def testButtonClick(self):
     """Indirect qt signal emission using the QPushButton.click() method """
     button = QPushButton('label')
     QObject.connect(button, SIGNAL('clicked()'), self.cb)
     self.args = tuple()
     button.click()
     self.assert_(self.called)
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:signal_emission_gui_test.py

示例2: testIt

 def testIt(self):
     global called
     called = False
     o = QObject()
     o.connect(o, SIGNAL("ASignal"), functools.partial(someSlot, "partial .."))
     o.emit(SIGNAL("ASignal"))
     self.assertTrue(called)
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:signal_emission_test.py

示例3: testMetaData

 def testMetaData(self):
     self.view = QWebView()
     QObject.connect(self.view, SIGNAL('loadFinished(bool)'),
                     self.load_finished)
     url = QUrl.fromLocalFile(adjust_filename('fox.html', __file__))
     self.view.setUrl(url)
     self.app.exec_()
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:webframe_test.py

示例4: __init__

 def __init__(self, obj=None, event_type=None, *args):
     #Creates a new filter object
     QObject.__init__(self, *args)
     self.obj = obj
     self.event_type = event_type
     self.events_handled = 0
     self.events_bypassed = 0
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:qobject_event_filter_test.py

示例5: timerEvent

    def timerEvent(self, event):
        QObject.timerEvent(self, event)
        event.accept()
        self.times_called += 1

        if self.times_called == 5:
            self.app.exit(0)
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:qobject_timer_event_test.py

示例6: setUp

 def setUp(self):
     #Acquire resources
     TimedQApplication.setUp(self, timeout=1000)
     self.view = QWebView()
     QObject.connect(self.view, SIGNAL('loadFinished(bool)'),
                     self.load_finished)
     self.called = False
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:webview_test.py

示例7: testQThreadReceiversExtern

    def testQThreadReceiversExtern(self):
        #QThread.receivers() - Inherited protected method

        obj = QThread()
        self.assertEqual(obj.receivers(SIGNAL('destroyed()')), 0)
        QObject.connect(obj, SIGNAL("destroyed()"), self.cb)
        self.assertEqual(obj.receivers(SIGNAL("destroyed()")), 1)
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:qobject_protected_methods_test.py

示例8: testButtonClicked

 def testButtonClicked(self):
     """Connection of a python slot to QPushButton.clicked()"""
     button = QPushButton('Mylabel')
     QObject.connect(button, SIGNAL('clicked()'), self.cb)
     self.args = tuple()
     button.emit(SIGNAL('clicked(bool)'), False)
     self.assert_(self.called)
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:signal_emission_gui_test.py

示例9: testSimplePythonSignalNoArgs

 def testSimplePythonSignalNoArgs(self):
     #Connecting a lambda to a simple python signal without arguments
     obj = Dummy()
     QObject.connect(obj, SIGNAL('foo()'),
                     lambda: setattr(obj, 'called', True))
     obj.emit(SIGNAL('foo()'))
     self.assert_(obj.called)
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:lambda_test.py

示例10: testSimple

    def testSimple(self):
        #QObject.objectName(string)
        name = 'object1'
        obj = QObject()
        obj.setObjectName(name)

        self.assertEqual(name, obj.objectName())
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:qobject_test.py

示例11: testEmpty

    def testEmpty(self):
        #QObject.objectName('')
        name = ''
        obj = QObject()
        obj.setObjectName(name)

        self.assertEqual(name, obj.objectName())
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:qobject_test.py

示例12: testTrUtf8AsInstanceMethod

 def testTrUtf8AsInstanceMethod(self):
     #Test QObject.trUtf8 as instance
     invar1 = 'test1'
     outvar1 = QObject.trUtf8(self.obj, invar1)
     invar2 = 'test2'
     outvar2 = QObject.trUtf8(self.obj, invar2, 'test comment')
     self.assertEqual((invar1, invar2), (outvar1, outvar2))
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:qobject_tr_as_instance_test.py

示例13: run

    def run(self):
        global thread_run
        thread_run = True
        QObject.connect(self.source, SIGNAL('source()'), self.target.myslot)

        while not self.target.called:
            pass
开发者ID:BadSingleton,项目名称:pyside2,代码行数:7,代码来源:qthread_signal_test.py

示例14: testValueChanged

        def testValueChanged(self):
            """Emission of a python signal to QSpinBox setValue(int)"""
            QObject.connect(self.obj, SIGNAL("dummy(int)"), self.spin, SLOT("setValue(int)"))
            self.assertEqual(self.spin.value(), 0)

            self.obj.emit(SIGNAL("dummy(int)"), 4)
            self.assertEqual(self.spin.value(), 4)
开发者ID:linzhun,项目名称:pyside2,代码行数:7,代码来源:pysignal_test.py

示例15: testConnection

 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")
开发者ID:BadSingleton,项目名称:pyside2,代码行数:8,代码来源:list_signal_test.py


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