Skip to content

Commit 395a82b

Browse files
committedMay 17, 2019
[ui] Harmonize effects stack properties to match revamped symbol selector
1 parent 13ec10e commit 395a82b

File tree

4 files changed

+127
-89
lines changed

4 files changed

+127
-89
lines changed
 

‎src/gui/effects/qgseffectstackpropertieswidget.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ QgsEffectStackPropertiesWidget::QgsEffectStackPropertiesWidget( QgsEffectStack *
107107
mPresentWidget = nullptr;
108108

109109
setupUi( this );
110+
this->layout()->setContentsMargins( 0, 0, 0, 0 );
111+
112+
mEffectsList->setMaximumHeight( static_cast< int >( Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 7 ) );
113+
mEffectsList->setMinimumHeight( mEffectsList->maximumHeight() );
114+
lblPreview->setMaximumWidth( mEffectsList->maximumHeight() );
110115

111116
mAddButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.svg" ) ) );
112117
mRemoveButton->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.svg" ) ) );
@@ -204,7 +209,7 @@ void QgsEffectStackPropertiesWidget::updateUi()
204209
void QgsEffectStackPropertiesWidget::updatePreview()
205210
{
206211
QPainter painter;
207-
QImage previewImage( 150, 150, QImage::Format_ARGB32 );
212+
QImage previewImage( 100, 100, QImage::Format_ARGB32 );
208213
previewImage.fill( Qt::transparent );
209214
painter.begin( &previewImage );
210215
painter.setRenderHint( QPainter::Antialiasing );
@@ -216,13 +221,13 @@ void QgsEffectStackPropertiesWidget::updatePreview()
216221
previewPicPainter.begin( &previewPic );
217222
previewPicPainter.setPen( Qt::red );
218223
previewPicPainter.setBrush( QColor( 255, 100, 100, 255 ) );
219-
previewPicPainter.drawEllipse( QPoint( 75, 75 ), 30, 30 );
224+
previewPicPainter.drawEllipse( QPoint( 50, 50 ), 20, 20 );
220225
previewPicPainter.end();
221226
mStack->render( previewPic, context );
222227
}
223228
else
224229
{
225-
context.painter()->translate( 35, 35 );
230+
context.painter()->translate( 20, 20 );
226231
mStack->render( *mPreviewPicture, context );
227232
}
228233
painter.end();

‎src/gui/symbology/qgslayerpropertieswidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ void QgsLayerPropertiesWidget::emitSignalChanged()
319319
mLayer->paintEffect()->setEnabled( false );
320320
paintEffectToggled = true;
321321
}
322-
mEffectWidget->setPreviewPicture( QgsSymbolLayerUtils::symbolLayerPreviewPicture( mLayer, QgsUnitTypes::RenderMillimeters, QSize( 80, 80 ) ) );
322+
mEffectWidget->setPreviewPicture( QgsSymbolLayerUtils::symbolLayerPreviewPicture( mLayer, QgsUnitTypes::RenderMillimeters, QSize( 60, 60 ) ) );
323323
if ( paintEffectToggled )
324324
{
325325
mLayer->paintEffect()->setEnabled( true );

‎src/ui/effects/qgseffectpropertieswidget.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<item>
3333
<widget class="QComboBox" name="mEffectTypeCombo">
3434
<property name="sizePolicy">
35-
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
35+
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
3636
<horstretch>0</horstretch>
3737
<verstretch>0</verstretch>
3838
</sizepolicy>

‎src/ui/effects/qgseffectstackpropertieswidgetbase.ui

Lines changed: 117 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,24 @@
1616
<layout class="QVBoxLayout" name="verticalLayout_3">
1717
<item>
1818
<layout class="QHBoxLayout" name="horizontalLayout">
19-
<item>
20-
<widget class="QListView" name="mEffectsList">
21-
<property name="sizePolicy">
22-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
23-
<horstretch>0</horstretch>
24-
<verstretch>0</verstretch>
25-
</sizepolicy>
26-
</property>
27-
<property name="maximumSize">
28-
<size>
29-
<width>16777215</width>
30-
<height>150</height>
31-
</size>
32-
</property>
33-
<property name="editTriggers">
34-
<set>QAbstractItemView::NoEditTriggers</set>
35-
</property>
36-
</widget>
37-
</item>
3819
<item>
3920
<widget class="QLabel" name="lblPreview">
4021
<property name="sizePolicy">
41-
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
22+
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
4223
<horstretch>0</horstretch>
4324
<verstretch>0</verstretch>
4425
</sizepolicy>
4526
</property>
4627
<property name="minimumSize">
4728
<size>
48-
<width>150</width>
49-
<height>150</height>
29+
<width>100</width>
30+
<height>100</height>
5031
</size>
5132
</property>
5233
<property name="maximumSize">
5334
<size>
54-
<width>16777215</width>
55-
<height>150</height>
35+
<width>120</width>
36+
<height>100</height>
5637
</size>
5738
</property>
5839
<property name="frameShape">
@@ -71,84 +52,136 @@
7152
<string/>
7253
</property>
7354
<property name="alignment">
74-
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
75-
</property>
76-
</widget>
77-
</item>
78-
</layout>
79-
</item>
80-
<item>
81-
<layout class="QHBoxLayout" name="pushBtnBox">
82-
<property name="spacing">
83-
<number>6</number>
84-
</property>
85-
<item>
86-
<widget class="QPushButton" name="mAddButton">
87-
<property name="maximumSize">
88-
<size>
89-
<width>50</width>
90-
<height>16777215</height>
91-
</size>
92-
</property>
93-
<property name="toolTip">
94-
<string>Add new effect</string>
55+
<set>Qt::AlignCenter</set>
9556
</property>
9657
</widget>
9758
</item>
9859
<item>
99-
<widget class="QPushButton" name="mRemoveButton">
100-
<property name="maximumSize">
101-
<size>
102-
<width>50</width>
103-
<height>16777215</height>
104-
</size>
105-
</property>
106-
<property name="toolTip">
107-
<string>Remove effect</string>
60+
<widget class="QListView" name="mEffectsList">
61+
<property name="sizePolicy">
62+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
63+
<horstretch>0</horstretch>
64+
<verstretch>0</verstretch>
65+
</sizepolicy>
10866
</property>
109-
</widget>
110-
</item>
111-
<item>
112-
<widget class="QPushButton" name="mUpButton">
11367
<property name="maximumSize">
11468
<size>
115-
<width>50</width>
116-
<height>16777215</height>
69+
<width>16777215</width>
70+
<height>150</height>
11771
</size>
11872
</property>
119-
<property name="toolTip">
120-
<string>Move up</string>
73+
<property name="editTriggers">
74+
<set>QAbstractItemView::NoEditTriggers</set>
12175
</property>
12276
</widget>
12377
</item>
12478
<item>
125-
<widget class="QPushButton" name="mDownButton">
126-
<property name="maximumSize">
127-
<size>
128-
<width>50</width>
129-
<height>16777215</height>
130-
</size>
131-
</property>
132-
<property name="toolTip">
133-
<string>Move down</string>
134-
</property>
135-
</widget>
79+
<layout class="QVBoxLayout" name="pushBtnBox_1">
80+
<property name="spacing">
81+
<number>4</number>
82+
</property>
83+
<item>
84+
<widget class="QPushButton" name="mAddButton">
85+
<property name="maximumSize">
86+
<size>
87+
<width>50</width>
88+
<height>16777215</height>
89+
</size>
90+
</property>
91+
<property name="toolTip">
92+
<string>Add new effect</string>
93+
</property>
94+
</widget>
95+
</item>
96+
<item>
97+
<widget class="QPushButton" name="mRemoveButton">
98+
<property name="maximumSize">
99+
<size>
100+
<width>50</width>
101+
<height>16777215</height>
102+
</size>
103+
</property>
104+
<property name="toolTip">
105+
<string>Remove effect</string>
106+
</property>
107+
</widget>
108+
</item>
109+
<item>
110+
<spacer name="verticalSpacer_1">
111+
<property name="orientation">
112+
<enum>Qt::Vertical</enum>
113+
</property>
114+
<property name="sizeHint" stdset="0">
115+
<size>
116+
<width>10</width>
117+
<height>80</height>
118+
</size>
119+
</property>
120+
<property name="sizeType">
121+
<enum>QSizePolicy::Preferred</enum>
122+
</property>
123+
</spacer>
124+
</item>
125+
</layout>
136126
</item>
137127
<item>
138-
<spacer name="horizontalSpacer">
139-
<property name="orientation">
140-
<enum>Qt::Horizontal</enum>
141-
</property>
142-
<property name="sizeHint" stdset="0">
143-
<size>
144-
<width>20</width>
145-
<height>20</height>
146-
</size>
147-
</property>
148-
</spacer>
128+
<layout class="QVBoxLayout" name="pushBtnBox_2">
129+
<property name="spacing">
130+
<number>4</number>
131+
</property>
132+
<item>
133+
<widget class="QPushButton" name="mUpButton">
134+
<property name="maximumSize">
135+
<size>
136+
<width>50</width>
137+
<height>16777215</height>
138+
</size>
139+
</property>
140+
<property name="toolTip">
141+
<string>Move up</string>
142+
</property>
143+
</widget>
144+
</item>
145+
<item>
146+
<widget class="QPushButton" name="mDownButton">
147+
<property name="maximumSize">
148+
<size>
149+
<width>50</width>
150+
<height>16777215</height>
151+
</size>
152+
</property>
153+
<property name="toolTip">
154+
<string>Move down</string>
155+
</property>
156+
</widget>
157+
</item>
158+
<item>
159+
<spacer name="verticalSpacer_2">
160+
<property name="orientation">
161+
<enum>Qt::Vertical</enum>
162+
</property>
163+
<property name="sizeHint" stdset="0">
164+
<size>
165+
<width>10</width>
166+
<height>80</height>
167+
</size>
168+
</property>
169+
<property name="sizeType">
170+
<enum>QSizePolicy::Preferred</enum>
171+
</property>
172+
</spacer>
173+
</item>
174+
</layout>
149175
</item>
150176
</layout>
151177
</item>
178+
<item>
179+
<widget class="Line" name="line">
180+
<property name="orientation">
181+
<enum>Qt::Horizontal</enum>
182+
</property>
183+
</widget>
184+
</item>
152185
<item>
153186
<widget class="QFrame" name="frame">
154187
<property name="sizePolicy">

0 commit comments

Comments
 (0)
Please sign in to comment.