Qt Model / View - qt

I get lost in QDelegate, QAbstractItem, QTreeview..
What i want to archive.
A Treeview where i can add parent items from a dialog thats looks like this:
Name | QButton | QProgressbar
On those parents i want to drop files from the windows explorer. Those childs should look like this:
Name | FilePath | pre filled QCombobox
Looks like there is no simple way to do that. Can someone explain what i have to look for in the docs and what would be the correct way to get the GUI i am looking for?

Related

Find index of a tab in QTabWidget

I'm looking for a away to find an index of a certain tab in QTabWidget, so I can set the current index to this one. I remove some of the tabs so I don't want to use just an int to set the current tab, because in the future those removed tabs are going to be visible again and I don't want the code to depand on that.
So ideally I would like to be able to write something like that:
ui->tabWidget->setCurrentIndex(ui->tab->getIndex());
Is there some method like getIndex()?
Use ui->tabWidget->indexOf(your tab)

Grid view display issue

I have a data table which display like below in grid view and I done edit, update & cancel operation on it, it will work fine
ID | Title | Number | State
585344 issue 1 140024 In progress
But I want to display it like below in grid view and doing Edit, update & cancel operation on it, How to do please help....
ID-585344
Title-issue 1
Number-140024
State-In progress
I would suggest instead of going for gridview go for Listview (as you are using .Net 4.0), you can easily achieve desired output.

Putting dynamic data in QT and can selection it

I want to do the next.
I have a program that must search and show some files. Before, I will do it with a QTextEdit, searching in the system and appending it when I found one.
Now I want to to the next: I want to show the name of the files but I want to select it in the GUI and, in anohter text edit, show the first line in the document.
So, I want to transform any file in something that I can select it (like a Radio Button, a check button or something like this).
I search info in the web but I dont found anything.
Anyone knows what I can do?
Usually you use something like a list view (list of selectable items) to do this. Fortunatley Qt has one! called QListView :)
See this link: QListView
You add one entry to the listview per file (for exampe). And then when you click/select an entry this triggers an event which you can make display the contents of the file in a nearby text box.

Qt name of button class

What is the name of the button class that allows me to select one option from many. This button looks like a normal button but it has arrow on the right side and this arrow allows to pick an option, I.E, button Add would look like this:
| Add \/ |
Are you thinking of a ComboBox?
Wiki
QT Docs

Tree Drag and Drop Functionality

label1
|
|*label2
|*label3
|___label4
|___label5
I want a tree in this structure, having line between the nodes, also, instead of Open and Close Folders, I have added my own graphic there with label. I did by extending TreeItemRenderer Class. Now, I if iam dragging and dropping a child node ex:label5, and try i drop it above label1 here, it is getting dropped there. i.e.,it is becoming like
label5 ----------> This should not happen.Child should be restricted from being added
label1 above parent.
|
|_label2
|_*label3
|___label4
I need to restrict the same. Kindly help me regarding the same.
You can implement custom dragging and dropping and apply any logic to this.
See here.

Resources