Skip to content
Permalink
Browse files

Merge branch 'master' of https://github.com/qgis/Quantum-GIS into col…

…oramp
  • Loading branch information
etiennesky committed Aug 24, 2012
2 parents 3f8a467 + c836d61 commit 6c50caa0a245ae90736f8dc9cf55481a65be68ee
@@ -210,6 +210,8 @@
<file>themes/default/mIconWarn.png</file>
<file>themes/default/mIconZoom.png</file>
<file>themes/default/mIconZip.png</file>
<file>themes/default/mIconCollapse.png</file>
<file>themes/default/mIconExpand.png</file>
<file>themes/default/mMapserverExport.png</file>
<file>themes/default/plugin.png</file>
<file>themes/default/propertyicons/action.png</file>
Binary file not shown.
Binary file not shown.
@@ -43,4 +43,5 @@ public:
void deleteFrames();

int nFrames() const;
QgsComposerFrame* frame( int i );
};
@@ -27,6 +27,7 @@
#include "qgsproject.h"

#include "qgsrasterformatsaveoptionswidget.h"
#include "qgsrasterpyramidsoptionswidget.h"
#include "qgsdialog.h"

#include <QInputDialog>
@@ -1118,15 +1119,26 @@ void QgsOptions::editGdalDriver( const QString& driverName )
QLabel *label = new QLabel( title, &dlg );
label->setAlignment( Qt::AlignHCenter );
layout->addWidget( label );
QgsRasterFormatSaveOptionsWidget* optionsWidget =
new QgsRasterFormatSaveOptionsWidget( &dlg, driverName,
QgsRasterFormatSaveOptionsWidget::Full, "gdal" );
layout->addWidget( optionsWidget );

if ( dlg.exec() == QDialog::Accepted )
if ( driverName == "_pyramids" )
{
optionsWidget->apply();
QgsRasterPyramidsOptionsWidget* optionsWidget =
new QgsRasterPyramidsOptionsWidget( &dlg, "gdal" );
layout->addWidget( optionsWidget );
dlg.resize( 400, 400 );
if ( dlg.exec() == QDialog::Accepted )
optionsWidget->apply();
}
else
{
QgsRasterFormatSaveOptionsWidget* optionsWidget =
new QgsRasterFormatSaveOptionsWidget( &dlg, driverName,
QgsRasterFormatSaveOptionsWidget::Full, "gdal" );
layout->addWidget( optionsWidget );
if ( dlg.exec() == QDialog::Accepted )
optionsWidget->apply();
}

}

// Return state of the visibility flag for newly added layers. If
@@ -238,6 +238,15 @@ void QgsComposerMultiFrame::deleteFrames()
mResizeMode = bkResizeMode;
}

QgsComposerFrame* QgsComposerMultiFrame::frame( int i )
{
if ( i >= mFrameItems.size() )
{
return 0;
}
return mFrameItems.at( i );
}

bool QgsComposerMultiFrame::_writeXML( QDomElement& elem, QDomDocument& doc, bool ignoreFrames ) const
{
elem.setAttribute( "resizeMode", mResizeMode );
@@ -70,6 +70,7 @@ class CORE_EXPORT QgsComposerMultiFrame: public QObject
void deleteFrames();

int nFrames() const { return mFrameItems.size(); }
QgsComposerFrame* frame( int i );

protected:
QgsComposition* mComposition;
@@ -525,8 +525,11 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
return false;
}

/** Set no data value on created dataset */
virtual bool setNoDataValue( int, double ) { return false; }
/** Set no data value on created dataset
* @param bandNo band number
* @param noDataValue no data value
*/
virtual bool setNoDataValue( int bandNo, double noDataValue ) { Q_UNUSED( bandNo ); Q_UNUSED( noDataValue ); return false; }

/**Returns the formats supported by create()*/
virtual QStringList createFormats() const { return QStringList(); }
@@ -110,7 +110,7 @@ int QgsRasterTransparency::alphaValue( double theValue, int theGlobalTransparenc

//Search through the transparency list looking for a match
bool myTransparentPixelFound = false;
TransparentSingleValuePixel myTransparentPixel = {0, 100};
TransparentSingleValuePixel myTransparentPixel = {0, 0, 100};
for ( int myListRunner = 0; myListRunner < mTransparentSingleValuePixelList.count(); myListRunner++ )
{
myTransparentPixel = mTransparentSingleValuePixelList[myListRunner];
@@ -83,6 +83,7 @@ qgsprojectionselector.cpp
qgsquickprint.cpp
qgsrasterlayersaveasdialog.cpp
qgsrasterformatsaveoptionswidget.cpp
qgsrasterpyramidsoptionswidget.cpp
qgsrubberband.cpp
qgsscalecombobox.cpp
qgstextannotationitem.cpp
@@ -93,6 +94,7 @@ qgsexpressionbuilderwidget.cpp
qgsexpressionbuilderdialog.cpp
qgsexpressionhighlighter.cpp
qgsquerybuilder.cpp
qgscollapsiblegroupbox.cpp
)

IF (WITH_TOUCH)
@@ -168,6 +170,7 @@ qgsprojectionselector.h
qgsquickprint.h
qgsrasterlayersaveasdialog.h
qgsrasterformatsaveoptionswidget.h
qgsrasterpyramidsoptionswidget.h
qgsludialog.h
qgsprojectbadlayerguihandler.h
qgslonglongvalidator.h
@@ -176,6 +179,7 @@ qgsscalecombobox.h
qgsexpressionbuilderwidget.h
qgsexpressionhighlighter.h
qgsquerybuilder.h
qgscollapsiblegroupbox.h
)

