You want to align the new windows with the bottom of the childwindow that created it. So when you create the new Window, you read the rect() value from the firstChildWindow that you probably have a pointer to somewhere in your application and then move to the new window to the bottom of the child window with move or setGeometry().
//slot creating the new window
void createWindow() {
window->move(frameGeometry().bottomLeft());
window->raise();
window->show();
}
//slot creating the new window
void createWindow() {
static QDialog* window = new QDialog;
window->move(frameGeometry().bottomLeft());
window->raise();
window->show();
}
To copy to clipboard, switch view to plain text mode
here is a simple implementation:
#include <QtGui>
{
Q_OBJECT
public:
{
connect(newButton, SIGNAL(clicked()), this, SLOT(createWindow()));
layout->addWidget(newButton);
}
private slots:
void createWindow() {
window->move(frameGeometry().bottomLeft());
window->raise();
window->show();
}
};
int main(int argc, char* argv[])
{
TestDlg dialog;
dialog.show();
return app.exec();
}
#include "main.moc"
#include <QtGui>
class TestDlg : public QDialog
{
Q_OBJECT
public:
TestDlg(QWidget* parent = 0) : QDialog(parent)
{
QPushButton* newButton = new QPushButton(tr("Create new Window"));
connect(newButton, SIGNAL(clicked()), this, SLOT(createWindow()));
QLayout* layout = new QVBoxLayout(this);
layout->addWidget(newButton);
}
private slots:
void createWindow() {
static QDialog* window = new QDialog;
window->move(frameGeometry().bottomLeft());
window->raise();
window->show();
}
};
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
TestDlg dialog;
dialog.show();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
Bookmarks