Warning, file /education/cantor/src/backends/kalgebra/kalgebrasyntaxhelpobject.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2009 Aleix Pol <aleixpol@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "kalgebrasyntaxhelpobject.h" 0008 #include "kalgebrasession.h" 0009 #include <analitzagui/operatorsmodel.h> 0010 #include <KLocalizedString> 0011 0012 KAlgebraSyntaxHelpObject::KAlgebraSyntaxHelpObject(const QString& command, KAlgebraSession* session) 0013 : SyntaxHelpObject(command, session) 0014 {} 0015 0016 void KAlgebraSyntaxHelpObject::fetchInformation() 0017 { 0018 OperatorsModel* opm=static_cast<KAlgebraSession*>(session())->operatorsModel(); 0019 QModelIndexList idxs=opm->match(opm->index(0,0), Qt::DisplayRole, command(), 1, Qt::MatchExactly); 0020 Q_ASSERT(idxs.size()<=1); 0021 0022 if(!idxs.isEmpty()) { 0023 QString result; 0024 QModelIndex idx=idxs.first(); 0025 int c=opm->columnCount(idx); 0026 for(int i=0; i<c; i++) { 0027 result += i18n("<p><b>%1:</b> %2</p>", 0028 opm->headerData(i, Qt::Horizontal).toString(), 0029 opm->data(idx.sibling(idx.row(), i)).toString()); 0030 } 0031 0032 setHtml(result); 0033 emit done(); 0034 } 0035 } 0036