diff --git a/src/Tools/RegExp/regexpdialog.cpp b/src/Tools/RegExp/regexpdialog.cpp index 50619d856d..fd3dc0f3b3 100644 --- a/src/Tools/RegExp/regexpdialog.cpp +++ b/src/Tools/RegExp/regexpdialog.cpp @@ -31,8 +31,8 @@ #include RegExpDialog::RegExpDialog(QWidget* parent) - : QDialog(parent), - ui(new Ui_RegExpDialog()) + : QDialog(parent) + , ui(new Ui_RegExpDialog()) { ui->setupUi(this); rxhilighter = new RegExpSyntaxHighlighter(ui->textEdit1); @@ -43,14 +43,20 @@ RegExpDialog::RegExpDialog(QWidget* parent) connect(ui->lineEditRegExp, &QLineEdit::textChanged, this, &RegExpDialog::performRegExp); connect(ui->caseInsensitiveOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); connect(ui->invertedGreedinessOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); - connect( - ui->dotMatchesEverythingOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); + connect(ui->dotMatchesEverythingOption, + &QCheckBox::toggled, + this, + &RegExpDialog::performRegExp); connect(ui->multilineOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); - connect( - ui->extendedPatternSyntaxOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); + connect(ui->extendedPatternSyntaxOption, + &QCheckBox::toggled, + this, + &RegExpDialog::performRegExp); connect(ui->dontCaptureOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); - connect( - ui->useUnicodePropertiesOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); + connect(ui->useUnicodePropertiesOption, + &QCheckBox::toggled, + this, + &RegExpDialog::performRegExp); } RegExpDialog::~RegExpDialog() @@ -130,8 +136,9 @@ void RegExpSyntaxHighlighter::highlightBlock(const QString& text) regFormat.setFontWeight(QFont::Normal); setFormat(0, text.length(), regFormat); - if (regexp.pattern().isEmpty()) + if (regexp.pattern().isEmpty()) { return;// empty regular expression + } int pos = 0; int last = -1; @@ -140,8 +147,9 @@ void RegExpSyntaxHighlighter::highlightBlock(const QString& text) QRegularExpressionMatch match; while ((pos = text.indexOf(regexp, pos, &match)) != -1) { - if (last == pos) + if (last == pos) { break; + } QString sub = text.mid(pos, match.capturedLength()); if (!sub.isEmpty()) { setFormat(pos, sub.length(), regFormat); diff --git a/src/Tools/ThumbnailProvider/ClassFactory.cpp b/src/Tools/ThumbnailProvider/ClassFactory.cpp index 4f04bb9ba1..05532450b1 100644 --- a/src/Tools/ThumbnailProvider/ClassFactory.cpp +++ b/src/Tools/ThumbnailProvider/ClassFactory.cpp @@ -61,16 +61,18 @@ STDMETHODIMP_(ULONG) CClassFactory::AddRef() STDMETHODIMP_(ULONG) CClassFactory::Release() { LONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) + if (0 == cRef) { delete this; + } return (ULONG)cRef; } STDMETHODIMP CClassFactory::CreateInstance(IUnknown* punkOuter, REFIID riid, void** ppvObject) { - if (NULL != punkOuter) + if (NULL != punkOuter) { return CLASS_E_NOAGGREGATION; + } return CThumbnailProvider_CreateInstance(riid, ppvObject); } @@ -84,18 +86,21 @@ STDMETHODIMP CClassFactory::LockServer(BOOL fLock) STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void** ppv) { - if (NULL == ppv) + if (NULL == ppv) { return E_INVALIDARG; + } - if (!IsEqualCLSID(CLSID_SampleThumbnailProvider, rclsid)) + if (!IsEqualCLSID(CLSID_SampleThumbnailProvider, rclsid)) { return CLASS_E_CLASSNOTAVAILABLE; + } CClassFactory* pcf; HRESULT hr; pcf = new CClassFactory(); - if (NULL == pcf) + if (NULL == pcf) { return E_OUTOFMEMORY; + } hr = pcf->QueryInterface(riid, ppv); pcf->Release(); diff --git a/src/Tools/ThumbnailProvider/Common.h b/src/Tools/ThumbnailProvider/Common.h index ddcb70db8d..b766f9daff 100644 --- a/src/Tools/ThumbnailProvider/Common.h +++ b/src/Tools/ThumbnailProvider/Common.h @@ -36,5 +36,15 @@ STDAPI_(HINSTANCE) DllInstance(); // {4BBBEAB5-BE00-41f4-A209-FE838660B9B1} #define szCLSID_SampleThumbnailProvider L"{4BBBEAB5-BE00-41f4-A209-FE838660B9B1}" -DEFINE_GUID(CLSID_SampleThumbnailProvider, 0x4bbbeab5, 0xbe00, 0x41f4, 0xa2, 0x9, 0xfe, 0x83, 0x86, - 0x60, 0xb9, 0xb1); +DEFINE_GUID(CLSID_SampleThumbnailProvider, + 0x4bbbeab5, + 0xbe00, + 0x41f4, + 0xa2, + 0x9, + 0xfe, + 0x83, + 0x86, + 0x60, + 0xb9, + 0xb1); diff --git a/src/Tools/ThumbnailProvider/Main.cpp b/src/Tools/ThumbnailProvider/Main.cpp index 48dcc8480e..dd5c695fe1 100644 --- a/src/Tools/ThumbnailProvider/Main.cpp +++ b/src/Tools/ThumbnailProvider/Main.cpp @@ -78,8 +78,9 @@ STDAPI_(ULONG) DllAddRef() STDAPI_(ULONG) DllRelease() { LONG cRef = InterlockedDecrement(&g_cRef); - if (0 > cRef) + if (0 > cRef) { cRef = 0; + } return cRef; } @@ -170,8 +171,12 @@ STDAPI CreateRegistryKey(REGKEY_SUBKEY_AND_VALUE* pKey) } if (SUCCEEDED(hr)) { - LSTATUS status = SHSetValue( - pKey->hKey, pKey->lpszSubKey, pKey->lpszValue, pKey->dwType, pvData, (DWORD)cbData); + LSTATUS status = SHSetValue(pKey->hKey, + pKey->lpszSubKey, + pKey->lpszValue, + pKey->dwType, + pvData, + (DWORD)cbData); if (NOERROR != status) { hr = HRESULT_FROM_WIN32(status); } diff --git a/src/Tools/ThumbnailProvider/ThumbnailProvider.cpp b/src/Tools/ThumbnailProvider/ThumbnailProvider.cpp index 56c67706ce..7a48e06a5f 100644 --- a/src/Tools/ThumbnailProvider/ThumbnailProvider.cpp +++ b/src/Tools/ThumbnailProvider/ThumbnailProvider.cpp @@ -48,13 +48,15 @@ IStream* CreateStreamOnResource(void* buffer, size_t length) // allocate memory to hold the resource data HGLOBAL hgblResourceData = GlobalAlloc(GMEM_MOVEABLE, length); - if (hgblResourceData == NULL) + if (hgblResourceData == NULL) { goto Return; + } // get a pointer to the allocated memory LPVOID pvResourceData = GlobalLock(hgblResourceData); - if (pvResourceData == NULL) + if (pvResourceData == NULL) { goto FreeData; + } // copy the data from the resource to the new memory block CopyMemory(pvResourceData, buffer, length); @@ -62,8 +64,9 @@ IStream* CreateStreamOnResource(void* buffer, size_t length) // create a stream on the HGLOBAL containing the data - if (SUCCEEDED(CreateStreamOnHGlobal(hgblResourceData, TRUE, &ipStream))) + if (SUCCEEDED(CreateStreamOnHGlobal(hgblResourceData, TRUE, &ipStream))) { goto Return; + } FreeData: // couldn't create stream; free the memory @@ -86,22 +89,26 @@ IWICBitmapSource* LoadBitmapFromStream(IStream* ipImageStream) NULL, CLSCTX_INPROC_SERVER, __uuidof(ipDecoder), - reinterpret_cast(&ipDecoder)))) + reinterpret_cast(&ipDecoder)))) { goto Return; + } // load the PNG - if (FAILED(ipDecoder->Initialize(ipImageStream, WICDecodeMetadataCacheOnLoad))) + if (FAILED(ipDecoder->Initialize(ipImageStream, WICDecodeMetadataCacheOnLoad))) { goto ReleaseDecoder; + } // check for the presence of the first frame in the bitmap UINT nFrameCount = 0; - if (FAILED(ipDecoder->GetFrameCount(&nFrameCount)) || nFrameCount != 1) + if (FAILED(ipDecoder->GetFrameCount(&nFrameCount)) || nFrameCount != 1) { goto ReleaseDecoder; + } // load the first frame (i.e., the image) IWICBitmapFrameDecode* ipFrame = NULL; - if (FAILED(ipDecoder->GetFrame(0, &ipFrame))) + if (FAILED(ipDecoder->GetFrame(0, &ipFrame))) { goto ReleaseDecoder; + } // convert the image to 32bpp BGRA format with pre-multiplied alpha // (it may not be stored in that format natively in the PNG resource, @@ -123,8 +130,9 @@ HBITMAP CreateHBITMAP(IWICBitmapSource* ipBitmap) // get image attributes and check for valid image UINT width = 0; UINT height = 0; - if (FAILED(ipBitmap->GetSize(&width, &height)) || width == 0 || height == 0) + if (FAILED(ipBitmap->GetSize(&width, &height)) || width == 0 || height == 0) { goto Return; + } // prepare structure giving bitmap information (negative height indicates a top-down DIB) BITMAPINFO bminfo; @@ -141,8 +149,9 @@ HBITMAP CreateHBITMAP(IWICBitmapSource* ipBitmap) HDC hdcScreen = GetDC(NULL); hbmp = CreateDIBSection(hdcScreen, &bminfo, DIB_RGB_COLORS, &pvImageBits, NULL, 0); ReleaseDC(NULL, hdcScreen); - if (hbmp == NULL) + if (hbmp == NULL) { goto Return; + } // extract the image into the HBITMAP @@ -200,8 +209,9 @@ STDMETHODIMP_(ULONG) CThumbnailProvider::AddRef() STDMETHODIMP_(ULONG) CThumbnailProvider::Release() { LONG cRef = InterlockedDecrement(&m_cRef); - if (0 == cRef) + if (0 == cRef) { delete this; + } return (ULONG)cRef; } @@ -224,10 +234,12 @@ bool CThumbnailProvider::CheckZip() const unsigned char pk[4] = {0x50, 0x4b, 0x03, 0x04}; for (int i = 0; i < 4; i++) { unsigned char c; - if (!zip.get((char&)c)) + if (!zip.get((char&)c)) { return false; - if (c != pk[i]) + } + if (c != pk[i]) { return false; + } } return true; @@ -237,15 +249,17 @@ STDMETHODIMP CThumbnailProvider::GetThumbnail(UINT cx, HBITMAP* phbmp, WTS_ALPHA { try { // first make sure we have a zip file but that might still be invalid - if (!CheckZip()) + if (!CheckZip()) { return NOERROR; + } std::ifstream file(m_szFile, std::ios::in | std::ios::binary); zipios::ZipInputStream zipstream(file); zipios::ConstEntryPointer entry; entry = zipstream.getNextEntry(); - while (entry->isValid() && entry->getName() != "thumbnails/Thumbnail.png") + while (entry->isValid() && entry->getName() != "thumbnails/Thumbnail.png") { entry = zipstream.getNextEntry(); + } if (entry && entry->isValid()) { // ok, we have found the file. Now, read it in byte for byte std::istream* str = &zipstream; diff --git a/src/Tools/embedded/Qt/cxx/main.cpp b/src/Tools/embedded/Qt/cxx/main.cpp index 6d128cf9a5..ca2da30e1f 100644 --- a/src/Tools/embedded/Qt/cxx/main.cpp +++ b/src/Tools/embedded/Qt/cxx/main.cpp @@ -28,8 +28,9 @@ void loadFreeCAD() TestFunction test = (TestFunction)freecadPlugin->resolve("FreeCAD_test"); if (test) { QString file = QFileDialog::getOpenFileName(); - if (!file.isEmpty()) + if (!file.isEmpty()) { test(file.toUtf8()); + } } } } diff --git a/src/Tools/embedded/Win32/FreeCAD_widget/FreeCAD_widget.cpp b/src/Tools/embedded/Win32/FreeCAD_widget/FreeCAD_widget.cpp index ef91dfe0d3..9819eba883 100644 --- a/src/Tools/embedded/Win32/FreeCAD_widget/FreeCAD_widget.cpp +++ b/src/Tools/embedded/Win32/FreeCAD_widget/FreeCAD_widget.cpp @@ -244,8 +244,9 @@ void OnLoadFreeCAD(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) std::string path = OnFileOpen(hWnd, message, wParam, lParam); if (!path.empty()) { for (std::string::iterator it = path.begin(); it != path.end(); ++it) { - if (*it == '\\') + if (*it == '\\') { *it = '/'; + } } PyObject* main = PyImport_AddModule("__main__"); PyObject* dict = PyModule_GetDict(main); diff --git a/src/Tools/embedded/glib/main.c b/src/Tools/embedded/glib/main.c index 0bfd1bff75..9d4a5fbfaa 100644 --- a/src/Tools/embedded/glib/main.c +++ b/src/Tools/embedded/glib/main.c @@ -26,8 +26,12 @@ static void helloWorld(GtkWidget* wid, GtkWidget* win) const char* error = PyUnicode_AsUTF8(pystring); GtkWidget* dialog = NULL; - dialog = gtk_message_dialog_new( - GTK_WINDOW(win), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s", error); + dialog = gtk_message_dialog_new(GTK_WINDOW(win), + GTK_DIALOG_MODAL, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "%s", + error); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); diff --git a/src/Tools/plugins/imageformats/svg/main.cpp b/src/Tools/plugins/imageformats/svg/main.cpp index 27952bac9b..bcdd83531b 100644 --- a/src/Tools/plugins/imageformats/svg/main.cpp +++ b/src/Tools/plugins/imageformats/svg/main.cpp @@ -68,14 +68,17 @@ QStringList QSvgPlugin::keys() const QImageIOPlugin::Capabilities QSvgPlugin::capabilities(QIODevice* device, const QByteArray& format) const { - if (format == "svg" || format == "svgz") + if (format == "svg" || format == "svgz") { return Capabilities(CanRead); - if (!format.isEmpty()) + } + if (!format.isEmpty()) { return 0; + } Capabilities cap; - if (device->isReadable() && QSvgIOHandler::canRead(device)) + if (device->isReadable() && QSvgIOHandler::canRead(device)) { cap |= CanRead; + } return cap; } diff --git a/src/Tools/plugins/imageformats/svg/qsvgiohandler.cpp b/src/Tools/plugins/imageformats/svg/qsvgiohandler.cpp index fc9d3788a8..2f1d423065 100644 --- a/src/Tools/plugins/imageformats/svg/qsvgiohandler.cpp +++ b/src/Tools/plugins/imageformats/svg/qsvgiohandler.cpp @@ -61,10 +61,10 @@ class QSvgIOHandlerPrivate { public: QSvgIOHandlerPrivate(QSvgIOHandler* qq) - : q(qq), - loaded(false), - readDone(false), - backColor(Qt::transparent) + : q(qq) + , loaded(false) + , readDone(false) + , backColor(Qt::transparent) { QPalette pal = webView.palette(); pal.setColor(QPalette::Background, backColor); @@ -88,10 +88,12 @@ public: bool QSvgIOHandlerPrivate::load(QIODevice* device) { - if (loaded) + if (loaded) { return true; - if (q->format().isEmpty()) + } + if (q->format().isEmpty()) { q->canRead(); + } // # The SVG renderer doesn't handle trailing, unrelated data, so we must // assume that all available data in the device is to be read. @@ -147,10 +149,12 @@ QSvgIOHandler::~QSvgIOHandler() bool QSvgIOHandler::canRead() const { - if (!device()) + if (!device()) { return false; - if (d->loaded && !d->readDone) + } + if (d->loaded && !d->readDone) { return true;// Will happen if we have been asked for the size + } QByteArray buf = device()->peek(8); if (buf.startsWith("\x1f\x8b")) { diff --git a/src/Tools/plugins/widget/customwidgets.cpp b/src/Tools/plugins/widget/customwidgets.cpp index 3ca351857a..1bdbb61841 100644 --- a/src/Tools/plugins/widget/customwidgets.cpp +++ b/src/Tools/plugins/widget/customwidgets.cpp @@ -53,8 +53,9 @@ UrlLabel::~UrlLabel() void UrlLabel::mouseReleaseEvent(QMouseEvent*) { - QMessageBox::information( - this, "Browser", QString("This starts your browser with url %1").arg(_url)); + QMessageBox::information(this, + "Browser", + QString("This starts your browser with url %1").arg(_url)); } QString UrlLabel::url() const @@ -131,9 +132,9 @@ void LocationWidget::retranslateUi() } FileChooser::FileChooser(QWidget* parent) - : QWidget(parent), - md(File), - _filter(QString()) + : QWidget(parent) + , md(File) + , _filter(QString()) { QHBoxLayout* layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); @@ -175,13 +176,19 @@ void FileChooser::chooseFile() QFileDialog::Options dlgOpt = QFileDialog::DontUseNativeDialog; QString fn; if (mode() == File) { - fn = QFileDialog::getOpenFileName( - this, tr("Select a file"), lineEdit->text(), _filter, 0, dlgOpt); + fn = QFileDialog::getOpenFileName(this, + tr("Select a file"), + lineEdit->text(), + _filter, + 0, + dlgOpt); } else { QFileDialog::Options option = QFileDialog::ShowDirsOnly | dlgOpt; - fn = QFileDialog::getExistingDirectory( - this, tr("Select a directory"), lineEdit->text(), option); + fn = QFileDialog::getExistingDirectory(this, + tr("Select a directory"), + lineEdit->text(), + option); } if (!fn.isEmpty()) { @@ -273,14 +280,18 @@ void AccelLineEdit::keyPressEvent(QKeyEvent* e) int key = e->key(); Qt::KeyboardModifiers state = e->modifiers(); - if (key == Qt::Key_Control) + if (key == Qt::Key_Control) { return; - else if (key == Qt::Key_Shift) + } + else if (key == Qt::Key_Shift) { return; - else if (key == Qt::Key_Alt) + } + else if (key == Qt::Key_Alt) { return; - else if (state == Qt::NoModifier && key == Qt::Key_Backspace) + } + else if (state == Qt::NoModifier && key == Qt::Key_Backspace) { return;// clears the edit field + } switch (state) { case Qt::ControlModifier: { @@ -416,12 +427,12 @@ ActionSelector::~ActionSelector() // -------------------------------------------------------------------- InputField::InputField(QWidget* parent) - : QLineEdit(parent), - Value(0), - Maximum(INT_MAX), - Minimum(-INT_MAX), - StepSize(1.0), - HistorySize(5) + : QLineEdit(parent) + , Value(0) + , Maximum(INT_MAX) + , Minimum(-INT_MAX) + , StepSize(1.0) + , HistorySize(5) {} InputField::~InputField() @@ -547,20 +558,20 @@ int QuantityFormat::defaultDenominator = 8;// for 1/8" QuantityFormat::QuantityFormat() - : option(OmitGroupSeparator | RejectGroupSeparator), - format(Fixed), - precision(4), - denominator(defaultDenominator) + : option(OmitGroupSeparator | RejectGroupSeparator) + , format(Fixed) + , precision(4) + , denominator(defaultDenominator) {} Quantity::Quantity() - : value(0), - unit() + : value(0) + , unit() {} Quantity::Quantity(double v, const Unit& u) - : value(v), - unit(u) + : value(v) + , unit(u) {} Quantity Quantity::parse(const QString& str) @@ -637,12 +648,12 @@ class QuantitySpinBoxPrivate { public: QuantitySpinBoxPrivate() - : validInput(true), - pendingEmit(false), - unitValue(0), - maximum(INT_MAX), - minimum(-INT_MAX), - singleStep(1.0) + : validInput(true) + , pendingEmit(false) + , unitValue(0) + , maximum(INT_MAX) + , minimum(-INT_MAX) + , singleStep(1.0) {} ~QuantitySpinBoxPrivate() {} @@ -652,8 +663,9 @@ public: QString text = t; const int s = text.size(); text = text.trimmed(); - if (pos) + if (pos) { (*pos) -= (s - text.size()); + } return text; } @@ -716,10 +728,12 @@ public: goto end; } else if (copy.at(0) == QLatin1Char('-')) { - if (minus) + if (minus) { state = QValidator::Intermediate; - else + } + else { state = QValidator::Invalid; + } goto end; } break; @@ -768,10 +782,12 @@ public: bool ok = false; double value = min; - if (locale.negativeSign() != QLatin1Char('-')) + if (locale.negativeSign() != QLatin1Char('-')) { copy.replace(locale.negativeSign(), QLatin1Char('-')); - if (locale.positiveSign() != QLatin1Char('+')) + } + if (locale.positiveSign() != QLatin1Char('+')) { copy.replace(locale.positiveSign(), QLatin1Char('+')); + } try { QString copy2 = copy; @@ -842,8 +858,8 @@ public: }// namespace Gui QuantitySpinBox::QuantitySpinBox(QWidget* parent) - : QAbstractSpinBox(parent), - d_ptr(new QuantitySpinBoxPrivate()) + : QAbstractSpinBox(parent) + , d_ptr(new QuantitySpinBoxPrivate()) { d_ptr->locale = locale(); this->setContextMenuPolicy(Qt::DefaultContextMenu); @@ -893,10 +909,12 @@ void QuantitySpinBox::setValue(const Base::Quantity& value) Q_D(QuantitySpinBox); d->quantity = value; // check limits - if (d->quantity.getValue() > d->maximum) + if (d->quantity.getValue() > d->maximum) { d->quantity.setValue(d->maximum); - if (d->quantity.getValue() < d->minimum) + } + if (d->quantity.getValue() < d->minimum) { d->quantity.setValue(d->minimum); + } d->unit = value.getUnit(); @@ -1065,8 +1083,8 @@ void QuantitySpinBox::clearSchema() updateText(d->quantity); } -QString QuantitySpinBox::getUserString(const Base::Quantity& val, double& factor, - QString& unitString) const +QString +QuantitySpinBox::getUserString(const Base::Quantity& val, double& factor, QString& unitString) const { return val.getUserString(factor, unitString); } @@ -1079,10 +1097,12 @@ QString QuantitySpinBox::getUserString(const Base::Quantity& val) const QAbstractSpinBox::StepEnabled QuantitySpinBox::stepEnabled() const { Q_D(const QuantitySpinBox); - if (isReadOnly() /* || !d->validInput*/) + if (isReadOnly() /* || !d->validInput*/) { return StepNone; - if (wrapping()) + } + if (wrapping()) { return StepEnabled(StepUpEnabled | StepDownEnabled); + } StepEnabled ret = StepNone; if (d->quantity.getValue() < d->maximum) { ret |= StepUpEnabled; @@ -1100,10 +1120,12 @@ void QuantitySpinBox::stepBy(int steps) double step = d->singleStep * steps; double val = d->unitValue + step; - if (val > d->maximum) + if (val > d->maximum) { val = d->maximum; - else if (val < d->minimum) + } + else if (val < d->minimum) { val = d->minimum; + } lineEdit()->setText(QString::fromUtf8("%L1 %2").arg(val).arg(d->unitStr)); updateFromCache(true); @@ -1179,8 +1201,9 @@ void QuantitySpinBox::showEvent(QShowEvent* event) bool selected = lineEdit()->hasSelectedText(); updateText(d->quantity); - if (selected) + if (selected) { selectNumber(); + } } void QuantitySpinBox::hideEvent(QHideEvent* event) @@ -1229,8 +1252,9 @@ void QuantitySpinBox::focusInEvent(QFocusEvent* event) if (event->reason() == Qt::TabFocusReason || event->reason() == Qt::BacktabFocusReason || event->reason() == Qt::ShortcutFocusReason) { - if (!hasSel) + if (!hasSel) { selectNumber(); + } } } @@ -1390,8 +1414,9 @@ void CommandIconView::startDrag(Qt::DropActions /*supportedActions*/) QPixmap pixmap; dataStream << items.count(); for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) { - if (it == items.begin()) + if (it == items.begin()) { pixmap = ((*it)->data(Qt::UserRole)).value(); + } dataStream << (*it)->text(); } @@ -1407,8 +1432,9 @@ void CommandIconView::startDrag(Qt::DropActions /*supportedActions*/) void CommandIconView::onSelectionChanged(QListWidgetItem* item, QListWidgetItem*) { - if (item) + if (item) { emitSelectionChanged(item->toolTip()); + } } // ------------------------------------------------------------------------------ @@ -1462,20 +1488,25 @@ UnsignedValidator::~UnsignedValidator() QValidator::State UnsignedValidator::validate(QString& input, int&) const { QString stripped;// = input.stripWhiteSpace(); - if (stripped.isEmpty()) + if (stripped.isEmpty()) { return Intermediate; + } bool ok; uint entered = input.toUInt(&ok); - if (!ok) + if (!ok) { return Invalid; - else if (entered < b) + } + else if (entered < b) { return Intermediate; - else if (entered > t) + } + else if (entered > t) { return Invalid; + } // else if ( entered < b || entered > t ) // return Invalid; - else + else { return Acceptable; + } } void UnsignedValidator::setRange(uint minimum, uint maximum) @@ -1600,8 +1631,9 @@ uint UIntSpinBox::minimum() const void UIntSpinBox::setMinimum(uint minVal) { uint maxVal = maximum(); - if (maxVal < minVal) + if (maxVal < minVal) { maxVal = minVal; + } setRange(minVal, maxVal); } @@ -1613,8 +1645,9 @@ uint UIntSpinBox::maximum() const void UIntSpinBox::setMaximum(uint maxVal) { uint minVal = minimum(); - if (minVal > maxVal) + if (minVal > maxVal) { minVal = maxVal; + } setRange(minVal, maxVal); } @@ -1723,10 +1756,10 @@ void PrefDoubleSpinBox::setParamGrpPath(const QByteArray& name) // ------------------------------------------------------------- ColorButton::ColorButton(QWidget* parent) - : QPushButton(parent), - _allowChange(true), - _allowTransparency(false), - _drawFrame(true) + : QPushButton(parent) + , _allowChange(true) + , _allowTransparency(false) + , _drawFrame(true) { _col = palette().color(QPalette::Active, QPalette::Midlight); connect(this, &ColorButton::clicked, this, &ColorButton::onChooseColor); @@ -1811,8 +1844,9 @@ void ColorButton::paintEvent(QPaintEvent* e) void ColorButton::onChooseColor() { - if (!_allowChange) + if (!_allowChange) { return; + } QColor c = QColorDialog::getColor(_col, this); if (c.isValid()) { setColor(c); diff --git a/src/Tools/plugins/widget/customwidgets.h b/src/Tools/plugins/widget/customwidgets.h index 11ea06ce2f..7177232ae3 100644 --- a/src/Tools/plugins/widget/customwidgets.h +++ b/src/Tools/plugins/widget/customwidgets.h @@ -117,8 +117,9 @@ struct QuantityFormat } static inline NumberFormat toFormat(char c, bool* ok = 0) { - if (ok) + if (ok) { *ok = true; + } switch (c) { case 'f': return Fixed; @@ -127,8 +128,9 @@ struct QuantityFormat case 'g': return Default; default: - if (ok) + if (ok) { *ok = false; + } return Default; } } diff --git a/src/Tools/plugins/widget/wizard.cpp b/src/Tools/plugins/widget/wizard.cpp index e9cc2f3297..3a51e4b6ba 100644 --- a/src/Tools/plugins/widget/wizard.cpp +++ b/src/Tools/plugins/widget/wizard.cpp @@ -110,8 +110,9 @@ void Wizard::insertPage(int index, QWidget* page) page->setWindowTitle(title); } - if (currentIndex() == index) + if (currentIndex() == index) { textLabel->setText(title); + } int current = currentIndex(); _backButton->setEnabled(current > 0); @@ -121,15 +122,17 @@ void Wizard::insertPage(int index, QWidget* page) void Wizard::backButtonClicked() { int index = currentIndex(); - if (index > 0) + if (index > 0) { setCurrentIndex(index - 1); + } } void Wizard::nextButtonClicked() { int index = currentIndex(); - if (index < count() - 1) + if (index < count() - 1) { setCurrentIndex(index + 1); + } } QPushButton* Wizard::backButton() const @@ -215,8 +218,8 @@ WizardExtensionFactory::WizardExtensionFactory(QExtensionManager* parent) : QExtensionFactory(parent) {} -QObject* WizardExtensionFactory::createExtension(QObject* object, const QString& iid, - QObject* parent) const +QObject* +WizardExtensionFactory::createExtension(QObject* object, const QString& iid, QObject* parent) const { Wizard* widget = qobject_cast(object);