Results 1 to 3 of 3

Thread: Problem in Mouse Press Events & Vectors

  1. #1
    Join Date
    Mar 2008
    Posts
    46
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem in Mouse Press Events & Vectors

    Hi friends i have 2 doubt's.

    1.) I am using mouse press events

    Qt Code:
    1. QMousePressEvent(QMouseEvent *e)
    2. 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 ).
    To copy to clipboard, switch view to plain text mode 
    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

  2. #2
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Problem in Mouse Press Events & Vectors

    Hmm Maybe it should look like this
    Qt Code:
    1. QVector<double>V1;
    2. QVector<double>V2
    3. QVector<double>V2
    4.  
    5. QVector<QVector *>Vmain;
    6. Vmain<<&V1<<&V2<<&V3;
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. for(cl = 0; cl<Vmain.count();cl++)
    2. {
    3. Vmain.at(cl)->clear();
    4. }
    To copy to clipboard, switch view to plain text mode 

    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...
    Last edited by THRESHE; 5th July 2008 at 15:36.
    C++ & AMD forever

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem in Mouse Press Events & Vectors

    1.
    Qt Code:
    1. QPoint pos = e->pos();
    To copy to clipboard, switch view to plain text mode 

    2.
    Qt Code:
    1. QVector< QVector<double> > Vmain;
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. Replies: 9
    Last Post: 22nd June 2008, 23:26
  2. problem about mouse button events
    By vql in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2008, 11:14
  3. Replies: 2
    Last Post: 2nd April 2008, 15:19
  4. mouse moving don't produce mouse events
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2006, 07:13
  5. QStackerWidget and mouse events
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2006, 20:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.