• Antelope Release 5.9 Mac OS X 10.13.2 2019-05-01

 

NAME

BQPfTreeview - BRTT Qt graphics class for displaying and editing parameter file objects

SYNOPSIS


-lbqplot -lbanner -lbrttutil $(STOCKLIB)

#include "BQ.h"

DESCRIPTION

BQPfTreeview objects are used to display and edit parameter file objects using the BUPf(3) and QTreeView classes.

This class inherits the BQConfigure class which is itself a subclass of the BUConfigure class with extensions to process Qt colors and fonts. The configure methods are implemented in the BUConfigure parent (see BUConfigure(3)).

INHERITS FROM

QTreeView, BQConfigure

CONSTRUCTOR

BQPfTreeview(QWidget *parent, BUPf *bupf);

Where "parent" is the QWidget parent for this object and "bupf" is the BUPf object, or a sub-class, to be displayed and/or edited.

METHODS INHERITED FROM BQConfigure

BQPfTreeview METHODS

OBJECT CONFIGURATION PARAMETERS

EXAMPLE

Following is a simple c++ example.


#include "BQ.h"

class MyBUPf : public BUPf {
public:
    MyBUPf (std::string pffile) : BUPf (pffile, PF_TYPE_PFFILE) {}
    BQPfTreeview *tv;

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 = tv->checkValue (index, &to_qstr);
    if (ok) {
        printf ("Change ok\n");
    } else {
        printf ("Constraints exception: changing back to original\n");
        to = from;
    }
}

int
main (int argc, char **argv)

{
    if (argc != 2) {
        fprintf (stderr, "usage: bqplot_test_pftreeview pfname\n");
        exit (1);
    }

    char *pfname = argv[1];
    MyBUPf *bupf;
    try {
        bupf = new MyBUPf (pfname);
    }
    catch (char const *err) {
        fprintf (stderr, "bqplot_test_opitonsdialog: BUPf(%s) error: %s\n", pfname, err);
        exit (1);
    }

    QApplication qapp(argc, argv);

    qapp.setApplicationName("bqplot_test_pftreeview");

    QWidget *widget = new QWidget();
    widget->setWindowTitle("bqplot_test_pftreeview");
    widget->show();
    widget->resize (800, 400);

    QGridLayout *layout = new QGridLayout (widget);
    layout->setSpacing (0);
    layout->setContentsMargins (0, 0, 0, 0);
    widget->setLayout (layout);

    BQPfTreeview *tv = new BQPfTreeview(widget, bupf);
    bupf->tv = tv;
    layout->addWidget (tv, 0, 0);
    tv->configure ("font", "courier 18 Bold", NULL);

    qapp.exec();

    exit (0);
}


SEE ALSO

bqplot(3), BQConfigure(3), BUPf(3)

AUTHOR

Danny Harvey, BRTT
Printer icon