Solved How to copy all items from one QListWidget to another?
-
I have created a QList of QListWidget and have appended some QListWidgets.I also have a QListWidget in mainwindow ui.
I want a particular QListWidget from QList to be displayed in the ui.How can it be done?Plz suggest. -
@Sriu1
One does not simply copy a QListWidget!
In fact its nearly impossible, as it inherits from QObject.
But I think you actually want to do something different, could you explain it in more detail? Prefered with a code example.
-
I'm creating a playlist for video,audio,image.I have created a QList<QListWidget*> list;
and I have appended 3 QListWidgets to this.I have a QComboBox in ui when video option is selected I want to display video QListWidget.Btw found a GOT fan here :)
-
@Sriu1 said in How to copy all items from one QListWidget to another?:
want to display video QListWidget
display where?
Can you be more specific? -
In the ui I have a QListWidget created in design mode. I want to display all the items from a particular QListWidget from the QList into the QListWidget which is created in the design mode.
-
@Sriu1 Then iterate over the items of that QListWidget and for each item create a new QListWidgetItem with same values and add it to the other QListWidget...
There is even a copy constructor: http://doc.qt.io/qt-5/qlistwidgetitem.html#QListWidgetItem-3
Or http://doc.qt.io/qt-5/qlistwidgetitem.html#clone
... -