Questions tagged [qt-slot]
53 questions
2
votes
0 answers
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 signal readyRead with disconnect which works fine and…

Murmi
- 91
- 10
2
votes
0 answers
Google mock for qabstractsocket class
I'm trying to solve my unit testing problem. I have a class with a QTcpSocket object in it. This class has derived from the QObject to use the signal/slot system and the socket object is used inside slots.
I have tried to mock (gmock) this socket…

Олег Юрченко
- 49
- 3
2
votes
1 answer
AttributeError: 'builtin_function_or_method' object has no attribute 'connect'
I am using PyQt based on PyQt4. I am using PyCharm 2017.3. My python version is 3.4.
I am trying to connect the signal that we get when we click mouse to capture content from a QLineEdit.
class HelloWorld(QMainWindow, tD_ui.Ui_MainWindow):
#…

royatirek
- 2,437
- 2
- 20
- 34
2
votes
1 answer
Qt signal on buttongroup not connected
I have a buttongroup defined with two radiobuttons
buttonGroupFFTDimension = new QButtonGroup(this);
buttonGroupFFTDimension->addButton(ui->radioButton1D, 1);
buttonGroupFFTDimension->addButton(ui->radioButton2D,…

Matthias Pospiech
- 3,130
- 18
- 55
- 76
2
votes
1 answer
QT signal and slot not working giving an error message
I am new to Qt and trying to write signal and slot. Below is the code I was trying to run. with SLOT and SIGNAL keywords on "connect" function, it works fine. But I do not want to use SIGNAL and SLOT keywords on connect function, instead want to use…

LilRazi
- 690
- 12
- 33
2
votes
1 answer
A warning message "No matching signal for" when executing my application
When executing my application some warning messages appear:
QMetaObject::connectSlotsByName: No matching signal for on_actionUndo_triggered(),
QMetaObject::connectSlotsByName: No matching signal for on_actionRedo_triggered()
I have implemented the…

Lion King
- 32,851
- 25
- 81
- 143
2
votes
3 answers
Qt: How to know if slot was called by signal-slot mechanism by calling the signal like a function
Inside a slot I check the QObject::sender() but now I want to call this slot directly like a function.
Can I know how this slot was called inside of the slot? Either by signal-slot mechanism or simply by calling the slot like a function?

kakush
- 3,334
- 14
- 47
- 68
1
vote
1 answer
Qt QObject::connect receiver and slot of different classes
I have two classes: first one is the main QMainWindow class, and the second one is my custom class. For example, I want to make a connection in the constructor of my custom class where when I press a TestButton (which is a part of the ui of main…

Powarito
- 67
- 4
1
vote
1 answer
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 triggered from A, not from Main. Will appreciate any…

user12209348
- 11
- 3
1
vote
1 answer
Why can't you use a generator function as a slot?
I'm trying to iterate through a list in a PySide2 application. So each time a "Next" button is pressed, the next item is returned from the list and displayed. I could keep track of the index of the entry in my list which was most recently read and…

James Dorsey
- 25
- 5
1
vote
1 answer
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
#include
class Request : public QObject
{
Q_OBJECT
public:
void make_request(QUrl…

HackNode
- 159
- 2
- 11
1
vote
1 answer
Cant assign a variable through connect method in pyqt
When trying to connect a button press to the assignment of a variable, PyCharm refuses to accept the syntax, stating Can't assign to function call with red syntax underlining.
Here is the following code:
self.button.clicked.connect(lambda :…

e15purple
- 29
- 7
1
vote
1 answer
Can I use global slots?
Can I use global slots in Qt?
I am trying to use this code, but it seems like it doesn't work.
slots void f(int i);
void connect(QSpinBox *spinBox)
{
QObject::connect(spinBox, SIGNAL(valueChanged(int)), NULL, SLOT(f(int)));
}
void f(int i)
{
…

Ufx
- 2,595
- 12
- 44
- 83
1
vote
1 answer
Slot as method of a locally instantiated class is never called
I have a list of mp3 files that I'm trying to play through pygame whenever different buttons are pressed (one file per button). Since there is a variable number of those files, I'm simply implementing a for loop, and I have an AudioPlayer class that…

pie3636
- 795
- 17
- 31
1
vote
2 answers
Use of QAbstractSocket stateChanged()-Signal
What is the correct use/implementation of the QAbstractSocket stateChanged()-Signal?
main.cpp:
#include
#include
#include
int main(int argc, char *argv[]){
QCoreApplication a(argc,…

Papierschnellboot
- 45
- 1
- 6