Skip to content
Permalink
Browse files

[FEATURE][georefencer] Make minimizing georeferencer when adding points

from canvas an option

Allows users to disable this option, which is annoying on multi-monitor
setups where it can be desirable to have both windows visible while
adding points.

The option is added as a checkbox in the "add map coordinates" dialog:
"Automatically hide georeferencer window". We show it directly in that
dialog for maximum discoverability, and to allow easier change of setting
for users who move between single/multi monitor setups.

Fixes #20449
  • Loading branch information
nyalldawson committed Jan 6, 2019
1 parent 0de94dd commit 6ed0b4762f1777bbdedc2a4ffa61f26d461eab74
@@ -91,32 +91,9 @@ void QgsGeorefConfigDialog::buttonBox_rejected()
void QgsGeorefConfigDialog::readSettings()
{
QgsSettings s;
if ( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowId" ) ).toBool() )
{
mShowIDsCheckBox->setChecked( true );
}
else
{
mShowIDsCheckBox->setChecked( false );
}

if ( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowCoords" ) ).toBool() )
{
mShowCoordsCheckBox->setChecked( true );
}
else
{
mShowCoordsCheckBox->setChecked( false );
}

if ( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowDocked" ) ).toBool() )
{
mShowDockedCheckBox->setChecked( true );
}
else
{
mShowDockedCheckBox->setChecked( false );
}
mShowIDsCheckBox->setChecked( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowId" ) ).toBool() );
mShowCoordsCheckBox->setChecked( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowCoords" ) ).toBool() );
mShowDockedCheckBox->setChecked( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ShowDocked" ) ).toBool() );

if ( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/ResidualUnits" ) ).toString() == QLatin1String( "mapUnits" ) )
{
@@ -6,18 +6,31 @@
<rect>
<x>0</x>
<y>0</y>
<width>309</width>
<height>443</height>
<width>478</width>
<height>542</height>
</rect>
</property>
<property name="windowTitle">
<string>Configure Georeferencer</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="mPointTipGroupBox">
<property name="title">
<string>Point tip</string>
<string>Point Tip</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
@@ -37,33 +50,50 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="mResidualUnitsGroupBox">
<item row="4" column="0">
<widget class="QCheckBox" name="mShowDockedCheckBox">
<property name="text">
<string>Show Georeferencer window docked</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Residual units</string>
<string>PDF Map</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QRadioButton" name="mPixelsButton">
<property name="text">
<string>Pixels</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="mMapUnitsButton">
<property name="text">
<string>Use map units if possible</string>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Paper size</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mPaperSizeComboBox"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="mPdfReportGroupBox">
<property name="title">
<string>PDF report</string>
<string>PDF Report</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
@@ -114,59 +144,29 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="mShowDockedCheckBox">
<property name="text">
<string>Show Georeferencer window docked</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox">
<item row="1" column="0">
<widget class="QGroupBox" name="mResidualUnitsGroupBox">
<property name="title">
<string>PDF map</string>
<string>Residual Units</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Paper size</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="mPaperSizeComboBox"/>
</item>
</layout>
<widget class="QRadioButton" name="mPixelsButton">
<property name="text">
<string>Pixels</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="mMapUnitsButton">
<property name="text">
<string>Use map units if possible</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
@@ -46,6 +46,8 @@ QgsMapCoordsDialog::QgsMapCoordsDialog( QgsMapCanvas *qgisCanvas, const QgsPoint
mToolEmitPoint = new QgsGeorefMapToolEmitPoint( qgisCanvas );
mToolEmitPoint->setButton( mPointFromCanvasPushButton );

mMinimizeWindowCheckBox->setChecked( s.value( QStringLiteral( "/Plugin-GeoReferencer/Config/Minimize" ), QStringLiteral( "1" ) ).toBool() );

connect( mPointFromCanvasPushButton, &QAbstractButton::clicked, this, &QgsMapCoordsDialog::setToolEmitPoint );

connect( mToolEmitPoint, &QgsGeorefMapToolEmitPoint::canvasClicked,
@@ -63,6 +65,7 @@ QgsMapCoordsDialog::~QgsMapCoordsDialog()

QgsSettings settings;
settings.setValue( QStringLiteral( "/Plugin-GeoReferencer/MapCoordsWindow/geometry" ), saveGeometry() );
settings.setValue( QStringLiteral( "/Plugin-GeoReferencer/Config/Minimize" ), mMinimizeWindowCheckBox->isChecked() );
}

void QgsMapCoordsDialog::updateOK()
@@ -119,7 +122,10 @@ void QgsMapCoordsDialog::setToolEmitPoint( bool isEnable )
{
if ( isEnable )
{
parentWidget()->showMinimized();
if ( mMinimizeWindowCheckBox->isChecked() )
{
parentWidget()->showMinimized();
}

Q_ASSERT( parentWidget()->parentWidget() );
parentWidget()->parentWidget()->activateWindow();
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>497</width>
<height>204</height>
<width>531</width>
<height>212</height>
</rect>
</property>
<property name="windowTitle">
@@ -17,6 +17,20 @@
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0">
<item row="1" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>X / East</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="4">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label">
<property name="text">
@@ -27,33 +41,13 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="leYCoord"/>
</item>
<item row="1" column="2">
<widget class="QLabel" name="textLabel2">
<property name="text">
<string>Y / North</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>X / East</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="leXCoord"/>
</item>
<item row="4" column="0" colspan="4">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
@@ -67,6 +61,19 @@
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="leYCoord"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="leXCoord"/>
</item>
<item row="4" column="0" colspan="4">
<widget class="QCheckBox" name="mMinimizeWindowCheckBox">
<property name="text">
<string>Automatically hide georeferencer window </string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>

0 comments on commit 6ed0b47

Please sign in to comment.
You can’t perform that action at this time.