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. how to send data from a window object back to mainwindow
Forum Updated to NodeBB v4.3 + New Features

how to send data from a window object back to mainwindow

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 362 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.
  • T Offline
    T Offline
    Tomax63
    wrote on last edited by
    #1

    Hi all

    I have an application with a main window, complete with ui.

    Now I open a dialog window doing some operations and generating values that I want to insert into some fields in the mainwindow.ui

    How can I send these values back to the mainwindow.ui?

    New window object:
    Messung::Messung(QWidget *parent, Kurve kurve, Betriebspunkt betriebspunkt, QVector<QVector<double> > messwerte) : QDialog(parent), ui(new Ui::Messung){
        ui->setupUi(this);
        this->setWindowTitle("Messung");
        // generating data here
    }
    

    Can I write data to the parent window fields by clickng on a button in the dialog window?

    Thanks in advance,
    Thomas

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

      Hi,

      It all depends on the lifetime of your dialog.

      Usually, you give getters and setters to your dialog and set it up before showing it from the MainWindow, then once done, you grab the data you want from it and modify your MainWindow using the getters.

      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
      1
      • T Offline
        T Offline
        Tomax63
        wrote on last edited by
        #3

        I made it! Finally i understood signals and slots!

        1 Reply Last reply
        1

        • Login

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