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