labscript-suite-temp-2 / runmanager

runmanager is a graphical user interface (GUI) used to aid the compilation of labscript experiment scripts into hardware instructions to be executed on the hardware. Experiment parameters can be adjusted in the GUI, and lists of parameters can be used to create sequences of experiments, and scan over complex parameter spaces.
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Prevent reordering of top 3 tabs #3

Closed philipstarkey closed 10 years ago

philipstarkey commented 10 years ago

Original report (archived issue) by Philip Starkey (Bitbucket: pstarkey, GitHub: philipstarkey).


A regression in runmanager v2.0:

You can now reorder the top 3 tabs (output, groups, axes). These should be fixed in place as they are special.

philipstarkey commented 10 years ago

Original comment by Chris Billington (Bitbucket: cbillington, GitHub: chrisjbillington).


Resolved in 346028a4fed829687f2973a15213e6a9597250ff

This was a little tricky to do because Qt does not allow for setting individual tabs movable or not. Furthermore, the relevant methods one has to override on the QTabBar contain a lot of calls to private methods, which makes re-implementing their behaviour more work than is worth it.

So instead, I did a bit of a hack - the subclassed TabBar keeps track of whether its individual tabs are supposed to be movable or not, and it turns the global setting on and off on mouseclick and mouserelease events, ensuring that when you click an unmovable tab, you will find that it is unmovable and when you click a movable tab, that it is movable.