Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    Unsolved Use a QDialog box in Win32 Application

    General and Desktop
    qinputdialog win32 console app
    3
    4
    743
    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.
    • F
      falcon010216 last edited by

      I have a win32 application using Visual Studio 2010 and QT4. The program compiles and run. In the program I try to create a QDialog box to enter a number.
      Here is the code

      #include "stdafx.h"
      #include "QtGui\qinputdialog.h"
      #include "QtGui\qmessagebox.h"
      #include "QtGui\qapplication.h"
      #include "QtCore/QDebug"

      int _tmain(int argc, char* argv[])
      {

      QApplication app(argc, argv);
      	QTextStream cout(stdout);                      
      
      	// Declarations of variables
      	int answer = 0;                                 
      
      	do {
      		// local variables to the loop:
      		int factArg = 0;
      		int fact(1);
      		factArg = QInputDialog::getInt(0, "Factorial Calculator",
      			"Factorial of:", 1);                    
      			cout << "User entered: " << factArg << endl;
      		int i = 2;
      		while (i <= factArg) {
      			fact = fact * i;
      			++i;
      		}
      		QString response = QString("The factorial of %1 is %2.\n%3")
      			.arg(factArg).arg(fact)                 
      			.arg("Compute another factorial?");     
      			answer = QMessageBox::question(0, "Play again?", response,
      			QMessageBox::Yes | QMessageBox::No);    
      	} while (answer == QMessageBox::Yes);
      		return EXIT_SUCCESS;
      return 0;
      

      }

      In this application If I run I get the following output in the console
      0_1522919990572_Untitled (2).png

      This code is run in debug mode. I have the QT4 at .lib. As shows QtGuid4.dll not found but the .dll file is already there in the location. Thanks.

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @falcon010216 last edited by

        @falcon010216 The library is found but not a method inside this library. Is it possible that your app is using a different Qt version at runtime than at build time? Do you have any directories containing Qt libraries in your PATH?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 1
        • newbieQTDev
          newbieQTDev last edited by newbieQTDev

          Hi jsulm.
          Thank for your replay
          This is the version of my QT.
          0_1522935084370_782e068b-c611-44e0-8fe1-c06b2fb9791d-immagine.png
          This is my file .pro

          QT += core
          QT += axcontainer
          QT -= gui
          
          CONFIG += c++11
          
          TARGET = myTestCOM
          CONFIG += console
          CONFIG -= app_bundle
          
          TEMPLATE = app
          
          SOURCES += main.cpp
          
          

          this is my setting's project
          0_1522935288486_fb59bc41-b7b4-4e0f-a536-e61bf3ee43ff-immagine.png
          0_1522935545658_7c99b899-7535-402d-b8e7-2fc781f0928f-immagine.png

          jsulm 1 Reply Last reply Reply Quote 0
          • jsulm
            jsulm Lifetime Qt Champion @newbieQTDev last edited by

            @newbieQTDev said in Use a QDialog box in Win32 Application:

            This is the version of my QT.

            No this is the Qt version which was used to build QtCreator (which is a Qt app).
            You're using Qt 5.6.0

            https://forum.qt.io/topic/113070/qt-code-of-conduct

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