mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Add Apply buttons to decoration dialogs
This commit is contained in:
parent
36b0f6567d
commit
e2d9794c2e
@ -89,11 +89,7 @@ void QgsDecorationCopyright::saveToProject()
|
||||
void QgsDecorationCopyright::run()
|
||||
{
|
||||
QgsDecorationCopyrightDialog dlg( *this, QgisApp::instance() );
|
||||
|
||||
if ( dlg.exec() )
|
||||
{
|
||||
update();
|
||||
}
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
#include <QSettings>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
|
||||
QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyright& deco, QWidget* parent )
|
||||
: QDialog( parent ), mDeco( deco )
|
||||
@ -29,6 +31,9 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
|
||||
QSettings settings;
|
||||
restoreGeometry( settings.value( "/Windows/DecorationCopyright/geometry" ).toByteArray() );
|
||||
|
||||
QPushButton* applyButton = buttonBox->button( QDialogButtonBox::Apply );
|
||||
connect( applyButton, SIGNAL( clicked() ), this, SLOT( apply() ) );
|
||||
|
||||
//programmatically hide orientation selection for now
|
||||
cboOrientation->hide();
|
||||
textLabel15->hide();
|
||||
@ -63,14 +68,7 @@ QgsDecorationCopyrightDialog::~QgsDecorationCopyrightDialog()
|
||||
|
||||
void QgsDecorationCopyrightDialog::on_buttonBox_accepted()
|
||||
{
|
||||
mDeco.mQFont = txtCopyrightText->currentFont();
|
||||
mDeco.mLabelQString = txtCopyrightText->toPlainText();
|
||||
mDeco.mLabelQColor = pbnColorChooser->color();
|
||||
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->itemData( cboPlacement->currentIndex() ).toInt() ) );
|
||||
mDeco.mMarginHorizontal = spnHorizontal->value();
|
||||
mDeco.mMarginVertical = spnVertical->value();
|
||||
mDeco.setEnabled( grpEnable->isChecked() );
|
||||
|
||||
apply();
|
||||
accept();
|
||||
}
|
||||
|
||||
@ -87,6 +85,18 @@ void QgsDecorationCopyrightDialog::on_pbnColorChooser_colorChanged( const QColor
|
||||
txtCopyrightText->setTextCursor( cursor );
|
||||
}
|
||||
|
||||
void QgsDecorationCopyrightDialog::apply()
|
||||
{
|
||||
mDeco.mQFont = txtCopyrightText->currentFont();
|
||||
mDeco.mLabelQString = txtCopyrightText->toPlainText();
|
||||
mDeco.mLabelQColor = pbnColorChooser->color();
|
||||
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->itemData( cboPlacement->currentIndex() ).toInt() ) );
|
||||
mDeco.mMarginHorizontal = spnHorizontal->value();
|
||||
mDeco.mMarginVertical = spnVertical->value();
|
||||
mDeco.setEnabled( grpEnable->isChecked() );
|
||||
mDeco.update();
|
||||
}
|
||||
|
||||
void QgsDecorationCopyrightDialog::on_buttonBox_helpRequested()
|
||||
{
|
||||
QgsContextHelp::run( metaObject()->className() );
|
||||
|
@ -32,6 +32,7 @@ class APP_EXPORT QgsDecorationCopyrightDialog : public QDialog, private Ui::QgsD
|
||||
void on_buttonBox_rejected();
|
||||
void on_buttonBox_helpRequested();
|
||||
void on_pbnColorChooser_colorChanged( const QColor& c );
|
||||
void apply();
|
||||
|
||||
protected:
|
||||
QgsDecorationCopyright& mDeco;
|
||||
|
@ -55,8 +55,6 @@ class APP_EXPORT QgsDecorationItem: public QObject
|
||||
*/
|
||||
void setPlacement( Placement placement ) { mPlacement = placement; }
|
||||
|
||||
void update();
|
||||
|
||||
signals:
|
||||
void toggled( bool t );
|
||||
|
||||
@ -74,6 +72,9 @@ class APP_EXPORT QgsDecorationItem: public QObject
|
||||
virtual void setName( const char *name );
|
||||
virtual QString name() { return mName; }
|
||||
|
||||
//! Redraws the decoration
|
||||
void update();
|
||||
|
||||
protected:
|
||||
|
||||
/** True if decoration item has to be displayed*/
|
||||
|
@ -92,11 +92,7 @@ void QgsDecorationNorthArrow::saveToProject()
|
||||
void QgsDecorationNorthArrow::run()
|
||||
{
|
||||
QgsDecorationNorthArrowDialog dlg( *this, QgisApp::instance() );
|
||||
|
||||
if ( dlg.exec() )
|
||||
{
|
||||
update();
|
||||
}
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void QgsDecorationNorthArrow::render( QPainter * theQPainter )
|
||||
|
@ -11,15 +11,15 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsdecorationnortharrowdialog.h"
|
||||
|
||||
#include "qgsdecorationnortharrow.h"
|
||||
|
||||
#include "qgslogger.h"
|
||||
#include "qgscontexthelp.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QSettings>
|
||||
#include <cmath>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
|
||||
QgsDecorationNorthArrowDialog::QgsDecorationNorthArrowDialog( QgsDecorationNorthArrow& deco, QWidget* parent )
|
||||
: QDialog( parent ), mDeco( deco )
|
||||
@ -29,6 +29,9 @@ QgsDecorationNorthArrowDialog::QgsDecorationNorthArrowDialog( QgsDecorationNorth
|
||||
QSettings settings;
|
||||
restoreGeometry( settings.value( "/Windows/DecorationNorthArrow/geometry" ).toByteArray() );
|
||||
|
||||
QPushButton* applyButton = buttonBox->button( QDialogButtonBox::Apply );
|
||||
connect( applyButton, SIGNAL( clicked() ), this, SLOT( apply() ) );
|
||||
|
||||
// rotation
|
||||
rotatePixmap( mDeco.mRotationInt );
|
||||
// signal/slot connection defined in 'designer' causes the slider to
|
||||
@ -64,13 +67,7 @@ void QgsDecorationNorthArrowDialog::on_buttonBox_helpRequested()
|
||||
|
||||
void QgsDecorationNorthArrowDialog::on_buttonBox_accepted()
|
||||
{
|
||||
mDeco.mRotationInt = sliderRotation->value();
|
||||
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->itemData( cboPlacement->currentIndex() ).toInt() ) );
|
||||
mDeco.setEnabled( grpEnable->isChecked() );
|
||||
mDeco.mAutomatic = cboxAutomatic->isChecked();
|
||||
mDeco.mMarginHorizontal = spinHorizontal->value();
|
||||
mDeco.mMarginVertical = spinVertical->value();
|
||||
|
||||
apply();
|
||||
accept();
|
||||
}
|
||||
|
||||
@ -90,6 +87,17 @@ void QgsDecorationNorthArrowDialog::on_sliderRotation_valueChanged( int theInt )
|
||||
rotatePixmap( theInt );
|
||||
}
|
||||
|
||||
void QgsDecorationNorthArrowDialog::apply()
|
||||
{
|
||||
mDeco.mRotationInt = sliderRotation->value();
|
||||
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->itemData( cboPlacement->currentIndex() ).toInt() ) );
|
||||
mDeco.setEnabled( grpEnable->isChecked() );
|
||||
mDeco.mAutomatic = cboxAutomatic->isChecked();
|
||||
mDeco.mMarginHorizontal = spinHorizontal->value();
|
||||
mDeco.mMarginVertical = spinVertical->value();
|
||||
mDeco.update();
|
||||
}
|
||||
|
||||
void QgsDecorationNorthArrowDialog::rotatePixmap( int theRotationInt )
|
||||
{
|
||||
QPixmap myQPixmap;
|
||||
|
@ -34,6 +34,7 @@ class APP_EXPORT QgsDecorationNorthArrowDialog : public QDialog, private Ui::Qgs
|
||||
void on_buttonBox_helpRequested();
|
||||
void on_spinAngle_valueChanged( int theInt );
|
||||
void on_sliderRotation_valueChanged( int theInt );
|
||||
void apply();
|
||||
|
||||
protected:
|
||||
QgsDecorationNorthArrow& mDeco;
|
||||
|
@ -98,11 +98,7 @@ void QgsDecorationScaleBar::saveToProject()
|
||||
void QgsDecorationScaleBar::run()
|
||||
{
|
||||
QgsDecorationScaleBarDialog dlg( *this, QgisApp::instance()->mapCanvas()->mapUnits(), QgisApp::instance() );
|
||||
|
||||
if ( dlg.exec() )
|
||||
{
|
||||
update();
|
||||
}
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,14 +11,14 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsdecorationscalebardialog.h"
|
||||
|
||||
#include "qgsdecorationscalebar.h"
|
||||
|
||||
#include "qgslogger.h"
|
||||
#include "qgscontexthelp.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QSettings>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
|
||||
QgsDecorationScaleBarDialog::QgsDecorationScaleBarDialog( QgsDecorationScaleBar& deco, int units, QWidget* parent )
|
||||
: QDialog( parent ), mDeco( deco )
|
||||
@ -28,6 +28,9 @@ QgsDecorationScaleBarDialog::QgsDecorationScaleBarDialog( QgsDecorationScaleBar&
|
||||
QSettings settings;
|
||||
restoreGeometry( settings.value( "/Windows/DecorationScaleBar/geometry" ).toByteArray() );
|
||||
|
||||
QPushButton* applyButton = buttonBox->button( QDialogButtonBox::Apply );
|
||||
connect( applyButton, SIGNAL( clicked() ), this, SLOT( apply() ) );
|
||||
|
||||
// set the map units in the spin box
|
||||
spnSize->setShowClearButton( false );
|
||||
switch ( units )
|
||||
@ -79,7 +82,7 @@ void QgsDecorationScaleBarDialog::on_buttonBox_helpRequested()
|
||||
QgsContextHelp::run( metaObject()->className() );
|
||||
}
|
||||
|
||||
void QgsDecorationScaleBarDialog::on_buttonBox_accepted()
|
||||
void QgsDecorationScaleBarDialog::apply()
|
||||
{
|
||||
mDeco.setPlacement( static_cast< QgsDecorationItem::Placement>( cboPlacement->itemData( cboPlacement->currentIndex() ).toInt() ) );
|
||||
mDeco.mMarginHorizontal = spnHorizontal->value();
|
||||
@ -89,7 +92,12 @@ void QgsDecorationScaleBarDialog::on_buttonBox_accepted()
|
||||
mDeco.setEnabled( grpEnable->isChecked() );
|
||||
mDeco.mStyleIndex = cboStyle->currentIndex();
|
||||
mDeco.mColor = pbnChangeColor->color();
|
||||
mDeco.update();
|
||||
}
|
||||
|
||||
void QgsDecorationScaleBarDialog::on_buttonBox_accepted()
|
||||
{
|
||||
apply();
|
||||
accept();
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ class APP_EXPORT QgsDecorationScaleBarDialog : public QDialog, private Ui::QgsDe
|
||||
void on_buttonBox_accepted();
|
||||
void on_buttonBox_rejected();
|
||||
void on_buttonBox_helpRequested();
|
||||
void apply();
|
||||
|
||||
protected:
|
||||
QgsDecorationScaleBar& mDeco;
|
||||
|
@ -256,7 +256,7 @@ p, li { white-space: pre-wrap; }
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -321,7 +321,7 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -245,7 +245,7 @@
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -18,6 +18,16 @@
|
||||
<normaloff>../../../../../.designer/backup</normaloff>../../../../../.designer/backup</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="9" column="0" colspan="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="grpEnable">
|
||||
<property name="sizePolicy">
|
||||
@ -57,7 +67,7 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="3" column="0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblLocation">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@ -73,20 +83,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblMargin">
|
||||
<item row="4" column="1">
|
||||
<widget class="QgsSpinBox" name="spnSize">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>155</width>
|
||||
<width>338</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Margin from edge (%)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="textLabel1_3_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
@ -99,7 +112,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0" colspan="3">
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="chkSnapping">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
@ -115,39 +128,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="textLabel1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Scale bar style</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>cboStyle</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="textLabel1_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Size of bar</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spnSize</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cboPlacement">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
@ -163,7 +144,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="cboStyle">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
@ -202,42 +183,39 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QgsColorButtonV2" name="pbnChangeColor">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>338</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QgsSpinBox" name="spnSize">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="textLabel1_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>338</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
<property name="text">
|
||||
<string>Size of bar</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spnSize</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="textLabel1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Scale bar style</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>cboStyle</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="hlytMargin" stretch="0,0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
@ -360,19 +338,58 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblMargin">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>155</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Margin from edge (%)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QgsColorButtonV2" name="pbnChangeColor">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</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>
|
||||
<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>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user