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. QFileDialog from within a class

QFileDialog from within a class

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 626 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.
  • G Offline
    G Offline
    gibbogle
    wrote on last edited by
    #1

    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
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      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
      0

      • Login

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