Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    About dialogs

    General and Desktop
    4
    9
    3075
    Loading More Posts
    • 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.
    • S
      sfarbac last edited by

      Hi,

      I'm new about using Qt and I'm trying creat dialog windows.I created a main dialog window succesfully but the lower window was not succes.Code as follows in mainwindow.cpp

      @#include<mydialog.h> //I created a window as myDialog in qt design and made include in mainwindow.cpp
      void MainWindow::on_actionMain_triggered() //I went to the slot in mainwindow
      {
      myDialog mDialog ;
      mDialog.setModal(true);
      mDialog.exec();
      }
      @
      When I deleted codes in slot and run ,project work.wrongs as follows;

      compile output;

      **jom: C:\Users\sefa\Desktop\QT\projeler\designer_kullanimi_2\Makefile.Debug [debug\designer_kullanimi_2.exe] Error 1120
      jom: C:\Users\sefa\Desktop\QT\projeler\designer_kullanimi_2\Makefile [debug] Error 2
      16:46:22: The process "C:\Qt2\Qt5.1.1\Tools\QtCreator\bin\jom.exe" exited with code 2.
      Error while building/deploying project designer_kullanimi_2 (kit: Desktop Qt 5.1.1 MSVC2012 OpenGL 64bit)
      When executing step 'Make'

      issues;

      mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl myDialog ::myDialog (class QWidget *)" (??0myDialog @@QEAA@PEAVQWidget@@@Z) referenced in function "private: void __cdecl MainWindow::on_actionMain_triggered(void)" (?on_actionMain_triggered@MainWindow@@AEAAXXZ)

      debug\designer_kullanimi_2.exe:-1: error: LNK1120: 2 unresolved externals

      1 Reply Last reply Reply Quote 0
      • Jeroentjehome
        Jeroentjehome last edited by

        Hi,
        Did you also include the dialog in your project file? The compiler is not able to find your constructor of the dialog class.
        Greetz

        Greetz, Jeroen

        1 Reply Last reply Reply Quote 0
        • S
          sfarbac last edited by

          in project file code
          @#-------------------------------------------------

          Project created by QtCreator 2013-12-02T16:31:01

          #-------------------------------------------------

          QT += core gui

          greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

          TARGET = designer_kullanimi_2
          TEMPLATE = app

          SOURCES += main.cpp
          mainwindow.cpp
          mydialog.cpp \

          HEADERS += mainwindow.h
          mydialog.h \

          FORMS += mainwindow.ui
          mydialog.ui \

          @

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Hi and welcome to devnet,

            Can you show the mydialog.h content ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • S
              sfarbac last edited by

              thanks,
              @#ifndef MYDIALOG_H
              #define MYDIALOG_H

              #include <QDialog>

              namespace Ui {
              class myDialog;
              }

              class myDialog : public QDialog
              {
              Q_OBJECT

              public:
              explicit myDialog(QWidget *parent = 0);
              ~myDialog();

              private:
              Ui::myDialog *ui;
              };

              #endif // MYDIALOG_H
              @

              1 Reply Last reply Reply Quote 0
              • SGaist
                SGaist Lifetime Qt Champion last edited by

                And how does the cpp look like ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply Reply Quote 0
                • S
                  sfarbac last edited by

                  I have not done anything cpp fiile without including mydialog.h.Problem may be do to the location of the debug and release file or installation.What do you think about this.I'm sorry to keep you busy

                  @#include "mainwindow.h"
                  #include <QApplication>
                  #include<mydialog.h>

                  int main(int argc, char *argv[])
                  {
                  QApplication a(argc, argv);
                  MainWindow w;
                  w.show();

                  return a.exec&#40;&#41;;
                  

                  }@

                  1 Reply Last reply Reply Quote 0
                  • SGaist
                    SGaist Lifetime Qt Champion last edited by

                    including mydialog.h in main.cpp won't change anything. You have the constructor from myDialog that seems to be missing. That's why I've asked for the mydialog.cpp file

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply Reply Quote 0
                    • larryn46
                      larryn46 last edited by

                      Try right clicking on the project name and selecting run qmake.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post