[TD]fix default line width on empty config
This commit is contained in:
@@ -100,7 +100,9 @@ void DlgPrefsTechDrawAnnotationImp::saveSettings()
|
||||
|
||||
// don't save invalid parameter values
|
||||
// the comboboxes are properly loaded.
|
||||
ui->pcbLineGroup->onSave();
|
||||
if (ui->pcbLineGroup->currentIndex() >= 0) {
|
||||
ui->pcbLineGroup->onSave();
|
||||
}
|
||||
if (ui->pcbLineStandard->currentIndex() >= 0) {
|
||||
ui->pcbLineStandard->onSave();
|
||||
}
|
||||
@@ -134,27 +136,13 @@ void DlgPrefsTechDrawAnnotationImp::loadSettings()
|
||||
// QAbstractSpinBox
|
||||
double kinkDefault = 5.0;
|
||||
ui->pdsbBalloonKink->setValue(kinkDefault);
|
||||
// re-read the available LineGroup files
|
||||
ui->pcbLineGroup->clear();
|
||||
std::string lgFileName = Preferences::lineGroupFile();
|
||||
std::string lgRecord = LineGroup::getGroupNamesFromFile(lgFileName);
|
||||
// split collected groups
|
||||
std::stringstream ss(lgRecord);
|
||||
std::vector<std::string> lgNames;
|
||||
while (std::getline(ss, lgRecord, ',')) {
|
||||
lgNames.push_back(lgRecord);
|
||||
}
|
||||
// fill the combobox with the found names
|
||||
for (auto it = lgNames.begin(); it < lgNames.end(); ++it) {
|
||||
ui->pcbLineGroup->addItem(tr((*it).c_str()));
|
||||
}
|
||||
|
||||
ui->cbAutoHoriz->onRestore();
|
||||
ui->cbPrintCenterMarks->onRestore();
|
||||
ui->cbPyramidOrtho->onRestore();
|
||||
ui->cbComplexMarks->onRestore();
|
||||
ui->cbShowCenterMarks->onRestore();
|
||||
ui->pcbLineGroup->onRestore();
|
||||
|
||||
ui->pdsbBalloonKink->onRestore();
|
||||
ui->cbCutSurface->onRestore();
|
||||
ui->pcbDetailMatting->onRestore();
|
||||
@@ -163,6 +151,10 @@ void DlgPrefsTechDrawAnnotationImp::loadSettings()
|
||||
ui->cb_ShowSectionLine->onRestore();
|
||||
ui->cb_IncludeCutLine->onRestore();
|
||||
|
||||
ui->pcbLineGroup->onRestore();
|
||||
DrawGuiUtil::loadLineGroupChoices(ui->pcbLineGroup);
|
||||
ui->pcbLineGroup->setCurrentIndex(Preferences::lineGroup());
|
||||
|
||||
ui->pcbMatting->onRestore();
|
||||
DrawGuiUtil::loadMattingStyleBox(ui->pcbMatting);
|
||||
ui->pcbMatting->setCurrentIndex(prefMattingStyle());
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
#include <Mod/TechDraw/App/DrawUtil.h>
|
||||
#include <Mod/TechDraw/App/DrawViewPart.h>
|
||||
#include <Mod/TechDraw/App/LineGenerator.h>
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
#include <Mod/TechDraw/App/Preferences.h>
|
||||
|
||||
#include "DlgPageChooser.h"
|
||||
@@ -190,6 +191,23 @@ void DrawGuiUtil::loadLineStyleChoices(QComboBox* combo, LineGenerator* generato
|
||||
}
|
||||
}
|
||||
|
||||
void DrawGuiUtil::loadLineGroupChoices(QComboBox* combo)
|
||||
{
|
||||
combo->clear();
|
||||
std::string lgFileName = Preferences::lineGroupFile();
|
||||
std::string lgRecord = LineGroup::getGroupNamesFromFile(lgFileName);
|
||||
// split collected groups
|
||||
std::stringstream ss(lgRecord);
|
||||
std::vector<QString> lgNames;
|
||||
while (std::getline(ss, lgRecord, ',')) {
|
||||
lgNames.push_back(Base::Tools::fromStdString(lgRecord));
|
||||
}
|
||||
// fill the combobox with the found names
|
||||
for (auto& name : lgNames) {
|
||||
combo->addItem(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! make an icon that shows a sample of lineNumber in the current line standard
|
||||
QIcon DrawGuiUtil::iconForLine(size_t lineNumber,
|
||||
|
||||
@@ -76,6 +76,7 @@ class TechDrawGuiExport DrawGuiUtil {
|
||||
static void loadLineStandardsChoices(QComboBox* combo);
|
||||
static void loadLineStyleChoices(QComboBox* combo,
|
||||
TechDraw::LineGenerator* generator = nullptr);
|
||||
static void loadLineGroupChoices(QComboBox* combo);
|
||||
static QIcon iconForLine(size_t lineNumber, TechDraw::LineGenerator* generator);
|
||||
|
||||
static double roundToDigits(double original, int digits);
|
||||
|
||||
Reference in New Issue
Block a user