signals-slots

How to intercept ALL signals emitted by a given event in QT?

I can imagine that there might be quite a few of them depending on the event, but at the same time, I guess this can be a best way to debug, and an interesting lesson. Why would I need it? I'm using some custom class based on the QWidget, which does not expand when I de-attach a QDockWidget based in the same window. Knowing what signals...

Qt signaling across threads, one is GUI thread?

What does it mean to move a object from one thread to another in Qt using moveToThread? Everything seems to work even before using moveToThread, which moves the object from one thread (GUI thread) to a another thread ( worked) and Qt:connect calls the appropriate slot on object. Is there any difference because of where the object lives,...

(How) is it possible to bind/rebind a method to work with a delegate of a different signature?

I'm a c++ developer having used signals & slots in c++ which to me seems to be analogous to delegates in c#. I've found myself at a loss in searching for the functionality provided by "bind", and feel I must be missing something. I feel like that something like the following, which is possible in c++ should be possible in c# with delega...

How can I implement a blocking process in a single slot without freezing the GUI?

Let's say I have an event and the corresponding function is called. This function interacts with the outside world and so can sometimes have long delays. If the function waits or hangs then my UI will freeze and this is not desirable. On the other hand, having to break up my function into many parts and re-emitting signals is long and...

QT slot get Signaled twice

In QT4.5, I use a QTableWidget, and I have connected the signal QTableWidget::itemClicked() to a custom slot like this: connect(_table, SIGNAL(itemClicked(QTableWidgetItem*)), item, SLOT(sloItemClicked(QTableWidgetItem*))); I create such a connection for each row I add to the table. The problem is that the slot sloItemClicked get ca...

PyQt4 QDialog connections not being made.

I am working on an application using PyQt4 and the designer it provides. I have a main window application that works fine, but I wanted to create custom message dialogs. I designed a dialog and set up some custom signal/slot connections in the __init__ method and wrote an if __name__=='__main__': and had a test. The custom slots work ...

Connecting multiple signals to a single slot in Qt

I'm trying to keep track of the textChanged() signal on for handful of QTextEdits. I want to do the same thing regardless of the text edit emitting the signal: uncheck its associated checkbox in a QListWidget if it becomes empty and leave it checked otherwise. The function I have so for is as follows: void MainWindow::changed() { QS...

QPushButton FocusIn generates which signal?

I am creating a small PyQt application and got stuck up in MouseOver effect. I have a QMainWindow which has three buttons named createProfileButton, downloadPackagesButton and installPackagesButton. All these are of type QPushButton Now I have created a Label which will hold the text when someone hovers the mouse over any of these butt...

Fewer connections in a Qt calculator

I'm writing a simplified calculator using Qt with C++, for learning purposes. Each number is a QPushButton that uses the same slot to modify the text in a lineEdit widget being used as a display. The slot uses the sender() method to figure out which button was pressed, so the correct number would be written on the display widget. In or...

Qt - emitting slots instead of signals

Suppose I have a QPushButton widget that is connected to a slot by its clicked() signal. This first slot in turn calls another slot by the emit keyword. The second slot takes an argument from the first slot and do something with it. It worked, but from what I understand of the signals-slots pattern, it only makes sense to emit a signal. ...

What does the following function do?

I am looking for Qt's implemention of the function QObject::qt_metacall(_c, _id, _a); this is where a given function name is converted into index. But I am not able to find the function implementation anywhere in their source code. int ssObject::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _...

Qt and OpenCV 2.0 integration problems

Hi all, I have a Qt application that uses OpenCV for image processing. Everything was working fine with OpenCV 1.0 but when I upgraded to OpenCV 2.0 it started crashing. I noticed that it only crashes whenever OpenCV functions are called inside Qt slots. For instance, the following slot: void TestClass::on_testButton_clicked() { I...

When to use signals and slots and when not to

We're using Qt that offers signals and slots which I find really convenient. However, with great power comes great responsibility and I think it's very easy too misuse this feature. Are there any best-practices for signal-slot usage? I'm having a hard time to find some general guidelines in this manner. Some questions (I have clear opi...

How to handle signals when a QT object isn't created through Designer?

Hi I've got a spare moment so decided to look at QT and how easily I can port my windows applications to Qt. My only real problem is a couple of controls that will need re-implementing under QT. I've already handled the basic drawing of the control but my control creates a child scroll bar. The problem is that this scrollbar is crea...

Qt in visual studio: connecting slots and signals doesn't work.

Hi, I have installed Qt and Qt for VS plugin. Everything works fine, UI applications compile and run that's ok, but connecting signals and slots doesn't. I have Q_OBJECT in my class and for connecting I am using this code in constructor: connect(ui.mainTableView, SIGNAL(activated(const QModelIndex &)), this, SLOT(showDetail(con...

Which light C++ event/delegate (signal/slot) library should I choose?

Hi there, I know that the question has already been asked and answered, but it was more than one year ago and it looks like there are new alternatives out there. So I'm coding a game with the SFML library (which I'm starting to find pretty much cool actually) and I'm looking for a light and fast event/delegate library. After doing som...

slot function not getting called

I am learning QT and trying out some examples. I am trying to make a dialog that disappears a label when a button is pressed and makes it appear when the same button is pressed again. Below is the code. #include <QApplication> #include <QPushButton> #include <QLabel> #include <QDialog> #include <QObject> #include <QHBoxLayout> int ma...

C++ Signals/Slot: Slot processing and best C++ Signal library?

I currently have a program which use busy pooling and a bunch of thread to monitor states of object, process data, and pass data.. This is all very hard to manage/waste cpu time. I am looking at removing thread and using signal / slot as there is none of my code which "block". So I will signal states of my object, which is easy. What's ...

Fastest C++ Signal/Slot Lib without dependency

I am going to pass data up/down a 5-10 layered object using signals and slots. Which should result in a few thousand signal per sec. Which is far form "I clicked a button". All my object will also signal them self on a timer about every 100ms so they can do some processing. What would be the fastest C++ Signal/Slot implementation which ...

C++ Managing Shared Object's Handle issues

Is there best practice for managing Object shared by 2 or more others Object. Even when running on different thread? For example A is created and a pointer to it is given to B and C. ObjA A = new ObjA(); B->GiveObj(A); C->GiveObj(A); Now how can I delete objA? So far what I though about is A monitor how many ref there are to it and w...