Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Ozgur Ugras BARAN

I can confirm that patch also works for qt 4.2.0.

On 5/14/07, Ozgur Ugras BARAN [EMAIL PROTECTED] wrote:


Attached patch solves TOC bug 3529 for Qt-4.3-pre. The problem was
blocked selectionchanged signal for selectionModel prevents correct
repainting. I have no idea whether this patch works for qt-4.2 or not.
Therefore, please somebody test it?

verify, commit, enjoy :)

Abdel, I have asked permission for svn commit rights. I guess it will
take time. Sorry..

Ugras




Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Jürgen Spitzmüller
Ozgur Ugras BARAN wrote:
 Attached patch solves TOC bug 3529 for Qt-4.3-pre. The problem was
 blocked selectionchanged signal for selectionModel prevents correct
 repainting. I have no idea whether this patch works for qt-4.2 or not.
 Therefore, please somebody test it?

Works for me (qt 4.2.3).

Abdel, what was the rationale to block the signals? Is it safe to put this in?

José, can I apply if Abdel confirms its the correct fix?

Jürgen


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Ozgur Ugras BARAN

Oh, there is another problem, now. Please do not apply patch. When you
change the selection with mouse, cursor goes to the beginning of the
section. With keyboard there is no problem.

I will solve this and resend the patch.

sorry..

Ugras

On 5/15/07, Jürgen Spitzmüller [EMAIL PROTECTED] wrote:


Ozgur Ugras BARAN wrote:
 Attached patch solves TOC bug 3529 for Qt-4.3-pre. The problem was
 blocked selectionchanged signal for selectionModel prevents correct
 repainting. I have no idea whether this patch works for qt-4.2 or not.
 Therefore, please somebody test it?

Works for me (qt 4.2.3).

Abdel, what was the rationale to block the signals? Is it safe to put this
in?

José, can I apply if Abdel confirms its the correct fix?

Jürgen



Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Ozgur Ugras BARAN

This one should be better in behaviour, but ugly as hell.

Would you please test it, again?

regards,

Ugras

On 5/15/07, Ozgur Ugras BARAN [EMAIL PROTECTED] wrote:


Oh, there is another problem, now. Please do not apply patch. When you
change the selection with mouse, cursor goes to the beginning of the
section. With keyboard there is no problem.

I will solve this and resend the patch.

sorry..

Ugras

On 5/15/07, Jürgen Spitzmüller [EMAIL PROTECTED] wrote:

 Ozgur Ugras BARAN wrote:
  Attached patch solves TOC bug 3529 for Qt-4.3-pre. The problem was
  blocked selectionchanged signal for selectionModel prevents correct
  repainting. I have no idea whether this patch works for qt-4.2 or not.
  Therefore, please somebody test it?

 Works for me (qt 4.2.3).

 Abdel, what was the rationale to block the signals? Is it safe to put
 this in?

 José, can I apply if Abdel confirms its the correct fix?

 Jürgen



Index: frontends/qt4/TocWidget.cpp
===
--- TocWidget.cpp	(revision 18311)
+++ TocWidget.cpp	(working copy)
@@ -205,12 +205,10 @@
 		return;
 	}
 
-	tocTV-selectionModel()-blockSignals(true);
-	tocTV-selectionModel()-clear();
-	tocTV-scrollTo(index);
-	tocTV-selectionModel()-setCurrentIndex(index,
-		QItemSelectionModel::ClearAndSelect);
-	tocTV-selectionModel()-blockSignals(false);
+	disconnectSelectionModel();
+	tocTV-setCurrentIndex(index);
+ 	tocTV-scrollTo(index);
+	reconnectSelectionModel();
 }
 
 
@@ -311,6 +309,13 @@
 		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 lyx
 
Index: frontends/qt4/TocWidget.h
===
--- TocWidget.h	(revision 18311)
+++ TocWidget.h	(working copy)
@@ -60,6 +60,8 @@
 private:
 	/// Reconnects the selection model change signal when TOC changed.
 	void reconnectSelectionModel();
+	/// Disconnects the selection model. This is a workaround for a problem of signals blocking.
+	void disconnectSelectionModel();
 
 	QToc * form_;
 


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Jürgen Spitzmüller
Ozgur Ugras BARAN wrote:
 This one should be better in behaviour, but ugly as hell.

 Would you please test it, again?

Works for me AFAICT. As said, I can commit it for you if I get o.k. from Abdel 
and José (and a log file entry from you).

