Skip to content

Commit

Permalink
[composer] Switch attribute table column dialog over to QgsDoubleSpinBox
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 25, 2014
1 parent 272b79b commit 721cab1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/app/composer/qgsattributeselectiondialog.cpp
Expand Up @@ -21,6 +21,7 @@
#include "qgscomposerattributetablemodelv2.h"
#include "qgsvectorlayer.h"
#include "qgsfieldexpressionwidget.h"
#include "qgsdoublespinbox.h"
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QGridLayout>
Expand Down Expand Up @@ -231,26 +232,27 @@ QWidget *QgsComposerColumnWidthDelegate::createEditor( QWidget *parent, const QS
{
Q_UNUSED( index );
Q_UNUSED( option );
QDoubleSpinBox *editor = new QDoubleSpinBox( parent );
QgsDoubleSpinBox *editor = new QgsDoubleSpinBox( parent );
editor->setMinimum( 0 );
editor->setMaximum( 1000 );
editor->setDecimals( 2 );
editor->setSuffix( tr( " mm" ) );
editor->setSpecialValueText( tr( "Automatic" ) );
editor->setShowClearButton( true );
return editor;
}

void QgsComposerColumnWidthDelegate::setEditorData( QWidget *editor, const QModelIndex &index ) const
{
int value = index.model()->data( index, Qt::EditRole ).toInt();

QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>( editor );
QgsDoubleSpinBox *spinBox = static_cast<QgsDoubleSpinBox*>( editor );
spinBox->setValue( value );
}

void QgsComposerColumnWidthDelegate::setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const
{
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>( editor );
QgsDoubleSpinBox *spinBox = static_cast<QgsDoubleSpinBox*>( editor );
spinBox->interpretText();
int value = spinBox->value();

Expand Down

0 comments on commit 721cab1

Please sign in to comment.