Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QFileDialog from within a class

    General and Desktop
    2
    2
    494
    Loading More Posts
    • 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.
    • G
      gibbogle last edited by

      Probably a stupid question, since I am at a primitive level of understanding...
      I have created a class like this:

      classQVideoOutput:publicQObject
      {

      public:

      QVideoOutput(QObjectparent=0,vtkRenderWindowVTKrenWin=0,QWidget*awidget=0);
      ...

      and instantiate it in MainWindow. I want to call QFileDialog() within one of the QVideoOutput member functions,
      but I have not been able to figure out what the first argument (QWidget *parent) should be. Various choices of awidget
      corresponding to GUI widgets fail, causing the program to crash. Obviously there is something fundamentally wrong with
      what I'm doing. I'd appreciate helpful advice.

      Thanks
      Gib

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        You need to pass the pointer of your QMainWindow to it (or from any other widget). If you don't have it at hand, you can simply pass 0 (zero).

        You can also make your QMainWindow into a Singleton (this is a programming construct, search the Web for more info) and then use it in your class. There are many options :)

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • First post
          Last post