QT4_WRAP_CPP(QGIS_GUI_MOC_SRCS ${QGIS_GUI_MOC_HDRS})
@@ -213,6 +217,7 @@ qgsfieldvalidator.h
qgsexpressionbuilderwidget.h
qgsexpressionbuilderdialog.h
qgsexpressionhighlighter.h
qgscollapsiblegroupbox.h

attributetable/qgsattributetablemodel.h
attributetable/qgsattributetablememorymodel.h
@@ -0,0 +1,127 @@
/***************************************************************************
qgscollapsiblegroupbox.cpp
-------------------
begin : August 2012
copyright : (C) 2012 by Etienne Tourigny
email : etourigny dot dev at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgscollapsiblegroupbox.h"

#include "qgsapplication.h"
#include "qgslogger.h"

#include <QStyleOptionGroupBox>
#include <QStylePainter>
#include <QLayout>

QgsCollapsibleGroupBox::QgsCollapsibleGroupBox( QWidget *parent )
: QGroupBox( parent ), mCollapsed( false )
{
connect( this, SIGNAL( toggled( bool ) ), this, SLOT( setToggled( bool ) ) );
}

QgsCollapsibleGroupBox::QgsCollapsibleGroupBox( const QString &title, QWidget *parent )
: QGroupBox( title, parent ), mCollapsed( false )
{}

void QgsCollapsibleGroupBox::paintEvent( QPaintEvent * event )
{
QGroupBox::paintEvent( event );

// paint expand/collapse icon only if groupbox is checkable as icon replaces check box
if ( ! isCheckable() )
return;

// create background mask + expand/collapse icon
// icons from http://www.iconfinder.com/search/?q=iconset%3AsplashyIcons
QPixmap icon( mCollapsed ?
QgsApplication::getThemePixmap( "/mIconExpand.png" ) :
QgsApplication::getThemePixmap( "/mIconCollapse.png" ) );
QPixmap background( icon.width() + 2, icon.height() + 2 );
background.fill( palette().color( backgroundRole() ) );

// paint on top of checkbox - does this work with all platforms/themes?
QStylePainter paint( this );
QStyleOptionGroupBox option;
initStyleOption( &option );
paint.drawComplexControl( QStyle::CC_GroupBox, option );
paint.drawItemPixmap( option.rect.adjusted( 4, -1, 0, 0 ),
Qt::AlignTop | Qt::AlignLeft,
background );
paint.drawItemPixmap( option.rect.adjusted( 6, 0, 0, 0 ),
Qt::AlignTop | Qt::AlignLeft,
icon );
}

void QgsCollapsibleGroupBox::showEvent( QShowEvent * event )
{
QGroupBox::showEvent( event );
// collapse if needed - any calls to setCollapsed() before have no effect
if ( isCheckable() && ! isChecked() && ! isCollapsed() )
setCollapsed( true );
}

void QgsCollapsibleGroupBox::setCollapsed( bool collapse )
{
if ( ! isVisible() )
return;

mCollapsed = collapse;

// minimize layout margins and save for subsequent restore
if ( collapse )
{
if ( layout() )
{
mMargins = layout()->contentsMargins();
layout()->setContentsMargins( 1, 1, 1, 1 );
}
}
else
{
if ( layout() )
{
layout()->setContentsMargins( mMargins );
}
}

// if we are collapsing, save hidden widgets in a list
if ( collapse )
{
mHiddenWidgets.clear();
foreach ( QWidget *widget, findChildren<QWidget*>() )
{
if ( widget->isHidden() )
mHiddenWidgets << widget;
}
}

// show/hide widgets
foreach ( QWidget *widget, findChildren<QWidget*>() )
widget->setHidden( collapse );

// if we are expanding, re-hide saved hidden widgets
if ( ! collapse )
{
foreach ( QWidget *widget, mHiddenWidgets )
{
widget->setHidden( true );
}
}

if ( mCollapsed )
emit collapsed( this );
else
emit expanded( this );
}

@@ -0,0 +1,58 @@
/***************************************************************************
qgscollapsiblegroupbox.h
-------------------
begin : August 2012
copyright : (C) 2012 by Etienne Tourigny
email : etourigny dot dev at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSCOLLAPSIBLEGROUPBOX_H
#define QGSCOLLAPSIBLEGROUPBOX_H

#include "qgisgui.h"

/** \ingroup gui
* A groupbox that collapses/expands when toggled and draws an expand/collapse icon in lieu of checkbox.
* Widget must be checkable for expand/collapse icon to appear.
*/

#include <QGroupBox>

class GUI_EXPORT QgsCollapsibleGroupBox : public QGroupBox
{
Q_OBJECT

public:
QgsCollapsibleGroupBox( QWidget *parent = 0 );
QgsCollapsibleGroupBox( const QString &title, QWidget *parent = 0 );

bool isCollapsed() const { return mCollapsed; }

signals:
void collapsed( QWidget* );
void expanded( QWidget* );

public slots:
void setToggled( bool toggled ) { setCollapsed( ! toggled ); }
void setCollapsed( bool collapse );

protected:
void paintEvent( QPaintEvent * );
void showEvent( QShowEvent * event );

private:
bool mCollapsed;
QMargins mMargins;
QList< QWidget* > mHiddenWidgets;
};

#endif

0 comments on commit 6c50caa

Please sign in to comment.
You can’t perform that action at this time.