A
A
Armen2015-01-16 22:36:54
Qt
Armen, 2015-01-16 22:36:54

Does Qt have a mechanism to forward the Child signal on behalf of the Parent?

Good evening everyone! At the moment I am separating the program interface from the logic, and organizing communication through slots and signals. I do like this:

QSlider* seekSlider = new QSlider(this);
    connect(seekSlider, SIGNAL(sliderMoved(int)), this, SLOT(on_sliderMoved(int)));
void ui::on_sliderMoved(int value) 
{
    emit sliderMoved(value);
}

That is, to redirect each signal from the child element to the parent element, I write a method that sends a signal on behalf of the parent. Does Qt have built-in mechanisms for such an action, only without creating additional. method?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly, 2015-01-17
@vt4a2h

What's stopping you from attaching a signal to a signal?
I really don’t know why, but your example can be rewritten like this without using additional methods.
PS
Also, discover the syntax for slots and signals from Qt5: qt-project.org/wiki/New_Signal_Slot_Syntax

A
Armenian Radio, 2015-01-16
@gbg

Well, you can bind one signal to several slots. It's not entirely clear what you want to do. Show more code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question