PDA

View Full Version : Problem in Mouse Press Events & Vectors



dheeraj
5th July 2008, 15:01
Hi friends i have 2 doubt's.

1.) I am using mouse press events



QMousePressEvent(QMouseEvent *e)
QPoint= e->Pos(); // Now here i wanted to get the Object Name of the Point e(I mean the point on which widget it is ).

I tried so much but cud't figure out a way to solve my problem.

2.) In this i am dealing with vectors .
here i have three vectors

QVector<double>V1;
QVector<double>V2
QVector<double>V2

I want to collect these into new vector Vmain, i declared it as

QVector<QVector *>Vmain;
Vmain<<V1<<V2<<V3;

But while doing operation on this ........

for(cl = 0; cl<Vmain.count();cl++)
{
Vmain.at(cl).clear();
}

I got these errors




error C2228: left of '.clear' must have class/struct/union
error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'QVector<T>'



please help me with this problem.

Thank You

THRESHE
5th July 2008, 15:32
Hmm Maybe it should look like this


QVector<double>V1;
QVector<double>V2
QVector<double>V2

QVector<QVector *>Vmain;
Vmain<<&V1<<&V2<<&V3;



for(cl = 0; cl<Vmain.count();cl++)
{
Vmain.at(cl)->clear();
}

You have a vector of pointers "QVector<QVector*>" don't forget about it :)

And honestly I don't understand what do you want to do in the first issue...

jpn
5th July 2008, 19:08
1.

QPoint pos = e->pos();

2.

QVector< QVector<double> > Vmain;