Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. [SOLVED]Reimplementing a virtual function, but with different parameters
Forum Update on Monday, May 27th 2025

[SOLVED]Reimplementing a virtual function, but with different parameters

Scheduled Pinned Locked Moved C++ Gurus
2 Posts 2 Posters 1.1k Views
  • 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.
  • L Offline
    L Offline
    LReiter
    wrote on last edited by
    #1

    EDIT: So, apparently trying for hours to solve a problem and finally posting an inquiry on a message board magically gives me the power to work around said problem. To whom it may concern, I now used static variables for my coordinates and everything works just dandy.

    Hey everybody,
    I have recently been getting back to c++ after a while and have a probably pretty simple problem with my most recent project.
    I basically have two windows on the screen (courtesy of Qt of course). One of them is for settings, the other for displaying 3D graphics. The settings window (inherits from QMainWindow) has (among others) a "load config" button which lets me, well, load some numbers from a file. It's all working fine.
    However, if I want to use those numbers as coordinates in the other "3D" window (inherits from QGLWidget), I have to reimplement (of course) the paintGL() function. paintGL(), however, takes zero arguments. I have successfully reimplemented initializeGL() and resizeGL(int,int), which are both called by show(). Since I'm using show() and it doesn't call my reimplemented version of paintGL(MainWindow), I have no idea how to get my numbers on the screen.
    Maybe this topic seems either rather complicated or idiotic to some more experienced users. I would, however, be very thankful for any hints regarding my own shortcomings. I also realize that my question is not entirely detached from Qt, but I thought it was more about c++ in general.
    Thanks a lot from Berlin!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should rather use setters on your 3D widget that you will call to set the various parameters you want, then call update() (from the setters) to trigger a redraw. That will make the overall design cleaner.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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