I have the code:
auto toolbar = new QToolBar(&mainWidget);
toolbar->move(50,50); // random pos, but not (0,0);
toolbar->addWidget(new QPushButton("1-button"));
auto secondButton = new QPushButton("2-button");
toolbar->addWidget(secondButton);
qDebug() << secondButton->pos(); // (0,0) ok because there's local coords.
qDebug() << secondButton->mapToGlobal(QPoint{0,0}); // expected secondButton's global pos, but found toolbar pos. Why?
Also I had tried some variants of usage of methods ‘geomtry’ and ‘rect’ that followed to the same result. Using Qt 6.6.
How to get a global position of a Widget in QToolbar? Thanks.