signals-slots

signals and slots

Can someone explain in simple terms the "signals and slots" pattern? ...

Which C++ signals/slots library should I choose?

I want to use a signals/slots library in a project that doesn't use QT. I have pretty basic requirements: Connect two functions with any number of parameters. Signals can be connected to multiple slots. Manual disconnection of signal/slot connection. Decent performance - the application is frame-based (e.g. not event-based) and I want...

Keeping the GUI separate

I have a program that (amongst other things) has a command line interface that lets the user enter strings, which will then be sent over the network. The problem is that I'm not sure how to connect the events, which are generated deep inside the GUI, to the network interface. Suppose for instance that my GUI class hierarchy looks like th...

how to connect a signal to a slot in a different thread?

Hello Qt uses signals and slots normally in a single thread, so calling a signal will call a slot in the same thread signal called. Is it any way to use a signal-slot mechanism to pass a message to qt thread ( so slot will be called later in specified thread's context )? ...

Qt4 existing slots are not recognized.

Hi I am currently trying to complete a project using Qt4 and C++. I am using buttons to switch between states. While trying to connect the buttons' clicked() signals to the textEdit to display the relevant state, I got stuck on an error: Object::connect No such slot QTextEdit::append("move state") Object::connect No such slot ...

Signal-slot architecture best practice

I am using libsigc++ to wire up an application, and is uncertain as to the easier way of going about it. There is a preexisting object hierarchy that manages the data layer, and the top level object exposes all functions. All good so far. To this I am adding a GUI object hierarchy, and in the application object I am hooking them toge...

Beginner Qt signals and slots question

I've just started learning Qt, which is my first experience with GUIs. So far it's just been console apps, and a bit of SDL. I'm getting very confused with this whole signals and slots thing. I've just finished Tutorial 11. When you press shoot, the shoot button sends a signal, which is connected to the slot in the Cannonfield, for the ...

Qt signals & inheritance question

I am relatively new to programming with Qt and had a question. Short version: How do I inherit signals defined in superclasses? I am trying to subclass someone else's nicely made QTWidgets to change some of the default behavior: //Plot3D is a QWidget that defines a signal "rotationChanged" class matLinePlot : public QObject, public...

Create PyQt menu from a list of strings

I have a list of strings and want to create a menu entry for each of those strings. When the user clicks on one of the entries, always the same function shall be called with the string as an argument. After some trying and research I came up with something like this: import sys from PyQt4 import QtGui, QtCore class MainWindow(QtGui.QMa...

Qt and C++ - troubles with signal/slots

Hi guys. I have a small trouble with signal/slot in Qt. I have an class wich has public slot: void doSomething(); In constructor of this class i do: this->connect( ui->textFrom, SIGNAL(returnPressed()), this, SLOT(doSomething()) ); I have QLineEdit - textFrom object. ../moc_mainwindow.cpp:66: undefined reference to...

Qt Jambi (Qt4Dotnet): distinguishing signal emitters in a slot

Hi! I'm newb to Qt and got stuck in a signal/slot mechanism. I have a toolbar with a number of tool buttons, each associated with some widget. The task is to show appropriate widget when tool button is clicked. I want to write a single slot that will handle the associations, but I can't figure out how to distinguish what button triggered...

QT + How to call slot from custom C++ code running in a different thread.

Hello, I am new to QT and I am doing some learning. I would like to trigger a slot that modify a GUI widget from a C++ thread(Currently a Qthread). Unfortunatly I get a: ASSERTION failed at: Q_ASSERT(qApp && qApp->thread() == QThread::currentThread()); here is some code: (MAIN + Thread class) class mythread : public QThread ...

QT Signal to specific object's slot

Hello, I would like to know which of the following is the proper way of doing thing with signal/slot in QT. I need a way to have multiple instance of a Dialog, i.e: A and B. And I need to tell A to print "A" and B to print "B" from a different thread. So I believe I need something like either: OPTION 1) A->print("A"); and B->print("B"...

QObject::connect issues with QAbstractItemModel

Hey, I have a QListView from which I obtain a QAbstractItemModel with list->model(); After this, I want to connect the dataChanged signal to a custom QObject of mine: if( QObject::connect(model, SIGNAL(dataChanged (const QModelIndex , const QModelIndex ) ), customObject_,SLOT(onText(const QModelIndex , const Q...

Help getting inserted data after Qt's rowInserted signal

Hey, I have a onText method that connects to a QAbstractItemModel's rowsInserted SIGNAL so I can be notified when new rows have been inserted: QObject::connect(model, SIGNAL(rowsInserted ( const QModelIndex & , int , int ) ), client_,SLOT(onText( const QModelIndex & , int , int )) ) The signal works fine, since I am notif...

Combining two QMainWindows

Good day pythonistas and the rest of the coding crowd, I have two QMainWindows designed and coded separately. I need to: display first on a button-press close the first window construct and display the second window using the arguments from the first I have tried to design a third class to control the flow but it does not understand...

Flex Framework that Uses Signals and Slots

Is there a framework for Flex that uses the Qt Signal and Slots paradigm? I'm getting tired of these event-mapped frameworks. ...

How to connect a slot to signal QProcess::started() ? QT

Edit: Solved. Hi, I'm starting with QT, I try to connect a slot to signal QProcess::started() but can't. QObject::connect() returns false. Any idea what am I doing wrong? Here's part of the code: class foo : public QObject { public: QProcess *process; public slots: void process_started(); } foo::foo() { process = new QPro...

Why is Qt looking for my slot in the base class instead of derived one?

I have my class X which inherits from Qt's class Base. I declared and defined void mySlot() slot in my class X and I'm connecting some signal to this slot in X's constructor. However, when running my program I get an error message saying there's no such slot as void mySlot() in the class Base. Why is the code generated by Meta Object Co...

Slot seemingly not recognized in Qt app

Hello, I have been working on learning C++ and Qt4 recently, but I have hit a stumbling block. I have the following class and implementation: class Window : public QWidget { public: Window(); public slots: void run(); private: //... }; and Window::Window() { //... connect(runBtn,SIGNAL(clicked()),this,SLOT(run...