BitcoinGUI: connect to message() signal from wallet model #3161

pull Diapolo wants to merge 0 commits into bitcoin:master from Diapolo:bitcoingui_con_mess_walletmodel changing 0 files +0 −0
  1. Diapolo commented at 6:01 PM on October 26, 2013: none
    • directly connect to message() signals from wallet model in the main GUI to reduce complexity of the slot/signal handling for message()
  2. BitcoinPullTester commented at 7:04 PM on October 26, 2013: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/55d41d39829f755591446026af8cc0f275019bf7 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  3. in src/qt/sendcoinsdialog.cpp:None in 55d41d3982 outdated
      52 | @@ -53,6 +53,8 @@ void SendCoinsDialog::setModel(WalletModel *model)
      53 |          setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance());
      54 |          connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64)));
      55 |          connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
      56 | +        // Receive and forward messages (WalletModel is used for passing through message())
      57 | +        connect(this, SIGNAL(message(QString,QString,unsigned int)), model, SIGNAL(message(QString,QString,unsigned int)));
    


    laanwj commented at 8:18 AM on October 27, 2013:

    Signals should come from the model (in turn coming from the core) and end up in the view, not the other way around. It a bit hacky to send messages through the model in this way.


    Diapolo commented at 11:14 AM on October 27, 2013:

    But it's allowed to connect a signal to signal at least ;-). I was thinking about the cleanest way to reach the GUI or the shortest as IMHO it would be cool to replace local message boxes with just emit message(). Can you describe the general flow that you think is best.

    My idea was we nearly have the walletmodel available in every view or dialog and it has a message() connection to the GUI...


    laanwj commented at 11:44 AM on October 27, 2013:

    Yes it's allowed to connect a signal to a signal, but try not to do it this way around. An object has the responsibility for what its signals mean and when they are emitted, so another object should not be subscribing its signals to anything. (yes, I know this is broken somewhat in WalletView as well by passing in the gui object and then subscribing it to various signals, which is weird, but let's keep it the exception not the rule)

    Best would be to have message() signals propagate up the view chain toward the main BitcoinGUI object. Don't try to take shortcuts (certainly not through a model).

  4. Diapolo closed this on Oct 27, 2013

  5. Diapolo commented at 8:15 PM on October 27, 2013: none

    I messed up the pull, will re-open when I fixed it ^^.

    Edit: I killed it and created a new one -_-!

  6. Bushstar referenced this in commit 40ef0f76a5 on Apr 8, 2020
  7. Bushstar referenced this in commit ad720eef19 on Apr 8, 2020
  8. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me