MCPcopy Create free account
hub / github.com/NetHack/NetHack / NetHackQtTextWindow

Method NetHackQtTextWindow

win/Qt/qt_menu.cpp:921–960  ·  view source on GitHub ↗

initialize a text window

Source from the content-addressed store, hash-verified

919
920// initialize a text window
921NetHackQtTextWindow::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
962void NetHackQtTextWindow::doUpdate()
963{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected