How to display list of opened tabs in Qt 4.8 on Ctrl+Tab - c++

Is there any straightforward (without listening to key events) way to display the list of opened tabs in Qt, like following (in Visual Studio). I just want to make sure Qt does not offer such a feature, before implementing such a widget by myself.
At least in a primitive way like in NotePad++ (meant no offense). Now, when I am using QTabBar and press Ctrl+Tab it shows something like this,
And I don't know actually what is that !

The default behaviour of ctrl-tab is to cycle through the tabs. You will need to customize that to display your own dialog. You don't need to connect to any signals to do this, simply pass a reference to the tab widget/bar into the dialog. You can then use that reference to retrieve the names and to change the tab.

Related

Disabling a ComboBox item in Win32 API

I would like to disable an item in a combobox in my Win32 application (C++). I'm not quite sure how to do this. I'm trying to achieve something that looks like this:
Notice how CollectionItem2 and 3 are greyed-out.
Any help would be very much appreciated!
If you truly need a combobox for this, then (as #IInspectable said) you'll need to do a custom drawn control. Basically, you'll have to store some information saying which items are disabled/grayed, and draw the items appropriately based on whether they're enabled or not.
There may be a somewhat easier way though. This is normally done with a Split Button. This is button with the BS_SPLITBUTTON style set. When the drop-down part of the button is clicked, it sends a BCN_DROPDOWN notification.
You normally respond to that by displaying a menu, typically using TrackPopupMenu to display it immediately below the button (or immediately to its right, if you prefer). This is a normal menu, so it can have items enabled, disabled, grayed, have check boxes, etc., as you see fit.
If you're using MFC, it has a CSplitButton class that wraps the Split Button, simplifying the code a little bit--you can pass an identifier of a menu and sub-menu when you create the CSplitButton object, and it handles things from there.
A sample result probably looks pretty familiar:
Note: MFC also has a CMfcMenuButton class. This has roughly similar functionality, but is somewhat clumsier to use. If memory serves, it is compatible with older versions of Windows (but the split button goes back to Vista, so it's fine unless you really need to support XP).

Qt on macOS: display two keyboard shortcuts for one menu item

I'm writing an app using Qt 5 on macOS, and I'd like to find a way to display more than one keyboard shortcut for a menu item. It's not necessary for either shortcuts to actually work as I'm utilizing a different mechanism for triggering the shortcuts than the usual method with QAction. I just want both shortcuts to be displayed in the menu. Something like:
I've tried using QAction::setKeyboardShortcuts, but only the first shortcut is displayed.
I've also tried using a facility of QAction where you specify a shortcut in its text using a tab character (e.g. "Throw Party\tCtrl+P"), but adding more than one shortcut (e.g. "Throw Party\tCtrl+P Ctrl+Alt+A") results in none being displayed at all, unless they're separated by a comma, in which case a) they display with buggy formatting, and b) it implies that it's one shortcut that requires two consecutive keystrokes, rather than two separate shortcuts.

Qt - What should I use to implement multiple windows?

I've started learning Qt (C++) and I'm overwhelmed by the whole lot of component it has. I'm writing my first application and here's what it should look like:
When I run it, I have one main widget which has 8 QPushButtons.
When I click any of the buttons a 'window' should open and it should
contain about 25-40 various labels, buttons, checkboxes, radio
buttons and so on. So, I need 8 'windows'.
My question is: what should I use to implement these 'windows' - Widgets, Dialogs, MainWindows? What is like a conventional QT way of solving this problem?
It depends on how you want your application to look like.
If you want to have multible 'Windows' like different Tabs in your application then use QStackedWidget Class or QTabWidget Class.
If you need something like a Pop-Up you could use a QDialog.
Please make sure you understand how QWidget works and always take a look in the Qt Documentation.

Hide Page/Tab from QTWidget - QT 5.5

i need to hide tabs from a existing project in QT, i don't want to delete the code because i have to set parameters on that code, the Application relay on that too. Seems like QT hasn't built-in hide(); function, i tried to edit stylesheet to make it smaller, but doesn't work too, i've looked on the internet and seems like this is a known issue. Does somebody have some tricks to avoid this?
Only thing i was able to come up with is:
ui->TabObject->setEnabled(false);
basically i disable objects in the tab to make them not usable by the user, but this is not a good thing for the whole UI.
Maybe by calling QTabWidget::removeTab(index) - this removes the tab from the QTabWidget, but does not delete the tab's QWidget.

custom combobox win32

I am trying to implement an auto-suggest feature in an win32 combobox (C++). I want to achieve a behaviour that is similar to the google auto suggest function. When the user types something into the edit-control of the combobox, its listbox opens and shows all possible matches. The Problem is the default behaviour of a win32 combobox is to always select the closest match and put the complete text (selected) into the edit control when the list is opened. I need to avoid this behaviour. The list should just open - dont select something and dont change the text in the edit-control!
I have tried to subclass the combobox and catch the CBN_DROPDOWN message, but this changes nothing on the default behavior.
Does anyone have a further idea? I dont want the auto-complete feature that just completes the text in the edit-control without opening the list.
Thx in advance
Greets, Michael