Jürgen


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread José Matos
On Tuesday 15 May 2007 08:40:44 Jürgen Spitzmüller wrote:
 Ozgur Ugras BARAN wrote:
  This one should be better in behaviour, but ugly as hell.
 
  Would you please test it, again?

 Works for me AFAICT. As said, I can commit it for you if I get o.k. from
 Abdel and José (and a log file entry from you).

  If Abdel thinks it is OK then it can go in.

 Jürgen

-- 
José Abílio


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Abdelrazak Younes

Ozgur Ugras BARAN wrote:

Oh, there is another problem, now. Please do not apply patch. When you
change the selection with mouse, cursor goes to the beginning of the
section. With keyboard there is no problem.


Yes, to answer Jurgen, that was one of the reason for blocking the 
signal IIRC.


Abdel.



Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Abdelrazak Younes

Ozgur Ugras BARAN wrote:

This one should be better in behaviour, but ugly as hell.


Let me judge it first ;-)




Index: frontends/qt4/TocWidget.cpp
===
--- TocWidget.cpp   (revision 18311)
+++ TocWidget.cpp   (working copy)
@@ -205,12 +205,10 @@
return;
}
 
-	tocTV-selectionModel()-blockSignals(true);

-   tocTV-selectionModel()-clear();
-   tocTV-scrollTo(index);
-   tocTV-selectionModel()-setCurrentIndex(index,
-   QItemSelectionModel::ClearAndSelect);
-   tocTV-selectionModel()-blockSignals(false);
+   disconnectSelectionModel();
+   tocTV-setCurrentIndex(index);
+   tocTV-scrollTo(index);
+   reconnectSelectionModel();
 }
 
 
@@ -311,6 +309,13 @@

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 
)));


72 chars per line maximum please.


+}
+
 } // namespace frontend
 } // namespace lyx
 
Index: frontends/qt4/TocWidget.h

===
--- TocWidget.h (revision 18311)
+++ TocWidget.h (working copy)
@@ -60,6 +60,8 @@
 private:
/// Reconnects the selection model change signal when TOC changed.
void reconnectSelectionModel();
+   /// Disconnects the selection model. This is a workaround for a problem 
of signals blocking.


ditto.


+   void disconnectSelectionModel();
 
 	QToc * form_;
 


As far as I see this patch looks correct. Jurgen, if you tested it 
carefully with mouse and keyboard navigation, and with the different 
buttons and lists, I think you can commit it.


Abdel.



Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Jürgen Spitzmüller
Abdelrazak Younes wrote:
 As far as I see this patch looks correct. Jurgen, if you tested it
 carefully with mouse and keyboard navigation, and with the different
 buttons and lists, I think you can commit it.

Yes, I tested all cases I could think of. I'll commit as soon as Ugras sends a 
log message.

Jürgen


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Ozgur Ugras BARAN

Correct bug 3529-(TOC widget does not select the current
part/section/subsection correctly) by replacing blockSignal()
directives for tocTV- selectionModel() with disconnect and reconnect
relevant signal.

Thanks Jurgen, Abdel.

ugras

On 5/15/07, Jürgen Spitzmüller [EMAIL PROTECTED] wrote:

Abdelrazak Younes wrote:
 As far as I see this patch looks correct. Jurgen, if you tested it
 carefully with mouse and keyboard navigation, and with the different
 buttons and lists, I think you can commit it.

Yes, I tested all cases I could think of. I'll commit as soon as Ugras sends a
log message.

Jürgen



Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Jürgen Spitzmüller
Ozgur Ugras BARAN wrote:
 Correct bug 3529-(TOC widget does not select the current
 part/section/subsection correctly) by replacing blockSignal()
 directives for tocTV- selectionModel() with disconnect and reconnect
 relevant signal.

 Thanks Jurgen, Abdel.

Applied. However, I rather meant something like:

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

Jürgen


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread José Matos
On Tuesday 15 May 2007 12:08:13 Ozgur Ugras BARAN wrote:
 Correct bug 3529-(TOC widget does not select the current
 part/section/subsection correctly) by replacing blockSignal()
 directives for tocTV- selectionModel() with disconnect and reconnect
 relevant signal.

 Thanks Jurgen, Abdel.

 ugras

  Now that the fix is applied do not forget to close the bug report. :-)

-- 
José Abílio


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Ozgur Ugras BARAN

I can confirm that patch also works for qt 4.2.0.

