コード例 #1
0
ファイル: QObject.cs プロジェクト: nanox/QtSharp
 protected unsafe bool ConnectDynamicSlot(QObject sender, string signal, Delegate slot)
 {
     int signalId = sender.MetaObject.IndexOfSignal(QMetaObject.NormalizedSignature(signal));
     this.slots.Add(new Handler(signalId, slot));
     QMetaObject.Connection connection = QMetaObject.Connect(sender, signalId, this, this.slots.Count - 1 + MetaObject.MethodCount);
     return connection != null;
 }
コード例 #2
0
 public unsafe bool ConnectDynamicSlot(QObject sender, string signal, Delegate slot)
 {
     this.slots.Add(slot);
     int signalId = sender.MetaObject.IndexOfSignal(QMetaObject.NormalizedSignature(signal));
     void* connection = QMetaObject.Connect(sender, signalId, this, this.slots.Count - 1 + MetaObject.MethodCount, 0, null);
     return connection != null;
 }
コード例 #3
0
ファイル: TableModel.cs プロジェクト: kuruntham/qyotoexamples
 public TableModel(QObject parent = null)
     : base(parent)
 {
     using (var context = new SqliteContext())
     {
         list = context.Products.ToList();
     }
 }
コード例 #4
0
ファイル: QObjectTests.cs プロジェクト: nanox/QtSharp
        public void TestChildren()
        {
            var o = new QObject(_qObject);

            // TODO
            //var childs = _qObject.Children;

            //Assert.IsTrue(childs.Contains(o));
        }
コード例 #5
0
ファイル: QObject.cs プロジェクト: nanox/QtSharp
 protected bool DisconnectDynamicSlot(QObject sender, string signal, Delegate value)
 {
     int i = this.slots.FindIndex(h => h.Delegate == value);
     if (i >= 0)
     {
         int signalId = this.slots[i].SignalId;
         bool disconnect = QMetaObject.Disconnect(sender, signalId, this, i + MetaObject.MethodCount);
         this.slots.RemoveAt(i);
         return disconnect;
     }
     return false;
 }
コード例 #6
0
 public bool DisconnectDynamicSlot(QObject sender, string signal, Delegate value)
 {
     int i = this.slots.IndexOf(value);
     if (i >= 0)
     {
         int signalId = sender.MetaObject.IndexOfSignal(QMetaObject.NormalizedSignature(signal));
         bool disconnect = QMetaObject.Disconnect(sender, signalId, this, i + MetaObject.MethodCount);
         this.slots.RemoveAt(i);
         return disconnect;
     }
     return false;
 }
コード例 #7
0
ファイル: QBasicTimerTests.cs プロジェクト: nanox/QtSharp
 public void TestIsActive()
 {
     using (var t = new QBasicTimer())
     {
         Assert.IsFalse(t.IsActive);
         using (var qObject = new QObject())
         {
             t.Start(1, qObject);
             Assert.IsTrue(t.IsActive);
             t.Stop();
             Assert.IsFalse(t.IsActive);
         }
     }
 }
コード例 #8
0
        public unsafe void TestPropagateGroupUpdateToChildren()
        {
            // this test verifies if group state changes are updating its children correctly
            var group = new QParallelAnimationGroup();
            var o = new QObject();
            o.SetProperty("ole", new QVariant(42));
            Assert.AreEqual(42, o.Property("ole").ToInt());

            var anim1 = new QPropertyAnimation(o, new QByteArray("ole"));
            anim1.EndValue = new QVariant(42);
            anim1.SetDuration(100);
            Assert.IsFalse(anim1.CurrentValue.IsValid);
            Assert.AreEqual(0, anim1.CurrentValue.ToInt());
            Assert.AreEqual(42, o.Property("ole").ToInt());

            var anim2 = new TestAnimation();
            anim2.StartValue = new QVariant(0);
            anim2.EndValue = new QVariant(100);
            anim2.SetDuration(200);

            Assert.IsTrue(anim2.CurrentValue.IsValid);
            Assert.AreEqual(0, anim2.CurrentValue.ToInt());

            Assert.AreEqual(QAbstractAnimation.State.Stopped, group.state);
            Assert.AreEqual(QAbstractAnimation.State.Stopped, anim1.state);
            Assert.AreEqual(QAbstractAnimation.State.Stopped, anim2.state);

            group.AddAnimation(anim1);
            group.AddAnimation(anim2);

            group.Start();
            Assert.AreEqual(QAbstractAnimation.State.Running, group.state);
            Assert.AreEqual(QAbstractAnimation.State.Running, anim1.state);
            Assert.AreEqual(QAbstractAnimation.State.Running, anim2.state);

            group.Pause();
            Assert.AreEqual(QAbstractAnimation.State.Paused, group.state);
            Assert.AreEqual(QAbstractAnimation.State.Paused, anim1.state);
            Assert.AreEqual(QAbstractAnimation.State.Paused, anim2.state);

            group.Stop();
            Assert.AreEqual(QAbstractAnimation.State.Stopped, group.state);
            Assert.AreEqual(QAbstractAnimation.State.Stopped, anim1.state);
            Assert.AreEqual(QAbstractAnimation.State.Stopped, anim2.state);
        }
