[Gui] remove unnecessary Boolean comparisons

This commit is contained in:
Uwe
2022-06-15 03:47:55 +02:00
parent 8e253cb4c8
commit c23a30b916
13 changed files with 22 additions and 22 deletions

View File

@@ -546,7 +546,7 @@ void Application::open(const char* FileName, const char* Module)
// in case of an automatically created empty document at startup
App::Document* act = App::GetApplication().getActiveDocument();
Gui::Document* gui = this->getDocument(act);
if (act && act->countObjects() == 0 && gui && gui->isModified() == false){
if (act && act->countObjects() == 0 && gui && !gui->isModified()){
Command::doCommand(Command::App, "App.closeDocument('%s')", act->getName());
qApp->processEvents(); // an update is needed otherwise the new view isn't shown
}
@@ -2410,7 +2410,7 @@ void Application::setStyleSheet(const QString& qssFile, bool tiledBackground)
// appear incorrect due to an outdated cache.
// See https://doc.qt.io/qt-5/qstyle.html#unpolish-1
// See https://forum.freecadweb.org/viewtopic.php?f=17&t=50783
if (d->startingUp == false) {
if (!d->startingUp) {
if (mdi->style())
mdi->style()->unpolish(qApp);
}

View File

@@ -2152,7 +2152,7 @@ void StdCmdAxisCross::activated(int iMsg)
Q_UNUSED(iMsg);
Gui::View3DInventor* view = qobject_cast<View3DInventor*>(Gui::getMainWindow()->activeWindow());
if (view) {
if (view->getViewer()->hasAxisCross() == false)
if (!view->getViewer()->hasAxisCross())
doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(True)");
else
doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(False)");

View File

@@ -1356,7 +1356,7 @@ unsigned int Document::getMemSize (void) const
void Document::Save (Base::Writer &writer) const
{
// It's only possible to add extra information if force of XML is disabled
if (writer.isForceXML() == false) {
if (!writer.isForceXML()) {
writer.addFile("GuiDocument.xml", this);
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Document");
@@ -1909,7 +1909,7 @@ void Document::detachView(Gui::BaseView* pcView, bool bPassiv)
}
// is already closing the document, and is not linked by other documents
if (d->_isClosing == false &&
if (!d->_isClosing &&
App::PropertyXLink::getDocumentInList(getDocument()).empty())
{
d->_pcAppWnd->onLastWindowClosed(this);

View File

@@ -893,9 +893,9 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent* const ev)
return true;
}
if ( (smev.isRelease(1) && this->button1down == false)
|| (smev.isRelease(2) && this->button2down == false)
|| (smev.isRelease(3) && this->button3down == false)) {
if ( (!smev.isRelease(1) && this->button1down)
|| (!smev.isRelease(2) && this->button2down)
|| (!smev.isRelease(3) && this->button3down)) {
//a button release event cane, but we didn't see the corresponding down
//event. Discard it. This discarding is relied upon in some hacks to
//overcome buggy synthetic mouse input coming from Qt when doing

View File

@@ -293,10 +293,10 @@ void Gui::GUIApplicationNativeEventAware::importSettings(std::vector<int>& motio
for (i = 0; i < 6; ++i) {
if (motionDataArray[i] != 0) {
if (enabled[i] == false)
if (!enabled[i])
motionDataArray[i] = 0;
else {
if (reversed[i] == true)
if (reversed[i])
motionDataArray[i] = - motionDataArray[i];
motionDataArray[i] = (int)((float)(motionDataArray[i]) * sensitivity[i] * generalSensitivity);
}

View File

@@ -261,9 +261,9 @@ bool NetworkRetriever::startDownload( const QString& startUrl )
if ( !d->dir.isEmpty() )
{
QDir dir(d->dir);
if ( dir.exists( d->dir ) == false )
if (!dir.exists(d->dir))
{
if ( dir.mkdir( d->dir ) == false)
if (!dir.mkdir(d->dir))
{
Base::Console().Error("Directory '%s' could not be created.", (const char*)d->dir.toLatin1());
return true; // please, no error message
@@ -534,7 +534,7 @@ void StdCmdDownloadOnlineHelp::activated(int iMsg)
if (canStart) {
bool ok = wget->startDownload(QString::fromLatin1(url.c_str()));
if ( ok == false )
if (!ok)
Base::Console().Error("The tool 'wget' couldn't be found. Please check your installation.");
else if ( wget->isDownloading() && _pcAction )
_pcAction->setText(tr("Stop downloading"));

View File

@@ -971,7 +971,7 @@ void PythonConsole::mouseReleaseEvent( QMouseEvent *e )
if (e->button() == Qt::LeftButton)
{
QTextCursor cursor = this->textCursor();
if (cursor.hasSelection() == false
if (!cursor.hasSelection()
&& cursor < this->inputBegin())
{
cursor.movePosition( QTextCursor::End );

View File

@@ -297,7 +297,7 @@ void AbstractSplitView::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp
r4 = ((col4 >> 24) & 0xff) / 255.0; g4 = ((col4 >> 16) & 0xff) / 255.0; b4 = ((col4 >> 8) & 0xff) / 255.0;
for (std::vector<View3DInventorViewer*>::iterator it = _viewer.begin(); it != _viewer.end(); ++it) {
(*it)->setBackgroundColor(QColor::fromRgbF(r1, g1, b1));
if (rGrp.GetBool("UseBackgroundColorMid",false) == false)
if (!rGrp.GetBool("UseBackgroundColorMid",false))
(*it)->setGradientBackgroundColor(SbColor(r2, g2, b2), SbColor(r3, g3, b3));
else
(*it)->setGradientBackgroundColor(SbColor(r2, g2, b2), SbColor(r3, g3, b3), SbColor(r4, g4, b4));

View File

@@ -73,7 +73,7 @@ unsigned int Thumbnail::getMemSize (void) const
void Thumbnail::Save (Base::Writer &writer) const
{
// It's only possible to add extra information if force of XML is disabled
if (writer.isForceXML() == false)
if (!writer.isForceXML())
writer.addFile("thumbnails/Thumbnail.png", this);
}

View File

@@ -70,7 +70,7 @@ void TreeView::mouseDoubleClickEvent (QMouseEvent * event)
getMainWindow()->setActiveWindow(view);
}
else if (item->getTypeId().isDerivedFrom(ViewProvider::getClassTypeId())) {
if (static_cast<ViewProvider*>(item)->doubleClicked() == false)
if (!static_cast<ViewProvider*>(item)->doubleClicked())
QTreeView::mouseDoubleClickEvent(event);
}
}

View File

@@ -428,7 +428,7 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
r3 = ((col3 >> 24) & 0xff) / 255.0; g3 = ((col3 >> 16) & 0xff) / 255.0; b3 = ((col3 >> 8) & 0xff) / 255.0;
r4 = ((col4 >> 24) & 0xff) / 255.0; g4 = ((col4 >> 16) & 0xff) / 255.0; b4 = ((col4 >> 8) & 0xff) / 255.0;
_viewer->setBackgroundColor(QColor::fromRgbF(r1, g1, b1));
if (rGrp.GetBool("UseBackgroundColorMid",false) == false)
if (!rGrp.GetBool("UseBackgroundColorMid",false))
_viewer->setGradientBackgroundColor(SbColor(r2, g2, b2), SbColor(r3, g3, b3));
else
_viewer->setGradientBackgroundColor(SbColor(r2, g2, b2), SbColor(r3, g3, b3), SbColor(r4, g4, b4));

View File

@@ -510,7 +510,7 @@ void View3DInventorViewer::init()
// Settings
setSeekTime(0.4f);
if (isSeekValuePercentage() == false)
if (!isSeekValuePercentage())
setSeekValueAsPercentage(true);
setSeekDistance(100);

View File

@@ -172,7 +172,7 @@ void ViewProviderDocumentObject::onChanged(const App::Property* prop)
}
else if (prop == &Visibility) {
// use this bit to check whether show() or hide() must be called
if (Visibility.testStatus(App::Property::User2) == false) {
if (!Visibility.testStatus(App::Property::User2)) {
Visibility.setStatus(App::Property::User2, true);
Visibility.getValue() ? show() : hide();
Visibility.setStatus(App::Property::User2, false);
@@ -228,7 +228,7 @@ void ViewProviderDocumentObject::hide(void)
{
ViewProvider::hide();
// use this bit to check whether 'Visibility' must be adjusted
if (Visibility.testStatus(App::Property::User2) == false) {
if (!Visibility.testStatus(App::Property::User2)) {
Visibility.setStatus(App::Property::User2, true);
Visibility.setValue(false);
Visibility.setStatus(App::Property::User2, false);
@@ -292,7 +292,7 @@ void ViewProviderDocumentObject::show(void)
}
// use this bit to check whether 'Visibility' must be adjusted
if (Visibility.testStatus(App::Property::User2) == false) {
if (!Visibility.testStatus(App::Property::User2)) {
Visibility.setStatus(App::Property::User2, true);
Visibility.setValue(true);
Visibility.setStatus(App::Property::User2, false);