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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:53:07+00:00 2026-05-31T14:53:07+00:00

I have the qmainwindow which homes several qgraphicsitems(an inherited class from qgraphicsitems) within a

  • 0

I have the qmainwindow which homes several qgraphicsitems(an inherited class from qgraphicsitems) within a qgraphicsview. These items contains their personal items which are inherited from qgraphicsitems also. These items listen to mouse press events. These items also have their own other data properties such as custom id.

I can pass mouse events from these items to the main window. I need to pass the above said custom id of the clicked item to the main window also with the event, so that main window can change its appearance to suite the clicked item.

What way can i do this ??

  • 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-31T14:53:08+00:00Added an answer on May 31, 2026 at 2:53 pm

    Maybe I didn’t get your question, but I would use SLOTS and SIGNALS rather than events.
    For example, put a signal on the QGraphicsScene, something like:

    void myItemClicked(int custom_id);
    

    so, when your items catch mouse event, they could do:

    emit scene()->myItemClicked(my_id);
    

    MainWindow could connect that signal coming from the scene to one of its slots and change its properties according to the id of the item coming along the signal.

    Otherwise, if you allow items to call methods of the QMainWindow (this is a design choice) yuo could store a pointer to it in the (for example) the scene, so items can do:

    scene()->mainwindow->aMethod();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have class MyForm which inherited from QMainWindow . Here's my code: std::auto_ptr<MyForm> pForm(new
I have a text editor like program which is a QMainWindow inherited class. There,
If I have a class which inherits QMainWindow, and I want it to only
I have a Qt Designer Class called MainWindow which is a QMainWindow. This class
I have a QMainWindow which spawns a few wizards. The QMainWindow has a QFrame
I have an inactive QMainWindow with a QTabWidget as CentralWidget which holds multiple QPlainTextEdits
i have a window which is like this <Window x:Class=pharmacy_Concept.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350
I have a class that inherits QMainWindow and I just want it to have
I have a QMainWindow with three widgets inside that are promoted to a class
I have a QMainWindow, and want to handle the clicked signal from a smaller

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.