Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] new QDialog crash
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] new QDialog crash

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 843 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Munteanu Marian
    wrote on last edited by
    #1

    The problem was in another part of the code.

    Hi, what is wrong with the following code?

    @
    class MyDialog : public QDialog
    {
    Q_OBJECT
    public:
    explicit MyDialog(QWidget *parent = 0);
    ~MyDialog();
    };
    MyDialog::MyDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MyDialog)
    {
    ui->setupUi(this);
    }

    class MainWindow : public QMainWindow
    {
    Q_OBJECT
    MyDialog * md;
    public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    };
    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);

    md = new MyDialog(this); // THIS LINE GENERATE A CRASH
    //MyDialog md(this); is OK

    }
    @

    Thank you.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      What is the stack trace of the crash?

      Oh and why is this marked as solved?

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved