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. About dialogs

About dialogs

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 3.5k Views
  • 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 Offline
    S Offline
    sfarbac
    wrote on last edited by
    #1

    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
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      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
      0
      • S Offline
        S Offline
        sfarbac
        wrote on last edited by
        #3

        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
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          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
          0
          • S Offline
            S Offline
            sfarbac
            wrote on last edited by
            #5

            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
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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
              0
              • S Offline
                S Offline
                sfarbac
                wrote on last edited by
                #7

                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
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  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
                  0
                  • larryn46L Offline
                    larryn46L Offline
                    larryn46
                    wrote on last edited by
                    #9

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

                    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