Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7003711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:06:16+00:00 2026-05-27T21:06:16+00:00

I am getting an error while trying to run this Application … the error

  • 0

I am getting an error while trying to run this Application … the error message is:

main.cpp(11): error: expression must have class type
int r = dialog.exec(); and I am not sure why!!!

I am using qmake to generate the make file… I have added the necessary files to the *.pro file since Dialog is inherited from QDialog I should have access to the function exec!

#include <QtGui>
#include <QDialog>
#include <QtUtil.h>
#include <Mathematics.h>
#include <Pair.h>
#include "View.h"

class QMesseageBox;
class QAction;
class QDialogButtonBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QTextEdit;

class Dialog : public QDialog {
    Q_OBJECT
public:
    Dialog() {
        QHBoxLayout *layout = new QHBoxLayout;
        // prevent left vertical box from growing when main window resized
        layout->addStretch(1);

        QLabel*      lab_Layers = new QLabel(tr("Layers"));
        d_inline   = new QLineEdit;
        d_inline->setText("50");

        scene = new QGraphicsScene(0, 0, 500, 500);
        view  = new View;

        layout->addWidget(view);
        view->setScene(scene);

        QVBoxLayout *mainLayout = new QVBoxLayout;
        mainLayout->addLayout(layout);
        setLayout(mainLayout);
        setWindowTitle(tr("VI Smooth 0.4"));    
    }

private slots:
    // scroll the "after" window when "before" one is scrolled (so they
    // remain in sync)

private:
    QAction* exitAction;
    QtUtil qt;
    QLineEdit*   d_inline;
    QGraphicsScene* scene;
    QGraphicsView*  view;
};

main class

#include <QApplication>
#include <QMessageBox>
#include "Dialog.h"

int 
main(int argc, char **argv) {
    QApplication app(argc, argv);
      argv++;
    Dialog dialog();
//  dialog.showMaximized();
    int r = dialog.exec();
    return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:06:16+00:00Added an answer on May 27, 2026 at 9:06 pm

    It should look something like this. If you create a Dialog object, you need to call show(). And you also need to return app.exec() in main().

    #include <QApplication>
    #include <QMessageBox>
    #include "Dialog.h"
    
    int 
    main(int argc, char **argv) {
        QApplication app(argc, argv);
          argv++;
        Dialog dialog;
        dialog.show()
        return app.exec(argc, argv);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While trying to run my application I'm getting this error. Sys.WebForms.PageRequestManagerServerErrorException:500 How can i
I have this error while trying to run my program. I am still wondering
I am getting this error message in the console, while I am trying to
I am getting this error while trying to run an ajaxq call. I am
Getting this error while I am trying to run /compile/build a Proiject Incompatible Types
I am getting an error while trying to run CFmx code on a remote
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
I keep getting this error while trying to modify some tables. Here's my code:
All of a sudden I start getting this error while trying to open 2
While trying to host the CLR, I keep getting this: error C2440: 'function' :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.