initialize a text window
| 919 | |
| 920 | // initialize a text window |
| 921 | NetHackQtTextWindow::NetHackQtTextWindow(QWidget *parent) : |
| 922 | QDialog(parent), |
| 923 | use_rip(false), |
| 924 | str_fixed(false), |
| 925 | textsearching(false), |
| 926 | ok("&Dismiss", this), |
| 927 | search("&Search", this), |
| 928 | lines(new NetHackQtTextListBox(this)), |
| 929 | target(""), |
| 930 | rip(this) |
| 931 | { |
| 932 | // |
| 933 | // TODO? |
| 934 | // Searching would be far more convenient if the window contained |
| 935 | // the search string requestor widget instead of just a [Search] |
| 936 | // button to request a popup for that. |
| 937 | // Also, searching should probably be disabled if the entire text |
| 938 | // fits within the window so there's nothing to scroll through. |
| 939 | // |
| 940 | |
| 941 | ok.setDefault(true); |
| 942 | connect(&ok,SIGNAL(clicked()), this, SLOT(doDismiss())); |
| 943 | connect(&search, SIGNAL(clicked()), this, SLOT(Search())); |
| 944 | connect(qt_settings, SIGNAL(fontChanged()), this, SLOT(doUpdate())); |
| 945 | |
| 946 | QVBoxLayout* vb = new QVBoxLayout(this); |
| 947 | vb->addWidget(&rip); |
| 948 | QHBoxLayout* hb = new QHBoxLayout(); |
| 949 | vb->addLayout(hb); |
| 950 | hb->addWidget(&ok); |
| 951 | hb->addWidget(&search); |
| 952 | vb->addWidget(lines); |
| 953 | |
| 954 | // we don't want keystrokes being sent to the main window for use as |
| 955 | // commands while this text window is popped up |
| 956 | setFocusPolicy(Qt::StrongFocus); |
| 957 | // needed so that keystrokes get sent to our keyPressEvent() |
| 958 | lines->setFocusPolicy(Qt::NoFocus); |
| 959 | setModal(true); |
| 960 | } |
| 961 | |
| 962 | void NetHackQtTextWindow::doUpdate() |
| 963 | { |
nothing calls this directly
no outgoing calls
no test coverage detected