QTabWidget and current tabs

26 views
Skip to first unread message

Todd Widup

unread,
Aug 8, 2017, 11:36:35 PM8/8/17
to python_in...@googlegroups.com
I am using currentWidget to get the current tab, but it doesnt work 100% correctly for me

ie : i have 3 tabs, Root, Arm, Leg

if I select leg, it will print leg.  if I select arm, it will print leg, and if I select arm again, it will print arm this time. 

very first selection will print correctly, the rest are always 1 selection behind

--
Todd Widup
Creature TD / Technical Artist
todd....@gmail.com

Justin Israel

unread,
Aug 8, 2017, 11:45:43 PM8/8/17
to python_in...@googlegroups.com
Are you connecting to QTabWidget.currentChanged() signal to respond and print the currentWidget() value? If so, can you see if it makes a difference if you do your connection like this:

tabWidget.currentChanged.connect(self.someSlot, QtCore.Qt.QueuedConnection)

Similar threads have reported a lag in the event loop updating things, so I wonder if waiting until the event loop runs before evaluating your slot would make a difference.

Justin


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CABBPk37LW2BfEC%2BYfqE%3DQ2TD18bPDkv%3Dyb3D0663sXgHepJx1Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Todd Widup

unread,
Aug 8, 2017, 11:55:32 PM8/8/17
to python_in...@googlegroups.com
ah  that works :D

thanks Justin

On Tue, Aug 8, 2017 at 8:45 PM, Justin Israel <justin...@gmail.com> wrote:
Are you connecting to QTabWidget.currentChanged() signal to respond and print the currentWidget() value? If so, can you see if it makes a difference if you do your connection like this:

tabWidget.currentChanged.connect(self.someSlot, QtCore.Qt.QueuedConnection)

Similar threads have reported a lag in the event loop updating things, so I wonder if waiting until the event loop runs before evaluating your slot would make a difference.

Justin


On Wed, Aug 9, 2017 at 3:36 PM Todd Widup <todd....@gmail.com> wrote:
I am using currentWidget to get the current tab, but it doesnt work 100% correctly for me

ie : i have 3 tabs, Root, Arm, Leg

if I select leg, it will print leg.  if I select arm, it will print leg, and if I select arm again, it will print arm this time. 

very first selection will print correctly, the rest are always 1 selection behind

--
Todd Widup
Creature TD / Technical Artist
todd....@gmail.com

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2DWCDWmwbkRxB9t%3D0yP94yoAxSMwn8zEVXg_J94VJ-Xw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

Justin Israel

unread,
Aug 9, 2017, 12:08:15 AM8/9/17
to python_in...@googlegroups.com
Interesting. One would think that if the signal is firing, that the state of the QTabWidget should now be accurate. I guess use that approach as-needed when you see this kind of lag in the state :-)



On Wed, Aug 9, 2017 at 3:55 PM Todd Widup <todd....@gmail.com> wrote:
ah  that works :D

thanks Justin

On Tue, Aug 8, 2017 at 8:45 PM, Justin Israel <justin...@gmail.com> wrote:
Are you connecting to QTabWidget.currentChanged() signal to respond and print the currentWidget() value? If so, can you see if it makes a difference if you do your connection like this:

tabWidget.currentChanged.connect(self.someSlot, QtCore.Qt.QueuedConnection)

Similar threads have reported a lag in the event loop updating things, so I wonder if waiting until the event loop runs before evaluating your slot would make a difference.

Justin


On Wed, Aug 9, 2017 at 3:36 PM Todd Widup <todd....@gmail.com> wrote:
I am using currentWidget to get the current tab, but it doesnt work 100% correctly for me

ie : i have 3 tabs, Root, Arm, Leg

if I select leg, it will print leg.  if I select arm, it will print leg, and if I select arm again, it will print arm this time. 

very first selection will print correctly, the rest are always 1 selection behind

--
Todd Widup
Creature TD / Technical Artist
todd....@gmail.com

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CABBPk37Rph52hsOKiLGKL4R5KZcz6GEo52ujPBMwKHCmnP1FHA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages