问题表明,你如何在树林植被中提出和降低[改变]QTreeWidgetItems的位置,
Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...
问题表明,你如何在树林植被中提出和降低[改变]QTreeWidgetItems的位置,
我认为,你需要使用模范物体才能操纵项目位置(如果你想要这样做的话)。 请举一个例子:将抽象模式的第一个项目移至底。
QAbstractItemModel* model = your_tree_view->model();
QModelIndex index0 = model->index(0, 0);
QMap<int, QVariant> data = model->itemData(index0);
// check siblings of the item; should be restored later
model->removeRow(0);
int rowCount = model->rowCount();
model->insertRow(rowCount);
QModelIndex index1 = model->index(rowCount, 0);
model->setItemData(index1, data);
一旦项目在模型中移入,您的树木概貌植被应相应更新。
如有必要改变您的树木情况表所示项目的规模:http://qt.nokia.com/doc/4.6/qetteditemdelegate.html” 方法
希望这一帮助,
I found serge s solution to be quite complicated as well for a simple move up / move down. There s actually a quite easier solution to this issue since you re using QTreeWidget :
QTreeWidgetItem* item = your_qtreewidget->currentItem();
int row = your_qtreewidget->currentIndex().row();
if (item && row > 0)
{
your_qtreewidget->takeTopLevelItem(row);
your_qtreewidget->insertTopLevelItem(row - 1, item);
your_qtreewidget->setCurrentItem(item);
}
在这里,你有一项法典,将一个项目移至上。 从这一点来看,你们应当能够找到如何在任何时候放下它!
Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...
I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...
Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...
Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...
I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...
Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...
Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...
I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...