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.
440
questions
0
votes
0answers
22 views
Problem Connecting Multiple QT Processes via D-Bus
I am trying to get IPC via D-Bus in QT working. I have written a test program that should be able to "broadcast" an integer to multiple instances of the test application. In my sample code that ...
1
vote
1answer
19 views
Sending a custom pyqtsignal from one main window to another
beginner python coder here. I created two main windows in qt designer. In the first window i have got a combobox(cb) with three items and a push button(Button1), and in the other window i have got a ...
0
votes
0answers
14 views
How to instruct Qt to continue execution after some method is finished? [duplicate]
I have a class RestClient. That class sends GET request to my server. It has following method:
void RestClient::sendRequestGet(QString path)
{
setPath(path);
request->setUrl(*url);
...
1
vote
1answer
23 views
Problem with PyQt5 signals emitted from other classes
In the example below I want to send a signal from A to Main and from B to Main. Receiving the signal from A is OK, but B does not work. The tricky part is that the "calculations" in B must be ...
0
votes
0answers
25 views
Qt Wrapper class on libWebSockets - not emitting a signal from the callback method
I am writing a WebSocket client application, based on the example, where the client application needs to pass the WebSocket Protocol while establishing connection with the server. Since QtWebSockets ...
0
votes
1answer
30 views
QByteArray emited and connected by value through QueuedConnection and appended to race condition?
I have a signal newData(int type, QByteArray data) connected as a queuedConnection to slotNewData(int type, QByteArray data) and then I emit two data callbacks as shown here
emit newData(...
0
votes
1answer
60 views
Problem Calling member function from a signal in Qt
So,I am making a simple calculator app in C++ using Qt4 as the GUI framework.
I have worked with Qt before but this time I am using C++ rather than python.
Now I have three files in my project,
main....
0
votes
0answers
16 views
How to use signal and slot in the threading?
I wrote such a string of code by pyqt5, when the received data exceeds the threshold, the alarm interface will pop up, this data is always received, so it needs to be judged all the time. To do this, ...
0
votes
2answers
65 views
Running a function depending upon multiple signals
I have two signals which are NOT necessarily received at the same time.
First signal
First signal is emitted by MyClass and is handled by a slot of MyClass:
QObject::connect(this, &MyClass::...
1
vote
2answers
86 views
QSpinBox and QDoubleSpinBox do not call method on valueChanged
All i want to do is call a method when the value of a qspinbox and a doublespinbox are changed.
I do not need the actual value from the spinbox being changed, i just want it to trigger the calling of ...
0
votes
1answer
71 views
Receiving c++ signals with arguments in QML QList<QPair>
I'm trying to figure out how to get QList> from C++ signal in QML, i'm only getting either QVariant(RecordList, ) or QVariant(QList, ). Tried with different supported sequence type and they work ...
0
votes
1answer
30 views
The QTableWiget::cellChanged signal is not emitted for cells with a QTableWidgetItem
I have the following code, creating a table with two cells:
QTableWidget table(2, 1);
QObject::connect(&table, &QTableWidget::cellChanged, [](int column, int row) {
qDebug() << ...
1
vote
1answer
62 views
Why does this Qt example work with addresses instead of the objects and functions themselves? And no SLOT/SIGNAL keywords?
I've encountered this code in the Qt documentation:
Counter a, b;
QObject::connect(&a, &Counter::valueChanged,
&b, &Counter::setValue);
a.setValue(12); // a....
0
votes
1answer
121 views
“Static polymorphism with Qt signal/slot: What is wrong?”
I'm trying to use static polymorphism instead of dynamics polymorphism with Qt signal/slot mechanism. But I get compile error. What is wrong in my code? What is workaround?
devices.h
#ifndef ...
0
votes
0answers
102 views
Is it wrong to change QChart data from QValueAxis::rangeChanged handler?
I'm trying to update data set in QChart on zooming (to avoid drawing lots of data points per pixel). For this I connect to QValueAxis::rangeChanged signal, and in the handler I remove the series and ...
2
votes
0answers
56 views
My application crashes when called connect for signal
I'm trying to create an application that allows you to interactively create lines. Left-click to create a new point, right-click completes line creation. For some reason, when I click the right mouse ...
1
vote
1answer
21 views
How to make signals appear in QtDesigner?
The PyQt5 docs says
"New signals defined in this way will be automatically added to the
class’s QMetaObject. This means that they will appear in Qt Designer"
How do I make anything appear in ...
1
vote
1answer
64 views
Guarantees in PyQt Signals and comparistion to use a Queue
I am considering two mechanisms to deliver results between different threads of an application. On possibility is creating a Python or PyQt queue that is filled by one thread and consumed by the ...
1
vote
1answer
72 views
Assigning values of a signal to a variable
I'm new to signal and slots in python and currently designing a GUI with Pyqt5. User requires to select from a mix of qcombobox where each element is a qmenu. I'm trying to store the selection of the ...
1
vote
1answer
110 views
Emit Signal in Constructor of Qml Registered Type doesn't Work
I am setting up a resource manager class for my application. to manage all state of resources, i need to emmit a Signal from constructor if it don't succeed to catch resource.
In fact i want to emit ...
1
vote
1answer
151 views
Create pyqtSignals from dictionary
Well I was scripting a software designed via Python which I'll be using signals and slots too much in an PyQt5 application. I got an idea of creating a dictionary where all signals come in and each ...
0
votes
0answers
14 views
Connecting pyqt slot on newly created object from instanciaton [duplicate]
So I'm currently stuck on finding a proper solution for this issue.
I'm creating new QT objects in a previously existing layout by instanciating.
I want to use some sort of "snapshot" of the territory ...
2
votes
1answer
118 views
How to close QWebSocket in thread?
I move a QWebSocket to a thread, and then how can I close it in main thread?
Since I move it to worker thread, I cannot call close from main thread directly. It crash with this message
...
2
votes
1answer
49 views
What effect will exist when using any 'return' statement inside Qt's slot
For instance, I connect the 'clicked' signal of QPushButton to a function named 'func_with_return'. Assumes that there are just three statements in this function: The first one is 'print('start')', ...
1
vote
1answer
212 views
How to emit a signal from the pyqt5 groupbox that can be updated dynamically
I have the parallel thread that read 10 uart and prints the data in pyqt5 gui. But the issue I am facing is those groupbox get updated when all 10 jobs completed but not instantly.
EDIT: To achieve ...
1
vote
1answer
288 views
How can I send a python dictionary to a QML interface with a Signal?
I want to send dictionaries, containing data that I need to use to dynamically create qml objects, from a PySide2 class to a QML interface and since I need to do it in response to certain events, I ...
1
vote
2answers
88 views
Use signals stored in a python dict
I would like to dynamically create then manipulate lots of widgets. My idea is to store widgets in a dict (mywidgets) and to trigger them with signals stored in another dict (mysignals). Both dict ...
1
vote
2answers
76 views
How do I assert the identity of a PyQt5 signal?
I'm in a situation where I want to assert the identity of a PyQt5 signal. Specifically, I want to check whether the clicked signal from a given QPushButton object is identical to a signal that is ...
0
votes
1answer
50 views
Qt Signal Slot connection issue
Trying to create 2 objects (clients) living in different threads and communicating with 1 object(server) living on the main thread.
However I'm not seeing any activity on the server object.
The main ...
0
votes
1answer
91 views
Why do my errors from pyqt signals freeze the ui until another python function gets called
In Maya 2016 everything is fine. But in Maya 2017 (after I did all the pyqt conversions), any Error happening in a function called from a qt signal doesn't get shown immediately. Then if I run another ...
1
vote
1answer
1k views
Connect python signal to QML ui slot with PySide2
I've just started playing with PySide2 and QML for an upcoming project and I immediately stumbled on a problem: How do I connect a signal emitted by a python class (that inherits from QObject) to a ...
0
votes
1answer
117 views
Listening to attached Component.onCompleted and Component.onDestroyed signals from C++ Q_OBJECT
I have a C++ Q_OBJECT (registered with qmlRegisterType) that I'd like to perform some actions on Component.onCompleted and Component.onDestroyed.
Is there a way to subscribe to those handlers without ...
1
vote
1answer
87 views
PySide *any* method call - SIGNALs and SLOTs
I am trying to create simple, universal method call for my PySide GUI library:
class GUI(QApplication):
def __init__(self, *args, **kwargs):
super(GUI, self).__init__()
self....
0
votes
1answer
59 views
Call a slot only when n number of signals are emitted?
Is it possible to connect more than 1 signal to a slot in a way that the slot gets called only when all the related signals are emitted?
0
votes
0answers
15 views
use signals and slots between two seprate class [duplicate]
I want to use signals and slots between two seprate class(i use pyqt5 and python3.7 on windows 10)
I'm doing the following, but I get this error:
TypeError: up_img() takes exactly 2 positional ...
1
vote
1answer
245 views
PySide: QAbstractItemModel - connect dataChanged()
I am trying to do some magic when the model is modified in any way. Reacting on an item being added or removed is quite easy but i have a hard time finding a way to react to an item being modified (...
1
vote
1answer
55 views
how to notify that the maxlength is overflowing
Is there a way to connect a signal before executing a default handler? I'm looking for a way to execute my function prior to QLineEdit::textChanged signal to execute notification about maximum length ...
2
votes
1answer
45 views
PyQt5: Slot in separate file not being called
I currently have a basic GUI right now with each page in its own file. I can navigate to and from each page with no problem, but I'm having difficulty simply passing a search query to another Widget. ...
1
vote
1answer
84 views
inputRejected signal not found
ALL,
connect(this, &QLineEdit::inputRejected,
this, &this::my_handler);
Qt 5.7.1 on Gentoo Linux
error: 'inputRejected' is not a member of 'QLineEdit'
Documentation doesn't give ...
1
vote
1answer
193 views
PySide2 Signal cannot receive QObject parameter
In PySide2 I have a custom defined object:
class ResizeEvent(QObject):
def __init__(self, qresizeevent=None):
...
I want to a child widget emit a signal when it is resized and the parent ...
0
votes
1answer
66 views
How to get known if QThread exited properly or was terminated?
I have found in Qt 4.8 there was terminated signal as you can see here:
http://doc.qt.io/archives/qt-4.8/qthread.html#terminated
But now in Qt 5.8 there is no such a thing. http://doc.qt.io/archives/...
2
votes
2answers
103 views
How to make Qt Signal emit by value without compile errors instead of reference?
I read that the signal/slot concept in qt should always pass arguments by value instead of reference to ensure that signals/slots work flawlessly between threads.
I now have a piece of code that will ...
0
votes
0answers
65 views
PyQt5 can't delete flag WindowStaysOnTopHint under Ubuntu 18.04
I'm trying to make a button which would place window on top of others. Using recommends from other questions, I put in my class setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint) to ...
1
vote
1answer
80 views
QT looking for slot in wrong class
I have a separate class for making a GET request with QNetwork shown below.
Reqest header:
#ifndef REQUEST_H
#define REQUEST_H
#include <QUrl>
#include <QObject>
class Request : public ...
3
votes
1answer
418 views
Optional Signal Arguments
I have a function which has default keyword arguments. I'm having trouble implementing this as I keep getting an error that if my signal has two arguments then I need to pass both arguments. Is there ...
1
vote
1answer
366 views
How do I setup Signals and Slots in PyQt with QThreads in both directions?
This is a followup-question based on ekhumoro's answers here and here.
I thought to understand, that when a slot is correctly defined with pyqtSlot and assigned to QThread (e.g. with moveToThread()), ...
0
votes
2answers
163 views
QObject::connect cant connect signal to a slot of *this* object
The title might be hard to understand, sorry for that.
I have problem connection signal to slot. There are no compile errors, but the connect returns false.
There is error line printed in the console:...
0
votes
1answer
536 views
How to use QMenu signals?
It is very straightforward to connect to QMenu::triggered or QMenu::hovered signals by calling QObject::connect and pass the appropriate QAction.
However, I do not know how to use QMenu::aboutToHide ...
0
votes
1answer
399 views
How to connect multiple signals to one slot in QT/QML?
I have a custom toolbar component and I want that the button components in it emit a toggled signal. I also want to capture the signals from all of the buttons in one onToggled handler in the top-...
1
vote
0answers
88 views
QUdpSocket connect to readyRead no effect after disconnecting
I'm trying to create an UDPLogger.
When I connect the first time to readyRead I get data over UDP.
connect(m_socket, &QUdpSocket::readyRead, this, &UDP::readData);
when I stop to get the ...