Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsitem and protected function Paint
Forum Updated to NodeBB v4.3 + New Features

QGraphicsitem and protected function Paint

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 392 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • petrP Offline
    petrP Offline
    petr
    wrote on last edited by petr
    #1

    Hi,

    i am using QGraphicsIitem and i would like make something this in protected function paint:

    MyEdge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)  {
         if (something) do original paint
         else i make my custom paint....
    }
    

    Is possible somehow do/call original paint function?
    Thanks, for advice..

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi, welcome to devnet.

      Sure. In C++ you can call base implementation in derived class by prefixing the method call with BaseClassName::.
      So in this case it would be:

      void MyEdge::paint(QPainter* painter, const QStyleOptionGraphicsItem* opt, QWidget* w)  {
         if (something)
            QGraphicsIitem::paint(painter, opt, w);
         else
            // i make my custom paint....
      }
      
      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved