Update of /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19138
Modified Files:
PlanDefineBatch.cpp PlanDefineBatch.h
Log Message:
Drag & Drop to plan definition simplified and fixed.
Index: PlanDefineBatch.cpp
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanDefineBatch.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PlanDefineBatch.cpp 17 May 2007 22:36:11 -0000 1.1
--- PlanDefineBatch.cpp 20 May 2007 16:34:37 -0000 1.2
***************
*** 111,115 ****
PlanDefineBatchListItem *PlanDefineBatchListItem::Nearest(PlanItemType _which)
{
- printf("in nearest\n");
QTreeWidgetItem *P = Parent(PIPlanBatch);
QTreeWidgetItem *C;
--- 111,114 ----
***************
*** 120,123 ****
--- 119,125 ----
return((PlanDefineBatchListItem*)P);
+ if (type()==PIPlanBatch)
+ P=this;
+
if (!P)
return(0);
***************
*** 125,136 ****
n=P->childCount();
- printf("nearest1\n");
for(i=0;i<n;i++) {
C=P->child(i);
- printf("nearest1 i=%d/%d x=%d, t=%d\n",i,n,_which,C->type());
if (C->type()==_which)
return((PlanDefineBatchListItem*)C);
}
- printf("nearestD\n");
return(0);
}
--- 127,135 ----
***************
*** 160,163 ****
--- 159,167 ----
}
+ void PlanDefineBatchList::dragUpdateSelection(int x, int y)
+ {
+ setCurrentItem(itemAt(x, y));
+ }
+
void PlanDefineBatchList::doPlanBatchRegister(CBM::PlanBatch *_batch)
***************
*** 219,222 ****
--- 223,229 ----
{
if (event->mimeData()->hasText()) {
+
+ dragUpdateSelection(event->pos().x(), event->pos().y());
+
if (children().contains(event->source())) {
event->setDropAction(Qt::MoveAction);
***************
*** 233,246 ****
{
if (event->mimeData()->hasText()) {
PlanDefineBatchListItem *I = dynamic_cast<PlanDefineBatchListItem*>(currentItem());
- printf("I=%x\n", (unsigned int) I);
if (I) {
event->setDropAction(Qt::MoveAction);
PlanDefineBatchListItem *C = new PlanDefineBatchListItem(App->PlanCompilerSelected());
- printf("there, finding nearest\n");
PlanDefineBatchListItem *P = I->Nearest(PICompilers);
- printf("nearest=%x\n", (unsigned int) P);
if (P) {
P->setExpanded(true);
--- 240,253 ----
{
if (event->mimeData()->hasText()) {
+
+ dragUpdateSelection(event->pos().x(), event->pos().y());
+
PlanDefineBatchListItem *I = dynamic_cast<PlanDefineBatchListItem*>(currentItem());
if (I) {
event->setDropAction(Qt::MoveAction);
PlanDefineBatchListItem *C = new PlanDefineBatchListItem(App->PlanCompilerSelected());
PlanDefineBatchListItem *P = I->Nearest(PICompilers);
if (P) {
P->setExpanded(true);
Index: PlanDefineBatch.h
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/Qt-4/Plan/PlanDefineBatch.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PlanDefineBatch.h 17 May 2007 22:36:11 -0000 1.1
--- PlanDefineBatch.h 20 May 2007 16:34:37 -0000 1.2
***************
*** 49,52 ****
--- 49,53 ----
{
+ protected:
public:
PlanDefineBatchListItem(PlanItemType _type);
***************
*** 65,68 ****
--- 66,71 ----
private:
protected:
+ virtual void dragUpdateSelection(int x, int y);
+
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent *event);
|