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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:39:30+00:00 2026-06-10T14:39:30+00:00

I have a application with two main windows and I want to catch events

  • 0

I have a application with two main windows and I want to catch events from one to another. For example at button1_MouseClick event(where button 1 is situated on Form1), I want to change text to label1(where label1 is on form2). Is that possible in qt c++, and if yes, how? Could you post some code snippets, please?

P.S. I have achieved what I want using a timer and a global boolean value, but I don’t like that

Thank you

  • 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-10T14:39:32+00:00Added an answer on June 10, 2026 at 2:39 pm

    I’d have a public function within the class for form 2 which when called would change the label. Then connect the button1_MouseClick event to a private function within the form 1 class which calls the form 2 public function.

    Along the lines of this perhaps:

    class form1 : public QMainWindow
    {
    //Put in everything else class needs
    
    private slots:
    void callChangeLabel();
    };
    
    void form1::callChangeLabel()
    {
    //f2 is an instance of form2
    f2->changeLabel();
    }
    
    
    class form2 : public QMainWindow
    {
    //Put in everything else class needs
    
    public:
    void changeLabel();
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that has two threads. The first one (the main thread)
I have an application that has a main UI and two modeless windows that
I have two modules like this (very very simplified): main.py: from window import *
I have an application that has two different login windows for two different types
I have a main window (Window based application) and two different UIViewController. i am
I write two windows console application as below class ProgramA { static void Main(string[]
Let's say I have 2 windows in my application, and two classes responsible for
I have a solution, that has two projects, the main one and a small
I have a Qt application that contains a QTreeWidget. I want to replace one
I have two application that need to talk to each other. App1 needs to

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.