Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9248977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:04:53+00:00 2026-06-18T10:04:53+00:00

I am migrating some code from FLTK to QT5 and I can’t seem to

  • 0

I am migrating some code from FLTK to QT5 and I can’t seem to get a widget in the graphical designed that corresponds to an OpenGL context? Does such a widget exist?

I built QT from the official sources, targeting VS2012x64 with the OpenGL option and have tried to add QT += opengl to my project.pro file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:04:54+00:00Added an answer on June 18, 2026 at 10:04 am

    Qt has the QGLWidget, but you should not use that directly in the Designer. Instead you should place a layout where you want the OpenGL widget to appear. Then you subclass QGLWidget, as you must overwrite the paintGL function anyway to draw something. Then after the setupUI() call you instanciate your custom GL widget and add it to the layout you placed in the designer with layoutinstance->addWidget(…)

    update due to comment

    mainwindow.ui

    <?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
     <class>MainWindow</class>
     <widget class="QMainWindow" name="MainWindow">
      <property name="geometry">
       <rect>
        <x>0</x>
        <y>0</y>
        <width>335</width>
        <height>191</height>
       </rect>
      </property>
      <property name="windowTitle">
       <string>MainWindow</string>
      </property>
      <widget class="QWidget" name="centralwidget">
       <layout class="QVBoxLayout" name="verticalLayout_2">
        <item>
         <layout class="QVBoxLayout" name="verticalLayout"/>
        </item>
       </layout>
      </widget>
      <action name="actionQuit">
       <property name="text">
        <string>&amp;Quit</string>
       </property>
      </action>
     </widget>
     <resources/>
     <connections/>
    </ui>
    

    myglwidget.hh

    #include <QGLWidget>
    
    class MyGLWidget : public QGLWidget
    { //...
    };
    

    mainwindow.hh

    #include <QMainWindow>
    
    #include "myglwidget.hh"
    #include "mainwindow_ui.hh" // generated by uic
    
    class MainWindow : public QMainWindow, Ui_MainWindow
    {
    
        MainWindow(QObject *parent = NULL) : 
            QMainWindow(parent)
        { // one would implement the constructor in the .cc file of course
            this->setupUi(this);
        
            glwidget = new MyGLWidget(this);
    
            // using the this pointer to emphase the location of the
            // member variable used.
            // NOTE: In the UI we defined a layout names verticalLayout
            this->verticalLayout->addWidget(glwidget);
        }
    
    protected:
        MyGLWidget *glwidget;
    };
    

    The key is, that you use just a layout. An ordinary, regular layout in the UI, to which you add your derived OpenGL widget. No morphs, no promotions in the ui!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am migrating some code that executes AppleScripts from NSAppleScript to NSUserAppleScriptTask so that
I am migrating some code from ColdFusion to .NET LinqToSQL. The following query is
I am migrating some C++ code from structures to classes. I was using structures
I have a piece of code that I'm migrating from Fortran to C++, and
I'm migrating some code from VB.NET to C# (3.5). I find structures like: Public
I am migrating some code from the older azure table storage client to the
I'm migrating some code from the ASPX view engine to Razor and I've run
I am migrating some code from Scala 2.10-M5 to Scala 2.10-M7 . I have
So I am migrating some code from VB.NET to C# however it fails when
We are migrating some code to use Entity Framework and have a query that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.