Results 1 to 2 of 2

Thread: Constness issue between QGLContext::currentContext() and QGLContext::makeCurrent()?

  1. #1
    Join Date
    Jan 2013
    Location
    Valbonne, France
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Question Constness issue between QGLContext::currentContext() and QGLContext::makeCurrent()?

    I am curious why QGLContext::currentContext() returns a const QGLcontext *, but QGLContext::makeCurrent() is not const. This makes it impossible to save a context to make it current later without casting. Are there non-obvious restrictions that would make the following illegal:

    Qt Code:
    1. QGLContext *saveContext = QGLContext::currentContext();
    2.  
    3. // [... Something that possibly changes the context ]
    4.  
    5. saveContext->makeCurrent();
    To copy to clipboard, switch view to plain text mode 

  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: Constness issue between QGLContext::currentContext() and QGLContext::makeCurrent(

    Usually you'd use QGLWidget::makeCurrent()
    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. Threaded QGLWidged -> QGLContext::makeCurrent(): Failed.
    By beetleskin in forum Qt Programming
    Replies: 3
    Last Post: 20th June 2011, 22:27
  2. QGLWidget & QGLContext & QThread
    By eye51 in forum Qt Programming
    Replies: 3
    Last Post: 3rd April 2011, 12:26
  3. QGLContext problems
    By bhuang in forum Qt Programming
    Replies: 1
    Last Post: 25th August 2010, 08:18
  4. QGLContext Issue
    By parmar in forum Qt Programming
    Replies: 5
    Last Post: 18th June 2010, 10:25
  5. overlay QGLContext
    By showhand in forum Qt Programming
    Replies: 3
    Last Post: 10th April 2007, 16:51

Tags for this Thread

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.