On 5/14/07, Ozgur Ugras BARAN <[EMAIL PROTECTED]> wrote:


Attached patch solves TOC bug 3529 for Qt-4.3-pre. The problem was
blocked selectionchanged signal for selectionModel prevents correct
repainting. I have no idea whether this patch works for qt-4.2 or not.
Therefore, please somebody test it?

verify, commit, enjoy :)

Abdel, I have asked permission for svn commit rights. I guess it will
take time. Sorry..

Ugras




Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Jürgen Spitzmüller
Ozgur Ugras BARAN wrote:
> Attached patch solves TOC bug 3529 for Qt-4.3-pre. The problem was
> blocked selectionchanged signal for selectionModel prevents correct
> repainting. I have no idea whether this patch works for qt-4.2 or not.
> Therefore, please somebody test it?

Works for me (qt 4.2.3).

Abdel, what was the rationale to block the signals? Is it safe to put this in?

José, can I apply if Abdel confirms its the correct fix?

Jürgen


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Ozgur Ugras BARAN

Oh, there is another problem, now. Please do not apply patch. When you
change the selection with mouse, cursor goes to the beginning of the
section. With keyboard there is no problem.

I will solve this and resend the patch.

sorry..

Ugras

On 5/15/07, Jürgen Spitzmüller <[EMAIL PROTECTED]> wrote:


Ozgur Ugras BARAN wrote:
> Attached patch solves TOC bug 3529 for Qt-4.3-pre. The problem was
> blocked selectionchanged signal for selectionModel prevents correct
> repainting. I have no idea whether this patch works for qt-4.2 or not.
> Therefore, please somebody test it?

Works for me (qt 4.2.3).

Abdel, what was the rationale to block the signals? Is it safe to put this
in?

José, can I apply if Abdel confirms its the correct fix?

Jürgen



Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Ozgur Ugras BARAN

This one should be better in behaviour, but ugly as hell.

Would you please test it, again?

regards,

Ugras

On 5/15/07, Ozgur Ugras BARAN <[EMAIL PROTECTED]> wrote:


Oh, there is another problem, now. Please do not apply patch. When you
change the selection with mouse, cursor goes to the beginning of the
section. With keyboard there is no problem.

I will solve this and resend the patch.

sorry..

Ugras

On 5/15/07, Jürgen Spitzmüller <[EMAIL PROTECTED]> wrote:
>
> Ozgur Ugras BARAN wrote:
> > Attached patch solves TOC bug 3529 for Qt-4.3-pre. The problem was
> > blocked selectionchanged signal for selectionModel prevents correct
> > repainting. I have no idea whether this patch works for qt-4.2 or not.
> > Therefore, please somebody test it?
>
> Works for me (qt 4.2.3).
>
> Abdel, what was the rationale to block the signals? Is it safe to put
> this in?
>
> José, can I apply if Abdel confirms its the correct fix?
>
> Jürgen
>


Index: frontends/qt4/TocWidget.cpp
===
--- TocWidget.cpp	(revision 18311)
+++ TocWidget.cpp	(working copy)
@@ -205,12 +205,10 @@
 		return;
 	}
 
-	tocTV->selectionModel()->blockSignals(true);
-	tocTV->selectionModel()->clear();
-	tocTV->scrollTo(index);
-	tocTV->selectionModel()->setCurrentIndex(index,
-		QItemSelectionModel::ClearAndSelect);
-	tocTV->selectionModel()->blockSignals(false);
+	disconnectSelectionModel();
+	tocTV->setCurrentIndex(index);
+ 	tocTV->scrollTo(index);
+	reconnectSelectionModel();
 }
 
 
@@ -311,6 +309,13 @@
 		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 lyx
 
Index: frontends/qt4/TocWidget.h
===
--- TocWidget.h	(revision 18311)
+++ TocWidget.h	(working copy)
@@ -60,6 +60,8 @@
 private:
 	/// Reconnects the selection model change signal when TOC changed.
 	void reconnectSelectionModel();
+	/// Disconnects the selection model. This is a workaround for a problem of signals blocking.
+	void disconnectSelectionModel();
 
 	QToc * form_;
 


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Jürgen Spitzmüller
Ozgur Ugras BARAN wrote:
> This one should be better in behaviour, but ugly as hell.
>
> Would you please test it, again?

Works for me AFAICT. As said, I can commit it for you if I get o.k. from Abdel 
and José (and a log file entry from you).

