mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Extent group box improvements: custom title base, checkable group box
This commit is contained in:
parent
b452bc0245
commit
9e16952732
@ -44,6 +44,13 @@ class QgsExtentGroupBox : QgsCollapsibleGroupBox
|
||||
|
||||
QgsExtentGroupBox::ExtentState extentState() const;
|
||||
|
||||
//! Set base part of title of the group box (will be appended with extent state)
|
||||
//! @note added in 2.12
|
||||
void setTitleBase( const QString& title );
|
||||
//! Set base part of title of the group box (will be appended with extent state)
|
||||
//! @note added in 2.12
|
||||
QString titleBase() const;
|
||||
|
||||
public slots:
|
||||
//! set output extent to be the same as original extent (may be transformed to output CRS)
|
||||
void setOutputExtentFromOriginal();
|
||||
@ -65,6 +72,8 @@ class QgsExtentGroupBox : QgsCollapsibleGroupBox
|
||||
void on_mYMinLineEdit_textEdited( const QString & );
|
||||
void on_mYMaxLineEdit_textEdited( const QString & );
|
||||
|
||||
void groupBoxClicked();
|
||||
|
||||
protected:
|
||||
void setOutputExtent( const QgsRectangle& r, const QgsCoordinateReferenceSystem& srcCrs, QgsExtentGroupBox::ExtentState state );
|
||||
void setOutputExtentFromLineEdit();
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
QgsExtentGroupBox::QgsExtentGroupBox( QWidget* parent )
|
||||
: QgsCollapsibleGroupBox( parent )
|
||||
, mTitleBase( tr( "Extent" ) )
|
||||
, mExtentState( OriginalExtent )
|
||||
{
|
||||
setupUi( this );
|
||||
@ -16,6 +17,7 @@ QgsExtentGroupBox::QgsExtentGroupBox( QWidget* parent )
|
||||
|
||||
connect( mCurrentExtentButton, SIGNAL( clicked() ), this, SLOT( setOutputExtentFromCurrent() ) );
|
||||
connect( mOriginalExtentButton, SIGNAL( clicked() ), this, SLOT( setOutputExtentFromOriginal() ) );
|
||||
connect( this, SIGNAL( clicked( bool ) ), this, SLOT( groupBoxClicked() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +60,9 @@ void QgsExtentGroupBox::setOutputExtent( const QgsRectangle& r, const QgsCoordin
|
||||
|
||||
mExtentState = state;
|
||||
|
||||
if ( isCheckable() && !isChecked() )
|
||||
setChecked( true );
|
||||
|
||||
updateTitle();
|
||||
|
||||
emit extentChanged( extent );
|
||||
@ -91,7 +96,9 @@ void QgsExtentGroupBox::updateTitle()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
msg = tr( "Extent (current: %1)" ).arg( msg );
|
||||
if ( isCheckable() && !isChecked() )
|
||||
msg = tr( "none" );
|
||||
msg = tr( "%1 (current: %2)" ).arg( mTitleBase ).arg( msg );
|
||||
|
||||
setTitle( msg );
|
||||
}
|
||||
@ -114,9 +121,34 @@ void QgsExtentGroupBox::setOutputExtentFromUser( const QgsRectangle& extent, con
|
||||
setOutputExtent( extent, crs, UserExtent );
|
||||
}
|
||||
|
||||
void QgsExtentGroupBox::groupBoxClicked()
|
||||
{
|
||||
if ( !isCheckable() )
|
||||
return;
|
||||
|
||||
updateTitle();
|
||||
|
||||
// output extent just went from null to something (or vice versa)
|
||||
emit extentChanged( outputExtent() );
|
||||
}
|
||||
|
||||
|
||||
QgsRectangle QgsExtentGroupBox::outputExtent() const
|
||||
{
|
||||
if ( isCheckable() && !isChecked() )
|
||||
return QgsRectangle();
|
||||
|
||||
return QgsRectangle( mXMinLineEdit->text().toDouble(), mYMinLineEdit->text().toDouble(),
|
||||
mXMaxLineEdit->text().toDouble(), mYMaxLineEdit->text().toDouble() );
|
||||
}
|
||||
|
||||
void QgsExtentGroupBox::setTitleBase(const QString& title)
|
||||
{
|
||||
mTitleBase = title;
|
||||
updateTitle();
|
||||
}
|
||||
|
||||
QString QgsExtentGroupBox::titleBase() const
|
||||
{
|
||||
return mTitleBase;
|
||||
}
|
||||
|
@ -54,6 +54,13 @@ class GUI_EXPORT QgsExtentGroupBox : public QgsCollapsibleGroupBox, private Ui::
|
||||
|
||||
ExtentState extentState() const { return mExtentState; }
|
||||
|
||||
//! Set base part of title of the group box (will be appended with extent state)
|
||||
//! @note added in 2.12
|
||||
void setTitleBase( const QString& title );
|
||||
//! Set base part of title of the group box (will be appended with extent state)
|
||||
//! @note added in 2.12
|
||||
QString titleBase() const;
|
||||
|
||||
public slots:
|
||||
//! set output extent to be the same as original extent (may be transformed to output CRS)
|
||||
void setOutputExtentFromOriginal();
|
||||
@ -75,11 +82,16 @@ class GUI_EXPORT QgsExtentGroupBox : public QgsCollapsibleGroupBox, private Ui::
|
||||
void on_mYMinLineEdit_textEdited( const QString & ) { setOutputExtentFromLineEdit(); }
|
||||
void on_mYMaxLineEdit_textEdited( const QString & ) { setOutputExtentFromLineEdit(); }
|
||||
|
||||
void groupBoxClicked();
|
||||
|
||||
protected:
|
||||
void setOutputExtent( const QgsRectangle& r, const QgsCoordinateReferenceSystem& srcCrs, ExtentState state );
|
||||
void setOutputExtentFromLineEdit();
|
||||
void updateTitle();
|
||||
|
||||
//! Base part of the title used for the extent
|
||||
QString mTitleBase;
|
||||
|
||||
ExtentState mExtentState;
|
||||
|
||||
QgsCoordinateReferenceSystem mOutputCrs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user