Commit 59692c86 authored by Antoine Regimbeau's avatar Antoine Regimbeau

BUG: correction of layer delete bug

parent a3bfaef1
......@@ -212,7 +212,7 @@ public:
// Public SLOTS.
public slots:
void Clear();
void Deleting( SizeType index )
void Deleting( int index );
inline void Delete( const KeyType & );
inline void DeleteCurrent();
inline void LowerCurrent();
......
......@@ -220,7 +220,7 @@ StackedLayerModel
/*****************************************************************************/
void
StackedLayerModel
::Deleting( SizeType index )
::Deleting( int index )
{
// qDebug() << this << "::Delete(" << index << ")";
......
......@@ -255,7 +255,7 @@ public slots:
//
// Signals.
signals:
void LayerDeleting(unsigned int index);
void LayerDeletingModel( int index);
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
......
......@@ -154,13 +154,16 @@ public:
// Public SLOTS.
public slots:
//bugfix
void OnLayerDeletingWidget( int index );
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
//
// Signals.
signals:
//bugFix
void LayerDeletingWidget( unsigned int index );
void LayerDeletingWidget( int index );
/**
*/
void CurrentChanged( int );
......
......@@ -151,13 +151,16 @@ LayerStackController
);
//bugfix
bool conSuc =
QObject::connect(
widget,
SIGNAL( LayerDeletingWidget( unsigned int index ) ),
SIGNAL( LayerDeletingWidget( int ) ),
// to:
model,
SLOT( Deleting( int ) )
);
std::cout<<"LayerDeletingWidget connect with Deleting : "
<<conSuc<<std::endl;
QObject::connect(
widget,
......@@ -251,7 +254,7 @@ LayerStackController
QObject::disconnect(
model,
SIGNAL( CurrentChanged( size_t ) ),
// from:
// from:deletin
this,
SLOT( OnStackedLayerCurrentChanged( size_t ) )
);
......
......@@ -108,6 +108,7 @@ LayerStackItemModel
QAbstractItemModel( p ),
m_StackedLayerModel( NULL )
{
std::cout<<"Construction of ItemModel : "<<this<<std::endl;
// QObject::connect(
// this,
// SIGNAL( modelAboutToBeReset() ),
......@@ -788,34 +789,16 @@ LayerStackItemModel
if( p.isValid() || count!=1 )
return false;
LayerStackWidget * widget = GetWidget< LayerStackWidget >();
assert( widget!=NULL );
QObject::disconnect(
widget,
SIGNAL( SelectionChanged( int ) ),
// from:
this,
SLOT( OnSelectionChanged( int ) )
);
beginRemoveRows( p, row, row + count - 1 );
{
// StackedLayerModel has already been shortened.
emit LayerDeleting(row);
emit LayerDeletingModel(row);
// TODO: Release additional row data here.
}
endRemoveRows();
QObject::connect(
widget,
SIGNAL( SelectionChanged( int ) ),
// from:
this,
SLOT( OnSelectionChanged( int ) )
);
return true;
}
......
......@@ -113,6 +113,7 @@ LayerStackWidget
SLOT( OnCurrentRowChanged( const QModelIndex &, const QModelIndex & ) )
);
bool test =
QObject::connect(
m_UI->treeView->selectionModel(),
SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection & ) ),
......@@ -120,16 +121,7 @@ LayerStackWidget
this,
SLOT( OnSelectionChanged( const QItemSelection &, const QItemSelection & ) )
);
/////// Bugfix
QObject::connect(
m_UI->treeView->selectionModel(),
SIGNAL( LayerDeleting(unsigned int index) ),
// to:
this,
SIGNAL( LayerDeletingWidget(unsigned int index) )
);
///////////////
std::cout<<"An other conncetion worked : "<<test<<std::endl;
QObject::connect(
m_UI->topButton,
......@@ -202,8 +194,28 @@ LayerStackWidget
this,
SIGNAL( ResetEffectsButtonClicked() )
);
/////// Bugfix
bool connectionBugFix = QObject::connect(
this->GetItemModel(),
SIGNAL( LayerDeletingModel(int) ),
// to:
this,
SLOT( OnLayerDeletingWidget(int) )
);
std::cout<<"LayerDeletingModel connected with OnLayerDeletingWidget : "
<<connectionBugFix<<std::endl;
std::cout<<"Model adress : "<<m_UI->treeView->selectionModel()<<std::endl;
///////////////
}
void
LayerStackWidget
::OnLayerDeletingWidget(int index)
{
std::cout<<"In widget, sending LayerDeletingSignal"<<std::endl;
emit LayerDeletingWidget(index);
}
/*******************************************************************************/
LayerStackWidget
::~LayerStackWidget()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment