Qt focus popup window or mainwindow

609 Views Asked by At

I would like to have a MainWindow, and from it, open a popup window for showing some information. And I would like to bring to the front the which one I select doint click on some of them. There is a good example in Qt samples, but it is using QML. I would not like to use qml for the moment.

enter image description here

I have already my MainWindow class, and I think I need to use a QDialog for creating the popup window, no?? Or QWidget?? The idea is showing a charts in that popup.

// Constructor
VDLandMarkDemo::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // Some Initializations 
}

// Destructor
MainWindow::~MainWindow(){delete ui;}


void MainWindow::on_graphics_clicked()
{

    chartwindow = new QDialog;
    chartwindow->activateWindow();

    // Some code chart relate on

    chartwindow->show();
}

EDIT1: I have found finally the solution to my question in this post: Qt: How to give focus to a modeless QDialog created from the main window when the main window is blocked by a modal QDialog Thanks anyway.

Thanks in advance.

0

There are 0 best solutions below