Results 1 to 5 of 5

Thread: Problem with reloading QHeaderView::paintsection() function.

  1. #1
    Join Date
    Apr 2009
    Posts
    2
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Problem with reloading QHeaderView::paintsection() function.

    HI, I have next problem:

    I need redraw headers column in Table, so I inherit from class QheaderView and reload function paintsection(). Then I just copy sources code from function QheaderView:aintsection() in my reloaded function CustomHeaderView:aintsection() and when I compile this, g++ gives next error in this line of code: Q_D(const QHeaderView);

    "error: 'const QHeaderView::d_func() const' is private within this context "



    Can someone tell me why?

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with reloading QHeaderView::paintsection() function.

    trolls use Pimpl approach. so, you should look at QHeaderViewPrivate class, find and copy all varianble which are used in QHeaderView and then all should work.
    note: if you saw code like this d-> that means that variable is located in QHeaderViewPrivate class.
    you can also include #include "qheaderview_p.h", but this is bad idea.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Apr 2009
    Posts
    2
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Problem with reloading QHeaderView::paintsection() function.

    I think it is bad idea "find and copy all varianble which are used in QHeaderView" because then that function will worck not correctly.

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with reloading QHeaderView::paintsection() function.

    this is not bad idea. bad idea it's using of private Qt's files.
    but if you find all vars and add to your class then your class will work fine if you move to next version of Qt, but if you still want to use private Qt's file then ther is no guaranty that you code will work on next version of Qt. I had such situation.
    btw, this is from one of Qt's private headers.
    //
    // W A R N I N G
    // -------------
    //
    // This file is not part of the Qt API. It exists purely as an
    // implementation detail. This header file may change from version to
    // version without notice, or even be removed.
    //
    // We mean it.
    //
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. The following user says thank you to spirit for this useful post:

    rokky05 (9th April 2009)

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with reloading QHeaderView::paintsection() function.

    How about simply calling the base class implementation where you need it?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 3
    Last Post: 12th March 2012, 01:45
  2. subclassed const function problem
    By qtneuling in forum Newbie
    Replies: 8
    Last Post: 22nd June 2008, 02:52
  3. Function confusion
    By KShots in forum General Programming
    Replies: 3
    Last Post: 26th June 2007, 21:56
  4. Link Errors
    By magikalpnoi in forum Qt Programming
    Replies: 5
    Last Post: 25th September 2006, 22:04
  5. K&R's strcpy function - problem with pointers
    By jamadagni in forum General Programming
    Replies: 7
    Last Post: 8th January 2006, 15:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.