Hello,

I'm new to Qt, I started actually today with it, after I was making my gui (.ui file) in the editor, I came to the problem how can I show my second window, I found a solution with google, but now im walking in next problems, so I thought let's join a Qt forum and leave my win api forum

Anyways, this is my code.

DMain.cpp
Qt Code:
  1. #include "DMain.h"
  2. #include "DBlock.h"
  3. #include "ui_Dmain.h"
  4. #include "ui_DBlock.h"
  5.  
  6. MainWindow::MainWindow(QWidget *parent) :
  7. QMainWindow(parent),
  8. ui(new Ui::MainWindow)
  9. {
  10. ui->setupUi(this);
  11. }
  12.  
  13. MainWindow::~MainWindow()
  14. {
  15. delete ui;
  16. }
  17.  
  18. void MainWindow::on_pushButton_clicked()
  19. {
  20. BlockDialog* BlockDialogv = new BlockDialog(this);
  21. if(!BlockDialogv->isVisible()) // this is not working
  22. {
  23. BlockDialogv->show();
  24. BlockDialogv->activateWindow();
  25. }
  26. }
To copy to clipboard, switch view to plain text mode 

DBlock.cpp
Qt Code:
  1. #include "DBlock.h"
  2. #include "ui_DBlock.h"
  3.  
  4. BlockDialog::BlockDialog(QWidget *parent) :
  5. QDialog(parent),
  6. ui(new Ui::BlockDialog)
  7. {
  8. ui->setupUi(this);
  9. }
  10.  
  11. BlockDialog::~BlockDialog()
  12. {
  13. delete ui;
  14. }
To copy to clipboard, switch view to plain text mode 

I'm trying to show a second dialog from my main, as you can see I tried to check if it allready existed, but off course this did not work, quite clearly if you look at the code, but I gave it a try. I want to make it so, that it can only open once and hide itselfs after someone closes it, I've to handle that in the BlockDialog class with a slot right?

Is this further all right coded?