From 59270a79e11c241c75454656189dea5165bcf8b3 Mon Sep 17 00:00:00 2001 From: Dongxu Li Date: Sun, 5 May 2024 15:58:55 -0400 Subject: [PATCH] Compiler warnings --- libraries/libdxfrw/src/drw_header.cpp | 2 +- .../src/actions/lc_actionmodifylinejoin.cpp | 8 +-- librecad/src/actions/rs_actiondefault.cpp | 3 - librecad/src/lib/engine/rs_hatch.cpp | 2 +- librecad/src/lib/engine/rs_system.cpp | 16 ++--- .../ui/forms/lc_layertreeoptionsdialog.cpp | 3 +- librecad/src/ui/lc_filedialogservice.cpp | 2 +- librecad/src/ui/lc_layertreeview.cpp | 18 +++-- librecad/src/ui/lc_layertreewidget.cpp | 67 +++++++++---------- .../src/ui/lc_penpaletteoptionsdialog.cpp | 3 +- librecad/src/ui/lc_penpalettewidget.cpp | 4 +- librecad/src/ui/qg_colorbox.cpp | 2 +- librecad/src/ui/qg_filedialog.cpp | 2 +- librecad/src/ui/qg_pentoolbar.cpp | 3 +- 14 files changed, 63 insertions(+), 72 deletions(-) diff --git a/libraries/libdxfrw/src/drw_header.cpp b/libraries/libdxfrw/src/drw_header.cpp index 9c73d7d180..b898dfab71 100644 --- a/libraries/libdxfrw/src/drw_header.cpp +++ b/libraries/libdxfrw/src/drw_header.cpp @@ -2404,7 +2404,7 @@ bool DRW_Header::parseDwg(DRW::Version version, dwgBuffer *buf, dwgBuffer *hBbuf } //temporary code to show header end sentinel - duint64 sz= buf->size()-1; + duint64 sz= 0; //buf->size()-1; if (version < DRW::AC1018) {//pre 2004 sz= buf->size()-16; buf->setPosition(sz); diff --git a/librecad/src/actions/lc_actionmodifylinejoin.cpp b/librecad/src/actions/lc_actionmodifylinejoin.cpp index b916d20a44..0319d58c07 100644 --- a/librecad/src/actions/lc_actionmodifylinejoin.cpp +++ b/librecad/src/actions/lc_actionmodifylinejoin.cpp @@ -69,7 +69,7 @@ void LC_ActionModifyLineJoin::doPreparePreviewEntities(QMouseEvent *e, [[maybe_u } if (snappedLine != nullptr){ // here we do not relay on snap point, simply get coordinates from even - RS_Vector coord = graphicView->toGraph(e->x(), e->y()); + RS_Vector coord = graphicView->toGraph(e->position()); LC_LineJoinData *lineJoinData = createLineJoinData(snappedLine, coord); if (lineJoinData != nullptr){ RS_Polyline *polyline = lineJoinData->polyline; @@ -93,7 +93,7 @@ void LC_ActionModifyLineJoin::doPreparePreviewEntities(QMouseEvent *e, [[maybe_u if (snappedLine != nullptr){ // retrieve current mouse position and recalculate line join data considering that mose position denotes part of line 1 that // will survive trim operation - RS_Vector coord = graphicView->toGraph(e->x(), e->y()); + RS_Vector coord = graphicView->toGraph(e->position()); updateLine1TrimData(coord); RS_Polyline *polyline = linesJoinData->polyline; @@ -126,7 +126,7 @@ void LC_ActionModifyLineJoin::doOnLeftMouseButtonRelease(QMouseEvent *e, int sta } if (snappedLine != nullptr){ line2 = snappedLine; - RS_Vector snap = graphicView->toGraph(e->x(), e->y()); + RS_Vector snap = graphicView->toGraph(e->position()); LC_LineJoinData *joinData = createLineJoinData(snappedLine, snap); if (joinData != nullptr){ // check whether parallel lines were selected @@ -173,7 +173,7 @@ void LC_ActionModifyLineJoin::doOnLeftMouseButtonRelease(QMouseEvent *e, int sta case ResolveFirstLineTrim: if (snappedLine == line1){ // we need trim hint on the first line - RS_Vector snap = graphicView->toGraph(e->x(), e->y()); + RS_Vector snap = graphicView->toGraph(e->position()); // update trim data according to selected part of line 1 updateLine1TrimData(snap); // check if polyline is built and if it so - trigger action diff --git a/librecad/src/actions/rs_actiondefault.cpp b/librecad/src/actions/rs_actiondefault.cpp index b323c9ecc3..f26bd2ab00 100644 --- a/librecad/src/actions/rs_actiondefault.cpp +++ b/librecad/src/actions/rs_actiondefault.cpp @@ -64,9 +64,6 @@ constexpr double minimumHoverTolerance = 3.0; constexpr double hoverToleranceFactor1 = 1.0; constexpr double hoverToleranceFactor2 = 10.0; -constexpr unsigned minHighLightDuplicates = 4; -constexpr unsigned maxHighLightDuplicates = 20; - // whether the entity supports glowing effects on mouse hovering bool allowMouseOverGlowing(const RS_Entity* entity) { diff --git a/librecad/src/lib/engine/rs_hatch.cpp b/librecad/src/lib/engine/rs_hatch.cpp index 073d73f46c..4a983cb12c 100644 --- a/librecad/src/lib/engine/rs_hatch.cpp +++ b/librecad/src/lib/engine/rs_hatch.cpp @@ -240,7 +240,7 @@ void RS_Hatch::update() { std::unique_ptr pat = RS_PATTERNLIST->requestPattern(data.pattern); if (pat == nullptr) { updateRunning = false; - RS_DEBUG->print(RS_Debug::D_ERROR, "RS_Hatch::update: requesting pattern: %s not found", data.pattern.toStdString().c_str()); + RS_DEBUG->print(RS_Debug::D_ERROR, "RS_Hatch::update: requesting pattern: %s not found", data.pattern.toUtf8().constData()); updateError = HATCH_PATTERN_NOT_FOUND; return; } else { diff --git a/librecad/src/lib/engine/rs_system.cpp b/librecad/src/lib/engine/rs_system.cpp index 74b56e90cf..87a29fde81 100644 --- a/librecad/src/lib/engine/rs_system.cpp +++ b/librecad/src/lib/engine/rs_system.cpp @@ -64,13 +64,13 @@ void RS_System::init(const QString& appName, // in AppImage QCoreApplication::applicationDirPath() directs to /lib64 of mounted AppImage // thus use argv[0] to extract the correct path to librecad executable appDir = QFileInfo( QFile::decodeName( arg0)).absoluteFilePath(); - RS_DEBUG->print("%s\n", (QString("arg0:")+ QString(arg0)).toStdString().c_str()); - RS_DEBUG->print("%s\n", (QString("appDir:")+ appDir).toStdString().c_str()); + RS_DEBUG->print("%s\n", (QString("arg0:")+ QString(arg0)).toUtf8().constData()); + RS_DEBUG->print("%s\n", (QString("appDir:")+ appDir).toUtf8().constData()); } else { // in regular application QCoreApplication::applicationDirPath() is preferred, see GitHub #1488 appDir = QCoreApplication::applicationDirPath(); - RS_DEBUG->print("%s\n", (QString("appDir2:")+ appDir).toStdString().c_str()); + RS_DEBUG->print("%s\n", (QString("appDir2:")+ appDir).toUtf8().constData()); } // when appDir is not HOME or CURRENT dir, search appDir too in getDirectoryList() @@ -529,7 +529,7 @@ QString RS_System::getAppDataDir() { if (!dir.mkpath( appData)) return QString(); } - RS_DEBUG->print("%s\n", (QString("appData: ") + appData).toStdString().c_str()); + RS_DEBUG->print("%s\n", (QString("appData: ") + appData).toUtf8().constData()); return appData; } @@ -599,7 +599,7 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) { } } - RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3").arg(__func__).arg(__LINE__).arg(appDir).toStdString().c_str()); + RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3").arg(__func__).arg(__LINE__).arg(appDir).toUtf8().constData()); #if (defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_UNIX)) // for AppImage use relative paths from executable @@ -620,7 +620,7 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) { #endif for (auto& dir: dirList) { - RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3\n").arg(__func__).arg(__LINE__).arg(dir).toStdString().c_str()); + RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3\n").arg(__func__).arg(__LINE__).arg(dir).toUtf8().constData()); } #ifdef Q_OS_MAC @@ -645,7 +645,7 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) { #endif if (subDirectory == "fonts") { QString savedFonts = RS_SETTINGS->readEntry( "/Fonts", ""); - RS_DEBUG->print("saved fonts: %s\n", savedFonts.toStdString().c_str()); + RS_DEBUG->print("saved fonts: %s\n", savedFonts.toUtf8().constData()); dirList += (RS_SETTINGS->readEntry( "/Fonts", "")).split( QRegularExpression("[;]"), option); } @@ -682,7 +682,7 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) { for (auto& dir: ret) { - RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3").arg(__func__).arg(__LINE__).arg(dir).toStdString().c_str()); + RS_DEBUG->print("%s\n", QString("%1(): line %2: dir=%3").arg(__func__).arg(__LINE__).arg(dir).toUtf8().constData()); } return ret; diff --git a/librecad/src/ui/forms/lc_layertreeoptionsdialog.cpp b/librecad/src/ui/forms/lc_layertreeoptionsdialog.cpp index 0f264bc4d2..5666a97ce8 100644 --- a/librecad/src/ui/forms/lc_layertreeoptionsdialog.cpp +++ b/librecad/src/ui/forms/lc_layertreeoptionsdialog.cpp @@ -152,8 +152,7 @@ void LC_LayerTreeOptionsDialog::validate(){ if (layerListSeparator.isEmpty()){ QMessageBox::warning(this, QMessageBox::tr("Error"), QMessageBox::tr("Layer list separator string is empty. It will not be possible to build layers tree.\n" - "Please specify a different value."), - QMessageBox::Ok); + "Please specify a different value.")); leLayerLevelSeparator -> setFocus(); doAccept = false; } diff --git a/librecad/src/ui/lc_filedialogservice.cpp b/librecad/src/ui/lc_filedialogservice.cpp index 2e52ed16bd..a55dbb0f6e 100644 --- a/librecad/src/ui/lc_filedialogservice.cpp +++ b/librecad/src/ui/lc_filedialogservice.cpp @@ -84,7 +84,7 @@ QList filtersTypeList = Number of values pertaining to the open file dialog mode, as defined in one of the relevant lists below. */ -const int numberOf_openFileModes = 0; +[[maybe_unused]] const int numberOf_openFileModes = 0; const QStringList filterSettingsPaths = { diff --git a/librecad/src/ui/lc_layertreeview.cpp b/librecad/src/ui/lc_layertreeview.cpp index 75d472d72f..1e8555afe3 100644 --- a/librecad/src/ui/lc_layertreeview.cpp +++ b/librecad/src/ui/lc_layertreeview.cpp @@ -57,8 +57,8 @@ void LC_LayerTreeView::dragEnterEvent(QDragEnterEvent *event) { return; } - QModelIndex dropIndex = indexAt(event->pos()); - auto* widget = (LC_LayerTreeWidget*)parentWidget(); + QModelIndex dropIndex = indexAt(event->position().toPoint()); + auto* widget = dynamic_cast(parentWidget()); if( !dropIndex.isValid() ) return; widget->onDragEnterEvent(dropIndex); @@ -74,10 +74,8 @@ void LC_LayerTreeView::dragEnterEvent(QDragEnterEvent *event) { } event->accept(); - QModelIndex dropIndex = indexAt(event->pos()); - - auto* widget = (LC_LayerTreeWidget*)parentWidget(); - + QModelIndex dropIndex = indexAt(event->position().toPoint()); + auto* widget = dynamic_cast(parentWidget()); if (!widget){ return; } @@ -130,11 +128,11 @@ void LC_LayerTreeView::dragEnterEvent(QDragEnterEvent *event) { QStringList LC_LayerTreeView::saveTreeExpansionState(){ QStringList treeExpansionState; LC_LayerTreeModel *layerTreeModel = getTreeModel(); - foreach (QModelIndex index, layerTreeModel->getPersistentIndexList()) { - if (this->isExpanded(index)){ - treeExpansionState << index.data(Qt::UserRole).toString(); - } + foreach (QModelIndex index, layerTreeModel->getPersistentIndexList()) { + if (this->isExpanded(index)){ + treeExpansionState << index.data(Qt::UserRole).toString(); } + } return treeExpansionState; } diff --git a/librecad/src/ui/lc_layertreewidget.cpp b/librecad/src/ui/lc_layertreewidget.cpp index c6ee2e2f3d..d4af06e69a 100644 --- a/librecad/src/ui/lc_layertreewidget.cpp +++ b/librecad/src/ui/lc_layertreewidget.cpp @@ -669,21 +669,21 @@ void LC_LayerTreeWidget::onCustomContextMenu(const QPoint &point){ contextMenu->setTitle(title); if (isVirtual){ - contextMenu->addAction(tr("&Add Child Layer"), this, &LC_LayerTreeWidget::addChildLayerForSelectedItem, 0); - contextMenu->addAction(tr("&Rename"), this, &LC_LayerTreeWidget::renameVirtualLayer, 0); - contextMenu->addAction(tr("&Remove Layers (Sub-Tree)"), this, &LC_LayerTreeWidget::removeLayersForSelectedItem, 0); + contextMenu->addAction(tr("&Add Child Layer"), this, &LC_LayerTreeWidget::addChildLayerForSelectedItem); + contextMenu->addAction(tr("&Rename"), this, &LC_LayerTreeWidget::renameVirtualLayer); + contextMenu->addAction(tr("&Remove Layers (Sub-Tree)"), this, &LC_LayerTreeWidget::removeLayersForSelectedItem); contextMenu->addSeparator(); - contextMenu->addAction(tr("&Copy Structure (Sub-Tree)"), this, &LC_LayerTreeWidget::createLayerCopy, 0); - contextMenu->addAction(tr("&Duplicate Content (Sub-Tree)"), this, &LC_LayerTreeWidget::createLayerDuplicate, 0); + contextMenu->addAction(tr("&Copy Structure (Sub-Tree)"), this, &LC_LayerTreeWidget::createLayerCopy); + contextMenu->addAction(tr("&Duplicate Content (Sub-Tree)"), this, &LC_LayerTreeWidget::createLayerDuplicate); // TODO - should we take care of virtual layer's visibility somehow? - contextMenu->addAction(tr("&Select Entities (Sub-Tree)"), this, &LC_LayerTreeWidget::selectLayersEntities, 0); + contextMenu->addAction(tr("&Select Entities (Sub-Tree)"), this, &LC_LayerTreeWidget::selectLayersEntities); } else { bool NON_ZERO_LAYER = !layerItem->isZero(); - contextMenu->addAction(tr("&Edit Layer &Attributes"), this, &LC_LayerTreeWidget::editSelectedLayer, 0); + contextMenu->addAction(tr("&Edit Layer &Attributes"), this, &LC_LayerTreeWidget::editSelectedLayer); if (NON_ZERO_LAYER){ - contextMenu->addAction(tr("&Remove Layer"), this, &LC_LayerTreeWidget::removeLayersForSelectedItem, 0); + contextMenu->addAction(tr("&Remove Layer"), this, &LC_LayerTreeWidget::removeLayersForSelectedItem); } contextMenu->addSeparator(); @@ -692,21 +692,21 @@ void LC_LayerTreeWidget::onCustomContextMenu(const QPoint &point){ bool hasItems = false; if (!layerItem->hasChildOfType(LC_LayerTreeItem::DIMENSIONAL)){ - contextMenu->addAction(tr("&Add Dimensions Sub-Layer"), this, &LC_LayerTreeWidget::addDimensionalLayerForSelectedItem, 0); + contextMenu->addAction(tr("&Add Dimensions Sub-Layer"), this, &LC_LayerTreeWidget::addDimensionalLayerForSelectedItem); hasItems = true; } if (!layerItem->hasChildOfType(LC_LayerTreeItem::INFORMATIONAL)){ - contextMenu->addAction(tr("&Add Info Sub-Layer"), this, &LC_LayerTreeWidget::addInformationalLayerForSelectedItem, 0); + contextMenu->addAction(tr("&Add Info Sub-Layer"), this, &LC_LayerTreeWidget::addInformationalLayerForSelectedItem); hasItems = true; } if (!layerItem->hasChildOfType(LC_LayerTreeItem::ALTERNATE_POSITION)){ contextMenu->addAction(tr("&Add Alternative View Sub-Layer"), this, - &LC_LayerTreeWidget::addAddAlternativePositionLayerForSelectedItem, 0); + &LC_LayerTreeWidget::addAddAlternativePositionLayerForSelectedItem); hasItems = true; } if (!flatListMode){ if (layerItem->childCount() > 0){ - contextMenu->addAction(tr("&Remove Sub-layers"), this, &LC_LayerTreeWidget::removeChildLayersForSelected, 0); + contextMenu->addAction(tr("&Remove Sub-layers"), this, &LC_LayerTreeWidget::removeChildLayersForSelected); hasItems = true; } } @@ -714,56 +714,55 @@ void LC_LayerTreeWidget::onCustomContextMenu(const QPoint &point){ contextMenu->addSeparator(); } if (layerItem->childCount() == 0){ - contextMenu->addAction(tr("Convert to Dimensional Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToDimensional, 0); - contextMenu->addAction(tr("Convert to Info Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToInformational, 0); - contextMenu->addAction(tr("Convert to Alternative Position Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToAlternativePosition, - 0); + contextMenu->addAction(tr("Convert to Dimensional Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToDimensional); + contextMenu->addAction(tr("Convert to Info Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToInformational); + contextMenu->addAction(tr("Convert to Alternative Position Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToAlternativePosition); contextMenu->addSeparator(); } } } else { - contextMenu->addAction(tr("Convert to Normal Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToNormal, 0); + contextMenu->addAction(tr("Convert to Normal Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToNormal); if (layerType != LC_LayerTreeItem::DIMENSIONAL){ - contextMenu->addAction(tr("Convert to Dimensional Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToDimensional, 0); + contextMenu->addAction(tr("Convert to Dimensional Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToDimensional); } if (layerType != LC_LayerTreeItem::INFORMATIONAL){ - contextMenu->addAction(tr("Convert to Info Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToInformational, 0); + contextMenu->addAction(tr("Convert to Info Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToInformational); } if (layerType != LC_LayerTreeItem::ALTERNATE_POSITION){ - contextMenu->addAction(tr("Convert to Alternative Position Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToAlternativePosition, 0); + contextMenu->addAction(tr("Convert to Alternative Position Layer"), this, &LC_LayerTreeWidget::convertLayerTypeToAlternativePosition); } contextMenu->addSeparator(); } if (layerItem->isVisible() && !layerItem->isLocked()){ - contextMenu->addAction(tr("&Select Layer's Entities"), this, &LC_LayerTreeWidget::selectLayersEntities, 0); + contextMenu->addAction(tr("&Select Layer's Entities"), this, &LC_LayerTreeWidget::selectLayersEntities); } contextMenu->addSeparator(); - contextMenu->addAction(tr("&Create Layer Copy"), this, &LC_LayerTreeWidget::createLayerCopy, 0); - contextMenu->addAction(tr("&Duplicate Layer With Content"), this, &LC_LayerTreeWidget::createLayerDuplicate, 0); + contextMenu->addAction(tr("&Create Layer Copy"), this, &LC_LayerTreeWidget::createLayerCopy); + contextMenu->addAction(tr("&Duplicate Layer With Content"), this, &LC_LayerTreeWidget::createLayerDuplicate); contextMenu->addSeparator(); if (!layerItem->isLocked()){ - contextMenu->addAction(tr("Move Selection to Layer"), this, &LC_LayerTreeWidget::moveSelectionToLayer, 0); - contextMenu->addAction(tr("Duplicate Selection to Layer"), this, &LC_LayerTreeWidget::duplicateSelectionToLayer, 0); + contextMenu->addAction(tr("Move Selection to Layer"), this, &LC_LayerTreeWidget::moveSelectionToLayer); + contextMenu->addAction(tr("Duplicate Selection to Layer"), this, &LC_LayerTreeWidget::duplicateSelectionToLayer); contextMenu->addSeparator(); } } contextMenu->addSeparator(); } else { // click is not on item - contextMenu->addAction(tr("&Add Layer"), this, &LC_LayerTreeWidget::addLayer, 0); + contextMenu->addAction(tr("&Add Layer"), this, &LC_LayerTreeWidget::addLayer); } - contextMenu->addAction(tr("&Freeze Others Layers"), this, &LC_LayerTreeWidget::hideOtherThanSelectedLayers, 0); - contextMenu->addAction(tr("&Defreeze All Layers"), this, &LC_LayerTreeWidget::showAllLayers, 0); - contextMenu->addAction(tr("&Freeze All Layers"), this, &LC_LayerTreeWidget::hideAllLayers, 0); - contextMenu->addAction(tr("&Unlock All Layers"), this, &LC_LayerTreeWidget::unlockAllLayers, 0); - contextMenu->addAction(tr("&Lock All Layers"), this, &LC_LayerTreeWidget::lockAllLayers, 0); - contextMenu->addAction(tr("Enable &Printing All Layers"), this, &LC_LayerTreeWidget::printAllLayers, 0); - contextMenu->addAction(tr("&Disable Printing All Layers"), this, &LC_LayerTreeWidget::noPrintAllLayers, 0); + contextMenu->addAction(tr("&Freeze Others Layers"), this, &LC_LayerTreeWidget::hideOtherThanSelectedLayers); + contextMenu->addAction(tr("&Defreeze All Layers"), this, &LC_LayerTreeWidget::showAllLayers); + contextMenu->addAction(tr("&Freeze All Layers"), this, &LC_LayerTreeWidget::hideAllLayers); + contextMenu->addAction(tr("&Unlock All Layers"), this, &LC_LayerTreeWidget::unlockAllLayers); + contextMenu->addAction(tr("&Lock All Layers"), this, &LC_LayerTreeWidget::lockAllLayers); + contextMenu->addAction(tr("Enable &Printing All Layers"), this, &LC_LayerTreeWidget::printAllLayers); + contextMenu->addAction(tr("&Disable Printing All Layers"), this, &LC_LayerTreeWidget::noPrintAllLayers); contextMenu->addSeparator(); - contextMenu->addAction(tr("&Find And Remove Empty Layers"), this, &LC_LayerTreeWidget::removeEmptyLayers, 0); + contextMenu->addAction(tr("&Find And Remove Empty Layers"), this, &LC_LayerTreeWidget::removeEmptyLayers); /// TODO - check whether these action is needed. Actually, it is possible to support them, // yet it is necessary to refactor these actions for proper selection of layer diff --git a/librecad/src/ui/lc_penpaletteoptionsdialog.cpp b/librecad/src/ui/lc_penpaletteoptionsdialog.cpp index 5bedb71941..ab5c09946e 100644 --- a/librecad/src/ui/lc_penpaletteoptionsdialog.cpp +++ b/librecad/src/ui/lc_penpaletteoptionsdialog.cpp @@ -126,8 +126,7 @@ void LC_PenPaletteOptionsDialog::selectMatchedItemColor(){ */ void LC_PenPaletteOptionsDialog::set_color(QComboBox* combo, QColor &custom) { - QColor current; - current.setNamedColor(combo->lineEdit()->text()); + auto current = QColor::fromString(combo->lineEdit()->text()); QColorDialog::setCustomColor(0, custom.rgb()); diff --git a/librecad/src/ui/lc_penpalettewidget.cpp b/librecad/src/ui/lc_penpalettewidget.cpp index 238f7636bc..63b562903b 100644 --- a/librecad/src/ui/lc_penpalettewidget.cpp +++ b/librecad/src/ui/lc_penpalettewidget.cpp @@ -411,9 +411,7 @@ void LC_PenPaletteWidget::invokeOptionsDialog(bool focusOnFile){ QMessageBox::warning( this, tr("Pen palette"), tr("Location of pens file is changed, please restart the application so new pens file will be used.\n\n" "Please note that if you'll save pen via editor without restart, current pens from palette will be saved " - "in the new file and therefore existing content of it will be overridden."), - QMessageBox::Ok, - Qt::NoButton); + "in the new file and therefore existing content of it will be overridden.")); } } } diff --git a/librecad/src/ui/qg_colorbox.cpp b/librecad/src/ui/qg_colorbox.cpp index 11f5597c39..19bed40c38 100644 --- a/librecad/src/ui/qg_colorbox.cpp +++ b/librecad/src/ui/qg_colorbox.cpp @@ -334,7 +334,7 @@ void QG_ColorBox::slotColorChanged(int index) { if(index < count() ) { QVariant q0=itemData(index); - if(q0 != QVariant::Invalid ) + if(q0.isValid()) { *currentColor=itemData(index).value(); } diff --git a/librecad/src/ui/qg_filedialog.cpp b/librecad/src/ui/qg_filedialog.cpp index 14ab15143a..72e2b3a341 100644 --- a/librecad/src/ui/qg_filedialog.cpp +++ b/librecad/src/ui/qg_filedialog.cpp @@ -257,7 +257,7 @@ QString QG_FileDialog::getSaveFile(RS2::FormatType* type){ *type = ftype; // append default extension: - if (!fi.fileName().endsWith(".dxf",Qt::CaseInsensitive)) + if (!fi.fileName().endsWith(".dxf",Qt::CaseInsensitive)) fn += getExtension(ftype); // store new default settings: diff --git a/librecad/src/ui/qg_pentoolbar.cpp b/librecad/src/ui/qg_pentoolbar.cpp index 2d3a76adc9..b4bdd0100f 100644 --- a/librecad/src/ui/qg_pentoolbar.cpp +++ b/librecad/src/ui/qg_pentoolbar.cpp @@ -144,7 +144,8 @@ RS_Pen QG_PenToolBar::getPen() const { * Called by the layer list (if this object was previously * added as a listener to a layer list). */ -void QG_PenToolBar::layerEdited(RS_Layer*) {} +void QG_PenToolBar::layerEdited(RS_Layer*) +{} /**