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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:31:19+00:00 2026-05-15T12:31:19+00:00

I need to view QGraphicsScene in 2 QGraphicsViews with condition that they have different

  • 0

I need to view QGraphicsScene in 2 QGraphicsViews with condition that they have different scale factors for items in scene. Closest function which I found is drawItems(), but as far I can understand, it must be called manually. How to repaint views automatically?
I have these two code fragments in program:

class TGraphicsView(QGraphicsView):

    def __init__(self, parent = None):
        print("__init__")
        QGraphicsView.__init__(self, parent)

    def drawItems(self, Painter, ItemCount, Items, StyleOptions):
        print("drawItems")
        Brush = QBrush(Qt.red, Qt.SolidPattern)
        Painter.setBrush(Brush)
        Painter.drawEllipse(0, 0, 100, 100)

…

    Mw.gvNavigation = TGraphicsView(Mw) # Mw - main window
    Mw.gvNavigation.setGeometry(0, 0, Size1, Size1)
    Mw.gvNavigation.setScene(Mw.Scene)
    Mw.gvNavigation.setSceneRect(0, 0, Size2, Size2)
    Mw.gvNavigation.show()

__init__ works, Mw.gvNavigation is displayed and there are Mw.Scene items in it, but drawItems() isn’t called.

  • 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-15T12:31:19+00:00Added an answer on May 15, 2026 at 12:31 pm

    The drawItems methods on QGraphicsView and QGraphicsScene objects have been deprecated in Qt 4.6 and have to be enabled using the IndirectPainting flag, but I would’t recommend using deprecated features.

    Here’s another stack overflow question on a similar issue. One of the answers shows how to make the paint methods on individual items in a scene aware of which view is painting them, and use different paint code when drawn in different views.

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

Sidebar

Related Questions

I have a view that changes if users scrolls it. I need something to
Let's say I have an app and in that app I need to view
I have a list of items displayed in my view. I need to be
I have 2 controllers that render a single view and I need the view
I have this in my controller. I need my view to generate some HTML,
I have an arraylist namelist in my model and in my view I need
I have QGraphicsView with QGraphicsScene and I need to draw unclosed paths (which may
I need a view that can display both in Portrait and landscape.But when I
I have SQL2008 installed on my local machine and need to view/alter/select rows and
That simple. I need to create a View using Code First. I found nothing

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.