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
0
votes
0 answers

PyQt: eventqueue size

I'm learning to use threads and GUIs, so please excuse me if I'm messing up the terminology. I have an application where I'm monitoring a socket for data and doing some heavy processing before displaying the results in a GUI: thread1 to monitor…
0
votes
0 answers

Make window's text unique for each different button

How can i make one form unique for different buttons? For example: QVector text { "Iter FIRST", "Iter SECOND" }; for(size_t i = 0; i < 2; ++i) { Form2 * form2 = new Form2(); //creating form connect(this,…
Nick Brian
  • 53
  • 5
0
votes
1 answer

Trouble with Qt's new signal/slot syntax - connecting to a simple function

As described here:, you can connect a signal to a simple function, like this: connect( sender, &Sender::valueChanged, someFunction ); Here is my program: #include #include #include…
Chester
  • 13
  • 1
0
votes
1 answer

How do I edit QMainWindow UI Widget From Another Class?

I need to edit a QLabel from MainWindow's UI in another source file. I've tried messing around with singals and slots, but honestly I'm completely lost and the Qt documentation doesn't help me in this exact situation. I understand that this has been…
Mr. Knot
  • 23
  • 2
0
votes
1 answer

Sending QPixmap pointer via signal-slots, empty pixmap data

I have problem with sharing pointer to Pixmap via signal-slot mechanism. Inside slot function I have correct QPixmap with fulled data. In reciever I have unaccessible QPixmap with empty data. Any ideas? class A { public: …
Kate Zz
  • 3,002
  • 5
  • 14
  • 17
0
votes
1 answer

Qt slots - Different speeds sender/receiver - prevent queueing up data

I have two rather independent threads running. One generates data and one contains some display logic. I transmit data via some QMetaObject::invokeMethod(processor, "newData"); on the generator side. (processor is some QObject that is part of a…
vlad_tepesch
  • 6,681
  • 1
  • 38
  • 80
0
votes
0 answers

c++ signal to QML with Connection

I emit a signal from c++ and try to call a slot from QML. I use Setcontextproperty and Connection : main.qml import QtQuick 2.7 import QtQuick.Window 2.2 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 Window { visible: true width: 640 …
Vana
  • 753
  • 3
  • 11
  • 20
0
votes
2 answers

PyQt Issue sending values to different class

in the code below I am trying to figure out the best way to share data from the "Data_Class" Class to the "Tab_2" Class. Specifically I am trying to get the values from "Data_Class" in tab1 to fill in the QLineEdit in tab2 when the buttons are…
Richard
  • 445
  • 1
  • 5
  • 21
0
votes
1 answer

How do I get the animation to work correctly in PyQt5 Qt3D?

I am trying to understand the animation operation in PyQt5 from the example in https://doc.qt.io/qt-5.10/qt3d-simple-cpp-example.html I have translated the code into Python and am able to run it but there is no animation. I'm thinking I need to…
P Moran
  • 1,624
  • 3
  • 18
  • 32
0
votes
2 answers

decorator on slot (PyQt)

I use QT to build my GUI, and decorator to record the log. When I use the decorator on a slot, the GUI will crush. The code is: import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * def LogInfos(func): …
Qiang Zhang
  • 820
  • 8
  • 32
0
votes
1 answer

Pyqt - Signal emited on Qthread sometimes isn't received

so i have a GUI that uses lots of pexpects to login to a program and retrieve information. So i started integrating that code into a Qthread; everything was working fine, until i remembered to test the error messages, it appears that the emited…
wrong1man
  • 133
  • 2
  • 10
0
votes
1 answer

PySide Signals not being sent to Slot, from QThread object

I'm working with a multi-threading application, where a worker thread gets created, that emits a signal. After creating the thread, I connect the signal with an object slot, that will perform some action. The problem, is the object slot, is not…
Mário Costa
  • 93
  • 1
  • 6
0
votes
1 answer

Pyside - QcolorDialog signals

What would be the signal for clicking the 'ok' button in the QColorDialog. I tried self.color_chooser = QtWidgets.QColorDialog() self.color_chooser.getColor() self.color_chooser.currentColorChanged.connect(self.color_pick) def color_pick(self): …
ghost654
  • 161
  • 2
  • 18
0
votes
1 answer

QVariantList becomes nested when accessed from Q_PROPERTY in QML

I am experiencing an odd issue accessing QVariantLists consisting of Q_GADGET objects via Q_PROPERTY's in another Q_GADGET object. For some reason, when accessing them through the property the lists nests itself down two elements like so: Variable…
Eventh
  • 21
  • 2
  • 7
0
votes
2 answers

How do I correctly use the signal/slot system from qt

So I want to send the height and width of my QScrollArea to my QWidget (both are custom classes that derive from these two) but I just don't get it to wrok. customScrollArea *scrollArea; RenderArea *scrollAreaWidgetContents; void…
LeonU
  • 11
  • 3