Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How do I pass test /any "widget" to QT dialog class ?
Qt 6.11 is out! See what's new in the release blog

How do I pass test /any "widget" to QT dialog class ?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 2 Posters 744 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    DeviceDiscoveryDialog accepts as default null pointer and "shows" default widget.
    How do I change such default ?
    ( I know it is basic, but I (still) really do not get the QT ui syntax... )

    MainWindow::MainWindow()
    : mdiArea(new QMdiArea)
    {
    DeviceDiscoveryDialog *DDD = new DeviceDiscoveryDialog(??????));
    DDD->show();

    JonBJ 1 Reply Last reply
    0
    • A Anonymous_Banned275

      DeviceDiscoveryDialog accepts as default null pointer and "shows" default widget.
      How do I change such default ?
      ( I know it is basic, but I (still) really do not get the QT ui syntax... )

      MainWindow::MainWindow()
      : mdiArea(new QMdiArea)
      {
      DeviceDiscoveryDialog *DDD = new DeviceDiscoveryDialog(??????));
      DDD->show();

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @AnneRanch
      If your DeviceDiscoveryDialog is intended to be a standalone modeless dialog, not an MDI subwindow in your QMdiArea, then all you want is:

      DeviceDiscoveryDialog *DDD = new DeviceDiscoveryDialog(this);
      

      Here this is your MainWindow, so it will be a dialog "owned" by your main window.

      and "shows" default widget.

      Not sure what you mean by this. DeviceDiscoveryDialog shows whatever widget(s) you have placed on it. That might be whatever you put on it in Designer if you did it that way. Or, if you did not use Designer for it and just created it in code it will be whatever widget(s) you added to it there. If you did not put any widgets on it it will just be blank. If you are asking how to add widgets now at runtime, for whatever reason, you would want something like

      QVBoxLayout *layout = new QVBoxLayout;
      DDD->setLayout(layout);
      layout->addWidget(new QLabel);
      layout->addWidget(new QTextEdit);
      ...
      

      If you actually intend the DeviceDiscoveryDialog to be added as an MDI subwindow on your main window (I'm not sure whether this is the case) you would want something like

      QMdiSubWindow *mdiSubWindow = mdiArea->addSubWindow(DDD);
      mdiSubWindow->show();
      
      1 Reply Last reply
      1
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        As usual - I did not explain well what I need.

        Here is actual code

        DeviceDiscoveryDialog *DDD = new DeviceDiscoveryDialog(this);

        where "this" is a parent of MainWindow

        and the resulting WRONG test dialog is placed as top dialog

        However coded this way
        DeviceDiscoveryDialog *DDD = new DeviceDiscoveryDialog();

        I still get the wrong dialog placed in center of main (parent) window.
        '
        I am trying to find out from WHERE it comes from - irregardless who is the parent. .

        In other words - what code goes into as DEFAULT parent , from where , and how can I add it as my own parent .

        There MUST be a real code somewhere - similar to "this" pointer.
        How do I code this "default" ?

        fcd4fbbd-63c3-41c6-90f9-a97f3a533ce1-image.png

        704f6c46-4533-4029-ae09-43dbcdc4f1f6-image.png

        In different words - I need SAME object with DIFFERENT parent and NOT same "default". AND I CANNOT FIGURE OUT THE syntax passing "widget pointer " if all I have is "form" pointer. .

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anonymous_Banned275
          wrote on last edited by
          #4

          NEVER MIND, I was looking at wrong parameter ....
          Standby for solution...
          The actual widget is buried in last part of the code and that is what I need to change.

          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