コード例 #9
0
ファイル: QEventHandler.cs プロジェクト: corngood/assemblygen
 public QEventHandler(QObject sender, object handler)
 {
     this.sender = sender;
     this.handler = handler;
 }
コード例 #10
0
 public EventReceiver(QObject parent)
     : base(parent)
 {
 }
コード例 #11
0
 /* TODO: CppSharp is buggy and neither uses default values of args nor generates overloads so there is no empty QObject ctor */
 public QEventHandler(QObject sender, object handler)
     : base((QObject) null)
 {
     this.sender = sender;
     this.handler = handler;
 }
コード例 #12
0
ファイル: QObjectTests.cs プロジェクト: nanox/QtSharp
        public void TestParent()
        {
            var o = new QObject(_qObject);

            Assert.AreEqual(_qObject.__Instance, o.Parent.__Instance);
        }
コード例 #13
0
ファイル: QObjectTests.cs プロジェクト: YekMX/QtSharp
 public void Init()
 {
     // TODO: Add Init code.
     _qObject = new QObject();
 }
コード例 #14
0
ファイル: QAnimationGroupTests.cs プロジェクト: nanox/QtSharp
        public unsafe void TestLoopWithoutStartValue()
        {
            QAnimationGroup parent = new QSequentialAnimationGroup();
            var o = new QObject();
            o.SetProperty("ole", new QVariant(0));
            Assert.AreEqual(0, o.Property("ole").ToInt());

            var anim1 = new QPropertyAnimation(o, new QByteArray("ole"));
            anim1.EndValue = new QVariant(-50);
            anim1.SetDuration(100);

            var anim2 = new QPropertyAnimation(o, new QByteArray("ole"));
            anim2.EndValue = new QVariant(50);
            anim2.SetDuration(100);

            parent.AddAnimation(anim1);
            parent.AddAnimation(anim2);

            parent.LoopCount = -1;
            parent.Start();

            Assert.IsTrue(anim1.StartValue.IsNull);
            Assert.AreEqual(0, anim1.CurrentValue.ToInt());
            Assert.AreEqual(0, parent.CurrentLoop);

            parent.CurrentTime = 200;
            Assert.AreEqual(1, parent.CurrentLoop);
            Assert.AreEqual(50, anim1.CurrentValue.ToInt());
            parent.Stop();
        }
コード例 #15
0
 public UncontrolledAnimation(QObject target, QByteArray propertyName, QObject parent = null)
     : base(target, propertyName, parent)
 {
     _id = 0;
     SetDuration(250);
     EndValue = new QVariant(0);
 }
コード例 #16
0
 public DynamicQObject(QObject parent)
     : base(parent)
 {
 }
コード例 #17
0
ファイル: QObjectTests.cs プロジェクト: nanox/QtSharp
        public void TestParentChildConstructor()
        {
            var o = new QObject(_qObject);

            // TODO
            //Assert.IsTrue(_qObject.Children.Contains(o));
        }
コード例 #18
0
ファイル: QObjectTests.cs プロジェクト: nanox/QtSharp
 public void Init()
 {
     _qObject = new QObject();
 }
コード例 #19
0
 public QEventHandler(QObject sender, object handler)
 /* TODO: CppSharp is buggy and neither uses default values of args nor generates overloads so there is no empty QObject ctor */ : base((QObject)null)
 {
     this.sender  = sender;
     this.handler = handler;
 }