コード例 #1
0
ファイル: core.py プロジェクト: pianohacker/nube
def styleNotifyChildren( obj, prop, value ):
	try:
		style = qmlAttachedPropertiesObject( StyleAttached, obj, False )
	except TypeError:
		style = None

	# If `receiveNotify` returns false, this Style has a value for this property
	if style and not style.receiveNotify( prop, value ):
		return

	for child in obj.children():
		if child is style: continue

		styleNotifyChildren( child, prop, value )
コード例 #2
0
ファイル: core.py プロジェクト: pianohacker/nube
	def lookupProperty( self, prop ):
		obj = self.parent()
		style = self

		while obj:
			if style:
				print( f'style of {obj}: {obj.objectName()} looking for {prop}' )
				value = getattr( style, '_' + prop )
				if value: return value
			else:
				print( f'{obj}: {obj.objectName()} has no style' )

			obj = getattr( obj, "parentItem", lambda: None)() or obj.parent()
			if obj: style = qmlAttachedPropertiesObject( StyleAttached, obj, False )

		return DEFAULT_STYLE[ prop ]
コード例 #3
0
component = QQmlComponent(engine)
component.setData(QML, QUrl())

party = component.create()

if party is not None and party.host is not None:
    print("\"%s\" is having a birthday!" % party.host.name)

    if isinstance(party.host, Boy):
        print("He is inviting:")
    else:
        print("She is inviting:")

    for guest in party.guests:
        attached = qmlAttachedPropertiesObject(BirthdayParty, guest, False)

        if attached is not None:
            rsvpDate = attached.property('rsvp')
        else:
            rsvpDate = QDate()

        if rsvpDate.isNull():
            print("    \"%s\" RSVP date: Hasn't RSVP'd" % guest.name)
        else:
            print("    \"%s\" RSVP date: %s" %
                  (guest.name, rsvpDate.toString()))
else:
    for e in component.errors():
        print("Error:", e.toString())
コード例 #4
0
ファイル: binding.py プロジェクト: death-finger/Scripts
component = QQmlComponent(engine)
component.setData(QML, QUrl())

party = component.create()

if party is not None and party.host is not None:
    print("\"%s\" is having a birthday!" % party.host.name)

    if isinstance(party.host, Boy):
        print("He is inviting:")
    else:
        print("She is inviting:")

    for guest in party.guests:
        attached = qmlAttachedPropertiesObject(BirthdayParty, guest, False)

        if attached is not None:
            rsvpDate = attached.property('rsvp')
        else:
            rsvpDate = QDate()

        if rsvpDate.isNull():
            print("    \"%s\" RSVP date: Hasn't RSVP'd" % guest.name)
        else:
            print("    \"%s\" RSVP date: %s" % (guest.name, rsvpDate.toString()))

    party.startParty()
else:
    for e in component.errors():
        print("Error:", e.toString());