Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt DoubleSpin Box value changed slot has called twice
Forum Updated to NodeBB v4.3 + New Features

Qt DoubleSpin Box value changed slot has called twice

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt creatorqt 5.5c++slotsdebugger
22 Posts 6 Posters 14.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Wael11
    wrote on last edited by
    #21

    The double call to slot happened in my case only with a breakpoint in the slot function, otherwise it is called once only. The second call was triggered by a timer event

    JonBJ 1 Reply Last reply
    0
    • W Wael11

      The double call to slot happened in my case only with a breakpoint in the slot function, otherwise it is called once only. The second call was triggered by a timer event

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #22

      @Wael11
      For anyone reading this: This is known behaviour, which I stumbled across a long time ago and it was infuriating.

      With a QSpinbox Qt Internal code uses a timer on clicks/presses. If you step through in debugger you exceed the timeout and get bad/double behaviour.

      Simplest: change all connect() to QSpinbox click/key to pass Qt::QueuedConnection as last parameter for connection type, not default Qt::DirectConnection. Now you can use debugger breakpoints and all will be well. I wrote a method to connect all my spinboxes like this.

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved