我有两个QListWidget(list1和list2)
list1 应该能够从中接收物品 list2list1 应该能够通过内部拖放重新组织list2 应该能够从中接收物品 list1list1->setSelectionMode(QAbstractItemView::SingleSelection);
list1->setDragEnabled(true);
list1->setDragDropMode(QAbstractItemView::DragDrop);
list1->viewport()->setAcceptDrops(true);
list1->setDropIndicatorShown(true);
ulist2->setSelectionMode(QAbstractItemView::SingleSelection);
list2->setDragEnabled(true);
list2->setDragDropMode(QAbstractItemView::InternalMove);
list2->viewport()->setAcceptDrops(true);
list2->setDropIndicatorShown(true);
Run Code Online (Sandbox Code Playgroud)
我不得不把它list2打开,InternalMove否则当我把它拖到它时,项目不会删除list1.
如果我把list1给InternalMove我不能删除任何更多的就可以了.
我是否必须编写自己的拖放功能才能执行此操作?
我有两张桌子,DVD和联系人.
DVD可以租给联系人,联系人可以租用许多DVD.
多对一链接(dvd-->contact)工作正常.
但另一种方式失败了: (contact-->dvd)
这是联系人映射:
<set name="dvds" inverse="true">
<key column="contactId"/>
<one-to-many class="Dvd"/>
</set>
Run Code Online (Sandbox Code Playgroud)
这是联系人的setter getter:
private Set<Dvd> dvds = new HashSet<Dvd>();
public Set<Dvd> getDvds(){
return dvds;
}
public void setDvds(Set<Dvd> dvds){
this.dvds=dvds;
}
Run Code Online (Sandbox Code Playgroud)
当我试图从这个联系人那里租来DVD时:
HashSet<Dvd> tt = (HashSet<Dvd>)dds;
Run Code Online (Sandbox Code Playgroud)
我得到一个例外:
java.lang.ClassCastException: org.hibernate.collection.PersistentSet
cannot be cast to java.util.HashSet
Run Code Online (Sandbox Code Playgroud)
异常是什么意思,我该如何解决?
编辑:这解决了我的问题:
.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
Run Code Online (Sandbox Code Playgroud) 我需要在滚动视图中有一个 arrayAdapter(片段),下面有按钮,不幸的是,这样做时我的片段有一个元素的大小并且正在滚动自己
这是我的观点:
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/myfragment"
android:name="com.myapply.MyListFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="clip_vertical" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TEST TEST TEST"
android:textColor="#FFFFFF"
android:textSize="25dp" />
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
欢迎任何帮助
android ×1
criteria ×1
fragment ×1
hibernate ×1
java ×1
one-to-many ×1
qlistwidget ×1
qt ×1
scrollview ×1