Skip to content

Commit 43b037f

Browse files
committed
Partially revert polishing
No slot markup, member functions are good enough. No const on functions which hand out non-const member. Restore original order in header which matched order in source. Move the new functions for testing purpose from public to protected. The test can access them via light-weight derived type.
1 parent 633044b commit 43b037f

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/gui/map/map_find_feature.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ ObjectQuery MapFindFeature::makeQuery() const
182182
}
183183

184184

185-
// slot
186185
void MapFindFeature::findNext()
187186
{
188187
auto query = makeQuery();
@@ -235,7 +234,6 @@ void MapFindFeature::findNextMatchingObject(ObjectQuery& query)
235234
}
236235

237236

238-
// slot
239237
void MapFindFeature::findAll()
240238
{
241239
auto map = controller.getMap();
@@ -267,14 +265,12 @@ void MapFindFeature::findAllMatchingObjects(ObjectQuery& query)
267265
}
268266

269267

270-
// slot
271268
void MapFindFeature::showHelp() const
272269
{
273270
Util::showHelp(controller.getWindow(), "find_objects.html");
274271
}
275272

276273

277-
// slot
278274
void MapFindFeature::tagSelectorToggled(bool active)
279275
{
280276
editor_stack->setCurrentIndex(active ? 1 : 0);

src/gui/map/map_find_feature.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,20 @@ class MapFindFeature : public QObject
5454

5555
void setEnabled(bool enabled);
5656

57-
QAction* showDialogAction() const { return show_action; }
57+
QAction* showDialogAction() { return show_action; }
5858

59-
QAction* findNextAction() const { return find_next_action; }
59+
QAction* findNextAction() { return find_next_action; }
6060

61+
protected:
6162
void findNextMatchingObject(ObjectQuery& query);
6263

6364
void findAllMatchingObjects(ObjectQuery& query);
6465

65-
private slots:
66+
private:
67+
void showDialog();
68+
69+
ObjectQuery makeQuery() const;
70+
6671
void findNext();
6772

6873
void findAll();
@@ -71,11 +76,6 @@ private slots:
7176

7277
void tagSelectorToggled(bool active);
7378

74-
private:
75-
void showDialog();
76-
77-
ObjectQuery makeQuery() const;
78-
7979

8080
MapEditorController& controller;
8181
QPointer<QDialog> find_dialog; // child of controller's window

test/tools_t.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,13 @@ void ToolsTest::testFindObjects()
263263

264264
TestMapEditor editor(map); // taking ownership
265265
editor.editor->setTool(nullptr);
266-
MapFindFeature find_feature {*editor.editor};
266+
267+
struct TestMapFindFeature : public MapFindFeature{
268+
TestMapFindFeature(MapEditorController &controller) : MapFindFeature(controller) {}
269+
using MapFindFeature::findNextMatchingObject;
270+
using MapFindFeature::findAllMatchingObjects;
271+
} find_feature {*editor.editor};
272+
267273
ObjectQuery symbol_query {QLatin1String("match"), ObjectQuery::OperatorIs, QLatin1String("yes")};
268274

269275
map->clearObjectSelection(false);

0 commit comments

Comments
 (0)