Questions tagged [qsignalspy]

In the QT platform, QSignalSpy is a class enabling introspection of signal emission.

The QSignalSpy class enables introspection of signal emission.

QSignalSpy can connect to any signal of any object and records its emission. QSignalSpy itself is a list of QVariant lists. Each emission of the signal will append one item to the list, containing the arguments of the signal.

http://qt-project.org/doc/qt-5/qsignalspy.html

12 questions
6
votes
2 answers

QSignalSpy can not be used with threads

I wrote a thread that executes a worker object. Everything works fine. Also the resulting signals are emitted as they should. Of course I took care of the usual mistakes regarding thread/object affinity. Today I wrote an automated module test for…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
2
votes
0 answers

Redundant namespace declaration in signal in order to use QSignalSpy

I'm trying to utilize QTest in combination with Catch and QSignalSpy to test my applications. I have to say, that I'm using Qt 5.10.0, which might be important. Recently I stumbled across a strange behavior, that I couldn't really…
Aleph0
  • 5,816
  • 4
  • 29
  • 80
2
votes
1 answer

QSignalSpy::wait(...) fails, when QTest::qWait(...) succeeds

It's a confusing situation i'm in. While testing state transitions for a QStateMachine, the following code fails to spy on the signal that causes the transition. // Test transition to SS_STARTING QSignalSpy spy(test_obj_,…
sayo9394
  • 435
  • 8
  • 18
2
votes
1 answer

Signal not catched by QSignalSpy

I'm currently coding some unit tests for one of my classes. However, I quickly ran into an issue. It seems that QSignalSpy sometimes does not catch the disconnected() signal emitted by my Client class. Here's my unit test: void…
mathlizee
  • 185
  • 2
  • 12
1
vote
2 answers

Monitor/Output emitted Qt-Signals

I defined some signals which are emitted on different occasions: signals: void buttonXClicked(int x); void numButtonsChanged(int num); Now I would just like to see how these signals look like and if the parameters are correct. It seems…
Qohelet
  • 1,459
  • 4
  • 24
  • 41
0
votes
1 answer

Use QSignalSpy with Microsoft::VisualStudio::CppUnitTestFramework

I want to test whether a Qt Class correctly emits a signal upon function call using QSignalSpy. I use MS Visual Studio and use the Microsoft::VisualStudio::CppUnitTestFramework. Executing unit tests generally works fine, but instantiating a…
0
votes
1 answer

QSignalSpy error: No such signal when connecting a signal to a QSignalSpy

I am trying to test a Qt application that uses QML. Specifically, I want to test the connection between a signal emitted by a QML object and a slot in a C++ class. Here's the relevant code I'm working with: QQuickView…
0
votes
0 answers

How to pass a string to qthread, PyQt5, directly to the run() function?

I'm doing a login page, mysql query in a separate thread, I can't get it from login_ui lineEdit.text (), I decided to try through signals and slots I can pass the string through signal.connect(same.funktion) trigger function. But it is not passed…
0
votes
1 answer

Test signal with my own class

I have some class which can emit some signal with another my class. Example: class CMyClass : public QBytaArray { void SomeAction(); } class CMainClass : public QObject { signals: void testSignal(const CMyClass &myClass); …
Mike
  • 860
  • 14
  • 24
0
votes
1 answer

How can I wait for a QWidget to close using QTestLib? [Qt5]

I am writing a QTest based test case for a class that derives from QWidget. After showing the widget, I want the test to end as soon as the widget is closed. My first attempt was to use QSignalSpy, only to find out that QWidget really does not send…
Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
0
votes
1 answer

QSignalSpy and std::shared_ptr

I would like to test a Qt piece of code that is using signals/slots with std::shared_ptr as parameters. My issue is that the QSignalSpy class, that works well for all the other type of parameters, does not seem to play nice when it comes to use…
CanardMoussant
  • 913
  • 8
  • 22
0
votes
1 answer

QML: Signal isn't being called in a unit test

I'm writing a C++ class ScriptProcess, meant to be used in QML, that acts as an interface to a child process. Said child process loads a script, then executes functions on demand. When you call a function, the result (be it a value or an…
JesseTG
  • 2,025
  • 1
  • 24
  • 48