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
1 answer

To send two arguments to a function with the click of a button

I have used QT Designer to have two QLineEdit's to take input from the user. After the user enters the values , when the Enter button is clicked I need the buttons to pass the values to the disk_angles function. How to pass two strings to a function…
Raghavendra MG
  • 89
  • 2
  • 11
0
votes
0 answers

Strange behavior of program on Qt 5

I'm writing two programs on Qt 5. The first ("Debug") program sends requests to the second ("Simulator") through a PCI-E device. The "Simulator" must respond as fast as possible. This is a separate issue, but now I want to ask about another strange…
Vladimir Bershov
  • 2,701
  • 2
  • 21
  • 51
0
votes
1 answer

PyQt5 Get the selected text content from other programs

I was looking at this example from PyQt4. Get the selected text from PyQt4.QtCore import QObject, pyqtSlot, SIGNAL, SLOT from PyQt4.QtGui import QApplication, QMessageBox import sys class MyClipboard(QObject): @pyqtSlot() def…
Storm Shadow
  • 442
  • 5
  • 12
0
votes
1 answer

Signals and slots not working in qt

in my Qt program I need the dialog to send a signal to a slot in the mainwindow. I have set the connection up correctly to the best of my knowledge and it does not give me any errors during compile or run time but for some reason it just doesn't do…
Nick
  • 31
  • 1
  • 5
0
votes
1 answer

Qt/C++: Recursive mutex, 'sync zones' and blocking signals

Firstly I'd like to point out that I've looked this up but can't find the answer I'm looking for/have got confused with overly detailed answers. I have a program which uses two threads. A Boolean values need to be set and read in Thread A but only…
SamMetix
  • 1
  • 5
0
votes
1 answer

QT Connect QNetworkReply SIGNAL finished() not firing

I had a look at this link and except the signal spy and debugging i tried at least everything. I took the example from this site. I haven't set up the debugger for now. My problem is that i want to fire a custom slot and nothing is happening. I…
Eggi
  • 170
  • 1
  • 15
0
votes
1 answer

QWidget through a slot

I'm trying to make a function that'll show a widget depending on the QWidget passed to it. I have: position_widget = new positionWidget(); timing_widget = new timingWidget(); ... void MainWindow::showScreen(QWidget *w) { …
easty
  • 35
  • 6
0
votes
1 answer

How to connect a button from ui-file class to slots from other classes?

I have 3 classes. class with a mainwindow which comes from the designer(ui-file) class wich will manage database stuff like inserts controller class. I want to extend the whole thing to networkcommunication later. My problem: I want to…
Markus
  • 23
  • 6
0
votes
1 answer

Transferring QTableWidgetItems from one tableWidget to another using a qvector

I have run into a problem with my program which I don't know how to solve. The problem is I have a Qtablewidget in two classes, and I have used the signal and slot mechanism to transfer a QVector, which contains the QTablewidgetItems from one class,…
Kitty Burner
  • 47
  • 11
0
votes
1 answer

PyQt5 signal and slot simple code explanation

I am very new to using PyQt and am trying to understand the signal slot mechanism. Unfortunately, documentation for PyQt often leads to Qt pages where syntax and parameters are hardly the same. I am trying to figure out 2 things in the simple…
Max
  • 2,072
  • 5
  • 26
  • 42
0
votes
1 answer

changing QTextEdit content during 'onTextChange()' signal

We have some code: void MainWindow::textChangedListener(){ QTextEdit* dock = qobject_cast(QObject::sender()); dock->setText("asd"); } And a signal: cout << connect(it->silaTextEdit, SIGNAL(textChanged()), this,…
user6053837
0
votes
1 answer

Use signals or Q_PROPERTY to update QML objects

I'm very frequently receiving data from a server. This data is mainly composed of numbers. Each of them is corresponding to a QML object that would need to be updated. What would be the best course of action between Q_PROPERTY and signals in order…
Grégoire Borel
  • 1,880
  • 3
  • 33
  • 55
0
votes
1 answer

QMenu activated multiple times

I was playing around with the Qt demo browser example mentioned here and noticed an anomaly when I tried making a minor change to the bookmark handling code. My intention was to make the bookmarks in the toolbar open up in a new tab instead of the…
Nithish
  • 1,580
  • 12
  • 21
0
votes
1 answer

How to get the member object for SLOT in connect()?

I Started learning Qt (5.5) a couple of days ago, and I recently got stuck on something when working with the connect function, specifically the SLOT parameter. I'm calling a member function from the same class that the connect function is called…
TakingItCasual
  • 771
  • 1
  • 7
  • 22
0
votes
1 answer

Pass ListView currentItem info to external component

I am working on QML with Qt logic as backbone application and I have the following situation: at startup, QML ApplicationWindow is shown with its StatusBar, which contains two status icons and one checkable Button, named UeStaffSelector for worker…
KernelPanic
  • 2,328
  • 7
  • 47
  • 90