MCPcopy Create free account
hub / github.com/KDE/kdevelop / fetchToolBarFor

Method fetchToolBarFor

kdevplatform/sublime/tests/test_toolviewtoolbar.cpp:83–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83QToolBar* TestToolViewToolBar::fetchToolBarFor(Sublime::View* view)
84{
85 QWidget* toolWidget = view->widget();
86 const char* loc = "fetchToolBarFor";
87 Q_UNUSED(loc);
88 Q_ASSERT_X(toolWidget, loc, "Tool refuses to create widget (null).");
89 Q_ASSERT(toolWidget->parent());
90 auto* toolWin = qobject_cast<QMainWindow*>(toolWidget->parent());
91 Q_ASSERT_X(toolWin, loc, "Tool widget's parent is not a QMainWindow.");
92 QList<QToolBar*> toolBars = toolWin->findChildren<QToolBar*>();
93 int barCount = toolBars.count();
94 char* failMsg = qstrdup(QStringLiteral("Expected to find a toolbar but found %1").arg(barCount).toLatin1().data());
95 Q_UNUSED(failMsg);
96 Q_ASSERT_X(barCount == 1, loc, failMsg);
97 delete [] failMsg;
98 return toolBars.at(0);
99}
100
101void TestToolViewToolBar::assertGoodBar(QToolBar* toolbar, const QString& actionText)
102{

Callers

nothing calls this directly

Calls 5

widgetMethod · 0.45
parentMethod · 0.45
countMethod · 0.45
dataMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected