mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
box switch
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@3074 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
789c6eeb99
commit
152ab639cd
@ -23,6 +23,7 @@
|
|||||||
#include <qwidget.h>
|
#include <qwidget.h>
|
||||||
#include <qrect.h>
|
#include <qrect.h>
|
||||||
#include <qcombobox.h>
|
#include <qcombobox.h>
|
||||||
|
#include <qcheckbox.h>
|
||||||
#include <qdom.h>
|
#include <qdom.h>
|
||||||
#include <qcanvas.h>
|
#include <qcanvas.h>
|
||||||
#include <qpainter.h>
|
#include <qpainter.h>
|
||||||
@ -131,6 +132,7 @@ void QgsComposerVectorLegend::init ( void )
|
|||||||
mTitle = "Legend";
|
mTitle = "Legend";
|
||||||
mMap = 0;
|
mMap = 0;
|
||||||
mNextLayerGroup = 1;
|
mNextLayerGroup = 1;
|
||||||
|
mFrame = true;
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
mCacheUpdated = false;
|
mCacheUpdated = false;
|
||||||
@ -485,14 +487,17 @@ void QgsComposerVectorLegend::draw ( QPainter & painter )
|
|||||||
<< " mPreviewMode = " << mPreviewMode << std::endl;
|
<< " mPreviewMode = " << mPreviewMode << std::endl;
|
||||||
|
|
||||||
// Draw background rectangle
|
// Draw background rectangle
|
||||||
painter.setPen( QPen(QColor(0,0,0), 1) );
|
|
||||||
painter.setBrush( QBrush( QColor(255,255,255), Qt::SolidPattern) );
|
|
||||||
|
|
||||||
painter.save();
|
if ( mFrame ) {
|
||||||
|
painter.setPen( QPen(QColor(0,0,0), 1) );
|
||||||
painter.translate ( QCanvasRectangle::x(), QCanvasRectangle::y() );
|
painter.setBrush( QBrush( QColor(255,255,255), Qt::SolidPattern) );
|
||||||
painter.drawRect ( 0, 0, QCanvasRectangle::width()+1, QCanvasRectangle::height()+1 ); // is it right?
|
|
||||||
painter.restore();
|
painter.save();
|
||||||
|
|
||||||
|
painter.translate ( QCanvasRectangle::x(), QCanvasRectangle::y() );
|
||||||
|
painter.drawRect ( 0, 0, QCanvasRectangle::width()+1, QCanvasRectangle::height()+1 ); // is it right?
|
||||||
|
painter.restore();
|
||||||
|
}
|
||||||
|
|
||||||
if ( plotStyle() == QgsComposition::Preview && mPreviewMode == Cache ) { // Draw from cache
|
if ( plotStyle() == QgsComposition::Preview && mPreviewMode == Cache ) { // Draw from cache
|
||||||
std::cout << "use cache" << std::endl;
|
std::cout << "use cache" << std::endl;
|
||||||
@ -588,6 +593,16 @@ void QgsComposerVectorLegend::mapChanged ( int id )
|
|||||||
QCanvasRectangle::canvas()->update();
|
QCanvasRectangle::canvas()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsComposerVectorLegend::frameChanged ( )
|
||||||
|
{
|
||||||
|
mFrame = mFrameCheckBox->isChecked();
|
||||||
|
|
||||||
|
QCanvasRectangle::update();
|
||||||
|
QCanvasRectangle::canvas()->update();
|
||||||
|
|
||||||
|
writeSettings();
|
||||||
|
}
|
||||||
|
|
||||||
void QgsComposerVectorLegend::recalculate ( void )
|
void QgsComposerVectorLegend::recalculate ( void )
|
||||||
{
|
{
|
||||||
std::cout << "QgsComposerVectorLegend::recalculate" << std::endl;
|
std::cout << "QgsComposerVectorLegend::recalculate" << std::endl;
|
||||||
@ -650,6 +665,8 @@ void QgsComposerVectorLegend::setOptions ( void )
|
|||||||
mMap = 0;
|
mMap = 0;
|
||||||
mMapComboBox->setCurrentItem ( 0 );
|
mMapComboBox->setCurrentItem ( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mFrameCheckBox->setChecked ( mFrame );
|
||||||
|
|
||||||
// Layers
|
// Layers
|
||||||
mLayersListView->clear();
|
mLayersListView->clear();
|
||||||
@ -829,6 +846,8 @@ bool QgsComposerVectorLegend::writeSettings ( void )
|
|||||||
QgsProject::instance()->writeEntry( "Compositions", path+"font/underline", mFont.underline() );
|
QgsProject::instance()->writeEntry( "Compositions", path+"font/underline", mFont.underline() );
|
||||||
QgsProject::instance()->writeEntry( "Compositions", path+"font/strikeout", mFont.strikeOut() );
|
QgsProject::instance()->writeEntry( "Compositions", path+"font/strikeout", mFont.strikeOut() );
|
||||||
|
|
||||||
|
QgsProject::instance()->writeEntry( "Compositions", path+"frame", mFrame );
|
||||||
|
|
||||||
// Layers: remove all, write new
|
// Layers: remove all, write new
|
||||||
path.sprintf("/composition_%d/vectorlegend_%d/layers/", mComposition->id(), mId );
|
path.sprintf("/composition_%d/vectorlegend_%d/layers/", mComposition->id(), mId );
|
||||||
QgsProject::instance()->removeEntry ( "Compositions", path );
|
QgsProject::instance()->removeEntry ( "Compositions", path );
|
||||||
@ -874,6 +893,8 @@ bool QgsComposerVectorLegend::readSettings ( void )
|
|||||||
mFont.setUnderline( QgsProject::instance()->readBoolEntry("Compositions", path+"font/underline", false, &ok) );
|
mFont.setUnderline( QgsProject::instance()->readBoolEntry("Compositions", path+"font/underline", false, &ok) );
|
||||||
mFont.setStrikeOut( QgsProject::instance()->readBoolEntry("Compositions", path+"font/strikeout", false, &ok) );
|
mFont.setStrikeOut( QgsProject::instance()->readBoolEntry("Compositions", path+"font/strikeout", false, &ok) );
|
||||||
|
|
||||||
|
mFrame = QgsProject::instance()->readBoolEntry("Compositions", path+"frame", true, &ok);
|
||||||
|
|
||||||
// Preview mode
|
// Preview mode
|
||||||
mPreviewMode = (PreviewMode) QgsProject::instance()->readNumEntry("Compositions", path+"previewmode", Render, &ok);
|
mPreviewMode = (PreviewMode) QgsProject::instance()->readNumEntry("Compositions", path+"previewmode", Render, &ok);
|
||||||
|
|
||||||
|
@ -173,6 +173,9 @@ public slots:
|
|||||||
// Combine selected layers
|
// Combine selected layers
|
||||||
void groupLayers( void );
|
void groupLayers( void );
|
||||||
|
|
||||||
|
// Frame settings changed
|
||||||
|
void frameChanged ( void );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Pointer to composition
|
// Pointer to composition
|
||||||
QgsComposition *mComposition;
|
QgsComposition *mComposition;
|
||||||
@ -228,6 +231,9 @@ private:
|
|||||||
|
|
||||||
/** \brief Layers list popup menu */
|
/** \brief Layers list popup menu */
|
||||||
QPopupMenu *mLayersPopupMenu;
|
QPopupMenu *mLayersPopupMenu;
|
||||||
|
|
||||||
|
/** \brief Draw frame */
|
||||||
|
bool mFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>212</width>
|
<width>216</width>
|
||||||
<height>419</height>
|
<height>419</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -88,6 +88,14 @@
|
|||||||
<string>Font</string>
|
<string>Font</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QCheckBox">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>mFrameCheckBox</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Box</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<widget class="QListView">
|
<widget class="QListView">
|
||||||
<column>
|
<column>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@ -168,12 +176,19 @@
|
|||||||
<receiver>QgsComposerVectorLegendBase</receiver>
|
<receiver>QgsComposerVectorLegendBase</receiver>
|
||||||
<slot>titleChanged()</slot>
|
<slot>titleChanged()</slot>
|
||||||
</connection>
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>mFrameCheckBox</sender>
|
||||||
|
<signal>stateChanged(int)</signal>
|
||||||
|
<receiver>QgsComposerVectorLegendBase</receiver>
|
||||||
|
<slot>frameChanged()</slot>
|
||||||
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>changeFont()</slot>
|
<slot>changeFont()</slot>
|
||||||
<slot>previewModeChanged(int)</slot>
|
<slot>previewModeChanged(int)</slot>
|
||||||
<slot>mapSelectionChanged(int)</slot>
|
<slot>mapSelectionChanged(int)</slot>
|
||||||
<slot>titleChanged()</slot>
|
<slot>titleChanged()</slot>
|
||||||
|
<slot>frameChanged()</slot>
|
||||||
</slots>
|
</slots>
|
||||||
<layoutdefaults spacing="6" margin="11"/>
|
<layoutdefaults spacing="6" margin="11"/>
|
||||||
</UI>
|
</UI>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user