mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -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;
|
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:
|
public slots:
|
||||||
//! set output extent to be the same as original extent (may be transformed to output CRS)
|
//! set output extent to be the same as original extent (may be transformed to output CRS)
|
||||||
void setOutputExtentFromOriginal();
|
void setOutputExtentFromOriginal();
|
||||||
@ -65,6 +72,8 @@ class QgsExtentGroupBox : QgsCollapsibleGroupBox
|
|||||||
void on_mYMinLineEdit_textEdited( const QString & );
|
void on_mYMinLineEdit_textEdited( const QString & );
|
||||||
void on_mYMaxLineEdit_textEdited( const QString & );
|
void on_mYMaxLineEdit_textEdited( const QString & );
|
||||||
|
|
||||||
|
void groupBoxClicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setOutputExtent( const QgsRectangle& r, const QgsCoordinateReferenceSystem& srcCrs, QgsExtentGroupBox::ExtentState state );
|
void setOutputExtent( const QgsRectangle& r, const QgsCoordinateReferenceSystem& srcCrs, QgsExtentGroupBox::ExtentState state );
|
||||||
void setOutputExtentFromLineEdit();
|
void setOutputExtentFromLineEdit();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
QgsExtentGroupBox::QgsExtentGroupBox( QWidget* parent )
|
QgsExtentGroupBox::QgsExtentGroupBox( QWidget* parent )
|
||||||
: QgsCollapsibleGroupBox( parent )
|
: QgsCollapsibleGroupBox( parent )
|
||||||
|
, mTitleBase( tr( "Extent" ) )
|
||||||
, mExtentState( OriginalExtent )
|
, mExtentState( OriginalExtent )
|
||||||
{
|
{
|
||||||
setupUi( this );
|
setupUi( this );
|
||||||
@ -16,6 +17,7 @@ QgsExtentGroupBox::QgsExtentGroupBox( QWidget* parent )
|
|||||||
|
|
||||||
connect( mCurrentExtentButton, SIGNAL( clicked() ), this, SLOT( setOutputExtentFromCurrent() ) );
|
connect( mCurrentExtentButton, SIGNAL( clicked() ), this, SLOT( setOutputExtentFromCurrent() ) );
|
||||||
connect( mOriginalExtentButton, SIGNAL( clicked() ), this, SLOT( setOutputExtentFromOriginal() ) );
|
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;
|
mExtentState = state;
|
||||||
|
|
||||||
|
if ( isCheckable() && !isChecked() )
|
||||||
|
setChecked( true );
|
||||||
|
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
|
||||||
emit extentChanged( extent );
|
emit extentChanged( extent );
|
||||||
@ -91,7 +96,9 @@ void QgsExtentGroupBox::updateTitle()
|
|||||||
default:
|
default:
|
||||||
break;
|
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 );
|
setTitle( msg );
|
||||||
}
|
}
|
||||||
@ -114,9 +121,34 @@ void QgsExtentGroupBox::setOutputExtentFromUser( const QgsRectangle& extent, con
|
|||||||
setOutputExtent( extent, crs, UserExtent );
|
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
|
QgsRectangle QgsExtentGroupBox::outputExtent() const
|
||||||
{
|
{
|
||||||
|
if ( isCheckable() && !isChecked() )
|
||||||
|
return QgsRectangle();
|
||||||
|
|
||||||
return QgsRectangle( mXMinLineEdit->text().toDouble(), mYMinLineEdit->text().toDouble(),
|
return QgsRectangle( mXMinLineEdit->text().toDouble(), mYMinLineEdit->text().toDouble(),
|
||||||
mXMaxLineEdit->text().toDouble(), mYMaxLineEdit->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; }
|
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:
|
public slots:
|
||||||
//! set output extent to be the same as original extent (may be transformed to output CRS)
|
//! set output extent to be the same as original extent (may be transformed to output CRS)
|
||||||
void setOutputExtentFromOriginal();
|
void setOutputExtentFromOriginal();
|
||||||
@ -75,11 +82,16 @@ class GUI_EXPORT QgsExtentGroupBox : public QgsCollapsibleGroupBox, private Ui::
|
|||||||
void on_mYMinLineEdit_textEdited( const QString & ) { setOutputExtentFromLineEdit(); }
|
void on_mYMinLineEdit_textEdited( const QString & ) { setOutputExtentFromLineEdit(); }
|
||||||
void on_mYMaxLineEdit_textEdited( const QString & ) { setOutputExtentFromLineEdit(); }
|
void on_mYMaxLineEdit_textEdited( const QString & ) { setOutputExtentFromLineEdit(); }
|
||||||
|
|
||||||
|
void groupBoxClicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setOutputExtent( const QgsRectangle& r, const QgsCoordinateReferenceSystem& srcCrs, ExtentState state );
|
void setOutputExtent( const QgsRectangle& r, const QgsCoordinateReferenceSystem& srcCrs, ExtentState state );
|
||||||
void setOutputExtentFromLineEdit();
|
void setOutputExtentFromLineEdit();
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
|
//! Base part of the title used for the extent
|
||||||
|
QString mTitleBase;
|
||||||
|
|
||||||
ExtentState mExtentState;
|
ExtentState mExtentState;
|
||||||
|
|
||||||
QgsCoordinateReferenceSystem mOutputCrs;
|
QgsCoordinateReferenceSystem mOutputCrs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user