Jürgen


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread José Matos
On Tuesday 15 May 2007 08:40:44 Jürgen Spitzmüller wrote:
> Ozgur Ugras BARAN wrote:
> > This one should be better in behaviour, but ugly as hell.
> >
> > Would you please test it, again?
>
> Works for me AFAICT. As said, I can commit it for you if I get o.k. from
> Abdel and José (and a log file entry from you).

  If Abdel thinks it is OK then it can go in.

> Jürgen

-- 
José Abílio


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Abdelrazak Younes

Ozgur Ugras BARAN wrote:

Oh, there is another problem, now. Please do not apply patch. When you
change the selection with mouse, cursor goes to the beginning of the
section. With keyboard there is no problem.


Yes, to answer Jurgen, that was one of the reason for blocking the 
signal IIRC.


Abdel.



Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Abdelrazak Younes

Ozgur Ugras BARAN wrote:

This one should be better in behaviour, but ugly as hell.


Let me judge it first ;-)




Index: frontends/qt4/TocWidget.cpp
===
--- TocWidget.cpp   (revision 18311)
+++ TocWidget.cpp   (working copy)
@@ -205,12 +205,10 @@
return;
}
 
-	tocTV->selectionModel()->blockSignals(true);

-   tocTV->selectionModel()->clear();
-   tocTV->scrollTo(index);
-   tocTV->selectionModel()->setCurrentIndex(index,
-   QItemSelectionModel::ClearAndSelect);
-   tocTV->selectionModel()->blockSignals(false);
+   disconnectSelectionModel();
+   tocTV->setCurrentIndex(index);
+   tocTV->scrollTo(index);
+   reconnectSelectionModel();
 }
 
 
@@ -311,6 +309,13 @@

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 
&)));


72 chars per line maximum please.


+}
+
 } // namespace frontend
 } // namespace lyx
 
Index: frontends/qt4/TocWidget.h

===
--- TocWidget.h (revision 18311)
+++ TocWidget.h (working copy)
@@ -60,6 +60,8 @@
 private:
/// Reconnects the selection model change signal when TOC changed.
void reconnectSelectionModel();
+   /// Disconnects the selection model. This is a workaround for a problem 
of signals blocking.


ditto.


+   void disconnectSelectionModel();
 
 	QToc * form_;
 


As far as I see this patch looks correct. Jurgen, if you tested it 
carefully with mouse and keyboard navigation, and with the different 
buttons and lists, I think you can commit it.


Abdel.



Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Jürgen Spitzmüller
Abdelrazak Younes wrote:
> As far as I see this patch looks correct. Jurgen, if you tested it
> carefully with mouse and keyboard navigation, and with the different
> buttons and lists, I think you can commit it.

Yes, I tested all cases I could think of. I'll commit as soon as Ugras sends a 
log message.

Jürgen


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Ozgur Ugras BARAN

Correct bug 3529-(TOC widget does not select the current
part/section/subsection correctly) by replacing blockSignal()
directives for tocTV- selectionModel() with disconnect and reconnect
relevant signal.

Thanks Jurgen, Abdel.

ugras

On 5/15/07, Jürgen Spitzmüller <[EMAIL PROTECTED]> wrote:

Abdelrazak Younes wrote:
> As far as I see this patch looks correct. Jurgen, if you tested it
> carefully with mouse and keyboard navigation, and with the different
> buttons and lists, I think you can commit it.

Yes, I tested all cases I could think of. I'll commit as soon as Ugras sends a
log message.

Jürgen



Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread Jürgen Spitzmüller
Ozgur Ugras BARAN wrote:
> Correct bug 3529-(TOC widget does not select the current
> part/section/subsection correctly) by replacing blockSignal()
> directives for tocTV- selectionModel() with disconnect and reconnect
> relevant signal.
>
> Thanks Jurgen, Abdel.

Applied. However, I rather meant something like:

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

Jürgen


Re: [patch] Bug 3529-TOC widget does not select the current part/section/subsection correctly

2007-05-15 Thread José Matos
On Tuesday 15 May 2007 12:08:13 Ozgur Ugras BARAN wrote:
> Correct bug 3529-(TOC widget does not select the current
> part/section/subsection correctly) by replacing blockSignal()
> directives for tocTV- selectionModel() with disconnect and reconnect
> relevant signal.
>
> Thanks Jurgen, Abdel.
>
> ugras

  Now that the fix is applied do not forget to close the bug report. :-)

-- 
José Abílio