38 #include <QAbstractButton>
39 #include <QColorDialog>
42 #include <QFileDialog>
45 #include <QStandardItemModel>
46 #include <QSvgRenderer>
47 #include <QMessageBox>
53 button->setProperty(
"propertyName", propertyName );
61 const QString propertyName( button->property(
"propertyName" ).toString() );
71 QString label = entryName;
72 if ( entryName ==
"size" )
81 label +=
" (" +
tr(
"area" ) +
")";
84 label +=
" (" +
tr(
"diameter" ) +
")";
98 mPenWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
99 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
100 mDashPatternUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
102 btnChangeColor->setAllowAlpha(
true );
103 btnChangeColor->setColorDialogTitle(
tr(
"Select line color" ) );
104 btnChangeColor->setContext(
"symbology" );
106 spinOffset->setClearValue( 0.0 );
111 mDrawInsideCheckBox->hide();
114 connect( spinWidth, SIGNAL( valueChanged(
double ) ),
this, SLOT(
penWidthChanged() ) );
116 connect( cboPenStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
penStyleChanged() ) );
117 connect( spinOffset, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
118 connect( cboCapStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
penStyleChanged() ) );
119 connect( cboJoinStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
penStyleChanged() ) );
126 if ( !layer || layer->
layerType() !=
"SimpleLine" )
133 mPenWidthUnitWidget->blockSignals(
true );
136 mPenWidthUnitWidget->blockSignals(
false );
137 mOffsetUnitWidget->blockSignals(
true );
140 mOffsetUnitWidget->blockSignals(
false );
141 mDashPatternUnitWidget->blockSignals(
true );
145 mDashPatternUnitWidget->blockSignals(
false );
148 spinWidth->blockSignals(
true );
150 spinWidth->blockSignals(
false );
151 btnChangeColor->blockSignals(
true );
153 btnChangeColor->blockSignals(
false );
154 spinOffset->blockSignals(
true );
156 spinOffset->blockSignals(
false );
157 cboPenStyle->blockSignals(
true );
158 cboJoinStyle->blockSignals(
true );
159 cboCapStyle->blockSignals(
true );
163 cboPenStyle->blockSignals(
false );
164 cboJoinStyle->blockSignals(
false );
165 cboCapStyle->blockSignals(
false );
169 mChangePatternButton->setEnabled( useCustomDashPattern );
170 label_3->setEnabled( !useCustomDashPattern );
171 cboPenStyle->setEnabled( !useCustomDashPattern );
172 mCustomCheckBox->blockSignals(
true );
173 mCustomCheckBox->setCheckState( useCustomDashPattern ? Qt::Checked : Qt::Unchecked );
174 mCustomCheckBox->blockSignals(
false );
178 mDrawInsideCheckBox->blockSignals(
true );
179 mDrawInsideCheckBox->setCheckState( drawInsidePolygon ? Qt::Checked : Qt::Unchecked );
180 mDrawInsideCheckBox->blockSignals(
false );
229 bool checked = ( state == Qt::Checked );
230 mChangePatternButton->setEnabled( checked );
231 label_3->setEnabled( !checked );
232 cboPenStyle->setEnabled( !checked );
241 if ( d.exec() == QDialog::Accepted )
284 bool checked = ( state == Qt::Checked );
303 mChangePatternButton->setIcon( buttonIcon );
317 mSizeUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
318 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
319 mOutlineWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
321 btnChangeColorFill->setAllowAlpha(
true );
322 btnChangeColorFill->setColorDialogTitle(
tr(
"Select fill color" ) );
323 btnChangeColorFill->setContext(
"symbology" );
324 btnChangeColorFill->setShowNoColor(
true );
325 btnChangeColorFill->setNoColorString(
tr(
"Transparent fill" ) );
326 btnChangeColorBorder->setAllowAlpha(
true );
327 btnChangeColorBorder->setColorDialogTitle(
tr(
"Select border color" ) );
328 btnChangeColorBorder->setContext(
"symbology" );
329 btnChangeColorBorder->setShowNoColor(
true );
330 btnChangeColorBorder->setNoColorString(
tr(
"Transparent border" ) );
332 spinOffsetX->setClearValue( 0.0 );
333 spinOffsetY->setClearValue( 0.0 );
335 QSize
size = lstNames->iconSize();
337 names <<
"circle" <<
"rectangle" <<
"diamond" <<
"pentagon" <<
"cross" <<
"cross2" <<
"triangle"
338 <<
"equilateral_triangle" <<
"star" <<
"regular_star" <<
"arrow" <<
"line" <<
"arrowhead" <<
"filled_arrowhead";
340 for (
int i = 0; i < names.count(); ++i )
344 QListWidgetItem* item =
new QListWidgetItem( icon, QString(), lstNames );
345 item->setData( Qt::UserRole, names[i] );
349 connect( lstNames, SIGNAL( currentRowChanged(
int ) ),
this, SLOT(
setName() ) );
350 connect( btnChangeColorBorder, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColorBorder(
const QColor& ) ) );
351 connect( btnChangeColorFill, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColorFill(
const QColor& ) ) );
352 connect( spinSize, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setSize() ) );
353 connect( spinAngle, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setAngle() ) );
354 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
355 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
360 if ( layer->
layerType() !=
"SimpleMarker" )
368 for (
int i = 0; i < lstNames->count(); ++i )
370 if ( lstNames->item( i )->data( Qt::UserRole ).toString() == name )
372 lstNames->setCurrentRow( i );
376 btnChangeColorBorder->blockSignals(
true );
378 btnChangeColorBorder->blockSignals(
false );
379 btnChangeColorFill->blockSignals(
true );
381 btnChangeColorFill->blockSignals(
false );
382 spinSize->blockSignals(
true );
384 spinSize->blockSignals(
false );
385 spinAngle->blockSignals(
true );
387 spinAngle->blockSignals(
false );
388 mOutlineStyleComboBox->blockSignals(
true );
390 mOutlineStyleComboBox->blockSignals(
false );
391 mOutlineWidthSpinBox->blockSignals(
true );
393 mOutlineWidthSpinBox->blockSignals(
false );
396 spinOffsetX->blockSignals(
true );
398 spinOffsetX->blockSignals(
false );
399 spinOffsetY->blockSignals(
true );
401 spinOffsetY->blockSignals(
false );
403 mSizeUnitWidget->blockSignals(
true );
406 mSizeUnitWidget->blockSignals(
false );
407 mOffsetUnitWidget->blockSignals(
true );
410 mOffsetUnitWidget->blockSignals(
false );
411 mOutlineWidthUnitWidget->blockSignals(
true );
414 mOutlineWidthUnitWidget->blockSignals(
false );
417 mHorizontalAnchorComboBox->blockSignals(
true );
418 mVerticalAnchorComboBox->blockSignals(
true );
421 mHorizontalAnchorComboBox->blockSignals(
false );
422 mVerticalAnchorComboBox->blockSignals(
false );
425 "<b>pentagon</b>|<b>triangle</b>|<b>equilateral_triangle</b>|"
426 "<b>star</b>|<b>regular_star</b>|<b>arrow</b>|<b>filled_arrowhead</b>|"
427 "<b>circle</b>|<b>cross</b>|<b>x</b>|"
428 "<b>cross2</b>|<b>line</b>|<b>arrowhead</b>]" ) );
447 mLayer->
setName( lstNames->currentItem()->data( Qt::UserRole ).toString() );
477 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
561 mBorderWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
562 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
564 btnChangeColor->setAllowAlpha(
true );
565 btnChangeColor->setColorDialogTitle(
tr(
"Select fill color" ) );
566 btnChangeColor->setContext(
"symbology" );
567 btnChangeColor->setShowNoColor(
true );
568 btnChangeColor->setNoColorString(
tr(
"Transparent fill" ) );
569 btnChangeBorderColor->setAllowAlpha(
true );
570 btnChangeBorderColor->setColorDialogTitle(
tr(
"Select border color" ) );
571 btnChangeBorderColor->setContext(
"symbology" );
572 btnChangeBorderColor->setShowNoColor(
true );
573 btnChangeBorderColor->setNoColorString(
tr(
"Transparent border" ) );
575 spinOffsetX->setClearValue( 0.0 );
576 spinOffsetY->setClearValue( 0.0 );
578 connect( btnChangeColor, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor(
const QColor& ) ) );
579 connect( cboFillStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
setBrushStyle() ) );
580 connect( btnChangeBorderColor, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setBorderColor(
const QColor& ) ) );
581 connect( spinBorderWidth, SIGNAL( valueChanged(
double ) ),
this, SLOT(
borderWidthChanged() ) );
582 connect( cboBorderStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
borderStyleChanged() ) );
583 connect( cboJoinStyle, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
borderStyleChanged() ) );
584 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
585 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
590 if ( layer->
layerType() !=
"SimpleFill" )
597 btnChangeColor->blockSignals(
true );
599 btnChangeColor->blockSignals(
false );
600 cboFillStyle->blockSignals(
true );
602 cboFillStyle->blockSignals(
false );
603 btnChangeBorderColor->blockSignals(
true );
605 btnChangeBorderColor->blockSignals(
false );
606 cboBorderStyle->blockSignals(
true );
608 cboBorderStyle->blockSignals(
false );
609 spinBorderWidth->blockSignals(
true );
611 spinBorderWidth->blockSignals(
false );
612 cboJoinStyle->blockSignals(
true );
614 cboJoinStyle->blockSignals(
false );
615 spinOffsetX->blockSignals(
true );
617 spinOffsetX->blockSignals(
false );
618 spinOffsetY->blockSignals(
true );
620 spinOffsetY->blockSignals(
false );
622 mBorderWidthUnitWidget->blockSignals(
true );
625 mBorderWidthUnitWidget->blockSignals(
false );
626 mOffsetUnitWidget->blockSignals(
true );
629 mOffsetUnitWidget->blockSignals(
false );
678 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
712 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
714 cboGradientColorRamp->setShowGradientOnly(
true );
717 btnChangeColor->setAllowAlpha(
true );
718 btnChangeColor->setColorDialogTitle(
tr(
"Select gradient color" ) );
719 btnChangeColor->setContext(
"symbology" );
720 btnChangeColor->setShowNoColor(
true );
721 btnChangeColor->setNoColorString(
tr(
"Transparent" ) );
722 btnChangeColor2->setAllowAlpha(
true );
723 btnChangeColor2->setColorDialogTitle(
tr(
"Select gradient color" ) );
724 btnChangeColor2->setContext(
"symbology" );
725 btnChangeColor2->setShowNoColor(
true );
726 btnChangeColor2->setNoColorString(
tr(
"Transparent" ) );
728 spinOffsetX->setClearValue( 0.0 );
729 spinOffsetY->setClearValue( 0.0 );
731 connect( btnChangeColor, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor(
const QColor& ) ) );
732 connect( btnChangeColor2, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor2(
const QColor& ) ) );
733 connect( cboGradientColorRamp, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
applyColorRamp() ) );
734 connect( cboGradientType, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
setGradientType(
int ) ) );
735 connect( cboCoordinateMode, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
setCoordinateMode(
int ) ) );
736 connect( cboGradientSpread, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
setGradientSpread(
int ) ) );
737 connect( radioTwoColor, SIGNAL( toggled(
bool ) ),
this, SLOT(
colorModeChanged() ) );
738 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
739 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
750 if ( layer->
layerType() !=
"GradientFill" )
757 btnChangeColor->blockSignals(
true );
759 btnChangeColor->blockSignals(
false );
760 btnChangeColor2->blockSignals(
true );
762 btnChangeColor2->blockSignals(
false );
766 radioTwoColor->setChecked(
true );
767 cboGradientColorRamp->setEnabled(
false );
771 radioColorRamp->setChecked(
true );
772 btnChangeColor->setEnabled(
false );
773 btnChangeColor2->setEnabled(
false );
779 cboGradientColorRamp->blockSignals(
true );
781 cboGradientColorRamp->blockSignals(
false );
784 cboGradientType->blockSignals(
true );
788 cboGradientType->setCurrentIndex( 0 );
791 cboGradientType->setCurrentIndex( 1 );
794 cboGradientType->setCurrentIndex( 2 );
797 cboGradientType->blockSignals(
false );
799 cboCoordinateMode->blockSignals(
true );
803 cboCoordinateMode->setCurrentIndex( 1 );
804 checkRefPoint1Centroid->setEnabled(
false );
805 checkRefPoint2Centroid->setEnabled(
false );
809 cboCoordinateMode->setCurrentIndex( 0 );
812 cboCoordinateMode->blockSignals(
false );
814 cboGradientSpread->blockSignals(
true );
818 cboGradientSpread->setCurrentIndex( 0 );
821 cboGradientSpread->setCurrentIndex( 1 );
824 cboGradientSpread->setCurrentIndex( 2 );
827 cboGradientSpread->blockSignals(
false );
829 spinRefPoint1X->blockSignals(
true );
831 spinRefPoint1X->blockSignals(
false );
832 spinRefPoint1Y->blockSignals(
true );
834 spinRefPoint1Y->blockSignals(
false );
835 checkRefPoint1Centroid->blockSignals(
true );
839 spinRefPoint1X->setEnabled(
false );
840 spinRefPoint1Y->setEnabled(
false );
842 checkRefPoint1Centroid->blockSignals(
false );
843 spinRefPoint2X->blockSignals(
true );
845 spinRefPoint2X->blockSignals(
false );
846 spinRefPoint2Y->blockSignals(
true );
848 spinRefPoint2Y->blockSignals(
false );
849 checkRefPoint2Centroid->blockSignals(
true );
853 spinRefPoint2X->setEnabled(
false );
854 spinRefPoint2Y->setEnabled(
false );
856 checkRefPoint2Centroid->blockSignals(
false );
858 spinOffsetX->blockSignals(
true );
860 spinOffsetX->blockSignals(
false );
861 spinOffsetY->blockSignals(
true );
863 spinOffsetY->blockSignals(
false );
864 mSpinAngle->blockSignals(
true );
866 mSpinAngle->blockSignals(
false );
868 mOffsetUnitWidget->blockSignals(
true );
871 mOffsetUnitWidget->blockSignals(
false );
906 if ( radioTwoColor->isChecked() )
935 if ( dlg.exec() && gradRamp )
938 cboGradientColorRamp->blockSignals(
true );
940 cboGradientColorRamp->blockSignals(
false );
957 spinRefPoint1X->setValue( 0.5 );
958 spinRefPoint1Y->setValue( 0 );
959 spinRefPoint2X->setValue( 0.5 );
960 spinRefPoint2Y->setValue( 1 );
965 spinRefPoint1X->setValue( 0 );
966 spinRefPoint1Y->setValue( 0 );
967 spinRefPoint2X->setValue( 1 );
968 spinRefPoint2Y->setValue( 1 );
972 spinRefPoint1X->setValue( 0.5 );
973 spinRefPoint1Y->setValue( 0.5 );
974 spinRefPoint2X->setValue( 1 );
975 spinRefPoint2Y->setValue( 1 );
990 checkRefPoint1Centroid->setEnabled(
true );
991 checkRefPoint2Centroid->setEnabled(
true );
997 checkRefPoint1Centroid->setChecked( Qt::Unchecked );
998 checkRefPoint1Centroid->setEnabled(
false );
999 checkRefPoint2Centroid->setChecked( Qt::Unchecked );
1000 checkRefPoint2Centroid->setEnabled(
false );
1027 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1065 mDistanceUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1066 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1068 btnChangeColor->setAllowAlpha(
true );
1069 btnChangeColor->setColorDialogTitle(
tr(
"Select gradient color" ) );
1070 btnChangeColor->setContext(
"symbology" );
1071 btnChangeColor->setShowNoColor(
true );
1072 btnChangeColor->setNoColorString(
tr(
"Transparent" ) );
1073 btnChangeColor2->setAllowAlpha(
true );
1074 btnChangeColor2->setColorDialogTitle(
tr(
"Select gradient color" ) );
1075 btnChangeColor2->setContext(
"symbology" );
1076 btnChangeColor2->setShowNoColor(
true );
1077 btnChangeColor2->setNoColorString(
tr(
"Transparent" ) );
1079 spinOffsetX->setClearValue( 0.0 );
1080 spinOffsetY->setClearValue( 0.0 );
1082 cboGradientColorRamp->setShowGradientOnly(
true );
1085 connect( cboGradientColorRamp, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT(
applyColorRamp() ) );
1086 connect( btnChangeColor, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor(
const QColor& ) ) );
1087 connect( btnChangeColor2, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor2(
const QColor& ) ) );
1088 connect( radioTwoColor, SIGNAL( toggled(
bool ) ),
this, SLOT(
colorModeChanged() ) );
1089 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
1090 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
offsetChanged() ) );
1092 connect( mBlurSlider, SIGNAL( valueChanged(
int ) ), mSpinBlurRadius, SLOT( setValue(
int ) ) );
1093 connect( mSpinBlurRadius, SIGNAL( valueChanged(
int ) ), mBlurSlider, SLOT( setValue(
int ) ) );
1098 if ( layer->
layerType() !=
"ShapeburstFill" )
1105 btnChangeColor->blockSignals(
true );
1107 btnChangeColor->blockSignals(
false );
1108 btnChangeColor2->blockSignals(
true );
1110 btnChangeColor2->blockSignals(
false );
1114 radioTwoColor->setChecked(
true );
1115 cboGradientColorRamp->setEnabled(
false );
1119 radioColorRamp->setChecked(
true );
1120 btnChangeColor->setEnabled(
false );
1121 btnChangeColor2->setEnabled(
false );
1124 mSpinBlurRadius->blockSignals(
true );
1125 mBlurSlider->blockSignals(
true );
1128 mSpinBlurRadius->blockSignals(
false );
1129 mBlurSlider->blockSignals(
false );
1131 mSpinMaxDistance->blockSignals(
true );
1133 mSpinMaxDistance->blockSignals(
false );
1135 mRadioUseWholeShape->blockSignals(
true );
1136 mRadioUseMaxDistance->blockSignals(
true );
1139 mRadioUseWholeShape->setChecked(
true );
1140 mSpinMaxDistance->setEnabled(
false );
1141 mDistanceUnitWidget->setEnabled(
false );
1145 mRadioUseMaxDistance->setChecked(
true );
1146 mSpinMaxDistance->setEnabled(
true );
1147 mDistanceUnitWidget->setEnabled(
true );
1149 mRadioUseWholeShape->blockSignals(
false );
1150 mRadioUseMaxDistance->blockSignals(
false );
1152 mDistanceUnitWidget->blockSignals(
true );
1155 mDistanceUnitWidget->blockSignals(
false );
1157 mIgnoreRingsCheckBox->blockSignals(
true );
1158 mIgnoreRingsCheckBox->setCheckState(
mLayer->
ignoreRings() ? Qt::Checked : Qt::Unchecked );
1159 mIgnoreRingsCheckBox->blockSignals(
false );
1164 cboGradientColorRamp->blockSignals(
true );
1166 cboGradientColorRamp->blockSignals(
false );
1169 spinOffsetX->blockSignals(
true );
1171 spinOffsetX->blockSignals(
false );
1172 spinOffsetY->blockSignals(
true );
1174 spinOffsetY->blockSignals(
false );
1175 mOffsetUnitWidget->blockSignals(
true );
1178 mOffsetUnitWidget->blockSignals(
false );
1218 if ( radioTwoColor->isChecked() )
1263 mDistanceUnitWidget->setEnabled( !value );
1286 if ( dlg.exec() && gradRamp )
1289 cboGradientColorRamp->blockSignals(
true );
1291 cboGradientColorRamp->blockSignals(
false );
1305 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1324 bool checked = ( state == Qt::Checked );
1337 mIntervalUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1338 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1339 mOffsetAlongLineUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1341 spinOffset->setClearValue( 0.0 );
1343 connect( spinInterval, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setInterval(
double ) ) );
1344 connect( mSpinOffsetAlongLine, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffsetAlongLine(
double ) ) );
1345 connect( chkRotateMarker, SIGNAL( clicked() ),
this, SLOT(
setRotate() ) );
1346 connect( spinOffset, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
1347 connect( radInterval, SIGNAL( clicked() ),
this, SLOT(
setPlacement() ) );
1348 connect( radVertex, SIGNAL( clicked() ),
this, SLOT(
setPlacement() ) );
1349 connect( radVertexLast, SIGNAL( clicked() ),
this, SLOT(
setPlacement() ) );
1350 connect( radVertexFirst, SIGNAL( clicked() ),
this, SLOT(
setPlacement() ) );
1351 connect( radCentralPoint, SIGNAL( clicked() ),
this, SLOT(
setPlacement() ) );
1356 if ( layer->
layerType() !=
"MarkerLine" )
1363 spinInterval->blockSignals(
true );
1365 spinInterval->blockSignals(
false );
1366 mSpinOffsetAlongLine->blockSignals(
true );
1368 mSpinOffsetAlongLine->blockSignals(
false );
1369 chkRotateMarker->blockSignals(
true );
1371 chkRotateMarker->blockSignals(
false );
1372 spinOffset->blockSignals(
true );
1374 spinOffset->blockSignals(
false );
1376 radInterval->setChecked(
true );
1378 radVertex->setChecked(
true );
1380 radVertexLast->setChecked(
true );
1382 radCentralPoint->setChecked(
true );
1384 radVertexFirst->setChecked(
true );
1387 mIntervalUnitWidget->blockSignals(
true );
1390 mIntervalUnitWidget->blockSignals(
false );
1391 mOffsetUnitWidget->blockSignals(
true );
1394 mOffsetUnitWidget->blockSignals(
false );
1395 mOffsetAlongLineUnitWidget->blockSignals(
true );
1398 mOffsetAlongLineUnitWidget->blockSignals(
false );
1439 bool interval = radInterval->isChecked();
1440 spinInterval->setEnabled( interval );
1441 mSpinOffsetAlongLine->setEnabled( radInterval->isChecked() || radVertexLast->isChecked() || radVertexFirst->isChecked() );
1443 if ( radInterval->isChecked() )
1445 else if ( radVertex->isChecked() )
1447 else if ( radVertexLast->isChecked() )
1449 else if ( radVertexFirst->isChecked() )
1499 mSizeUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1500 mBorderWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1501 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1502 viewGroups->setHeaderHidden(
true );
1504 mChangeColorButton->setColorDialogTitle(
tr(
"Select fill color" ) );
1505 mChangeColorButton->setContext(
"symbology" );
1506 mChangeBorderColorButton->setColorDialogTitle(
tr(
"Select border color" ) );
1507 mChangeColorButton->setContext(
"symbology" );
1509 spinOffsetX->setClearValue( 0.0 );
1510 spinOffsetY->setClearValue( 0.0 );
1514 connect( viewImages->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT(
setName(
const QModelIndex& ) ) );
1515 connect( viewGroups->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT(
populateIcons(
const QModelIndex& ) ) );
1516 connect( spinSize, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setSize() ) );
1517 connect( spinAngle, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setAngle() ) );
1518 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
1519 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
1523 #include <QAbstractListModel>
1524 #include <QPixmapCache>
1541 int rowCount(
const QModelIndex & parent = QModelIndex() )
const override
1547 QVariant
data(
const QModelIndex &
index,
int role = Qt::DisplayRole )
const override
1549 QString entry =
mSvgFiles.at( index.row() );
1551 if ( role == Qt::DecorationRole )
1554 if ( !QPixmapCache::find( entry, pixmap ) )
1559 bool fillParam, outlineParam, outlineWidthParam;
1564 pixmap = QPixmap::fromImage( img );
1565 QPixmapCache::insert( entry, pixmap );
1570 else if ( role == Qt::UserRole || role == Qt::ToolTipRole )
1588 QStandardItem *parentItem = invisibleRootItem();
1590 for (
int i = 0; i < svgPaths.size(); i++ )
1592 QDir dir( svgPaths[i] );
1593 QStandardItem *baseGroup;
1597 baseGroup =
new QStandardItem( QString(
"App Symbols" ) );
1601 baseGroup =
new QStandardItem( QString(
"User Symbols" ) );
1605 baseGroup =
new QStandardItem( dir.dirName() );
1607 baseGroup->setData( QVariant( svgPaths[i] ) );
1608 baseGroup->setEditable(
false );
1609 baseGroup->setCheckable(
false );
1610 baseGroup->setIcon( QgsApplication::style()->standardIcon( QStyle::SP_DirIcon ) );
1611 baseGroup->setToolTip( dir.path() );
1612 parentItem->appendRow( baseGroup );
1613 createTree( baseGroup );
1614 QgsDebugMsg( QString(
"SVG base path %1: %2" ).arg( i ).arg( baseGroup->data().toString() ) );
1618 void createTree( QStandardItem* &parentGroup )
1620 QDir parentDir( parentGroup->data().toString() );
1621 foreach ( QString item, parentDir.entryList( QDir::Dirs | QDir::NoDotAndDotDot ) )
1623 QStandardItem* group =
new QStandardItem( item );
1624 group->setData( QVariant( parentDir.path() +
"/" + item ) );
1625 group->setEditable(
false );
1626 group->setCheckable(
false );
1627 group->setToolTip( parentDir.path() +
"/" + item );
1628 group->setIcon( QgsApplication::style()->standardIcon( QStyle::SP_DirIcon ) );
1629 parentGroup->appendRow( group );
1630 createTree( group );
1638 viewGroups->setModel( g );
1640 int rows = g->rowCount( g->indexFromItem( g->invisibleRootItem() ) );
1641 for (
int i = 0; i < rows; i++ )
1643 viewGroups->setExpanded( g->indexFromItem( g->item( i ) ),
true );
1648 viewImages->setModel( m );
1653 QString path = idx.data( Qt::UserRole + 1 ).toString();
1656 viewImages->setModel( m );
1658 connect( viewImages->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT(
setName(
const QModelIndex& ) ) );
1670 bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
1671 QColor defaultFill, defaultOutline;
1672 double defaultOutlineWidth;
1674 mChangeColorButton->setEnabled( hasFillParam );
1675 mChangeBorderColorButton->setEnabled( hasOutlineParam );
1676 mBorderWidthSpinBox->setEnabled( hasOutlineWidthParam );
1682 mChangeColorButton->setColor( layer->
fillColor() );
1686 mChangeColorButton->setColor( defaultFill );
1689 if ( hasOutlineParam )
1693 mChangeBorderColorButton->setColor( layer->
outlineColor() );
1697 mChangeBorderColorButton->setColor( defaultOutline );
1701 mFileLineEdit->blockSignals(
true );
1702 mFileLineEdit->setText( layer->
path() );
1703 mFileLineEdit->blockSignals(
false );
1705 mBorderWidthSpinBox->blockSignals(
true );
1706 mBorderWidthSpinBox->setValue( layer->
outlineWidth() );
1707 mBorderWidthSpinBox->blockSignals(
false );
1718 if ( layer->
layerType() !=
"SvgMarker" )
1726 QAbstractItemModel* m = viewImages->model();
1727 QItemSelectionModel* selModel = viewImages->selectionModel();
1728 for (
int i = 0; i < m->rowCount(); i++ )
1730 QModelIndex idx( m->index( i, 0 ) );
1731 if ( m->data( idx ).toString() ==
mLayer->
path() )
1733 selModel->select( idx, QItemSelectionModel::SelectCurrent );
1734 selModel->setCurrentIndex( idx, QItemSelectionModel::SelectCurrent );
1740 spinSize->blockSignals(
true );
1742 spinSize->blockSignals(
false );
1743 spinAngle->blockSignals(
true );
1745 spinAngle->blockSignals(
false );
1748 spinOffsetX->blockSignals(
true );
1750 spinOffsetX->blockSignals(
false );
1751 spinOffsetY->blockSignals(
true );
1753 spinOffsetY->blockSignals(
false );
1755 mSizeUnitWidget->blockSignals(
true );
1758 mSizeUnitWidget->blockSignals(
false );
1759 mBorderWidthUnitWidget->blockSignals(
true );
1762 mBorderWidthUnitWidget->blockSignals(
false );
1763 mOffsetUnitWidget->blockSignals(
true );
1766 mOffsetUnitWidget->blockSignals(
false );
1769 mHorizontalAnchorComboBox->blockSignals(
true );
1770 mVerticalAnchorComboBox->blockSignals(
true );
1773 mHorizontalAnchorComboBox->blockSignals(
false );
1774 mVerticalAnchorComboBox->blockSignals(
false );
1796 QString name = idx.data( Qt::UserRole ).toString();
1798 mFileLineEdit->setText( name );
1818 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
1825 QString
file = QFileDialog::getOpenFileName( 0,
1826 tr(
"Select SVG file" ),
1827 s.value(
"/UI/lastSVGMarkerDir" ).toString(),
1828 tr(
"SVG files" ) +
" (*.svg)" );
1829 QFileInfo fi( file );
1830 if ( file.isEmpty() || !fi.exists() )
1834 mFileLineEdit->setText( file );
1836 s.setValue(
"/UI/lastSVGMarkerDir", fi.absolutePath() );
1842 if ( !QFileInfo( text ).exists() )
1853 if ( !QFileInfo( mFileLineEdit->text() ).exists() )
1855 QUrl url( mFileLineEdit->text() );
1856 if ( !url.isValid() )
1862 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
1864 QApplication::restoreOverrideCursor();
1954 #include <QFileDialog>
1960 mTextureWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1961 mSvgOutlineWidthUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
1962 mSvgTreeView->setHeaderHidden(
true );
1965 mChangeColorButton->setColorDialogTitle(
tr(
"Select fill color" ) );
1966 mChangeColorButton->setContext(
"symbology" );
1967 mChangeBorderColorButton->setColorDialogTitle(
tr(
"Select border color" ) );
1968 mChangeBorderColorButton->setContext(
"symbology" );
1970 connect( mSvgListView->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT( setFile(
const QModelIndex& ) ) );
1971 connect( mSvgTreeView->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT( populateIcons(
const QModelIndex& ) ) );
1990 mTextureWidthSpinBox->blockSignals(
true );
1991 mTextureWidthSpinBox->setValue( width );
1992 mTextureWidthSpinBox->blockSignals(
false );
1994 mRotationSpinBox->blockSignals(
true );
1996 mRotationSpinBox->blockSignals(
false );
1997 mTextureWidthUnitWidget->blockSignals(
true );
2000 mTextureWidthUnitWidget->blockSignals(
false );
2001 mSvgOutlineWidthUnitWidget->blockSignals(
true );
2004 mSvgOutlineWidthUnitWidget->blockSignals(
false );
2005 mChangeColorButton->blockSignals(
true );
2007 mChangeColorButton->blockSignals(
false );
2008 mChangeBorderColorButton->blockSignals(
true );
2010 mChangeBorderColorButton->blockSignals(
false );
2011 mBorderWidthSpinBox->blockSignals(
true );
2013 mBorderWidthSpinBox->blockSignals(
false );
2030 void QgsSVGFillSymbolLayerWidget::on_mBrowseToolButton_clicked()
2032 QString filePath = QFileDialog::getOpenFileName( 0,
tr(
"Select SVG texture file" ), QString(),
tr(
"SVG file" ) +
" (*.svg);;" +
tr(
"All files" ) +
" (*.*)" );
2033 if ( !filePath.isNull() )
2035 mSVGLineEdit->setText( filePath );
2040 void QgsSVGFillSymbolLayerWidget::on_mTextureWidthSpinBox_valueChanged(
double d )
2049 void QgsSVGFillSymbolLayerWidget::on_mSVGLineEdit_textEdited(
const QString & text )
2056 QFileInfo fi( text );
2066 void QgsSVGFillSymbolLayerWidget::on_mSVGLineEdit_editingFinished()
2073 QFileInfo fi( mSVGLineEdit->text() );
2076 QUrl url( mSVGLineEdit->text() );
2077 if ( !url.isValid() )
2083 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
2085 QApplication::restoreOverrideCursor();
2091 void QgsSVGFillSymbolLayerWidget::setFile(
const QModelIndex& item )
2093 QString
file = item.data( Qt::UserRole ).toString();
2095 mSVGLineEdit->setText( file );
2104 mSvgTreeView->setModel( g );
2106 int rows = g->rowCount( g->indexFromItem( g->invisibleRootItem() ) );
2107 for (
int i = 0; i < rows; i++ )
2109 mSvgTreeView->setExpanded( g->indexFromItem( g->item( i ) ),
true );
2113 mSvgListView->setModel( m );
2116 void QgsSVGFillSymbolLayerWidget::populateIcons(
const QModelIndex& idx )
2118 QString path = idx.data( Qt::UserRole + 1 ).toString();
2121 mSvgListView->setModel( m );
2123 connect( mSvgListView->selectionModel(), SIGNAL( currentChanged(
const QModelIndex&,
const QModelIndex& ) ),
this, SLOT( setFile(
const QModelIndex& ) ) );
2128 void QgsSVGFillSymbolLayerWidget::on_mRotationSpinBox_valueChanged(
double d )
2140 bool hasFillParam, hasOutlineParam, hasOutlineWidthParam;
2141 QColor defaultFill, defaultOutline;
2142 double defaultOutlineWidth;
2144 if ( hasFillParam && resetValues )
2146 mChangeColorButton->setColor( defaultFill );
2148 mChangeColorButton->setEnabled( hasFillParam );
2149 if ( hasOutlineParam && resetValues )
2151 mChangeBorderColorButton->setColor( defaultOutline );
2153 mChangeBorderColorButton->setEnabled( hasOutlineParam );
2154 if ( hasOutlineWidthParam && resetValues )
2156 mBorderWidthSpinBox->setValue( defaultOutlineWidth );
2158 mBorderWidthSpinBox->setEnabled( hasOutlineWidthParam );
2161 void QgsSVGFillSymbolLayerWidget::on_mChangeColorButton_colorChanged(
const QColor& color )
2172 void QgsSVGFillSymbolLayerWidget::on_mChangeBorderColorButton_colorChanged(
const QColor& color )
2183 void QgsSVGFillSymbolLayerWidget::on_mBorderWidthSpinBox_valueChanged(
double d )
2192 void QgsSVGFillSymbolLayerWidget::on_mTextureWidthUnitWidget_changed()
2203 void QgsSVGFillSymbolLayerWidget::on_mSvgOutlineWidthUnitWidget_changed()
2220 mDistanceUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2221 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2226 if ( layer->
layerType() !=
"LinePatternFill" )
2235 mAngleSpinBox->blockSignals(
true );
2237 mAngleSpinBox->blockSignals(
false );
2238 mDistanceSpinBox->blockSignals(
true );
2240 mDistanceSpinBox->blockSignals(
false );
2241 mOffsetSpinBox->blockSignals(
true );
2243 mOffsetSpinBox->blockSignals(
false );
2246 mDistanceUnitWidget->blockSignals(
true );
2249 mDistanceUnitWidget->blockSignals(
false );
2250 mOffsetUnitWidget->blockSignals(
true );
2253 mOffsetUnitWidget->blockSignals(
false );
2265 void QgsLinePatternFillSymbolLayerWidget::on_mAngleSpinBox_valueChanged(
double d )
2274 void QgsLinePatternFillSymbolLayerWidget::on_mDistanceSpinBox_valueChanged(
double d )
2283 void QgsLinePatternFillSymbolLayerWidget::on_mOffsetSpinBox_valueChanged(
double d )
2292 void QgsLinePatternFillSymbolLayerWidget::on_mDistanceUnitWidget_changed()
2303 void QgsLinePatternFillSymbolLayerWidget::on_mOffsetUnitWidget_changed()
2320 mHorizontalDistanceUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2321 mVerticalDistanceUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2322 mHorizontalDisplacementUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2323 mVerticalDisplacementUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2329 if ( !layer || layer->
layerType() !=
"PointPatternFill" )
2335 mHorizontalDistanceSpinBox->blockSignals(
true );
2337 mHorizontalDistanceSpinBox->blockSignals(
false );
2338 mVerticalDistanceSpinBox->blockSignals(
true );
2340 mVerticalDistanceSpinBox->blockSignals(
false );
2341 mHorizontalDisplacementSpinBox->blockSignals(
true );
2343 mHorizontalDisplacementSpinBox->blockSignals(
false );
2344 mVerticalDisplacementSpinBox->blockSignals(
true );
2346 mVerticalDisplacementSpinBox->blockSignals(
false );
2348 mHorizontalDistanceUnitWidget->blockSignals(
true );
2351 mHorizontalDistanceUnitWidget->blockSignals(
false );
2352 mVerticalDistanceUnitWidget->blockSignals(
true );
2355 mVerticalDistanceUnitWidget->blockSignals(
false );
2356 mHorizontalDisplacementUnitWidget->blockSignals(
true );
2359 mHorizontalDisplacementUnitWidget->blockSignals(
false );
2360 mVerticalDisplacementUnitWidget->blockSignals(
true );
2363 mVerticalDisplacementUnitWidget->blockSignals(
false );
2376 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDistanceSpinBox_valueChanged(
double d )
2385 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDistanceSpinBox_valueChanged(
double d )
2394 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDisplacementSpinBox_valueChanged(
double d )
2403 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDisplacementSpinBox_valueChanged(
double d )
2412 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDistanceUnitWidget_changed()
2423 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDistanceUnitWidget_changed()
2434 void QgsPointPatternFillSymbolLayerWidget::on_mHorizontalDisplacementUnitWidget_changed()
2445 void QgsPointPatternFillSymbolLayerWidget::on_mVerticalDisplacementUnitWidget_changed()
2464 mSizeUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2465 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2469 btnColor->setAllowAlpha(
true );
2470 btnColor->setColorDialogTitle(
tr(
"Select symbol color" ) );
2471 btnColor->setContext(
"symbology" );
2473 spinOffsetX->setClearValue( 0.0 );
2474 spinOffsetY->setClearValue( 0.0 );
2476 connect( cboFont, SIGNAL( currentFontChanged(
const QFont & ) ),
this, SLOT(
setFontFamily(
const QFont& ) ) );
2477 connect( spinSize, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setSize(
double ) ) );
2478 connect( btnColor, SIGNAL( colorChanged(
const QColor& ) ),
this, SLOT(
setColor(
const QColor& ) ) );
2479 connect( spinAngle, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setAngle(
double ) ) );
2480 connect( spinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
2481 connect( spinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT(
setOffset() ) );
2482 connect(
widgetChar, SIGNAL( characterSelected(
const QChar & ) ),
this, SLOT(
setCharacter(
const QChar & ) ) );
2488 if ( layer->
layerType() !=
"FontMarker" )
2495 cboFont->blockSignals(
true );
2497 cboFont->blockSignals(
false );
2498 spinSize->blockSignals(
true );
2500 spinSize->blockSignals(
false );
2501 btnColor->blockSignals(
true );
2503 btnColor->blockSignals(
false );
2504 spinAngle->blockSignals(
true );
2506 spinAngle->blockSignals(
false );
2509 spinOffsetX->blockSignals(
true );
2511 spinOffsetX->blockSignals(
false );
2512 spinOffsetY->blockSignals(
true );
2514 spinOffsetY->blockSignals(
false );
2516 mSizeUnitWidget->blockSignals(
true );
2519 mSizeUnitWidget->blockSignals(
false );
2521 mOffsetUnitWidget->blockSignals(
true );
2524 mOffsetUnitWidget->blockSignals(
false );
2527 mHorizontalAnchorComboBox->blockSignals(
true );
2528 mVerticalAnchorComboBox->blockSignals(
true );
2531 mHorizontalAnchorComboBox->blockSignals(
false );
2532 mVerticalAnchorComboBox->blockSignals(
false );
2574 mLayer->
setOffset( QPointF( spinOffsetX->value(), spinOffsetY->value() ) );
2632 if ( layer->
layerType() !=
"CentroidFill" )
2639 mDrawInsideCheckBox->blockSignals(
true );
2641 mDrawInsideCheckBox->blockSignals(
false );
2663 mWidthUnitWidget->setUnits( QStringList() <<
tr(
"Pixels" ) <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2664 mOffsetUnitWidget->setUnits( QStringList() <<
tr(
"Millimeter" ) <<
tr(
"Map unit" ), 1 );
2666 mSpinOffsetX->setClearValue( 0.0 );
2667 mSpinOffsetY->setClearValue( 0.0 );
2669 connect( cboCoordinateMode, SIGNAL( currentIndexChanged(
int ) ),
this, SLOT( setCoordinateMode(
int ) ) );
2670 connect( mSpinOffsetX, SIGNAL( valueChanged(
double ) ),
this, SLOT( offsetChanged() ) );
2671 connect( mSpinOffsetY, SIGNAL( valueChanged(
double ) ),
this, SLOT( offsetChanged() ) );
2681 if ( layer->
layerType() !=
"RasterFill" )
2692 mImageLineEdit->blockSignals(
true );
2694 mImageLineEdit->blockSignals(
false );
2696 cboCoordinateMode->blockSignals(
true );
2700 cboCoordinateMode->setCurrentIndex( 1 );
2704 cboCoordinateMode->setCurrentIndex( 0 );
2707 cboCoordinateMode->blockSignals(
false );
2708 mSpinTransparency->blockSignals(
true );
2709 mSpinTransparency->setValue(
mLayer->
alpha() * 100.0 );
2710 mSpinTransparency->blockSignals(
false );
2711 mSliderTransparency->blockSignals(
true );
2712 mSliderTransparency->setValue(
mLayer->
alpha() * 100.0 );
2713 mSliderTransparency->blockSignals(
false );
2714 mRotationSpinBox->blockSignals(
true );
2716 mRotationSpinBox->blockSignals(
false );
2718 mSpinOffsetX->blockSignals(
true );
2720 mSpinOffsetX->blockSignals(
false );
2721 mSpinOffsetY->blockSignals(
true );
2723 mSpinOffsetY->blockSignals(
false );
2724 mOffsetUnitWidget->blockSignals(
true );
2727 mOffsetUnitWidget->blockSignals(
false );
2729 mWidthSpinBox->blockSignals(
true );
2731 mWidthSpinBox->blockSignals(
false );
2732 mWidthUnitWidget->blockSignals(
true );
2736 mWidthUnitWidget->setUnit( 1 );
2739 mWidthUnitWidget->setUnit( 2 );
2743 mWidthUnitWidget->setUnit( 0 );
2747 mWidthUnitWidget->blockSignals(
false );
2748 updatePreviewImage();
2761 void QgsRasterFillSymbolLayerWidget::on_mBrowseToolButton_clicked()
2765 QString lineEditText = mImageLineEdit->text();
2766 if ( !lineEditText.isEmpty() )
2768 QFileInfo openDirFileInfo( lineEditText );
2769 openDir = openDirFileInfo.path();
2772 if ( openDir.isEmpty() )
2774 openDir = s.value(
"/UI/lastRasterFillImageDir",
"" ).toString();
2778 QString filePath = QFileDialog::getOpenFileName( 0,
tr(
"Select image file" ), openDir );
2779 if ( !filePath.isNull() )
2782 QFileInfo fileInfo( filePath );
2783 if ( !fileInfo.exists() || !fileInfo.isReadable() )
2785 QMessageBox::critical( 0,
"Invalid file",
"Error, file does not exist or is not readable" );
2789 s.setValue(
"/UI/lastRasterFillImageDir", fileInfo.absolutePath() );
2790 mImageLineEdit->setText( filePath );
2791 on_mImageLineEdit_editingFinished();
2795 void QgsRasterFillSymbolLayerWidget::on_mImageLineEdit_editingFinished()
2802 QFileInfo fi( mImageLineEdit->text() );
2805 QUrl url( mImageLineEdit->text() );
2806 if ( !url.isValid() )
2812 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
2814 updatePreviewImage();
2815 QApplication::restoreOverrideCursor();
2820 void QgsRasterFillSymbolLayerWidget::setCoordinateMode(
int index )
2837 void QgsRasterFillSymbolLayerWidget::on_mSpinTransparency_valueChanged(
int value )
2846 updatePreviewImage();
2849 void QgsRasterFillSymbolLayerWidget::offsetChanged()
2851 mLayer->
setOffset( QPointF( mSpinOffsetX->value(), mSpinOffsetY->value() ) );
2855 void QgsRasterFillSymbolLayerWidget::on_mOffsetUnitWidget_changed()
2867 void QgsRasterFillSymbolLayerWidget::on_mRotationSpinBox_valueChanged(
double d )
2876 void QgsRasterFillSymbolLayerWidget::on_mWidthUnitWidget_changed()
2883 switch ( mWidthUnitWidget->getUnit() )
2902 void QgsRasterFillSymbolLayerWidget::on_mWidthSpinBox_valueChanged(
double d )
2913 void QgsRasterFillSymbolLayerWidget::updatePreviewImage()
2921 if ( image.isNull() )
2923 mLabelImagePreview->setPixmap( QPixmap() );
2927 if ( image.height() > 150 || image.width() > 150 )
2929 image = image.scaled( 150, 150, Qt::KeepAspectRatio, Qt::SmoothTransformation );
2932 QImage previewImage( 150, 150, QImage::Format_ARGB32 );
2933 previewImage.fill( Qt::transparent );
2934 QRect imageRect(( 150 - image.width() ) / 2.0, ( 150 - image.height() ) / 2.0, image.width(), image.height() );
2936 p.begin( &previewImage );
2938 uchar pixDataRGB[] = { 150, 150, 150, 150,
2943 QImage img( pixDataRGB, 2, 2, 8, QImage::Format_ARGB32 );
2944 QPixmap pix = QPixmap::fromImage( img.scaled( 8, 8 ) );
2945 QBrush checkerBrush;
2946 checkerBrush.setTexture( pix );
2947 p.fillRect( imageRect, checkerBrush );
2954 p.drawImage( imageRect.left(), imageRect.top(), image );
2956 mLabelImagePreview->setPixmap( QPixmap::fromImage( previewImage ) );