mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
From Ozgur Ugras BARAN: Fix bug 3529
* src/frontends/qt4/TocWidget.{cpp,h}: - new member disconnectSelectionModel() - (select): replace blockSignal() directives for tocTV selectionModel() with disconnect (the above new function) and reconnect relevant signal git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18338 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
df90247126
commit
9e4022e235
@ -106,7 +106,8 @@ depth calculation.
|
|||||||
int TocWidget::getIndexDepth(QModelIndex const & index, int depth)
|
int TocWidget::getIndexDepth(QModelIndex const & index, int depth)
|
||||||
{
|
{
|
||||||
++depth;
|
++depth;
|
||||||
return (index.parent() == QModelIndex())? depth : getIndexDepth(index.parent(),depth);
|
return (index.parent() ==
|
||||||
|
QModelIndex())? depth : getIndexDepth(index.parent(),depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -205,12 +206,10 @@ void TocWidget::select(QModelIndex const & index)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tocTV->selectionModel()->blockSignals(true);
|
disconnectSelectionModel();
|
||||||
tocTV->selectionModel()->clear();
|
tocTV->setCurrentIndex(index);
|
||||||
tocTV->scrollTo(index);
|
tocTV->scrollTo(index);
|
||||||
tocTV->selectionModel()->setCurrentIndex(index,
|
reconnectSelectionModel();
|
||||||
QItemSelectionModel::ClearAndSelect);
|
|
||||||
tocTV->selectionModel()->blockSignals(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -307,8 +306,21 @@ void TocWidget::setTocModel(size_t type)
|
|||||||
void TocWidget::reconnectSelectionModel()
|
void TocWidget::reconnectSelectionModel()
|
||||||
{
|
{
|
||||||
connect(tocTV->selectionModel(),
|
connect(tocTV->selectionModel(),
|
||||||
SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
|
SIGNAL(currentChanged(const QModelIndex &,
|
||||||
this, SLOT(selectionChanged(const QModelIndex &, const QModelIndex &)));
|
const QModelIndex &)),
|
||||||
|
this,
|
||||||
|
SLOT(selectionChanged(const QModelIndex &,
|
||||||
|
const QModelIndex &)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TocWidget::disconnectSelectionModel()
|
||||||
|
{
|
||||||
|
disconnect(tocTV->selectionModel(),
|
||||||
|
SIGNAL(currentChanged(const QModelIndex &,
|
||||||
|
const QModelIndex &)),
|
||||||
|
this,
|
||||||
|
SLOT(selectionChanged(const QModelIndex &,
|
||||||
|
const QModelIndex &)));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
|
@ -60,6 +60,9 @@ protected:
|
|||||||
private:
|
private:
|
||||||
/// Reconnects the selection model change signal when TOC changed.
|
/// Reconnects the selection model change signal when TOC changed.
|
||||||
void reconnectSelectionModel();
|
void reconnectSelectionModel();
|
||||||
|
/// Disconnects the selection model.
|
||||||
|
//This is a workaround for a problem of signals blocking.
|
||||||
|
void disconnectSelectionModel();
|
||||||
|
|
||||||
QToc * form_;
|
QToc * form_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user