Results 1 to 1 of 1

Thread: QML 1 problem with signal disconnect

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2011
    Posts
    25
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QML 1 problem with signal disconnect

    I have a problem with QML1 and signal disconnections.
    I'm using Qt 5.1. The problem does not appear with QML2.
    I searched online but it does not seem a known problem therefore I think this may be my fault anyway.

    My application is structured with a numeric edit panel with a numeric keypad (called NumericInputpanel).
    When instances of my particular QtQuick widget (called NumericInputFrameLabel) are clicked, the NumericInputpanel is shown in the bottom part of the screen.
    When keypad buttons (of NumericInputpanel) are clicked I want change value (that is the text) of my NumericInputFrameLabel.

    To do this I tried to use signals "connect/disconnect" on QML.
    When my NumericInputFrameLabel is clicked is called the callback "connectItem()"
    Qt Code:
    1. var numericIP = Utils.getNumericInputPanel(nifl); // function get the instantiated numericInputPanel on top level!
    2. if (Utils.assert(numericIP,"")) return; // It works.. don't care about it..
    3.  
    4. [...]
    5.  
    6. // connect
    7. numericIP.update.connect(updateText) // callback to update NumericInputFrameLabel text
    8.  
    9. // init numeric input
    10. numericIP.value = frameText.text // initialization of numeric ip getting current value..
    11. [...]
    12.  
    13. // show numeric input
    14. stateMachine.showNumericInput();
    To copy to clipboard, switch view to plain text mode 

    This works without any problem.
    The problem happens when I close the NumericInputPanel.
    When it is closed is called a callback "disconnectItem"():
    Qt Code:
    1. var numericIP = Utils.getNumericInputPanel(nifl); // as connect callback
    2. if (Utils.assert(numericIP,"Cannot disconnect (1)")) return;
    3. var mainScreen = Utils.getMainScreen(nifl);
    4. if (Utils.assert(mainScreen,"Cannot disconnect (2)")) return;
    5.  
    6. [...]
    7.  
    8. // disconnect
    9. numericIP.update.disconnect(updateText) // disconnect the signal NOT WORKS WITH QML1!!!!!!!
    10. [...]
    11.  
    12. // update frame text
    13. nifl.defaultValue = frameText.text
    14.  
    15. // hide numeric input
    16. stateMachine.hideNumericInput();
    17.  
    18. // slide down main screen
    19. mainScreen.y = 0;
    To copy to clipboard, switch view to plain text mode 

    disconnectItem is called correctly but does not disconnect te signal "numericIP.update" from callback "updateText".
    As wrote all works with QML2. Is there something wrong?

    thanks in advance,

    Nicola


    update: using Qt 4.8.4 the disconnect seem works!

    update2: Ok.. new update.
    In old code (that work with Qt5.1 + QML2) I connect some signal with other signals.
    After replacing all these "binds" with connection signal -> callback functions, all works also with Qt5.1 and QML1.
    Therefore the problem seem to be related to connections signal -> signal with Qt 5.1 and QML1.
    The strange thing is that with Qt4.8.4 works also with signal -> signal connections/disconnections
    Last edited by nick85; 19th December 2013 at 11:06.

Similar Threads

  1. waitForReadyRead and disconnect
    By matteo.ceruti in forum Qt Programming
    Replies: 6
    Last Post: 27th November 2012, 19:28
  2. disconnect usb device
    By marco.stanzani in forum Qt Programming
    Replies: 1
    Last Post: 4th November 2011, 19:42
  3. Replies: 2
    Last Post: 3rd May 2011, 20:22
  4. connect, disconnect and reconnect problem
    By janK in forum Qt Programming
    Replies: 13
    Last Post: 25th August 2010, 19:25
  5. disconnect SIGNAL/SLOT directly after emitting data
    By donglebob in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2009, 22:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.