Results 1 to 10 of 10

Thread: QRubberBand Overdrawn?

  1. #1
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QRubberBand Overdrawn?

    Hello,

    I'm using QRubberBand to draw a moving resize handle like the QSplitter's, it's working fine until it's dragged over a custom rendering widget (using OpenGL), it looks darker like it's overdrawn and while moving it shows trails behind it. This only happens on the portion overlapping with the OpenGL widget. Any idea what possible causes for this?

    Thanks.

  2. #2
    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: QRubberBand Overdrawn?

    QGLWidget should not be composed with other widgets (especially on Windows). To make it work properly you should switch to Qt5 and use the latest additions to OpenGL rendering in Qt.
    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.


  3. #3
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QRubberBand Overdrawn?

    I'm not using any Qt OpenGL Widgets, I create my own OpenGL-enabled widget, which also supports Direct3D.

  4. #4
    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: QRubberBand Overdrawn?

    Well then you are on your own as far as composting is concerned. You have to find a proper way to overlay the rubber band.
    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.


  5. #5
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QRubberBand Overdrawn?

    So if I use the Qt OpenGL widgets, the rubber band would not suffer from this problem?


    Added after 1 9 minutes:


    I've come across similar threads and it seems there're no solution...
    Last edited by qtoptus; 3rd March 2015 at 17:08.

  6. #6
    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: QRubberBand Overdrawn?

    Quote Originally Posted by qtoptus View Post
    So if I use the Qt OpenGL widgets, the rubber band would not suffer from this problem?
    If you use the ones from Qt 5.3+ then you should be fine.
    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.


  7. The following user says thank you to wysota for this useful post:

    qtoptus (4th March 2015)

  8. #7
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QRubberBand Overdrawn?

    Thanks for help.

  9. #8
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QRubberBand Overdrawn?

    I noticed the same problem occurs with QSplitter. So if I have a quad split views, it only happens when moving the splitter handle that separates two 2 views on each sides, not the splitter between two views. Also the color appears darker than when it's on other widgets.

  10. #9
    Join Date
    Oct 2014
    Posts
    81
    Thanks
    20
    Thanked 9 Times in 9 Posts
    Qt products
    Qt5
    Platforms
    Windows
    Wiki edits
    7

    Default Re: QRubberBand Overdrawn?

    Quote Originally Posted by qtoptus View Post
    I'm not using any Qt OpenGL Widgets, I create my own OpenGL-enabled widget, which also supports Direct3D.
    Could you elaborate on how did you implement your own D3D rendered widget with Qt? (It's something I'm interested.)

  11. #10
    Join Date
    Apr 2010
    Posts
    152
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QRubberBand Overdrawn?

    First I create a class derived from QWidget with following settings in the constructor:

    setAutoFillBackground(false);
    setAttribute(Qt::WA_PaintOnScreen, true);
    setAttribute(Qt::WA_NativeWindow, true);

    Then I pass the winId() of this widget to Direct3D setup code. You have to cast the returned winId() to HWND

    You also need to override the D3D widget's paintEngine() to return NULL

    And paintEvent(QPaintEvent *ev) to call D3D rendering commands between BeginScene/EndScene pairs...as usual

    Hope this helps.

  12. The following user says thank you to qtoptus for this useful post:

    Kryzon (8th March 2015)

Similar Threads

  1. QRubberBand Color
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 29th November 2012, 22:31
  2. QRubberband and QcustomPlot
    By OzQTNoob in forum Newbie
    Replies: 1
    Last Post: 16th October 2012, 03:19
  3. QRubberBand problem
    By nightroad in forum Newbie
    Replies: 15
    Last Post: 29th March 2011, 15:11
  4. Use of QRubberBand
    By lni in forum Qt Programming
    Replies: 0
    Last Post: 21st April 2009, 12:59
  5. Using QRubberBand class?!?!?
    By nupul in forum Newbie
    Replies: 3
    Last Post: 1st April 2006, 17:19

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.