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

Method NetHackQtMenuWindow

win/Qt/qt_menu.cpp:156–224  ·  view source on GitHub ↗

Table view columns (0..4): [pick-count] [check-box] [object-glyph] [selector-letter] [description] pick-count is normally empty and gets wider as needed.

Source from the content-addressed store, hash-verified

154// pick-count is normally empty and gets wider as needed.
155//
156NetHackQtMenuWindow::NetHackQtMenuWindow(QWidget *parent) :
157 QDialog(parent),
158 is_invent(false), // reset to True when window is core's WIN_INVEN
159 table(new NetHackQtMenuListBox()),
160 prompt(0),
161 biggestcount(0L), // largest subset amount that user has entered
162 countdigits(0), // number of digits needed by biggestcount
163 counting(false), // user has typed a digit and more might follow
164 searching(false) // user has begun entering a search target string
165{
166 // setFont() was in SelectMenu(), in time to be rendered but too late
167 // when measuring the width and height that will be needed
168 QFont tablefont(qt_settings->normalFixedFont());
169 table->setFont(tablefont);
170
171 QGridLayout *grid = new QGridLayout();
172 table->setColumnCount(5);
173#if __cplusplus >= 202002L
174 table->setFrameStyle(static_cast<int>(QFrame::Panel)
175 | static_cast<int>(QFrame::Sunken));
176#else
177 table->setFrameStyle(QFrame::Panel|QFrame::Sunken);
178#endif
179 table->setLineWidth(2); // note: this is not row spacing
180 table->setShowGrid(false);
181 table->horizontalHeader()->hide();
182 table->verticalHeader()->hide();
183
184 ok=new QPushButton("Ok");
185 connect(ok,SIGNAL(clicked()),this,SLOT(accept()));
186
187 cancel=new QPushButton("Cancel");
188 connect(cancel,SIGNAL(clicked()),this,SLOT(reject()));
189
190 all=new QPushButton("All");
191 connect(all,SIGNAL(clicked()),this,SLOT(All()));
192
193 none=new QPushButton("None");
194 connect(none,SIGNAL(clicked()),this,SLOT(ChooseNone()));
195
196 invert=new QPushButton("Invert");
197 connect(invert,SIGNAL(clicked()),this,SLOT(Invert()));
198
199 search=new QPushButton("Search");
200 connect(search,SIGNAL(clicked()),this,SLOT(Search()));
201
202 QPoint pos(0,ok->height());
203 move(pos);
204 prompt.setParent(this);
205 prompt.move(pos);
206
207 grid->addWidget(ok, 0, 0);
208 grid->addWidget(cancel, 0, 1);
209 grid->addWidget(all, 0, 2);
210 grid->addWidget(none, 0, 3);
211 grid->addWidget(invert, 0, 4);
212 grid->addWidget(search, 0, 5);
213 grid->addWidget(&prompt, 1, 0, 1, 7);

Callers

nothing calls this directly

Calls 2

setFontMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected