Collapsible QDockWidget when clicking on the tab - pyqt

I am trying to mimic the behaviour on PyCharm, where there are docks on the edges and, if the user clicks on the tab, it exapnds and collapses the dock to increase the central widget.
I managed to put the tabs on the site, and I can subscribe to the tabBarClicked event to detect QDockWidgets, but I still need to figure out 2 problems:
How to always display a tab on each region where there is a dock (if there is more than 1 dock on that area, the tabs are automatically handled, but if there is only 1 dockwidget, no tabs are shown).
How to keep the tab if I hide the dock (for collapsing the widget).
Any ideas? This is what I got so far. As you can see, the QDockWidget on the bottom does not have a tab, but a title bar.

Related

Sublime Text 3: Moving tab from one panel (column) to another

I use Sublime Text 3 in two column mode. I have several tabs open in each panel/column.
Current behavior:
(Upper part of diagram)
There are seven tabs open in the left panel. The current displayed tab is tab 2. I move tab 7 over to the right panel.
(Lower part of diagram)
Result: The tab moves over to the right panel. It's displayed in the right panel. That's fine, whatever. On the left panel, though, tab 6 is now displayed instead of tab 2.
Desired result: On the left panel, tab 2 should be displayed instead of tab 6. Is there any setting to do this?
There is no setting to do this as at build 3157. Someone wrote a plugin to handle this when closing tabs, maybe it could be adapted to work when moving tabs between groups also.
https://github.com/SublimeTextIssues/Core/issues/455

Excel/VBA - Set Focus and Scroll to Control

I'm looping through the ActiveX controls on my spreadsheet to implement tab control. I have around 100 controls in my spreadsheet, so not everything fits on a single "page" (it's all in the same tab, you just have to scroll down.)
I can use Activate to set the focus to the next control. However, when I tab through the controls and pass the bottom of the viewable window, the window doesn't automatically scroll to show the control with focus.
Is there a way to get the spreadsheet to scroll so that the control that has focus is actually on the screen?
Sorceri nailed it right on the head. I used Window.ScrollRow to scroll down the page after I set the focus. The only issue is that this sets the bottom of the row to the top of the window, so it's just off screen. I was able to resolve this by specifying:
ActiveWindow.ScrollRow = row-3
Thanks!

Python + GTK - Scrolled menu bugged

Basically, when we click on a combobox near to the bottom edge of the screen, the first item of the menu begins at the same vertical position of the combobox, leaving a blank space on top of this.
This way the menu is created with the size to hold all the menu items, but since the first element of these is not put at the top of the menu, the menu has to scroll to see them.
Link to the image: http://postimg.org/image/767ukjphz/
It's not a bug in my code. The menu is created correctly. The bug is in the GTK libraries.
So, what do you suggest me?, how can I resolve this situation?, maybe moving to menu position?

LWUIT: tabs - how to mark the currently selected tab

I have 4 tabs. Each tab is represented by a button. Those buttons are used to select the currently displayed tab. Each button has an icon and text.
I'd like to highlight the currently selected tab by changing background color and text label color of the corresponding button. I'd like to do it using Theme and Resource Editor.
I created theme and specified unselected, selected and pressed styles for UIID "Tab". My tabs look great in Sun WTK! Fine! But I found that on a real phone the tabs always look like unselected. I tried on Nokia 5800 XPressMusic and C7. Why the difference?
After some experiments I found out the reason - the buttons may be only in 2 states: unselected and pressed. They never be in the selected state. On the emulator when I move to a button using navi keys, it becomes selected.
So, what should I do to mark the current tab?
You can use a few different approaches especially in 1.5.
LWUIT 1.5 has a Tabs component which pretty much does everything for you and is remarkably flexible.
It uses radio buttons on which the method setToggleButton(true) is invoked. Toggle buttons act like radio buttons so when you press a button in the group it stays pressed and is rendered using the ToggleButton style (you can set the UIID to whatever you want). See a sample of using toggle buttons in the font demo portion of LWUIT demo.
An option that will work for older versions of LWUIT is to just set the UIID of the button to a different value when it is pressed (and restore the UIID of the previously selected button to the original value).
I implemented what I needed. Thanks to Shai and his example.
I didn't use theme properties and made all customizations in the code. I did so because I didn't catch how setting unique UIID can help me, since the problem is not in the identifying the UIID for which the props have to be changed, but in identifying the button's style to be changed.
Below some important notes of my solution.
Call addActionListener for the buttons AFTER they have added to the tabs.
When any tab button is pressed, update UNSELECTED styles of the tab buttons. Also you can change their icons.
Call form's repaint() after step 2.

Tab bar is also moving when i scroll the table view

I have written the code programmatically for my tab bar in my table view.The problem whenever i am scrolling the table view,the tab bar is also moving.The tab bar created in one cell,so it is also scrolling.How to keep that in static.Please help me in this.
Thanks in advance
DOn't put the TabBar in the Scrollview. Rather, have the TabBar at the bottom of the main view, and have the ScrollView extend only to the top of the TabBar. That should fix it. If you put the TabBar on the ScrollView, it will scroll around (that's what the ScrollView does).
If you're creating the tab bar as one of the cells, this will always happen. (It's the expected behaviour for the table cell.)
Why on earth are you using this approach, rather than simply putting the tab bar above or below the UITableView?

Resources