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 4030112
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:25:49+00:00 2026-05-20T11:25:49+00:00

I’m writing a Qt GUI Application, but there’s a strange error i can’t figure

  • 0

I’m writing a Qt GUI Application, but there’s a strange error i can’t figure out;
Here’s the whole code:
main.cpp

#include "LevelEditor.h"
int main(int argc, char* argv[])
{
    LevelEditor editor(argc, argv);
    editor.go();
    return 0;
}

LevelEditor.h

#ifndef LEVELEDITOR_H
#define LEVELEDITOR_H

#include <QtGui>

class LevelEditor
{
    public:
        LevelEditor(int argc, char* argv[]);
        ~LevelEditor();
        void go();
    protected:
        QApplication* app;
        QMainWindow* main_window;
        QMenuBar* menu_bar;
        QStatusBar* status_bar;
        QWidget* central;
        QMenu* menu_entry[3];
        QFrame* about_frame;

        QList<QAction*> file_actions;
        QList<QAction*> edit_actions;
        QList<QAction*> help_actions;
    private:
};

#endif // LEVELEDITOR_H

LevelEditor.cpp

#include "LevelEditor.h"
#include <QStatusBar>
LevelEditor::LevelEditor(int argc, char* argv[])
{
    //initialise main objects
    app = new QApplication(argc, argv);
    main_window = new QMainWindow();
    menu_bar = main_window->menuBar();
    status_bar = main_window->statusBar();
    central = main_window->centralWidget();
    about_frame = new QFrame();

    //initialise menu entries and actions
    menu_entry[0] = new QMenu();    //file
    menu_entry[1] = new QMenu();    //edit
    menu_entry[2] = new QMenu();    //about

    //creating and connecting events to action
    menu_entry[0]->setTitle("File");
    file_actions.append(new QAction("New", menu_entry[0]));
    file_actions.append(new QAction("Open", menu_entry[0]));
    file_actions.append(new QAction("Save", menu_entry[0]));
    file_actions.append(new QAction("Quit", menu_entry[0]));
    QObject::connect(file_actions.back(), SIGNAL(triggered()), app, SLOT(quit()));
    QObject::connect(file_actions.back(), SIGNAL(hovered()), status_bar, SLOT(showMessage("Quit this App"));
    menu_entry[0]->addActions(file_actions);
    menu_bar->addMenu(menu_entry[0]);

    //edit menu
    menu_entry[1]->setTitle("Edit");
    edit_actions.append(new QAction("Cut", menu_entry[1]));
    edit_actions.append(new QAction("Copy", menu_entry[1]));
    edit_actions.append(new QAction("Paste", menu_entry[1]));
    menu_entry[1]->addActions(edit_actions);
    menu_bar->addMenu(menu_entry[1]);

    //help menu
    help_actions.append(new QAction("About", menu_entry[2]));
    QObject::connect(help_actions.back(), SIGNAL(triggered()), about_frame, SLOT(show()));
    menu_entry[2]->setTitle("Help");
    menu_entry[2]->addActions(help_actions);
    menu_bar->addMenu(menu_entry[2]);

    about_frame->resize(400,300);
}

LevelEditor::~LevelEditor()
{
    //dtor
}

void LevelEditor::go()
{
    //nothing
    main_window->showMaximized();
    menu_bar->show();
    status_bar->show();
    app->exec();
}

This code compiles fine without errors.
Anyway, the debug console gives me a warning
QObject::connect : NO such slot &QStatusBar::showMessage(“Quit this App”)

The problem seems related to this line:

QObject::connect(file_actions.back(), SIGNAL(hovered()), status_bar, SLOT(showMessage("Quit this App"));

I’ve searched in “QStatusBar.h” for the showMessage function and it is declared, but can’t be called neither with “.” nor “->” (even if it’s public). Also tried this:
QObject::connect(file_actions.back(), SIGNAL(hovered()), status_bar, SLOT(showMessage("Quit this App", 0));

and this:
QObject::connect(file_actions.back(), SIGNAL(hovered()), status_bar, SLOT(QStatusBar::showMessage("Quit this App"));

But to no avail, it just won’t recognise the function.

Am i missing something here?
Thanks in advance.

EDIT: Solved, i was taking the hard way to show a status text instead of using QAction::setStatusTip, my bad.

  • 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-20T11:25:50+00:00Added an answer on May 20, 2026 at 11:25 am

    You can’t connect a signal to a slot with different signature. And you are not even using the proper connect syntax. The SLOT part should be:

    SLOT(showMessage(const QString &))
    

    It’s to tell the meta object system what type(s) of parameters to send to the slot, not what concrete data to send.

    In your case, you can’t connect a signal with no parameter to a slot that expects one. You can achieve that by connecting the signal to your own slot and then call QStatusBar::showMessage from there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I need to clean up various Word 'smart' characters in user input, including but

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.