Commit 4442a927 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk

Braces cleanup

Change-Id: I8413252c90a1487d291f15d92837c30ab697b245
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent bfad6f10
......@@ -344,9 +344,8 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
if (name->isNameId()) {
if (const Name *usingDeclarationName = ud->name()) {
if (const QualifiedNameId *q = usingDeclarationName->asQualifiedNameId()) {
if (q->name() && q->name()->isEqualTo(name)) {
if (q->name() && q->name()->isEqualTo(name))
return bindings()->globalNamespace()->lookupType(q);
}
}
}
}
......@@ -802,9 +801,8 @@ ClassOrNamespace *ClassOrNamespace::findBlock(Block *block)
flush();
QHash<Block *, ClassOrNamespace *>::const_iterator citBlock = _blocks.find(block);
if (citBlock != _blocks.end()) {
if (citBlock != _blocks.end())
return citBlock.value();
}
for (citBlock = _blocks.begin(); citBlock != _blocks.end(); ++citBlock) {
if (ClassOrNamespace *foundNestedBlock = citBlock.value()->findBlock(block))
......@@ -1110,9 +1108,8 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name, ClassOrNamespac
for (unsigned i = 0; i < klassMemberCount; ++i){
Symbol *klassMemberAsSymbol = klass->memberAt(i);
if (klassMemberAsSymbol->isTypedef()) {
if (Declaration *declaration = klassMemberAsSymbol->asDeclaration()) {
if (Declaration *declaration = klassMemberAsSymbol->asDeclaration())
qDebug() << "Member: " << oo(declaration->type(), declaration->name());
}
}
}
}
......
......@@ -1121,9 +1121,8 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
if (! isTypeTypedefed(originalType, ty)
|| ! areOriginalAndTypedefedTypePointer(originalType, ty)) {
*replacedDotOperator = originalType->isPointerType() || ty->isPointerType();
if (PointerType *ptrTy = ty->asPointerType()) {
if (PointerType *ptrTy = ty->asPointerType())
ty = ptrTy->elementType();
}
}
}
......
......@@ -311,9 +311,8 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
QLocale locale;
QStringList filePaths = ModelManagerInterface::instance()
->filesAtQrcPath(path, &locale, 0, ModelManagerInterface::ActiveQrcResources);
if (filePaths.isEmpty()) {
if (filePaths.isEmpty())
filePaths = ModelManagerInterface::instance()->filesAtQrcPath(path);
}
if (!filePaths.isEmpty()) {
Document::Ptr importedDoc = snapshot.document(filePaths.at(0));
if (importedDoc)
......
......@@ -111,11 +111,10 @@ private:
QString QrcParser::normalizedQrcFilePath(const QString &path) {
QString normPath = path;
int endPrefix = 0;
if (path.startsWith(QLatin1String("qrc:/"))) {
if (path.startsWith(QLatin1String("qrc:/")))
endPrefix = 4;
} else if (path.startsWith(QLatin1String(":/"))) {
else if (path.startsWith(QLatin1String(":/")))
endPrefix = 1;
}
if (endPrefix < path.size() && path.at(endPrefix) == QLatin1Char('/'))
while (endPrefix + 1 < path.size() && path.at(endPrefix+1) == QLatin1Char('/'))
++endPrefix;
......@@ -377,9 +376,8 @@ void QrcParserPrivate::collectFilesInPath(const QString &path, QMap<QString,QStr
QString fileName = res.key().right(res.key().size()-key.size());
QStringList &els = (*contents)[fileName];
foreach (const QString &val, res.value())
if (!els.contains(val)){
if (!els.contains(val))
els << val;
}
++res;
} else {
QString dirName = res.key().mid(key.size(), endDir - key.size() + 1);
......
......@@ -632,8 +632,7 @@ void TypeDescriptionReader::readEnumValues(AST::UiScriptBinding *ast, LanguageUt
continue;
}
PropertyGetterSetter *getterSetter = AST::cast<PropertyGetterSetter *>(it->assignment);
if (getterSetter) {
if (getterSetter)
addError(objectLit->firstSourceLocation(), tr("Enum should not contain getter and setters, but only 'string: number' elements."));
}
}
}
......@@ -1011,11 +1011,10 @@ extern "C" HRESULT CALLBACK stack(CIDebugClient *Client, PCSTR argsIn)
tokens.pop_front();
}
if (!tokens.empty()) {
if (tokens.front() == "unlimited") {
if (tokens.front() == "unlimited")
maxFrames = 1000;
} else {
else
integerFromString(tokens.front(), &maxFrames);
}
}
const std::string stack = gdbmiStack(exc.control(), exc.symbols(),
......
......@@ -117,9 +117,8 @@ void AndroidDeployStepWidget::setQASIPackagePath()
QString packagePath =
QFileDialog::getOpenFileName(this, tr("Qt Android Smart Installer"),
QDir::homePath(), tr("Android package (*.apk)"));
if (!packagePath.isEmpty()) {
if (!packagePath.isEmpty())
AndroidManager::installQASIPackage(m_step->target(), packagePath);
}
}
......
......@@ -367,15 +367,13 @@ bool AndroidManager::bundleQt(ProjectExplorer::Target *target)
{
AndroidDeployStep *androidDeployStep
= AndroidGlobal::buildStep<AndroidDeployStep>(target->activeDeployConfiguration());
if (androidDeployStep) {
if (androidDeployStep)
return androidDeployStep->deployAction() == AndroidDeployStep::BundleLibraries;
}
AndroidDeployQtStep *androidDeployQtStep
= AndroidGlobal::buildStep<AndroidDeployQtStep>(target->activeDeployConfiguration());
if (androidDeployQtStep) {
if (androidDeployQtStep)
return androidDeployQtStep->deployAction() == AndroidDeployQtStep::BundleLibrariesDeployment;
}
return false;
}
......@@ -819,9 +817,8 @@ QVector<AndroidManager::Library> AndroidManager::availableQtLibsWithDependencies
if (!qmakeProject || !version)
return QVector<AndroidManager::Library>();
QString qtLibsPath = version->qmakeProperty("QT_INSTALL_LIBS");
if (!readelfPath.toFileInfo().exists()) {
if (!readelfPath.toFileInfo().exists())
return QVector<AndroidManager::Library>();
}
LibrariesMap mapLibs;
QDir libPath;
QDirIterator it(qtLibsPath, QStringList() << QLatin1String("*.so"), QDir::Files, QDirIterator::Subdirectories);
......@@ -997,9 +994,8 @@ QString AndroidManager::loadLocal(ProjectExplorer::Target *target, int apiLevel,
dependencyLib = dependencyLib.arg(apiLevel);
if (libElement.hasAttribute(QLatin1String("extends"))) {
const QString extends = libElement.attribute(QLatin1String("extends"));
if (libs.contains(extends)) {
if (libs.contains(extends))
dependencyLibs << dependencyLib;
}
} else if (!dependencyLibs.contains(dependencyLib)) {
dependencyLibs << dependencyLib;
}
......
......@@ -455,9 +455,8 @@ void AndroidManifestEditorWidget::initializePage()
bool AndroidManifestEditorWidget::eventFilter(QObject *obj, QEvent *event)
{
if (obj == m_targetLineEdit) {
if (event->type() == QEvent::FocusIn) {
if (event->type() == QEvent::FocusIn)
QTimer::singleShot(0, this, SLOT(updateTargetComboBox()));
}
}
if (obj == m_overlayWidget)
......@@ -561,9 +560,8 @@ bool AndroidManifestEditorWidget::setActivePage(EditorPage page)
syncToEditor();
setFocus();
} else {
if (!syncToWidgets()) {
if (!syncToWidgets())
return false;
}
QWidget *fw = m_overlayWidget->focusWidget();
if (fw && fw != m_overlayWidget)
......
......@@ -44,9 +44,8 @@ BareMetalGdbCommandsDeployStepWidget::BareMetalGdbCommandsDeployStepWidget(BareM
m_commands = new QPlainTextEdit(this);
fl->addRow(tr("GDB commands:"),m_commands);
m_commands->setPlainText(m_step.gdbCommands());
if (!connect(m_commands,SIGNAL(textChanged()),SLOT(update()))) {
if (!connect(m_commands,SIGNAL(textChanged()),SLOT(update())))
qDebug()<<"BareMetalGdbCommandsDeployStepWidget connect failed.";
}
}
void BareMetalGdbCommandsDeployStepWidget::update()
......
......@@ -58,11 +58,10 @@ void CMakeParser::stdError(const QString &line)
{
QString trimmedLine = rightTrimmed(line);
if (trimmedLine.isEmpty() && !m_lastTask.isNull()) {
if (m_skippedFirstEmptyLine) {
if (m_skippedFirstEmptyLine)
doFlush();
} else {
else
m_skippedFirstEmptyLine = true;
}
return;
}
if (m_skippedFirstEmptyLine)
......
......@@ -728,9 +728,8 @@ void EditorManager::closeView(Core::Internal::EditorView *view)
bool EditorManager::closeAllEditors(bool askAboutModifiedEditors)
{
d->m_documentModel->removeAllRestoredDocuments();
if (closeDocuments(d->m_documentModel->openedDocuments(), askAboutModifiedEditors)) {
if (closeDocuments(d->m_documentModel->openedDocuments(), askAboutModifiedEditors))
return true;
}
return false;
}
......
......@@ -270,8 +270,7 @@ void OpenEditorsWindow::addHistoryItems(const QList<EditLocation> &history, Edit
m_editorList->addTopLevelItem(item);
if (m_editorList->topLevelItemCount() == 1){
if (m_editorList->topLevelItemCount() == 1)
m_editorList->setCurrentItem(item);
}
}
}
......@@ -468,9 +468,8 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor &
// token[.....] == ....
// token[i + n] == T_RPAREN
if (i + 1 < tokens.size() && tokens.at(i + 1).is(T_LPAREN)) {
if (i + 1 < tokens.size() && tokens.at(i + 1).is(T_LPAREN))
closingParenthesisPos = skipMatchingParentheses(tokens, i - 1, 0);
}
} else if ((i > 3 && tk.is(T_LPAREN) && tokens.at(i - 1).is(T_IDENTIFIER)
&& tokens.at(i - 2).is(T_LPAREN)
&& (tokens.at(i - 3).is(T_SIGNAL) || tokens.at(i - 3).is(T_SLOT)))) {
......
......@@ -242,11 +242,10 @@ int LineForNewIncludeDirective::operator()(const QString &newIncludeFileName,
if (group.commonIncludeDir() == IncludeGroup::includeDir(pureIncludeFileName))
localBestIncludeGroup = group;
}
if (!localBestIncludeGroup.isEmpty()) {
if (!localBestIncludeGroup.isEmpty())
bestGroup = localBestIncludeGroup;
} else {
else
bestGroup = groupsMixedIncludeDirs.last();
}
}
}
......
......@@ -141,9 +141,8 @@ bool SearchSymbols::visit(Class *symbol)
QString name = symbolName(symbol);
QString scopedName = scopedSymbolName(name);
QString previousScope = switchScope(scopedName);
if (symbolsToSearchFor & SymbolSearcher::Classes) {
if (symbolsToSearchFor & SymbolSearcher::Classes)
appendItem(name, QString(), previousScope, ModelItemInfo::Class, symbol);
}
for (unsigned i = 0; i < symbol->memberCount(); ++i) {
accept(symbol->memberAt(i));
}
......
......@@ -155,11 +155,10 @@ void ImageViewer::contextMenuEvent(QContextMenuEvent *ev)
copyAction->setEnabled(hasImage);
imageViewerAction->setEnabled(hasImage);
QAction *action = menu.exec(ev->globalPos());
if (action == copyAction) {
if (action == copyAction)
QApplication::clipboard()->setImage(image);
} else if (action == imageViewerAction) {
else if (action == imageViewerAction)
openImageViewer(image);
}
}
#include "imageviewer.moc"
......@@ -148,11 +148,10 @@ void LldbEngine::abortDebugger()
void LldbEngine::setupEngine()
{
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
if (startParameters().remoteSetupNeeded) {
if (startParameters().remoteSetupNeeded)
notifyEngineRequestRemoteSetup();
} else {
else
startLldb();
}
}
void LldbEngine::startLldb()
......
......@@ -128,9 +128,8 @@ void DiffEditorPlugin::diff()
QString DiffEditorPlugin::getFileContents(const QString &fileName, QTextCodec *codec) const
{
QFile file(fileName);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
return codec->toUnicode(file.readAll());
}
return QString();
}
......
......@@ -1051,11 +1051,10 @@ ChunkData DiffEditorWidget::calculateOriginalData(const QList<Diff> &diffList) c
const QStringList lines = diff.text.split(QLatin1Char('\n'));
const bool equal = isEqual(diffList, i);
if (diff.command == Diff::Insert) {
if (diff.command == Diff::Insert)
lastRightLineEqual = lastRightLineEqual && equal;
} else if (diff.command == Diff::Delete) {
else if (diff.command == Diff::Delete)
lastLeftLineEqual = lastLeftLineEqual && equal;
}
const int lastLeftPos = currentLeftPos;
const int lastRightPos = currentRightPos;
......
......@@ -405,11 +405,10 @@ QList<Diff> Differ::diffMyers(const QString &text1, const QString &text2)
k <= qMin(d, kMaxForward - qAbs(d + kMaxForward) % 2);
k = k + 2) {
int x;
if (k == -d || (k < d && forwardV[k + vShift - 1] < forwardV[k + vShift + 1])) {
if (k == -d || (k < d && forwardV[k + vShift - 1] < forwardV[k + vShift + 1]))
x = forwardV[k + vShift + 1]; // copy vertically from diagonal k + 1, y increases, y may exceed the graph
} else {
else
x = forwardV[k + vShift - 1] + 1; // copy horizontally from diagonal k - 1, x increases, x may exceed the graph
}
int y = x - k;
if (x > n) {
......@@ -441,11 +440,10 @@ QList<Diff> Differ::diffMyers(const QString &text1, const QString &text2)
k <= qMin(d, kMaxReverse - qAbs(d + kMaxReverse) % 2);
k = k + 2) {
int x;
if (k == -d || (k < d && reverseV[k + vShift - 1] < reverseV[k + vShift + 1])) {
if (k == -d || (k < d && reverseV[k + vShift - 1] < reverseV[k + vShift + 1]))
x = reverseV[k + vShift + 1];
} else {
else
x = reverseV[k + vShift - 1] + 1;
}
int y = x - k;
if (x > n) {
......@@ -559,9 +557,8 @@ int Differ::findSubtextEnd(const QString &text,
{
if (m_currentDiffMode == Differ::LineMode) {
int subtextEnd = text.indexOf(QLatin1Char('\n'), subtextStart);
if (subtextEnd == -1) {
if (subtextEnd == -1)
subtextEnd = text.count() - 1;
}
return ++subtextEnd;
} else if (m_currentDiffMode == Differ::WordMode) {
if (!text.at(subtextStart).isLetter())
......@@ -732,9 +729,8 @@ QList<Diff> Differ::cleanupSemantics(const QList<Diff> &diffList)
}
equalitiesToBeSplit.insert(data.equalityIndex, true);
equalities.removeAt(i);
if (i > 0) {
if (i > 0)
i--; // reexamine previous equality
}
} else {
i++;
}
......@@ -807,9 +803,8 @@ QList<Diff> Differ::cleanupSemanticsLossless(const QList<Diff> &diffList)
thisDiff.text = bestEdit;
nextDiff.text = bestEquality2;
if (!bestEquality1.isEmpty()) {
if (!bestEquality1.isEmpty())
newDiffList.append(prevDiff); // append modified equality1
}
if (bestEquality2.isEmpty()) {
i++;
if (i < diffList.count())
......
......@@ -163,11 +163,10 @@ QWidget *DiffShowEditor::toolBar()
void DiffShowEditor::setDescriptionVisible(bool visible)
{
if (visible) {
if (visible)
m_toggleDescriptionButton->setToolTip(tr("Hide Change Description"));
} else {
else
m_toggleDescriptionButton->setToolTip(tr("Show Change Description"));
}
m_diffShowWidget->setVisible(visible);
}
......
......@@ -207,9 +207,8 @@ QModelIndex TreeViewFind::nextIndex(const QModelIndex &idx, bool *wrapped) const
QModelIndex current = model->index(idx.row(), 0, idx.parent());
// check for children
if (model->rowCount(current) > 0) {
if (model->rowCount(current) > 0)
return current.child(0, 0);
}
// no more children, go up and look for parent with more children
QModelIndex nextIndex;
......
......@@ -380,9 +380,8 @@ void BranchModel::setCurrentBranch()
BranchNode *local = m_rootNode->children.at(LocalBranches);
int pos = 0;
for (pos = 0; pos < local->count(); ++pos) {
if (local->children.at(pos)->name == currentBranch) {
if (local->children.at(pos)->name == currentBranch)
m_currentBranch = local->children[pos];
}
}
}
......
......@@ -537,9 +537,8 @@ QString GitDiffHandler::workingTreeContents(const QString &fileName) const
QString absoluteFileName = workingDir.absoluteFilePath(fileName);
QFile file(absoluteFileName);
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
return m_editor->editorWidget()->codec()->toUnicode(file.readAll());
}
return QString();
}
......
......@@ -145,9 +145,8 @@ QString IosRunConfiguration::appName() const
const QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(profilePath());
if (node) {
TargetInformation ti = node->targetInformation();
if (ti.valid) {
if (ti.valid)
return ti.target;
}
}
}
qDebug() << "IosRunConfiguration::appName failed";
......
......@@ -342,19 +342,16 @@ void AbstractMsvcToolChain::inferWarningsForLevel(int warningLevel, WarningFlags
// reset all except unrelated flag
flags = flags & WarningsAsErrors;
if (warningLevel >= 1) {
if (warningLevel >= 1)
flags |= WarningFlags(WarningsDefault | WarnIgnoredQualfiers | WarnHiddenLocals | WarnUnknownPragma);
}
if (warningLevel >= 2) {
if (warningLevel >= 2)
flags |= WarningsAll;
}
if (warningLevel >= 3) {
flags |= WarningFlags(WarningsExtra | WarnNonVirtualDestructor | WarnSignedComparison
| WarnUnusedLocals | WarnDeprecated);
}
if (warningLevel >= 4) {
if (warningLevel >= 4)
flags |= WarnUnusedParams;
}
}
bool AbstractMsvcToolChain::operator ==(const ToolChain &other) const
......
......@@ -89,11 +89,10 @@ protected:
void mouseDoubleClickEvent(QMouseEvent *ev)
{
int line = cursorForPosition(ev->pos()).block().blockNumber();
if (unsigned taskid = m_taskids.value(line, 0)) {
if (unsigned taskid = m_taskids.value(line, 0))
TaskHub::showTaskInEditor(taskid);
} else {
else
QPlainTextEdit::mouseDoubleClickEvent(ev);
}
}
private:
......
......@@ -1176,9 +1176,8 @@ void ProjectExplorerPlugin::updateVariable(const QByteArray &variable)
projectFilePath = doc->filePath();
if (Target *target = project->activeTarget()) {
kit = target->kit();
if (BuildConfiguration *buildConfiguration = target->activeBuildConfiguration()) {
if (BuildConfiguration *buildConfiguration = target->activeBuildConfiguration())
buildConfigurationName = buildConfiguration->displayName();
}
}
}
ProjectMacroExpander expander(projectFilePath, projectName, kit, buildConfigurationName);
......
......@@ -591,9 +591,8 @@ QPair<QString, QString> DesktopQmakeRunConfiguration::extractWorkingDirAndExecut
QString workingDir;
if (!destDir.isEmpty()) {
bool workingDirIsBaseDir = false;
if (destDir == ti.buildTarget) {
if (destDir == ti.buildTarget)
workingDirIsBaseDir = true;
}
if (QDir::isRelativePath(destDir))
destDir = QDir::cleanPath(ti.buildDir + QLatin1Char('/') + destDir);
......
......@@ -156,11 +156,10 @@ QByteArray AbstractMobileApp::generateMainCpp(QString *errorMessage) const
QString line;
while (!(line = in.readLine()).isNull()) {
bool adaptLine = true;
if (line.contains(QLatin1String("// DELETE_LINE"))) {
if (line.contains(QLatin1String("// DELETE_LINE")))
continue; // omit this line in the output
} else {
else
adaptLine = adaptCurrentMainCppTemplateLine(line);
}
if (adaptLine) {
const int commentIndex = line.indexOf(QLatin1String(" //"));
if (commentIndex != -1)
......
......@@ -146,9 +146,8 @@ LibraryWizardDialog::LibraryWizardDialog(const QString &templateName,
// Use the intro page instead, set up initially
setIntroDescription(tr("This wizard generates a C++ library project."));
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS))) {
if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
m_targetPageId = addTargetSetupPage();
}
m_modulesPageId = addModulesPage();
......
......@@ -75,11 +75,10 @@ const Import ImportLabel::import() const
void ImportLabel::setReadOnly(bool readOnly) const
{
m_removeButton->setDisabled(readOnly);
if (readOnly) {
if (readOnly)
m_removeButton->setIcon(QIcon());
} else {
else
m_removeButton->setIcon(QIcon(Core::Constants::ICON_CLOSE_DOCUMENT));
}
}
void ImportLabel::emitRemoveImport()
......
......@@ -194,11 +194,10 @@ QString DesignDocument::displayName() const
QString DesignDocument::simplfiedDisplayName() const
{
if (rootModelNode().id().isEmpty()) {
if (rootModelNode().id().isEmpty())
return rootModelNode().id();
} else {
else
return rootModelNode().simplifiedTypeName();
}
QStringList list = displayName().split(QLatin1Char('/'));
return list.last();
......@@ -637,9 +636,8 @@ void DesignDocument::redo()
static bool isFileInProject(DesignDocument *designDocument, ProjectExplorer::Project *project)
{
foreach (const QString &fileNameInProject, project->files(ProjectExplorer::Project::ExcludeGeneratedFiles)) {
if (designDocument->fileName() == fileNameInProject) {
if (designDocument->fileName() == fileNameInProject)
return true;
}
}
return false;
......
......@@ -75,9 +75,8 @@ QVariant ItemLibrarySortedModel::data(const QModelIndex &index, int role) const
if (m_roleNames.contains(role)) {
QVariant value = m_privList.at(index.row())->property(m_roleNames.value(role));
if (ItemLibrarySortedModel* model = qobject_cast<ItemLibrarySortedModel *>(value.value<QObject*>())) {
if (ItemLibrarySortedModel* model = qobject_cast<ItemLibrarySortedModel *>(value.value<QObject*>()))
return QVariant::fromValue(model);
}
return m_privList.at(index.row())->property(m_roleNames.value(role));
}
......@@ -145,11 +144,10 @@ bool ItemLibrarySortedModel::setElementVisible(int libId, bool visible)
return false;
int visiblePos = visibleElementPosition(libId);
if (visible) {
if (visible)
privateInsert(visiblePos, (m_elementModels.value(libId)));
} else {
else
privateRemove(visiblePos);
}
m_elementOrder[pos].visible = visible;
return true;
......@@ -240,9 +238,8 @@ void ItemLibrarySortedModel::resetModel()
void ItemLibrarySortedModel::addRoleName(const QByteArray &roleName)
{
if (m_roleNames.values().contains(roleName)) {
if (m_roleNames.values().contains(roleName))
return;
}
int key = m_roleNames.count();
m_roleNames.insert(key, roleName);
......
......@@ -81,11 +81,10 @@ QVariant GradientModel::data(const QModelIndex &index, int role) const
return index.row();
}
if (role == Qt::UserRole + 1) {
if (role == Qt::UserRole + 1)
return getPosition(index.row());
} else if (role == Qt::UserRole + 2) {
else if (role == Qt::UserRole + 2)
return getColor(index.row());
}
qWarning() << Q_FUNC_INFO << "invalid role";