mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
[GRASS] region pen options moved to GRASS options
This commit is contained in:
parent
faa32f36cf
commit
bed703ebfe
@ -19,6 +19,7 @@
|
||||
<file alias="grass_new_point.png">themes/default/grass_new_point.png</file>
|
||||
<file alias="grass_new_vector_layer.png">themes/default/grass_new_vector_layer.png</file>
|
||||
<file alias="grass_open_mapset.png">themes/default/grass_open_mapset.png</file>
|
||||
<file alias="grass_options_region.png">themes/default/grass_options_region.png</file>
|
||||
<file alias="grass_region_edit.png">themes/default/grass_region_edit.png</file>
|
||||
<file alias="grass_region.png">themes/default/grass_region.png</file>
|
||||
<file alias="grass_set_region.png">themes/default/grass_set_region.png</file>
|
||||
|
@ -226,12 +226,7 @@ void QgsGrassPlugin::initGui()
|
||||
this, SLOT( setEditAction() ) );
|
||||
|
||||
connect( QgsGrass::instance(), SIGNAL( mapsetChanged() ), SLOT( mapsetChanged() ) );
|
||||
|
||||
// Init Region symbology
|
||||
mRegionPen.setColor( QColor( settings.value( "/GRASS/region/color", "#ff0000" ).toString() ) );
|
||||
mRegionPen.setWidth( settings.value( "/GRASS/region/width", 0 ).toInt() );
|
||||
mRegionBand->setColor( mRegionPen.color() );
|
||||
mRegionBand->setWidth( mRegionPen.width() );
|
||||
connect( QgsGrass::instance(), SIGNAL( regionPenChanged() ), SLOT( displayRegion() ) );
|
||||
|
||||
mapsetChanged();
|
||||
|
||||
@ -486,6 +481,10 @@ void QgsGrassPlugin::displayRegion()
|
||||
|
||||
QgsRectangle rect( QgsPoint( window.west, window.north ), QgsPoint( window.east, window.south ) );
|
||||
|
||||
QPen regionPen = QgsGrass::regionPen();
|
||||
mRegionBand->setColor( regionPen.color() );
|
||||
mRegionBand->setWidth( regionPen.width() );
|
||||
|
||||
QgsGrassRegionEdit::drawRegion( mCanvas, mRegionBand, rect, &mCoordinateTransform );
|
||||
}
|
||||
|
||||
@ -536,23 +535,6 @@ void QgsGrassPlugin::regionClosed()
|
||||
mRegion = 0;
|
||||
}
|
||||
|
||||
QPen & QgsGrassPlugin::regionPen()
|
||||
{
|
||||
return mRegionPen;
|
||||
}
|
||||
|
||||
void QgsGrassPlugin::setRegionPen( QPen & pen )
|
||||
{
|
||||
mRegionPen = pen;
|
||||
|
||||
mRegionBand->setColor( mRegionPen.color() );
|
||||
mRegionBand->setWidth( mRegionPen.width() );
|
||||
|
||||
QSettings settings;
|
||||
settings.setValue( "/GRASS/region/color", mRegionPen.color().name() );
|
||||
settings.setValue( "/GRASS/region/width", ( int ) mRegionPen.width() );
|
||||
}
|
||||
|
||||
void QgsGrassPlugin::openMapset()
|
||||
{
|
||||
// QgsDebugMsg("entered.");
|
||||
|
@ -19,8 +19,6 @@
|
||||
#include "qgscoordinatereferencesystem.h"
|
||||
#include "qgscoordinatetransform.h"
|
||||
#include <QObject>
|
||||
#include <QPen>
|
||||
|
||||
|
||||
class QgsGrassTools;
|
||||
class QgsGrassNewMapset;
|
||||
@ -75,10 +73,6 @@ class QgsGrassPlugin : public QObject, public QgisPlugin
|
||||
//! Destructor
|
||||
virtual ~QgsGrassPlugin();
|
||||
|
||||
//! Get Region Pen
|
||||
QPen & regionPen( void );
|
||||
//! Set Region Pen
|
||||
void setRegionPen( QPen & );
|
||||
//! Get an icon from the active theme if possible
|
||||
static QIcon getThemeIcon( const QString &theName );
|
||||
|
||||
@ -139,8 +133,6 @@ class QgsGrassPlugin : public QObject, public QgisPlugin
|
||||
|
||||
//! Pointer to Display region acction
|
||||
QAction *mRegionAction;
|
||||
//! Region width
|
||||
QPen mRegionPen;
|
||||
//! Region dialog
|
||||
QgsGrassRegion *mRegion;
|
||||
// Region rubber band
|
||||
|
@ -258,31 +258,6 @@ QgsGrassRegion::QgsGrassRegion( QgsGrassPlugin *plugin, QgisInterface *iface,
|
||||
connect( mEWRes, SIGNAL( editingFinished() ), this, SLOT( EWResChanged() ) );
|
||||
connect( mRows, SIGNAL( editingFinished() ), this, SLOT( rowsChanged() ) );
|
||||
connect( mCols, SIGNAL( editingFinished() ), this, SLOT( colsChanged() ) );
|
||||
|
||||
// Symbology
|
||||
QPen pen = mPlugin->regionPen();
|
||||
mColorButton->setContext( "gui" );
|
||||
mColorButton->setColorDialogTitle( tr( "Select color" ) );
|
||||
mColorButton->setColor( pen.color() );
|
||||
connect( mColorButton, SIGNAL( colorChanged( const QColor& ) ), this, SLOT( changeColor( const QColor& ) ) );
|
||||
|
||||
mWidthSpinBox->setValue( pen.width() );
|
||||
connect( mWidthSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( changeWidth() ) );
|
||||
}
|
||||
|
||||
void QgsGrassRegion::changeColor( const QColor& color )
|
||||
{
|
||||
QPen pen = mPlugin->regionPen();
|
||||
pen.setColor( color );
|
||||
mPlugin->setRegionPen( pen );
|
||||
}
|
||||
|
||||
void QgsGrassRegion::changeWidth( void )
|
||||
{
|
||||
QPen pen = mPlugin->regionPen();
|
||||
|
||||
pen.setWidth( mWidthSpinBox->value() );
|
||||
mPlugin->setRegionPen( pen );
|
||||
}
|
||||
|
||||
QString QgsGrassRegion::formatEdge( double v )
|
||||
|
@ -81,9 +81,6 @@ class QgsGrassRegion: public QDialog, private Ui::QgsGrassRegionBase
|
||||
|
||||
void radioChanged( void );
|
||||
|
||||
void changeColor( const QColor& color );
|
||||
void changeWidth( void );
|
||||
|
||||
void restorePosition( void );
|
||||
|
||||
//! Called when the capture finished to refresh the mWindow values
|
||||
|
@ -160,67 +160,6 @@ or change the following values</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Border</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="textLabel7">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="textLabel6">
|
||||
<property name="text">
|
||||
<string>Width</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QSpinBox" name="mWidthSpinBox"/>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QgsColorButtonV2" name="mColorButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -232,13 +171,6 @@ or change the following values</string>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsColorButtonV2</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>qgscolorbuttonv2.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
BIN
src/plugins/grass/themes/default/grass_options_region.png
Normal file
BIN
src/plugins/grass/themes/default/grass_options_region.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@ -2350,6 +2350,23 @@ void QgsGrass::setModulesConfig( bool custom, const QString &customDir )
|
||||
}
|
||||
}
|
||||
|
||||
QPen QgsGrass::regionPen()
|
||||
{
|
||||
QSettings settings;
|
||||
QPen pen;
|
||||
pen.setColor( QColor( settings.value( "/GRASS/region/color", "#ff0000" ).toString() ) );
|
||||
pen.setWidthF( settings.value( "/GRASS/region/width", 0 ).toFloat() );
|
||||
return pen;
|
||||
}
|
||||
|
||||
void QgsGrass::setRegionPen( const QPen & pen )
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue( "/GRASS/region/color", pen.color().name() );
|
||||
settings.setValue( "/GRASS/region/width", pen.widthF() );
|
||||
emit regionPenChanged();
|
||||
}
|
||||
|
||||
bool QgsGrass::modulesDebug()
|
||||
{
|
||||
QSettings settings;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#define QGSGRASS_H
|
||||
|
||||
#include <QMutex>
|
||||
#include <QPen>
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
@ -471,6 +472,10 @@ class GRASS_LIB_EXPORT QgsGrass : public QObject
|
||||
|
||||
void setModulesConfig( bool custom, const QString &customDir );
|
||||
|
||||
static QPen regionPen();
|
||||
|
||||
void setRegionPen( const QPen & pen );
|
||||
|
||||
// Modules UI debug
|
||||
static bool modulesDebug();
|
||||
|
||||
@ -501,6 +506,9 @@ class GRASS_LIB_EXPORT QgsGrass : public QObject
|
||||
/** Emitted when modules debug mode changed */
|
||||
void modulesDebugChanged();
|
||||
|
||||
/** Emitted when region pen changed */
|
||||
void regionPenChanged();
|
||||
|
||||
private:
|
||||
static int initialized; // Set to 1 after initialization
|
||||
static bool active; // is active mode
|
||||
|
@ -53,6 +53,13 @@ QgsGrassOptions::QgsGrassOptions( QWidget *parent )
|
||||
|
||||
mImportExternalCheckBox->setChecked( settings.value( mImportSettingsPath + "/external", true ).toBool() );
|
||||
|
||||
// Region
|
||||
QPen regionPen = QgsGrass::regionPen();
|
||||
mRegionColorButton->setContext( "gui" );
|
||||
mRegionColorButton->setColorDialogTitle( tr( "Select color" ) );
|
||||
mRegionColorButton->setColor( regionPen.color() );
|
||||
mRegionWidthSpinBox->setValue( regionPen.width() );
|
||||
|
||||
restoreOptionsBaseUi();
|
||||
}
|
||||
|
||||
@ -87,4 +94,10 @@ void QgsGrassOptions::saveOptions()
|
||||
mCrsTransformationComboBox->itemData( mCrsTransformationComboBox->currentIndex() ).toInt() );
|
||||
|
||||
settings.setValue( mImportSettingsPath + "/external", mImportExternalCheckBox->isChecked() );
|
||||
|
||||
// Region
|
||||
QPen regionPen = QgsGrass::regionPen();
|
||||
regionPen.setColor( mRegionColorButton->color() );
|
||||
regionPen.setWidthF( mRegionWidthSpinBox->value() );
|
||||
QgsGrass::instance()->setRegionPen( regionPen );
|
||||
}
|
||||
|
@ -71,6 +71,9 @@
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -95,6 +98,15 @@
|
||||
<normaloff>:/images/icons/qbrowser-icon-60x60.png</normaloff>:/images/icons/qbrowser-icon-60x60.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Region</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../plugins/grass/qgsgrass_plugin.qrc">
|
||||
<normaloff>:/images/themes/default/grass/grass_options_region.png</normaloff>:/images/themes/default/grass/grass_options_region.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -119,7 +131,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="mModulesPage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
@ -234,8 +246,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>286</width>
|
||||
<height>98</height>
|
||||
<width>447</width>
|
||||
<height>358</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_28">
|
||||
@ -308,6 +320,92 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="mRegionPage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QgsCollapsibleGroupBox" name="mRegionGroupBox">
|
||||
<property name="title">
|
||||
<string>Region border</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mRegionColorLabel">
|
||||
<property name="text">
|
||||
<string>Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QgsColorButtonV2" name="mRegionColorButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="mRegionWidthLabel">
|
||||
<property name="text">
|
||||
<string>Width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="mRegionWidthSpinBox">
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.200000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -345,6 +443,11 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QgsColorButtonV2</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>qgscolorbuttonv2.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QgsCollapsibleGroupBox</class>
|
||||
<extends>QGroupBox</extends>
|
||||
@ -354,6 +457,7 @@
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../images/images.qrc"/>
|
||||
<include location="../../plugins/grass/qgsgrass_plugin.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
Loading…
x
Reference in New Issue
Block a user