0

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.

Arritmic
  • 474
  • 2
  • 12
  • What did you try, so far? Can you post some code? And what's the question by the way? – p-a-o-l-o Feb 23 '18 at 12:57
  • Done! Thanks for the interest @p-a-o-l-o – Arritmic Feb 23 '18 at 13:15
  • Still I don't get the question. – p-a-o-l-o Feb 23 '18 at 13:18
  • The question is that just now I can open a Dialog window, but my main window is always in the background... Behind my new popup window. And I want it comes to the front if I click with the mouse on it. But now, it does not work. Is there some way without using mouse events? Thanks. – Arritmic Feb 23 '18 at 13:25
  • Already solved. Thanks and sorry for not explaining it well. – Arritmic Feb 23 '18 at 13:42
  • Yes @eyllanesc . I do not exactly if it is duplicated or not. And I do not know if I should to close this post. Maybe some of you have more experience than me and could tell me. :) – Arritmic Feb 23 '18 at 14:04
  • @Arritmic If the answer for both cases is the same, practically your answer refers to the other answer, then it is a duplicate, and therefore we close the community, closes it with more privileges or you eliminate it. – eyllanesc Feb 23 '18 at 14:05
  • @eyllanesc The question is not the same, but I have found the solution for my problem there. – Arritmic Feb 23 '18 at 14:13
  • If the solution works for this question, it should be marked as a duplicate and both questions should be left in place. There's no reason to delete this question because it can still be useful as a "signpost" to the other answer. – EJoshuaS - Stand with Ukraine Feb 23 '18 at 14:42

0 Answers0