23 #include <QDialogButtonBox>
33 mOrientationComboBox->addItem( tr(
"Vertical" ), Qt::Vertical );
34 mOrientationComboBox->addItem( tr(
"Horizontal" ), Qt::Horizontal );
36 mMinLabelLineEdit->setPlaceholderText( tr(
"Default" ) );
37 mMaxLabelLineEdit->setPlaceholderText( tr(
"Default" ) );
39 mFontButton->setShowNullFormat(
true );
40 mFontButton->setNoFormatString( tr(
"Default" ) );
42 connect( mUseContinuousLegendCheckBox, &QCheckBox::stateChanged,
this, [ = ](
bool checked )
44 mLayoutGroup->setEnabled( checked );
45 mLabelsGroup->setEnabled( checked );
49 connect( mMinLabelLineEdit, &QLineEdit::textChanged,
this, &QgsColorRampLegendNodeWidget::onChanged );
50 connect( mMaxLabelLineEdit, &QLineEdit::textChanged,
this, &QgsColorRampLegendNodeWidget::onChanged );
51 connect( mPrefixLineEdit, &QLineEdit::textChanged,
this, &QgsColorRampLegendNodeWidget::onChanged );
52 connect( mSuffixLineEdit, &QLineEdit::textChanged,
this, &QgsColorRampLegendNodeWidget::onChanged );
53 connect( mDirectionComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, &QgsColorRampLegendNodeWidget::onChanged );
54 connect( mOrientationComboBox, qOverload<int>( &QComboBox::currentIndexChanged ),
this, &QgsColorRampLegendNodeWidget::onOrientationChanged );
55 connect( mNumberFormatPushButton, &QPushButton::clicked,
this, &QgsColorRampLegendNodeWidget::changeNumberFormat );
84 mDirectionComboBox->setCurrentIndex( mDirectionComboBox->findData(
settings.
direction() ) );
85 mOrientationComboBox->setCurrentIndex( mOrientationComboBox->findData(
settings.
orientation() ) );
87 onOrientationChanged();
88 mBlockSignals =
false;
93 mUseContinuousLegendCheckBox->setVisible( visible );
96 void QgsColorRampLegendNodeWidget::changeNumberFormat()
110 void QgsColorRampLegendNodeWidget::onOrientationChanged()
112 switch (
static_cast< Qt::Orientation
>( mOrientationComboBox->currentData().toInt() ) )
115 mDirectionComboBox->setItemText( 0, tr(
"Maximum on Top" ) );
116 mDirectionComboBox->setItemText( 1, tr(
"Minimum on Top" ) );
120 mDirectionComboBox->setItemText( 0, tr(
"Maximum on Right" ) );
121 mDirectionComboBox->setItemText( 1, tr(
"Minimum on Right" ) );
128 void QgsColorRampLegendNodeWidget::onChanged()
143 QVBoxLayout *vLayout =
new QVBoxLayout();
145 vLayout->addWidget( mWidget );
146 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok, Qt::Horizontal );
147 connect( mButtonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
148 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
149 connect( mButtonBox, &QDialogButtonBox::helpRequested,
this, [ = ]
151 QgsHelp::openHelp( QStringLiteral(
"working_with_raster/raster_properties.html#raster-legend-settings" ) );
154 vLayout->addWidget( mButtonBox );
155 setLayout( vLayout );
156 setWindowTitle( tr(
"Legend Node Settings" ) );