Questions tagged [qt-signals]

Signals and slots are used for communication between objects. The signals and slots mechanism is a central feature of Qt and probably the part that differs most from the features provided by other frameworks.

Signals are emitted by an object when its internal state has changed in some way that might be interesting to the object's client or owner. Only the class that defines a signal and its subclasses can emit the signal.

When a signal is emitted, the slots connected to it are usually executed immediately, just like a normal function call. When this happens, the signals and slots mechanism is totally independent of any GUI event loop. Execution of the code following the emit statement will occur once all slots have returned.

Signals are automatically generated by the moc and must not be implemented in the .cpp file. They can never have return types (i.e. use void).

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5 (note about new signal syntax in Qt5). Also, here is documentation for using signals for QML.

507 questions
-1
votes
1 answer

Why does the same signal need to be connected to the main circuit slot method to be triggerable?

I have two threads, a main thread and a sub-thread, and a signal in the main thread that's connected to the slot method in the main thread and the sub-thread respectively. I emit this signal in the destructor of the main thread and want to trigger…
-1
votes
1 answer

Using parameters emitted with default signals in pyqt5

I have a QTableWidget, which allows changing the data in a table while the program is running. I would like to know in which row and column the data was changed. There is a default signal cellChanged(int row, int column) but I dont know how to…
-1
votes
1 answer

How can I acquire the data transferring from signal to slot in Qt5?

Well, I have been a new to Qt and I am now using signals and slots. I would like to define a signal void send(int); and emit this signal in A.cpp with some int val like '5' emit send(5); After that, in B.h, I defined a slot void receive(int…
-1
votes
1 answer

PyQt connecting signal between sub class and parent class

I want create a simple button to trigger some task. I was using PyQt designer to built GUI and trying to follow the advice that do not edit the UI module directly but put my customized code in a separate module then inherit all GUI aspects. This is…
Anthony
  • 43
  • 4
-1
votes
2 answers

Slot is not detected when QPushbutton is released

I am currently making a main menu for a game, but when the button is clicked it does not seem to call the relevant slot (The button does not do anything). I have tried to move the button to a thread to ensure that nothing is keeping it from running…
AO1114
  • 3
  • 3
-1
votes
1 answer

cannot call button signal from abstract class

I want to call a function when a button click. the implementation of the button is in the abstract class. but when I compile I'm getting this error. This is my .h file of the base class #ifndef HOME_H #define HOME_H #include #include…
Alex D Rex
  • 89
  • 1
  • 9
-1
votes
1 answer

C++: Call function of Class B when a function of Class A is called (Pointer to Class A is a Member of Class B)

class A { void functionA(); }; class B { A* A_; void functionB(); }; How can I automatically call functionB() in a class B instance, if functionA() is called outside of the class B instance? (Pointer to a Class A instance is member of the…
Thomas
  • 11
  • 1
  • 2
-1
votes
1 answer

Signal and slots for Qt C++

I am working on signal and slots. here is the mainwindow.h .... public slots: void slotChangeName(); .... mainwindow.cpp; #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { …
dizel
  • 25
  • 6
-1
votes
1 answer

Qt using parametre of the signal

I created a signal, which is emitted when the user input something(a number) in a qlineedit field, the signal is emitted with a parametre(the number that the user just type in the field). And i would like to use that parametre as a regular number(in…
Barbell
  • 194
  • 1
  • 6
  • 19
-1
votes
1 answer

Qt emit signal from a class to class

I've tried to emit a custom signal login() from my loginmanager class to the mainwindow. The signal is fired on the loginButtonClicked slot, and to my understand on the signal/slot mechanism, it should be able to capture any signal fired event and…
ReverseEngineer
  • 529
  • 1
  • 5
  • 18
-1
votes
1 answer

No signals emitted from QTableView

For some reason, my QTableView seems to never emit a single signal. At first I tried connecting to any slot programmatically, but then I realized even through the Signal/Slot Editor from the GUI I could not make something happen, no matter which…
asm
  • 11
  • 3
-2
votes
2 answers

Sending QStringList between classes using signals and slots

I have a GUI built using the QT Creator. At some point a Dialog window is opened to which I need to send a variable of type QStringList. I do this using the signals and slots method. However, the variable is empty once sent. Here is some code…
Zynky
  • 1
  • 4
1 2 3
33
34