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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:49:36+00:00 2026-05-24T09:49:36+00:00

i have a class implemented from QGraphicsItem, called Node. i have a rectangle shaped

  • 0

i have a class implemented from QGraphicsItem, called Node.

i have a rectangle shaped “Node” and i can do something when user clicked on it

i use mousePress and mouseRelease events.

but i want to be notified when user clicked “out of” the rectangle shape.

i tried to implement these functions:

Qt Code:

void Node::focusInEvent ( QFocusEvent * event){
cout<<"in"<<endl;
update();

QGraphicsItem::focusInEvent(event);
}
void Node::focusOutEvent ( QFocusEvent * event ){
cout<<"out"<<endl;
update();
QGraphicsItem::focusOutEvent(event);

}
void Node::hoverEnterEvent(QGraphicsSceneHoverEvent *event){
cout<<"out"<<endl;
}

these do not reacts if i click in or out of rectangle.
should i set a logic on my own for example getting the mouse position and control if it is out of rectangle?
or is there a built in method?

or how can a “Node” object know if other Node object is clicked?

also i wonder, googled but could not found that when does focusinevent and focusoutevent triggered? I guess focusOutEvent must work when i had clicked in the item, then out of the item, am i wrong?

thanks for idea.

  • 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-24T09:49:37+00:00Added an answer on May 24, 2026 at 9:49 am

    Have you called setFlags method of your graphics item with QGraphicsItem::ItemIsSelectable or QGraphicsItem::ItemIsMovable ?

    According to QT doc.

    By default, no flags are enabled.

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

Sidebar

Related Questions

I have implemented VirtualPathProvider class so I can keep all my views in the
I have a class derived from QGraphicsView , which contains QGraphicsItem -derived elements. I
I have the simple class using auto-implemented properies: Public Class foo { public foo()
I have a .NET 3.5 web application for which I have implemented a class
Let's say I have a class that implements the IDisposable interface. Something like this:
I have a service class implemented in Java 6 / Spring 3 that needs
I was wondering if it makes sense to have objects inherit from a class
In general, if you have a class that inherits from a Thread class, and
Consider that I have a complex class structure where many elements inherit from other
I have a class method (implemented in a shared object in UNIX environment) which

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.