mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Added a slider to set line width.
This commit is contained in:
parent
aefe36dbca
commit
8932469470
3 changed files with 55 additions and 24 deletions
|
@ -28,7 +28,6 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
delete ui->povrayLayout;
|
||||
#endif
|
||||
|
||||
ui->lineWidth->setValidator(new QDoubleValidator(ui->lineWidth));
|
||||
connect(ui->FadeStepsColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||
connect(ui->HighlightNewPartsColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||
connect(ui->gridStudColor, SIGNAL(clicked()), this, SLOT(ColorButtonClicked()));
|
||||
|
@ -69,7 +68,21 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
else
|
||||
ui->antiAliasingSamples->setCurrentIndex(0);
|
||||
ui->edgeLines->setChecked(mOptions->Preferences.mDrawEdgeLines);
|
||||
ui->lineWidth->setText(lcFormatValueLocalized(mOptions->Preferences.mLineWidth));
|
||||
|
||||
if (QGLFormat::defaultFormat().sampleBuffers() && QGLFormat::defaultFormat().samples() > 1)
|
||||
{
|
||||
glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, mLineWidthRange);
|
||||
glGetFloatv(GL_SMOOTH_LINE_WIDTH_GRANULARITY, &mLineWidthGranularity);
|
||||
}
|
||||
else
|
||||
{
|
||||
glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, mLineWidthRange);
|
||||
mLineWidthGranularity = 1.0f;
|
||||
}
|
||||
|
||||
ui->LineWidthSlider->setRange(0, (mLineWidthRange[1] - mLineWidthRange[0]) / mLineWidthGranularity);
|
||||
ui->LineWidthSlider->setValue((mOptions->Preferences.mLineWidth - mLineWidthRange[0]) / mLineWidthGranularity);
|
||||
|
||||
ui->MeshLOD->setChecked(mOptions->Preferences.mAllowLOD);
|
||||
ui->FadeSteps->setChecked(mOptions->Preferences.mFadeSteps);
|
||||
ui->HighlightNewParts->setChecked(mOptions->Preferences.mHighlightNewParts);
|
||||
|
@ -137,6 +150,7 @@ lcQPreferencesDialog::lcQPreferencesDialog(QWidget* Parent, lcPreferencesDialogO
|
|||
on_studLogo_toggled();
|
||||
on_antiAliasing_toggled();
|
||||
on_edgeLines_toggled();
|
||||
on_LineWidthSlider_valueChanged();
|
||||
on_FadeSteps_toggled();
|
||||
on_HighlightNewParts_toggled();
|
||||
on_gridStuds_toggled();
|
||||
|
@ -205,7 +219,7 @@ void lcQPreferencesDialog::accept()
|
|||
mOptions->AASamples = 2;
|
||||
|
||||
mOptions->Preferences.mDrawEdgeLines = ui->edgeLines->isChecked();
|
||||
mOptions->Preferences.mLineWidth = lcParseValueLocalized(ui->lineWidth->text());
|
||||
mOptions->Preferences.mLineWidth = mLineWidthRange[0] + static_cast<float>(ui->LineWidthSlider->value()) * mLineWidthGranularity;
|
||||
mOptions->Preferences.mAllowLOD = ui->MeshLOD->isChecked();
|
||||
mOptions->Preferences.mFadeSteps = ui->FadeSteps->isChecked();
|
||||
mOptions->Preferences.mHighlightNewParts = ui->HighlightNewParts->isChecked();
|
||||
|
@ -375,7 +389,14 @@ void lcQPreferencesDialog::on_antiAliasing_toggled()
|
|||
|
||||
void lcQPreferencesDialog::on_edgeLines_toggled()
|
||||
{
|
||||
ui->lineWidth->setEnabled(ui->edgeLines->isChecked());
|
||||
ui->LineWidthSlider->setEnabled(ui->edgeLines->isChecked());
|
||||
ui->LineWidthLabel->setEnabled(ui->edgeLines->isChecked());
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_LineWidthSlider_valueChanged()
|
||||
{
|
||||
float Value = mLineWidthRange[0] + static_cast<float>(ui->LineWidthSlider->value()) * mLineWidthGranularity;
|
||||
ui->LineWidthLabel->setText(QString::number(Value));
|
||||
}
|
||||
|
||||
void lcQPreferencesDialog::on_FadeSteps_toggled()
|
||||
|
|
|
@ -35,6 +35,7 @@ public slots:
|
|||
void ColorButtonClicked();
|
||||
void on_antiAliasing_toggled();
|
||||
void on_edgeLines_toggled();
|
||||
void on_LineWidthSlider_valueChanged();
|
||||
void on_FadeSteps_toggled();
|
||||
void on_HighlightNewParts_toggled();
|
||||
void on_gridStuds_toggled();
|
||||
|
@ -68,5 +69,7 @@ private:
|
|||
void UpdateMouseTree();
|
||||
void UpdateMouseTreeItem(int ItemIndex);
|
||||
void setShortcutModified(QTreeWidgetItem *treeItem, bool modified);
|
||||
};
|
||||
|
||||
float mLineWidthRange[2];
|
||||
float mLineWidthGranularity;
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>598</width>
|
||||
<height>492</height>
|
||||
<height>494</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -391,16 +391,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineWidth">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>75</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="antiAliasing">
|
||||
<property name="text">
|
||||
|
@ -441,13 +431,6 @@
|
|||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="axisIcon">
|
||||
<property name="text">
|
||||
|
@ -476,6 +459,29 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSlider" name="LineWidthSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::NoTicks</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="LineWidthLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1220,7 +1226,8 @@
|
|||
<tabstop>studLogo</tabstop>
|
||||
<tabstop>studLogoCombo</tabstop>
|
||||
<tabstop>edgeLines</tabstop>
|
||||
<tabstop>lineWidth</tabstop>
|
||||
<tabstop>LineWidthSlider</tabstop>
|
||||
<tabstop>LineWidthLabel</tabstop>
|
||||
<tabstop>MeshLOD</tabstop>
|
||||
<tabstop>axisIcon</tabstop>
|
||||
<tabstop>FadeSteps</tabstop>
|
||||
|
|
Loading…
Reference in a new issue