Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Master / slave dialogs - looking for an idea



  • There are two dialogs In attached screen shot.
    Clicking "Nearby BT" button in "master dialog" MainWindow form executes the "slave dialog" Bluetooth scanner dialog.
    The Bluetooth scanner form contains two QLists filled by Bluetooth scanner dialog.
    My task / objective is to update MainWindow -> Nearby BT devices list with results as seen in Bluetooth scanner -> yet not titled "upper" list of BT devices ( address and name ).

    I guess it is a job for "signal / slot", however I am clueless how and where to implement it.

    I do not need a code , just looking for conceptual suggestions on how to reuse the results of a process of scanning in Bluetooth scanner dialog.

    Any constructive comments would be greatly appreciated.
    Cheers

    e14ede0e-59fc-40b2-b868-a72d4d7ec494-image.png


  • Lifetime Qt Champion

    @AnneRanch When exactly do you want to "update MainWindow -> Nearby BT devices list with results as seen in Bluetooth scanner"? When the second dialog is closed or when it is still open and gets new data?

    If you want to use signals/slots, then simply define a signal in the second dialog and connect it to a slot in first dialog.



  • @jsulm said in Master / slave dialogs - looking for an idea:

    @AnneRanch When exactly do you want to "update MainWindow -> Nearby BT devices list with results as seen in Bluetooth scanner"? When the second dialog is closed or when it is still open and gets new data?

    To make it easy for the user - just single step - update MainWindow after Bluetooth scanner is "updated". It is now done in constructor of Bluetooth scanner and of course manually using the buttons too.

    If you want to use signals/slots, then simply define a signal in the second dialog and connect it to a slot in first dialog.

    Sounds easy, not sure if I need to "rerun" the code extracting the list again in MainWindow or just access the results. Will experiment with that approach.

    Am I correct to say it is the QApplication a(argc, argv); in main.cpp taking care of "linking " the signals "across " the dialogs?


  • Lifetime Qt Champion

    @AnneRanch said in Master / slave dialogs - looking for an idea:

    just single step - update MainWindow after Bluetooth scanner is "updated".

    In this case you do not need signals/slots. Add a public method to your second dialog which returns the data. When the second dialog is closed call that method to get the data.


Log in to reply