Skip to content

Commit

Permalink
Label preview of adv labeling is collapsible
Browse files Browse the repository at this point in the history
  • Loading branch information
dakcarto committed Sep 15, 2012
1 parent 8f0cb99 commit d0800fb
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
19 changes: 19 additions & 0 deletions src/app/qgslabelinggui.cpp
Expand Up @@ -278,12 +278,31 @@ QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsM
mBufferAttributesPropertiesGroupBox->setCollapsed( true );
mFontAttributePropertiesGroupBox->setCollapsed( true );

connect( groupBox_mPreview,
SIGNAL( collapsedStateChanged( QgsCollapsibleGroupBox* ) ),
this,
SLOT( collapseSample( QgsCollapsibleGroupBox* ) ) );
}

QgsLabelingGui::~QgsLabelingGui()
{
}

void QgsLabelingGui::collapseSample( QgsCollapsibleGroupBox* grpbx )
{
if ( grpbx->isCollapsed() )
{
QList<int> splitSizes = mFontPreviewSplitter->sizes();
if ( splitSizes[0] > grpbx->height() )
{
int delta = splitSizes[0] - grpbx->height();
splitSizes[0] -= delta;
splitSizes[1] += delta;
mFontPreviewSplitter->setSizes( splitSizes );
}
}
}

void QgsLabelingGui::apply()
{
QgsPalLayerSettings settings = layerSettings();
Expand Down
1 change: 1 addition & 0 deletions src/app/qgslabelinggui.h
Expand Up @@ -38,6 +38,7 @@ class QgsLabelingGui : public QWidget, private Ui::QgsLabelingGuiBase
QgsPalLayerSettings layerSettings();

public slots:
void collapseSample( QgsCollapsibleGroupBox* grpbx );
void apply();
void changeTextColor();
void changeTextFont();
Expand Down
28 changes: 26 additions & 2 deletions src/ui/qgslabelingguibase.ui
Expand Up @@ -33,6 +33,15 @@
<item row="0" column="0">
<widget class="QFrame" name="frameLabelWith">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<item>
<widget class="QCheckBox" name="chkEnableLabeling">
<property name="text">
Expand Down Expand Up @@ -154,10 +163,13 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="handleWidth">
<number>10</number>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QGroupBox" name="groupBox_mPreview">
<widget class="QgsCollapsibleGroupBox" name="groupBox_mPreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
Expand All @@ -173,11 +185,23 @@
<property name="title">
<string>Sample</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
Expand Down

0 comments on commit d0800fb

Please sign in to comment.