[TD]fix line standard drop downs
This commit is contained in:
@@ -49,15 +49,29 @@ DlgPrefsTechDrawAnnotationImp::DlgPrefsTechDrawAnnotationImp( QWidget* parent )
|
||||
ui->pdsbBalloonKink->setUnit(Base::Unit::Length);
|
||||
ui->pdsbBalloonKink->setMinimum(0);
|
||||
|
||||
// stylesheet override to defeat behaviour of non-editable combobox to ignore
|
||||
// maxVisibleItems property
|
||||
QString ssOverride = QString::fromUtf8("combobox-popup: 0;");
|
||||
ui->pcbSectionStyle->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
ui->pcbSectionStyle->setStyleSheet(ssOverride);
|
||||
ui->pcbCenterStyle->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
ui->pcbCenterStyle->setStyleSheet(ssOverride);
|
||||
ui->pcbHighlightStyle->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
ui->pcbHighlightStyle->setStyleSheet(ssOverride);
|
||||
ui->pcbHiddenStyle->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
ui->pcbHiddenStyle->setStyleSheet(ssOverride);
|
||||
|
||||
// connect the LineGroup the update the tooltip if index changed
|
||||
connect(ui->pcbLineGroup, qOverload<int>(&QComboBox::currentIndexChanged),
|
||||
this, &DlgPrefsTechDrawAnnotationImp::onLineGroupChanged);
|
||||
|
||||
m_lineGenerator = new LineGenerator();
|
||||
}
|
||||
|
||||
DlgPrefsTechDrawAnnotationImp::~DlgPrefsTechDrawAnnotationImp()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
delete m_lineGenerator;
|
||||
}
|
||||
|
||||
void DlgPrefsTechDrawAnnotationImp::saveSettings()
|
||||
@@ -80,8 +94,6 @@ void DlgPrefsTechDrawAnnotationImp::saveSettings()
|
||||
ui->pcbHighlightStyle->onSave();
|
||||
ui->cbEndCap->onSave();
|
||||
ui->pcbHiddenStyle->onSave();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DlgPrefsTechDrawAnnotationImp::loadSettings()
|
||||
@@ -129,33 +141,16 @@ void DlgPrefsTechDrawAnnotationImp::loadSettings()
|
||||
if (ui->pcbLineStandard->count() > Preferences::lineStandard()) {
|
||||
ui->pcbLineStandard->setCurrentIndex(Preferences::lineStandard());
|
||||
}
|
||||
// we have to connect the slot after the inital load or the current standard will
|
||||
// be set to index 0 when the widget is created
|
||||
connect(ui->pcbLineStandard, qOverload<int>(&QComboBox::currentIndexChanged),
|
||||
this, &DlgPrefsTechDrawAnnotationImp::onLineStandardChanged);
|
||||
|
||||
// note: line numbering starts at 1, not 0. we set the preference to the
|
||||
// currentIndex in saveSettings, Preferences returns the actual line number,
|
||||
// so we need to subtract 1 here to get the index.
|
||||
ui->pcbSectionStyle->onRestore();
|
||||
DrawGuiUtil::loadLineStyleChoices(ui->pcbSectionStyle, m_lineGenerator);
|
||||
if (ui->pcbSectionStyle->count() > Preferences::SectionLineStyle()) {
|
||||
ui->pcbSectionStyle->setCurrentIndex(Preferences::SectionLineStyle() - 1);
|
||||
}
|
||||
|
||||
ui->pcbCenterStyle->onRestore();
|
||||
DrawGuiUtil::loadLineStyleChoices(ui->pcbCenterStyle, m_lineGenerator);
|
||||
if (ui->pcbCenterStyle->count() > Preferences::CenterLineStyle()) {
|
||||
ui->pcbCenterStyle->setCurrentIndex(Preferences::CenterLineStyle() - 1);
|
||||
}
|
||||
|
||||
ui->pcbHighlightStyle->onRestore();
|
||||
DrawGuiUtil::loadLineStyleChoices(ui->pcbHighlightStyle, m_lineGenerator);
|
||||
if (ui->pcbHighlightStyle->count() > Preferences::HighlightLineStyle()) {
|
||||
ui->pcbHighlightStyle->setCurrentIndex(Preferences::HighlightLineStyle() - 1);
|
||||
}
|
||||
|
||||
ui->pcbHiddenStyle->onRestore();
|
||||
DrawGuiUtil::loadLineStyleChoices(ui->pcbHiddenStyle, m_lineGenerator);
|
||||
if (ui->pcbHiddenStyle->count() > Preferences::HiddenLineStyle()) {
|
||||
ui->pcbHiddenStyle->setCurrentIndex(Preferences::HiddenLineStyle() - 1);
|
||||
}
|
||||
loadLineStyleBoxes();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,7 +190,7 @@ void DlgPrefsTechDrawAnnotationImp::onLineGroupChanged(int index)
|
||||
lgNames.push_back(lgRecord);
|
||||
}
|
||||
ui->pcbLineGroup->setToolTip(
|
||||
QObject::tr("%1 defines these line widths:\n thin: %2\n graphic: %3\n "
|
||||
QObject::tr("%1 defines these line widths:\n thin: %2\n graphic: %3\n"
|
||||
"thick: %4")
|
||||
.arg(QString::fromStdString(lgNames.at(0).substr(1)),
|
||||
QString::fromStdString(lgNames.at(1)),
|
||||
@@ -203,4 +198,40 @@ void DlgPrefsTechDrawAnnotationImp::onLineGroupChanged(int index)
|
||||
QString::fromStdString(lgNames.at(3))));
|
||||
}
|
||||
|
||||
//! we must save the current line group preference when it changes so that the
|
||||
//! line style comboboxes are filled for the correct standard.
|
||||
void DlgPrefsTechDrawAnnotationImp::onLineStandardChanged(int index)
|
||||
{
|
||||
Preferences::setLineStandard(index);
|
||||
m_lineGenerator->reloadDescriptions();
|
||||
loadLineStyleBoxes();
|
||||
}
|
||||
|
||||
//! fill the various line style comboboxes
|
||||
void DlgPrefsTechDrawAnnotationImp::loadLineStyleBoxes()
|
||||
{
|
||||
// note: line numbering starts at 1, not 0. we set the preference to the
|
||||
// currentIndex in saveSettings, Preferences returns the actual line number,
|
||||
// so we need to subtract 1 here to get the index.
|
||||
DrawGuiUtil::loadLineStyleChoices(ui->pcbSectionStyle, m_lineGenerator);
|
||||
if (ui->pcbSectionStyle->count() > Preferences::SectionLineStyle()) {
|
||||
ui->pcbSectionStyle->setCurrentIndex(Preferences::SectionLineStyle() - 1);
|
||||
}
|
||||
|
||||
DrawGuiUtil::loadLineStyleChoices(ui->pcbCenterStyle, m_lineGenerator);
|
||||
if (ui->pcbCenterStyle->count() > Preferences::CenterLineStyle()) {
|
||||
ui->pcbCenterStyle->setCurrentIndex(Preferences::CenterLineStyle() - 1);
|
||||
}
|
||||
|
||||
DrawGuiUtil::loadLineStyleChoices(ui->pcbHighlightStyle, m_lineGenerator);
|
||||
if (ui->pcbHighlightStyle->count() > Preferences::HighlightLineStyle()) {
|
||||
ui->pcbHighlightStyle->setCurrentIndex(Preferences::HighlightLineStyle() - 1);
|
||||
}
|
||||
|
||||
DrawGuiUtil::loadLineStyleChoices(ui->pcbHiddenStyle, m_lineGenerator);
|
||||
if (ui->pcbHiddenStyle->count() > Preferences::HiddenLineStyle()) {
|
||||
ui->pcbHiddenStyle->setCurrentIndex(Preferences::HiddenLineStyle() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_DlgPrefsTechDrawAnnotationImp.cpp>
|
||||
|
||||
Reference in New Issue
Block a user