Results 1 to 6 of 6

Thread: problem using dialog to control a glwidget in a main window

  1. #1
    Join Date
    Jun 2010
    Posts
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default problem using dialog to control a glwidget in a main window

    I've got an application that has a main window with a glWidget and sliders (as in helloGL), and a second window alongside it that has the controls to manipulate the GL widget's content.

    That is, I have the interface built. Where I'm stuck is that I can't work out how to share variables between the two windows so I can communicate changes to the glWidget context from the controls window.

    This is likely an issue with my not yet grasping how QT works. I'm sure there must be a way to communicate between windows, but I can't see it.

    Any help/pointers would be much apreciated.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: problem using dialog to control a glwidget in a main window

    You can use signals and slots

  3. #3
    Join Date
    Jun 2010
    Posts
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem using dialog to control a glwidget in a main window

    I looked at that, but I didn't know how to make the dialog class aware of the glWidget. I may need to study signals/slots a bit more. by 'I may' I of course mean 'absolutelly must...'

    Think I solved it for the moment, I passed a pointer to the glWidget as a parameter to the control dialogs constructor. That's probably a cheap hack that misses a major point of QT, but it works.

    I'll change it to use signals and slots as soon as I can figure them out. Thanks for the help, and the link.
    Last edited by rucs_hack; 12th August 2010 at 20:51.

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: problem using dialog to control a glwidget in a main window

    You can code signals and slots to the main window widget (first window), so that you expose whatever functionality you want to call from the dialog (or second window)

  5. #5
    Join Date
    Jun 2010
    Posts
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem using dialog to control a glwidget in a main window

    Quote Originally Posted by Zlatomir View Post
    You can code signals and slots to the main window widget (first window), so that you expose whatever functionality you want to call from the dialog (or second window)
    That would seem to make the most sense. Frantically reading the signals/slots link right now. Quite how I managed to get this far into QT without learning about them is beyond me. Mind you, I mainly do CLI.

  6. #6
    Join Date
    Jun 2010
    Posts
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem using dialog to control a glwidget in a main window

    Oh dear. Now I've got to grips with signals and slots I have a severe case of 'buggrit I'm an idiot' going on....

Similar Threads

  1. Replies: 2
    Last Post: 4th August 2010, 19:10
  2. Embed dialog in main window
    By The_Fallen in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2010, 15:06
  3. Replies: 4
    Last Post: 10th February 2010, 06:56
  4. Qt 4.6.0: Opening a dialog from a main window
    By dmginc in forum Qt Programming
    Replies: 3
    Last Post: 14th January 2010, 12:16
  5. Crash during sending list from dialog to main window
    By Djony in forum Qt Programming
    Replies: 5
    Last Post: 23rd November 2006, 19:43

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.