Re: [Interest] Fwd: Re: Signal/Slot connection fails, even though QMetaObject::activate is called

2020-02-17 Thread Giuseppe D'Angelo via Interest

Il 08/02/20 03:37, Jonathan Purol ha scritto:
After manually removing every line of code to see when a MVCE would 
work, I found a loose `blockSignals(true)` flying around that was there 
from a debugging session.


By the way: there's QSignalBlocker for not forgetting...

HTH,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Fwd: Re: Signal/Slot connection fails, even, though QMetaObject::activate is called

2020-02-16 Thread Roland Hughes

+3

I have worked in midrange shops where where we could only build from a 
CMS library. You could "local compile" a single source file within LSE 
or a BUILD-ONE command file, but you could only build a testable binary 
from a CMS library. Every developer had their own CMS (Code Management 
System). Once we had local compiled the files we changed we had to put 
them back into CMS to build a testable binary. When we thought things 
worked we had to promote to one of the integration testing CMS areas 
T01-T99.


Whenever we started a new project we nuked our CMS and took a fresh pull 
from Production P01.


The pain of checking in all changes before testing is paid for by not 
having to spend days tracking something like this down.


On 2/15/20 5:00 AM, interest-requ...@qt-project.org wrote:

On 07/02/2020 21.37, Jonathan Purol wrote:

After manually removing every line of code to see when a MVCE would
work, I found a loose `blockSignals(true)` flying around that was there
from a debugging session.

`git diff`? Stuff like this is why you should use a VCS (it doesn't have
to be git) even for personal projects, and commit early and often, so
that when you're working on something, it's easy to see what's changed.




--
Roland Hughes, President
Logikal Solutions
(630)-205-1593

http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] Fwd: Re: Signal/Slot connection fails, even though QMetaObject::activate is called

2020-02-14 Thread Matthew Woehlke
On 07/02/2020 21.37, Jonathan Purol wrote:
> After manually removing every line of code to see when a MVCE would
> work, I found a loose `blockSignals(true)` flying around that was there
> from a debugging session.

`git diff`? Stuff like this is why you should use a VCS (it doesn't have
to be git) even for personal projects, and commit early and often, so
that when you're working on something, it's easy to see what's changed.



-- 
Matthew
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] Fwd: Re: Signal/Slot connection fails, even though QMetaObject::activate is called

2020-02-07 Thread Jonathan Purol
Thanks to Sze-Howe for pointing me out that I should post this to the 
global thread, instead of to just the people who I talked to before.

Sorry to the two people who have now received this message twice!

sincerely,
Folling


 Forwarded Message 
Subject: 	Re: [Interest] Signal/Slot connection fails, even though 
QMetaObject::activate is called

Date:   Sat, 8 Feb 2020 01:21:04 +0100
From:   Jonathan Purol 
To: Tony Rietwyk 
CC: Scott Bloom 



I am so sincerely sorry everyone.
After manually removing every line of code to see when a MVCE would 
work, I found a loose `blockSignals(true)` flying around that was there 
from a debugging session.


I just want to curl up and cry, either in laughter or in sadness - but 
three hours later and it finally works - sorry for wasting your time.


sincerely,
Folling

On 2/8/20 1:10 AM, Tony Rietwyk wrote:

Hi,

Does it work if you don't pass 'this' as the third argument to 
connect?  I never use that particular overload of connect. I usually 
pass the lambda as the third argument.


Hope that helps, Tony


On 8/02/2020 10:03 am, Scott Bloom wrote:

Are you sure the function is getting called (via a break point)?



-Original Message-
From: Interest [mailto:interest-boun...@qt-project.org] On Behalf Of 
Jonathan Purol

Sent: Friday, February 7, 2020 2:44 PM
To: Qt Project 
Subject: [Interest] Signal/Slot connection fails, even though 
QMetaObject::activate is called


Hello everyone,

I have a QMainWindow subclass called `text_editor` with a function 
`save` which looks as follows:

```cpp
void text_editor::save() {

      _textbox->document()->setModified(false);
      _textbox->setFocus();

      emit saved();

}
```

I now connect to that slot in another class like this:
```cpp
_information_editor = new text_editor{this};

connect(
      _information_editor,
      _editor::saved,
      this,
      [=]() {
      std::cout << "hello\n";
      }
);

```

I have verified that the signal is emitted, in fact, the method 
generated by the moc:

```cpp
// SIGNAL 0
void text_editor::saved()
{
      QMetaObject::activate(this, , 0, nullptr); } 
``` is definitely called (verified with gdb and some other debugging 
shenenigans).
In addition, the connection object returned by `connect` is valid, as 
verified by its implicit bool-cast operator.
However, "hello" is never printed. I suspected this could be because 
`text_editor` inherits from `QMainWindow` and could have a different 
thread affinity, so I tried the following things:


1. Move the editor to the same thread as the object which establishes 
the connection 2. Use a QueuedConnection 3. Connect to the slot from 
WITHIN the text editor itself, making sure that we are 100% on the 
same slot


and none of them worked.
Just for clarification, the print of "hello" is only an example, so 
even if there was some issue with that, I would have detected it, the 
actual code is of course different.


I'm really out of luck here, and would appreciate any help.

Sincerely,
Folling

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest