-lbqplot -lbanner -lbrttutil $(STOCKLIB) #include "BQ.h"
BQPfOptionsDialog(QString pfname); BQPfOptionsDialog(BUPf *bupf);
Where "pfname" is the parameter file name and "bupf" is the BUPf object, or a sub-class, to be displayed and/or edited.
#include "BQ.h" class MyBUPf : public BUPf { public: MyBUPf (std::string pffile) : BUPf (pffile, PF_TYPE_PFFILE) {} BQPfOptionsDialog *od; protected: void valueChangedCallback (std::string key, int index, std::string from, std::string &to); }; void MyBUPf::valueChangedCallback (std::string key, int index, std::string from, std::string &to) { printf ("Attempting to change '%s' to '%s'\n", from.c_str(), to.c_str()); QString to_qstr = to.c_str(); bool ok = od->tv->checkValue (index, &to_qstr); char msg[512]; if (ok) { sprintf (msg, "<font color=\"black\">Attempting to change '%s' to '%s': </font><font color=\"black\">Ok</font>", from.c_str(), to.c_str()); od->setStatusMsg (msg); } else { sprintf (msg, "<font color=\"black\">Attempting to change '%s' to '%s': </font><font color=\"red\">Constraints exception: changing back to original</font>", from.c_str(), to.c_str()); od->setStatusMsg (msg); to = from; } } int main (int argc, char **argv) { if (argc != 2) { fprintf (stderr, "usage: bqplot_test_options pfname\n"); exit (1); } char *pfname = argv[1]; MyBUPf *bupf; try { bupf = new MyBUPf (pfname); } catch (char const *err) { fprintf (stderr, "bqplot_test_optionsdialog: BUPf(%s) error: %s\n", pfname, err); exit (1); } QApplication qapp(argc, argv); qapp.setApplicationName("bqplot_test_opitonsdialog"); BQTopLevel *toplevel = new BQTopLevel(NULL, 1); char title[128]; sprintf (title , "bqplot_test_optionsdialog %s", pfname); toplevel->setWindowTitle(title); toplevel->show(); QGridLayout *layout = new QGridLayout (toplevel); layout->setSpacing (0); layout->setContentsMargins (0, 0, 0, 0); toplevel->setLayout (layout); BQPfOptionsDialog *options = new BQPfOptionsDialog (bupf); bupf->od = options; auto button = new QPushButton ("Options...", toplevel); toplevel->connect (button, &QAbstractButton::clicked, [options]() { options->show(); }); layout->addWidget (button, 0, 0, 1, 1); toplevel->resize (30, 20); qapp.exec(); exit (0); }