View Full Version : How to use a button/widget as item for QListWidget?
youkai
2nd August 2008, 11:17
Hi!
I want to place one or more buttons into a QListWidgetItem to enable a choice at a certain position/item in the QListWidget.
It doesn't have to be a button, a simple text-link would be enough.
Is it possible?
So long
aamer4yu
4th August 2008, 07:31
Why cant u use QListWidget::itemClicked ??
Also to give effect of link, you can change the mouse cursor if its in the ListWidget :)
spirit
4th August 2008, 09:41
you can also use
void QListWidget::setItemWidget ( QListWidgetItem * item, QWidget * widget )
but I agree with aamer4yu
aamer4yu
4th August 2008, 10:55
From the docs -
void QListWidget::setItemWidget ( QListWidgetItem * item, QWidget * widget )
Sets the widget to be displayed in the give item.
This function should only be used to display static content in the place of a list widget item. If you want to display custom dynamic content or implement a custom editor widget, use QListView and subclass QItemDelegate instead.
Also using a widget wont be a good idea when u can get the work done without it. Why make ur application heavy ;)
youkai
6th August 2008, 15:34
Thanks for your answers. :)
I realized it with a context menu. But "setItemWidget" seems to be interesting.
Bye
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.