forked from qt-creator/qt-creator
Make it easy to set a kit matcher.
Using a function to set a kit matcher is much easier that crating a new
class. It also enables an easy way to reuse classes that are using it.
E.g.
DeviceProcessesDialog processDialog;
processDialog.kitChooser()->setKitMatcher([](const Kit* kit) {
return kit->isValid() && other_checks_with(kit);
});
Change-Id: I4e2fc7c52038902412cec5331504230bb8160ceb
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -110,18 +110,16 @@ DebuggerKitChooser::DebuggerKitChooser(Mode mode, QWidget *parent)
|
||||
, m_hostAbi(Abi::hostAbi())
|
||||
, m_mode(mode)
|
||||
{
|
||||
}
|
||||
|
||||
// Match valid debuggers and restrict local debugging to compatible toolchains.
|
||||
bool DebuggerKitChooser::kitMatches(const Kit *k) const
|
||||
{
|
||||
if (!DebuggerKitInformation::isValidDebugger(k))
|
||||
return false;
|
||||
if (m_mode == LocalDebugging) {
|
||||
const ToolChain *tc = ToolChainKitInformation::toolChain(k);
|
||||
return tc && tc->targetAbi().os() == m_hostAbi.os();
|
||||
}
|
||||
return true;
|
||||
setKitMatcher([this](const Kit *k) {
|
||||
// Match valid debuggers and restrict local debugging to compatible toolchains.
|
||||
if (!DebuggerKitInformation::isValidDebugger(k))
|
||||
return false;
|
||||
if (m_mode == LocalDebugging) {
|
||||
const ToolChain *tc = ToolChainKitInformation::toolChain(k);
|
||||
return tc && tc->targetAbi().os() == m_hostAbi.os();
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
QString DebuggerKitChooser::kitToolTip(Kit *k) const
|
||||
|
||||
Reference in New Issue
Block a user