mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Coding - Apply .clang-format formatting #286
Update empty method guards to new style with regex (see PR). Used clang-format 18.1.8. New actions to validate code formatting is added. Update .clang-format with disabling of include sorting. It is temporary changes, then include will be sorted. Apply formatting for /src and /tools folder. The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/DFBrowser_SearchLineModel.hxx>
|
||||
|
||||
@@ -31,8 +31,11 @@
|
||||
// function : Constructor
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
DFBrowser_SearchLineModel::DFBrowser_SearchLineModel (QObject* theParent, DFBrowser_Module* theModule)
|
||||
: QAbstractTableModel (theParent), myModule (theModule), myRowCount (0)
|
||||
DFBrowser_SearchLineModel::DFBrowser_SearchLineModel(QObject* theParent,
|
||||
DFBrowser_Module* theModule)
|
||||
: QAbstractTableModel(theParent),
|
||||
myModule(theModule),
|
||||
myRowCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -40,15 +43,17 @@ DFBrowser_SearchLineModel::DFBrowser_SearchLineModel (QObject* theParent, DFBrow
|
||||
// function : SetValues
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void DFBrowser_SearchLineModel::SetValues (const QMap<int, QMap<QString, DFBrowser_SearchItemInfo > >& theDocumentValues,
|
||||
const QMap<int, QStringList>& theDocumentInfoValues)
|
||||
void DFBrowser_SearchLineModel::SetValues(
|
||||
const QMap<int, QMap<QString, DFBrowser_SearchItemInfo>>& theDocumentValues,
|
||||
const QMap<int, QStringList>& theDocumentInfoValues)
|
||||
{
|
||||
myAdditionalValues = theDocumentValues;
|
||||
myAdditionalValues = theDocumentValues;
|
||||
myDocumentInfoValues = theDocumentInfoValues;
|
||||
|
||||
myRowCount = 0;
|
||||
for (QMap<int, QStringList>::const_iterator aValuesIt = myDocumentInfoValues.begin();
|
||||
aValuesIt != myDocumentInfoValues.end(); aValuesIt++)
|
||||
aValuesIt != myDocumentInfoValues.end();
|
||||
aValuesIt++)
|
||||
myRowCount += aValuesIt.value().size();
|
||||
}
|
||||
|
||||
@@ -67,93 +72,96 @@ void DFBrowser_SearchLineModel::ClearValues()
|
||||
// function : GetPath
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QStringList DFBrowser_SearchLineModel::GetPath (const QModelIndex& theIndex) const
|
||||
QStringList DFBrowser_SearchLineModel::GetPath(const QModelIndex& theIndex) const
|
||||
{
|
||||
int aRowInDocument;
|
||||
int aDocumentId = getDocumentId (theIndex.row(), aRowInDocument);
|
||||
int aDocumentId = getDocumentId(theIndex.row(), aRowInDocument);
|
||||
if (aDocumentId < 0)
|
||||
return QStringList();
|
||||
|
||||
const QMap<QString, DFBrowser_SearchItemInfo>& anAdditionalValues = myAdditionalValues[aDocumentId];
|
||||
const QMap<QString, DFBrowser_SearchItemInfo>& anAdditionalValues =
|
||||
myAdditionalValues[aDocumentId];
|
||||
const QStringList& anInfoValues = myDocumentInfoValues[aDocumentId];
|
||||
|
||||
return anAdditionalValues[anInfoValues[aRowInDocument] ].Path();
|
||||
return anAdditionalValues[anInfoValues[aRowInDocument]].Path();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : GetValue
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QString DFBrowser_SearchLineModel::GetValue (const QModelIndex& theIndex) const
|
||||
QString DFBrowser_SearchLineModel::GetValue(const QModelIndex& theIndex) const
|
||||
{
|
||||
int aRowInDocument;
|
||||
int aDocumentId = getDocumentId (theIndex.row(), aRowInDocument);
|
||||
int aDocumentId = getDocumentId(theIndex.row(), aRowInDocument);
|
||||
if (aDocumentId < 0)
|
||||
return QString();
|
||||
QString aValue = myDocumentInfoValues[aDocumentId][aRowInDocument];
|
||||
return aValue.mid (0, aValue.indexOf (SplitSeparator()));
|
||||
return aValue.mid(0, aValue.indexOf(SplitSeparator()));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : index
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QModelIndex DFBrowser_SearchLineModel::index (int theRow, int theColumn, const QModelIndex& theParent) const
|
||||
QModelIndex DFBrowser_SearchLineModel::index(int theRow,
|
||||
int theColumn,
|
||||
const QModelIndex& theParent) const
|
||||
{
|
||||
if (!hasIndex (theRow, theColumn, theParent))
|
||||
if (!hasIndex(theRow, theColumn, theParent))
|
||||
return QModelIndex();
|
||||
return createIndex (theRow, theColumn);
|
||||
return createIndex(theRow, theColumn);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : data
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
QVariant DFBrowser_SearchLineModel::data (const QModelIndex& theIndex, int theRole) const
|
||||
QVariant DFBrowser_SearchLineModel::data(const QModelIndex& theIndex, int theRole) const
|
||||
{
|
||||
switch (theIndex.column())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
case 0: {
|
||||
if (theRole == Qt::DisplayRole || theRole == Qt::EditRole || theRole == Qt::ToolTipRole)
|
||||
{
|
||||
int aRowInDocument;
|
||||
int aDocumentId = getDocumentId (theIndex.row(), aRowInDocument);
|
||||
int aDocumentId = getDocumentId(theIndex.row(), aRowInDocument);
|
||||
if (aDocumentId < 0)
|
||||
return QVariant();
|
||||
return myDocumentInfoValues[aDocumentId][aRowInDocument];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
case 1: {
|
||||
if (theRole == Qt::DecorationRole)
|
||||
{
|
||||
int aRowInDocument;
|
||||
int aDocumentId = getDocumentId (theIndex.row(), aRowInDocument);
|
||||
int aDocumentId = getDocumentId(theIndex.row(), aRowInDocument);
|
||||
if (aDocumentId < 0)
|
||||
return QVariant();
|
||||
QString anInfoValue = myDocumentInfoValues[aDocumentId][aRowInDocument];
|
||||
QVariant anIcon = myAdditionalValues[aDocumentId][anInfoValue].Icon();
|
||||
QString anInfoValue = myDocumentInfoValues[aDocumentId][aRowInDocument];
|
||||
QVariant anIcon = myAdditionalValues[aDocumentId][anInfoValue].Icon();
|
||||
if (anIcon.isNull())
|
||||
{
|
||||
QString anAttributeName = anInfoValue.mid (0, anInfoValue.indexOf (SplitSeparator()));
|
||||
anIcon = DFBrowser_Module::GetAttributeInfo (anAttributeName.toUtf8().data(),
|
||||
myModule, DFBrowserPane_ItemRole_Decoration_40x40, 0);
|
||||
QString anAttributeName = anInfoValue.mid(0, anInfoValue.indexOf(SplitSeparator()));
|
||||
anIcon = DFBrowser_Module::GetAttributeInfo(anAttributeName.toUtf8().data(),
|
||||
myModule,
|
||||
DFBrowserPane_ItemRole_Decoration_40x40,
|
||||
0);
|
||||
}
|
||||
else
|
||||
anIcon = DFBrowser_Tools::GetLabelIcon (TDF_Label(), false);
|
||||
anIcon = DFBrowser_Tools::GetLabelIcon(TDF_Label(), false);
|
||||
return anIcon;
|
||||
}
|
||||
if (theRole == Qt::SizeHintRole) return QSize (80, 80);
|
||||
if (theRole == Qt::SizeHintRole)
|
||||
return QSize(80, 80);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
case 2: {
|
||||
if (theRole == Qt::DisplayRole || theRole == Qt::EditRole)
|
||||
{
|
||||
int aRowInDocument;
|
||||
int aDocumentId = getDocumentId (theIndex.row(), aRowInDocument);
|
||||
int aDocumentId = getDocumentId(theIndex.row(), aRowInDocument);
|
||||
if (aDocumentId < 0)
|
||||
return QVariant();
|
||||
QString anInfoValue = myDocumentInfoValues[aDocumentId][aRowInDocument];
|
||||
@@ -180,23 +188,23 @@ void DFBrowser_SearchLineModel::EmitLayoutChanged()
|
||||
// function : getDocumentId
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
int DFBrowser_SearchLineModel::getDocumentId (const int theRow, int& theRowInDocument) const
|
||||
int DFBrowser_SearchLineModel::getDocumentId(const int theRow, int& theRowInDocument) const
|
||||
{
|
||||
theRowInDocument = 0;
|
||||
int aDocumentId = -1;
|
||||
int aDocumentId = -1;
|
||||
|
||||
int aCurrentRow = theRow;
|
||||
for (int aValueId = 0, aSize = myDocumentInfoValues.size(); aValueId < aSize; aValueId++)
|
||||
{
|
||||
int aValueIndex = aValueId+1;
|
||||
if (!myDocumentInfoValues.contains (aValueIndex))
|
||||
int aValueIndex = aValueId + 1;
|
||||
if (!myDocumentInfoValues.contains(aValueIndex))
|
||||
continue;
|
||||
QStringList aValues = myDocumentInfoValues[aValueIndex];
|
||||
int aValuesSize = aValues.size();
|
||||
QStringList aValues = myDocumentInfoValues[aValueIndex];
|
||||
int aValuesSize = aValues.size();
|
||||
if (aCurrentRow < aValuesSize)
|
||||
{
|
||||
aDocumentId = aValueIndex;
|
||||
theRowInDocument= aCurrentRow;
|
||||
aDocumentId = aValueIndex;
|
||||
theRowInDocument = aCurrentRow;
|
||||
}
|
||||
else
|
||||
aCurrentRow = aCurrentRow - aValuesSize;
|
||||
|
Reference in New Issue
Block a user