Skip to content
Permalink
Browse files

[composer] Switch attribute table column dialog over to QgsDoubleSpinBox

  • Loading branch information
nyalldawson committed Sep 25, 2014
1 parent 272b79b commit 721cab1ca48b7c0fdaaee5ca5697ddbace7451b2
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/app/composer/qgsattributeselectiondialog.cpp
@@ -21,6 +21,7 @@
#include "qgscomposerattributetablemodelv2.h"
#include "qgsvectorlayer.h"
#include "qgsfieldexpressionwidget.h"
#include "qgsdoublespinbox.h"
#include <QCheckBox>
#include <QDialogButtonBox>
#include <QGridLayout>
@@ -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();

0 comments on commit 721cab1

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