signals-slots

How signal and slots are implemented under the hood ?

Hello This question is already asked in this forum but I don't understand the concept. I was reading around and it seems that signal and slots are implemented using function pointers i.e the signal is one big function which inside it calls all connected slots (function pointers). Is this correct? And what is the role of the generated m...

How does boost implements signals and slots?

To continue another question, lets ask this: How does Boost implement the signals/slot mechanism? See: http://stackoverflow.com/questions/1406940/how-signal-and-slots-are-implemented-under-the-hood http://www.boost.org/doc/libs/1%5F40%5F0/doc/html/signals.html ...

Qt signals and slots, threads, app.exec(), and related queries

[related to this question] I wrote this piece of code to understand how qt signals and slots work. I need someone to explain the behaviour, and to tell me if I'm right about my own conclusions. My program: connectionhandler.h #ifndef CONNECTIONHANDLER_H #define CONNECTIONHANDLER_H #include <QTcpServer> class ConnectionHandler : publ...

Qt GUI app: warning if QObject::connect() failed?

I recently migrated my Qt project from Linux to Vista, and now I'm debugging signals blindly. On Linux, if QObject::connect() fails in a debug build, I get a warning message on stderr. On Windows, there is no console output for GUI applications, only an OutputDebugString call. I already installed DebugView, and it catches my own qDebug...

how to connect two window in qt

acctualy i want when i click a pushbutton then it will connect to another window. But i am unable to declare my own slot in Ui_example.h file. so what i do? ...

Qt Map Signals Based On Parameter Value

Hi folks, I know that i can use QSignalMapper to call a slot with different parameters based on connection. What i want to achieve is a little different. We are using plugins in our application and different plugins are responsible for different types of objects. We are connecting multiple slots, each implemented in a different plugin,...

Is it possible to have a QWidget as a child to a QObject?

Hi, My main application object is a QObject, that juggles a QSystemTrayIcon, a QDialog, a QWindow and a few other components. The app mostly sits in the tray, with some options dialogs etc etc. Now, I'd like to use QMetaObject::connectSlotsByName() to connect signals from these objects to slots in the main object. It's 10-15 of them, s...

Signal and Slot vs Multithreading in Boost Library

I have gone through similar questions on Stackoverflow but still can't get a good answer: how boost implements signals and slots How signal and slots are implemented I am quite puzzled on how this signal/slot is achieved. Q1: From the following code, sig is connected to two function(Hello() and World()), and it seems that the funct...

Pointer to a Qt Slot

Hi, i want to build a pointer to a Qt Slot: union { void (*set_slot)(unsigned long value); void (*refresh_slot)(void); } the_slot; The slot definition is: void set_pwm(unsigned long new_pwm); I try to do something like this: the_slot.set_slot = set_pwm; But the compiler says that the signature does not match: error:...

Qt widget update later but when?

I'd like to know what happens exactly when I call a QWidget's update() method. Here is the documentation: http://doc.trolltech.com/4.5/qwidget.html#update This function does not cause an immediate repaint; instead it schedules a paint event for processing when Qt returns to the main event loop. This permits Qt to optimize fo...

How do I find out if a goroutine is done, without blocking?

All the examples I've seen so far involve blocking to get the result (via the <-chan operator). My current approach involves passing a pointer to a struct: type goresult struct { result resultType; finished bool; } which the goroutine writes upon completion. Then it's a simple matter of checking finished whenever convenient. ...

Qt library event loop problems

I'm writing a DLL that is used as a plugin by another application and would like to leverage Qt's abilities. I have all of the classes set up, compiling and running, but no signals are being emitted. So it seems as though there's no QEventLoop. Attempt 1: I modified my main class to subclass QThread instead of QObject, and in the run() ...

Trying to get signals to work in my QT. I need some advice and help

So I have in my main function: string s = "\nWelcome to Rawr\n"; const QString output(s); **emit output(output); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Getting an error here** I have set up a Signal in QT Desginer named: output(const QString &s) My receiver for the signal is my "Form"... in my form.h i have: The slot is called "change...

Is it possible to see definition of Q_SIGNALS, Q_SLOT, SLOT(), SIGNAL() macros? (Qt)

Is it possible to see definition of Q_SIGNALS, Q_SLOT, SLOT(), SIGNAL() macros in Qt framework? P.S. Google gave me nothing in this question. ...

Qt tells me that my SLOT doesnt exist, but with a make clean, make it doesnt complain anymore

when i download a fresh copy from our SVN, make then run my program, Qt tells me that one of my SLOTS doesn't work but with a handy-dandy make clean then make, it seems to solve the problem. i continue to make changes in the code on my PC and that message never shows again. C++ Qt 4.6 gcc has anyone had this problem? and ideas? thanks...

Argument type for Qt signal and slot, does const reference qualifiers matters?

For signal and slot of below type signals: void textChanged(const QString &); public slots: void setText(const QString & text) the type of argument of textChanged and setText seems to work invarable of const and &. Does the constant and reference qualification make any difference compared to just using QString ? QObject::co...

unable to bind a signal to a slot in QT

hi , I just started with QT and I know the concept of signal/slot but in implementing it I have problem. take a look at my code : #include "test.h" #include <QCoreApplication> test::test() { // TODO Auto-generated constructor stub } test::~test() { // TODO Auto-generated destructor stub } void test::fireslot(){ qDebug...

How does Qt implement signals and slots?

Can someone explain to me the basic idea of Qt signals&slots mechanism IMPLEMENTATION? I want to know what all those Q_OBJECT macros do "in plain C++". This question is NOT about signals&slots usage. added: I know that Qt uses moc compiler to transform Qt-C++ in plain C++. But what does moc do? I tried to read "moc_filename.cpp" files b...

Is there a way to stop a boost::signal from calling its slots if one of them returns true?

Hello, I am using the boost library and my question is about boost::signals. I have a signal that might call many different slots but only one slot will match the call so I want this particular slot to return true and that the calling will stop. Is it possible? Is it efficient? Can you guys suggest me a better way to do it if it's not ef...

boost signals - How control lifetime of objects sent to subscribers? Smart pointers?

I am using boost::signals2 under Red Hat Enterprise Linux 5.3. My signal creates an object copy and sends it's pointer to subscribers. This was implemented for thread safety to prevent the worker thread from updating a string property on the object at the same time it is being read ( perhaps I should revisit the use of locks? ). Anywa...