这样当鼠标进入到QListWidget的某一个Item时就会发射itemEntered(QListWidgetItem*)信号。
接下来你只需要在两个QListWidget都可见的地方(一般为这两个QListWidget的父窗口)将
第一个QListWidget发射的itemEntered(QListWidgetItem*)信号connect到第二个QListWidget自定义
的槽里面就可以了,在这个槽函数里你就可以完成创建新Item的工作了。
可以,你可以参考assitant中的说明void QListWidget::setItemWidget(QListWidgetItem * item, QWidget * widget)
Sets the widget to be displayed in the given 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.
上面的翻译:
该函数应该只用来在一个list widget item位置显示静态内容。如果你想要显示自定义动态内容或实现一个自定义编辑控件,使用QListView和子类化QItemDelegate代替。
1. 使用:void setSelected ( int index, bool select )2.
插入:
void insertItem ( const QListBoxItem * lbi, int index = -1 )
void insertItem ( const QListBoxItem * lbi, const QListBoxItem * after )
void insertItem ( const QString &text, int index = -1 )
void insertItem ( const QPixmap &pixmap, int index = -1 )
void insertItem ( const QPixmap &pixmap, const QString &text, int index = -1 )
删除
void removeItem ( int index )
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)