Creating a listbox-like control in QT C++ - c++

I am a beginner at QT and I have been trying to port a GUI project over from raw Win32 to QT. Only problem is I cannot find the name for some controls in the QT framework such as the pictured one below.
I believe it is called a listbox in C# and C++ and I used some code to put the title bar up at the top containing "Update, Version, Size, Date". What would this translate to in QT? I have tried the tableview from QT but it only succeeds in making a Microsoft Excel type box with rows and columns, my goal is only to get vertical columns with a title at the top. Thank you!

That's not a ListBox control, that's a ListView control.
Not sure what Qt calls it, but since they prefix everything with a Q, I'd imagine it's QListView.
The ListView is like a super-duper ListBox that also has a column header attached to it when you set it to display in "Details" view.

QListBox was deprecated in Qt 4, and was replaced by QListView.
For the type of multi-column control pictured, QTreeWidget should work.

Related

Qt - TableView with categories

I am looking to replicate the look of the TableView presented in this picture using Qt. The one in the picture looks to be created with Windows Forms. The main part I'm wondering about is how the different items have different categories kind of (with each section having a header).
Is it possible to do this in a Qt TableView, or do I need to use a TreeView?

Nested comboboxes in Qt

I'm looking for a way of nesting comboboxes in my GUI application (or to be more precise, I'm looking for a way to have an item displaying similar visual and functionnal properties as nested comboboxes).
Looking first at all the functions provided by the combobox class, it seems comboboxes nesting it's not supported by Qt.
I therefore thought that another solution would be to create a "menu" item outside the menu bar. If I understand correctly this phrase from the offical Qt documentation, it seems to be feasiable :
A menu widget can be either a pull-down menu in a menu bar or a standalone context menu
Not sure though was is meant by the "context" word.
However, there is no such (menu) widget in Qt designer and I haven't found any good examples about how to do it on the internet (and can't get a menu not associated with a menu bar to be displayed on the windows), explaining why I'm currently doubting whether it's feasible or not with a menu item.
I would greaty appreciate if you could provide some code sample along your response.
EDIT :
To clarify my first post, I'm trying to do something similar to this app :
It's the application that comes along the 3D connexion mouse whose usage is to parametrize each button.
As you can see, there are several sub-menu items. By clicking on the arrow next to a textbox, you open a sub-menu containing itself folders that contains themselves paramaters.

Creating tabbed document interfaces in Qt Designer?

I am trying to write a program that will use a tabbed document interface (TDI) like seen in Notepad++ or most web browsers. I know how to build GUIs using Qt Designer, and code in Qt C++ (after a few days of playing around).
I have created an example of what each page widget will look like using Designer, and now I want to add the ability to create and testroy tabs at runtime, each containing a unique instance of the page widget. However, I have no idea how to do this without adding a class that extends QWidget, and building the page widget with code. I could go down this route, but I'm sure there must be a better way of creating a TDI; but I can't find any tutorials or examples of how to do this.
Does anyone have any suggestions?
For creating tab interfaces you should look into QTabWidget.
It is a container widget included in Qt Designer which automatically handles operations on tabs. It has several build in methods for manipulating its tabs and theirs contents.
Each page of QTabWidget is handled separately and can have different layouts and functionality.
If you want to include several different objects to one page assign a layout to it and then assign the objects to the layout.

Qt - ComboBox automatically in TableView?

So in my project, I had a TableView and i edited some of its info's in the Qt Editor itself. I also implemented all the codes for it and when I ran before, I could see a comboBox in a place of int. But for some reasons I had to replace that TableView with a new one. All the codes are the same, but I don't see any comboBox now. So does that mean the comboBox appeared for something done in the Editor?
If you replaced your TableView in the qt designer and gave it the same name as before it shouldn't do anything to your c++ implementation of your class. The settings you enter in the qt designer will be deleted when you delete the TableView and you have to re-enter the ones you had before. So you can still use your previous c++ implementation of your class.
I usually design my gui in qt designer and then create a class that sets up signals/slots and initializes the widgets to my liking. So if you had setup your widgets from your class constructor you wouldn't have to worry about any of this.
Good luck!

Equivalent of WinForm "Dock Fill" for Qt Widgets / Layouts?

Starting with Qt (coming from C#, WinForms) I wonder what the equivalent of Dock: Fill is (a control shall use all available space)?
The screenshots below show the structure of my simple demo application. The QTableView shall expand to the full horizontal dimensions. In a WinForm I'd accomplish this by using Dock: Fill. Is there a (similar) solution in Qt?
I have tried the SizePolicy and LayoutSizeRestriction (SetMaximumSize), but with no success.
It can be a little unintuitive the first time around but you just need to set a layout on the QDialog. Right-click anywhere on the dialog form and select "Lay out".