Y
Y
yourisus2016-12-09 17:25:40
Python
yourisus, 2016-12-09 17:25:40

How to link two qwidjet?

Is it possible to somehow manipulate frames using QApplication? I'm trying to somehow draw analogies with Layout from Android, the signals are very finicky, and in general it turns out to connect only this kind of

mainWindow.connect(self.btn, SIGNAL(clicked()), action())

I tried to link buttons of different frames, but it doesn't work.
In a word, interaction is needed, maybe there is some other simpler template?
8cb13b8a687443078698bdd8669bafa9.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly, 2016-12-09
@vitali1995

What kind of interaction is needed?
All widgets are perfectly connected by signals:

connect(childWidget1->button, QPushButton::clicked, this, MainWindow::onButton1Click);
connect(childWidget2->button, QPushButton::clicked, this, MainWindow::onButton2Click);

onButton1Click()
{
childWidget2->doSmth();
}

T
tschin, 2016-12-09
@tschin

You might be better off using qstackwidget. In it, you can add pages with the widgets you need and conveniently switch them.
If you do it the way you want, then there should be objects of these windows + a signal in the sender, which will be associated with a public slot in the receiver.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question