customlist in Qt - c++

I want to create a Custom List which will contain not only a single line text but a combination of text, images buttons, progressbars. Is there any way to do this? I am unable to create that.
Please help me.

You can try to use QTableWidget where you can display a widget in a cell.
In your case you can do this:
Create a custom widget with buttons, progress bar, etc.
Implement a QTableView with only one column
Insert an instantiate custom widget in each row you are using
This should do what you want to achieve

Related

How to give a model from qtreeview two clickable icons

my problem is i want to add a new function to the item in teeview but the method of QAbstractItemModel::data(index,role) only give one checkbox or one icon to set
now i want to set two picture,which is clickable.
can it use the method of 'paint' or others?

Save the current position/order in a QTabWidget when a button is clicked - User Settings

Is it possible to save the current tab position/order in a QTabWidget in Qt?
What I want is basically to be able to let the users arrange the tabs as they like and then let them save the position so when they open the application again the tabs are where they were when last saved.
In the past I have done this put this only saves the window geometry.
QSettings mySettings("someName", "MyApp");
mySettings.beginGroup("MainWindow");
mySettings.setValue("geometry", saveGeometry());
mySettings.endGroup()
;
Any idea how or where can I find the information to get this done?
Thanks
Apparently there is no built-in way to do it, so you need to implement it. I don't see any possible troubles with it.
For example, you may obtain the index of each widget using QTabWidget::indexOf, or you may iterate over all tabs and obtain widgets using QTabWidget::widget, depending on which way is more convenient in your app.
When starting the app, sort your widgets by saved index and add them to the tab widget in that order.

QTreeView: How to put multiple widgets in one cell?

I'd like to put multiple widgets in one cell of a QTreeView. QTreeView already does this with check boxes (e.g if you set ItemIsUserCheckable and ItemIsEditable). For example, how would I show a small tool button next to a line edit, instead of the check box next to the line edit?
I've gone through the whole deal of subclassing Qtreeview, implementing a custom ItemDelegate, and overriding paint( ) and createEditor( ). And that works if I only need to render simple things, like a single line edit, single button, etc. However, I cannot get it to work for nested components.
I tried to create a QHBoxLayout, add a QLineEdit and a QToolBarButton to it, add the layout to a new QWidget, and return the whole thing from createEditor( ). However, nothing shows up.
Can anybody provide a simple example?
Thanks!

Show a download list with qt4

What is the best way to show a list of downloads using QT4?
1 QListWidget
2 QTreeWidget
3 QTableWidget
Thanks
It depends on how much functionality you want. If you just want to simply list the filenames, use a QListWidget. If you want to list other things like progress, filesize, etc. then you may want to use a QTableWidget. If you want to be able to group downloads under different categories, you can use the QTreeWidget, which will also allow for multiple table cells per row like the QTableWidget.
If you want something fancier like the firefox downloader, you may have to create an item delegate to handle the drawing yourself.
Use the model-view-controller widgets.
QListView
QTableView
QTreeView

file selector in a qtablewidget

I'm trying to get one cell in a QTableWidget to be a box with button at end"..." with file selector, but don't know how to change what kind of widget the cell is.
To control the types of cells in a table, it's best to use the QTableView class. Then, by using QItemDelegate you can make some table cell a button, to which you may bind a signal that opens a dialog.
I recommend starting by reading about delegate classes in the Qt docs.