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

  • SEARCH
  • Home
  • 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 8555095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:02:35+00:00 2026-06-11T15:02:35+00:00

I am following the Qt example listed in the QtSDK titled: Getting Started Programming

  • 0

I am following the Qt example listed in the QtSDK titled: “Getting Started Programming with Qt”. My problem is that the program doesn’t display any of the objects.

My main.cpp looks like so:

#include <QtGui>

#include <notepad.h>

int main(int argv, char **args)  {
    QApplication app(argv, args);

    QVBoxLayout layout;

    Notepad notepad();

    QWidget window;
    window.setLayout(&layout);

    window.show();

    return app.exec();
}

The ‘notepad.h’ file:

#ifndef NOTEPAD_H
#define NOTEPAD_H

#include <QtGui>

class Notepad : public QMainWindow  {
    Q_OBJECT

    public:
        Notepad();

    private slots:
        void open();
        void save();
        void quit();

    private:
        QTextEdit *text_edit;

        QAction *open_action;
        QAction *save_action;
        QAction *exit_action;

        QMenu *file_menu;
};

#endif // NOTEPAD_H

The ‘notepad.cpp’ file:

#include "notepad.h"

Notepad::Notepad()  {
    open_action = new QAction(tr("&Open"), this);
    save_action = new QAction(tr("&Save"), this);
    exit_action = new QAction(tr("&Exit"), this);

    connect(open_action, SIGNAL(triggered()), this, SLOT(open()));
    connect(save_action, SIGNAL(triggered()), this, SLOT(save()));
    connect(exit_action, SIGNAL(triggered()), qApp, SLOT(quit()));

    file_menu = menuBar()->addMenu(tr("&File"));
    file_menu->addAction(open_action);
    file_menu->addAction(save_action);
    file_menu->addSeparator();
    file_menu->addAction(exit_action);

    text_edit = new QTextEdit;
    setCentralWidget(text_edit);

    setWindowTitle(tr("Notepad"));
}

void Notepad::open()  {
    ...
}

void Notepad::save()  {
    ...
}

void Notepad::quit()  {
}

Any help in resolving the matter would be much appreciated.

Edit

My original question asked why I was I was getting a compile time error for not implementing the “quit” function incase you are wondering :).

  • 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-06-11T15:02:36+00:00Added an answer on June 11, 2026 at 3:02 pm

    You have to implement quit() method defined as private slot in notepad.h . Unresolved errors are linking errors and tells you that linker hasn’t found any implementation for the function declaration. Add this to notepad.cpp :

    void Notepad::quit()  {
        ...
    }
    

    For new question :

    Try notepad.show(). Your MainWindow can be notepad object because it is a QMainWindow.

    int main(int argv, char **args)  {
        QApplication app(argv, args);
    
        Notepad notepad();
        notepad.show();
    
        return app.exec();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example: Suppose in the following example I want to match strings that do not
According to the manpage (where it had been listed as an example) the following
For example, let us say we have the following schema (listed in http://www.w3.org/TR/xmlschema-0/#NS )
Noob question here. I'm following this example/tutorial to try and isolate a problem I
In following example: Line1 <br /> Line2 I'm using <br /> to force Line2
The following example will not compile for me: #include <iostream> #include <functional> #include <string>
I find the following example mildly surprising: >>> class Foo: def blah(self): pass >>>
What happens in the following example? struct B { }; struct D1 : B
I'm applying the following example http://jsoup.org/cookbook/extracting-data/example-list-links to list links. package org.jsoup.examples; import org.jsoup.Jsoup; import
I have tree like following example, where every leaf is object. [1] |--[2] |

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.