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. [merged] qglwidget and layouts problem?
Forum Updated to NodeBB v4.3 + New Features

[merged] qglwidget and layouts problem?

Scheduled Pinned Locked Moved General and Desktop
18 Posts 5 Posters 7.6k 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.
  • T Offline
    T Offline
    theblizzfreak
    wrote on last edited by
    #3

    can you show me an example of that? :) i have no idea lol

    sorry for that

    heres my guess :)
    i set qwidget thats parented which i called MainFrame which is the 'id' then add the method to it which is setlayout on qmainwindow?

    can someone say if thats right or not

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #4

      Yes that is right for a general QWidget parent. If you are using QMainWindow then you can just do:

      @
      mainWindow->setCentralWidget( myGLWidget );
      @

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • T Offline
        T Offline
        theblizzfreak
        wrote on last edited by
        #5

        awesome so how do i add opengl code to it :)

        god wish the qt book explained it for the newer versions of QT ;l

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZapB
          wrote on last edited by
          #6

          Get an svn checkout of a few simple OpenGL examples that uses QGLWidget from my repository:

          @
          svn co https://svn.theharmers.co.uk/svn/codes/public/opengl/trunk opengl-examples
          cd opengl-examples/06-solar-system
          qmake
          make
          @

          Basically follow the QGLWidget documentation and override paintGL(), resizeGL(), and initializeGL(). Then override any event handler functions that you need e.g. keyPressEvent( QKeyEvent* e ).

          Nokia Certified Qt Specialist
          Interested in hearing about Qt related work

          1 Reply Last reply
          0
          • T Offline
            T Offline
            theblizzfreak
            wrote on last edited by
            #7

            these are great for someone who is using C++ as the core code but i much prefer QML way of doing things so how would one do that with QML? :) i just love that hole idea that a gui is run by a unique part and 3D graphics done by another and plus its alot nicer to work with once im very good with QML i will defently look into C++ focused QT for more control if needed for more freedom as i love C++ :) its very nice

            1 Reply Last reply
            0
            • T Offline
              T Offline
              theblizzfreak
              wrote on last edited by
              #8

              ?? :)

              1 Reply Last reply
              0
              • T Offline
                T Offline
                theblizzfreak
                wrote on last edited by
                #9

                okay so i really didn't want to post again but im very confused :(

                iv got a QML written Application all done by me but i dont understand how to put opengl code into it i have my QGLWidget showing but i dont know where to put the code i know the docuementation is great but only for C++ focused coding and not QML :( so where would one go for QML i like QML but i also like the C++ way of doing it just makes things alot more funner for me using QML any ideas? :) thank you if iv miss read something or iv done something wrong please tell me so its possible that i can learn from it also please tell me how you figure this stuff out because im out of options when it comes to thinking of ways of making things work in QT

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mlong
                  wrote on last edited by
                  #10

                  Please don't double post. You've already asked this question in your "original thread":http://developer.qt.nokia.com/forums/viewthread/8133/ less than two hours ago. Be patient, and someone will reply there if they have an answer for you.

                  Software Engineer
                  My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                  1 Reply Last reply
                  0
                  • X Offline
                    X Offline
                    xcoder
                    wrote on last edited by
                    #11

                    Once I came across a code snippet where QGLWidget was embbedded in QML. I think he used somekind of QGraphicsRectangle.

                    I'll try to look up the code.

                    Only a biker knows why a dog sticks his head out of a car window.

                    1 Reply Last reply
                    0
                    • X Offline
                      X Offline
                      xcoder
                      wrote on last edited by
                      #12

                      Take a look at this, but this isn't the code I found earlier.
                      But still might be helpful: "Click here":http://talk.maemo.org/archive/index.php/t-39913.html

                      Only a biker knows why a dog sticks his head out of a car window.

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        theblizzfreak
                        wrote on last edited by
                        #13

                        Thats how you do it with C++ :) i want to do it in QML mostly unless that the only way, if i do then ill otherwise have to rewrite all my QML into C++ / QT way of doing code which is very tedious and i would rather do that in a later update of my application for now i just want things to work and the tutorials to actually work logically :D this is really annoying :((( not at you tho dude just in general finding a decent gui toolkit that has documentation that makes sense is very hard to come by some of the books are nice but they dont explain Opengl with QT in total detail which is very very /inraging :(

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mlong
                          wrote on last edited by
                          #14

                          Ok... maybe we'll discuss it here. :-)

                          Outside of some nifty stuff which is still forthcoming, there is no direct OpenGL access available from inside of QML. It all has to be done from the C++ side of things as far as I know. QGLWidget is, by definition, a C++ thing.

                          The info that xcoder posted is all about making the QGLWidget coexist with your QDeclarative (QML) display area. That's probably as close as you're going to get at the moment. I don't see where that necessarily requires you to rewrite all of your QML into C++.

                          Software Engineer
                          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            theblizzfreak
                            wrote on last edited by
                            #15

                            okay :D then ill do it np :) i just need to know where to place the code and is there any tutorials that explains in good detail i tried using the Orginal QT documentation but its not very detailed with the idea of placement of code inside someone elses abstract code and problems of that nature :)

                            wheres the common place to put this code? :) for most people and why? and how do you figure that out and know the reasons?

                            please go into detail when answering :]

                            if you need my code just ask :)

                            1 Reply Last reply
                            0
                            • EddyE Offline
                              EddyE Offline
                              Eddy
                              wrote on last edited by
                              #16

                              Merged the 2 posts

                              Qt Certified Specialist
                              www.edalsolutions.be

                              1 Reply Last reply
                              0
                              • T Offline
                                T Offline
                                theblizzfreak
                                wrote on last edited by
                                #17

                                thanks :) lets hope theres an answer to my question with hope }:

                                1 Reply Last reply
                                0
                                • T Offline
                                  T Offline
                                  theblizzfreak
                                  wrote on last edited by
                                  #18

                                  iv written what QT needs to do a basic 3d graphics render but for some reason i just keep getting errors ??? and these errors are just horrid ones that no one can figure out

                                  heres what i put i know theres some dots missing but i really dont understand what the point of it is maybe for digits?? Or something whateva but the point is it wont work no matter how many ways i try to do it even with dots! :( maybe because im placing it within some other code?? but that shouldnt effect it at all if the syntax was correct on this piece of code below, its all very confusing and i really would apperciate it if someone could guide me in the right direction and do it in a detailed way :) so i can learn from it

                                  @ class opengl : public QGLWidget
                                  {
                                  Q_OBJECT

                                  public:
                                      opengl(QWidget *parent)
                                          : QGLWidget(parent) {}
                                  
                                  protected:
                                  
                                      void initializeGL()
                                  
                                      {
                                          glClearColor(0.0, 0.0, 0.0, 0.0);
                                          glEnable(GL_DEPTH_TEST);
                                      }
                                  
                                  
                                      void resizeGL(int w, int h)
                                      {
                                          glViewport(0, 0, (GLint)w, (GLint)h);
                                          glFrustum();
                                  
                                      }
                                  
                                  
                                      void paintGL()
                                  
                                              glRotatef();
                                      glMaterialfv();
                                      glBeing(GL_QUADS);
                                      glVertex3f();
                                  
                                      glEnd();
                                  };
                                  

                                  @

                                  1 Reply Last reply
                                  0

                                  • Login

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