Results 1 to 9 of 9

Thread: Composition

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Composition

    Is still not possible to use composition with a QPixmap in Qt 4..5.3 under windows?
    Only QImage?
    If not when it will be possible?

    Best Regards,
    Franco
    Franco Amato

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Composition

    Did you try it?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Composition

    Quote Originally Posted by wysota View Post
    Did you try it?
    No, the doc says that. How can I select a region over a Pixmap/Image using composition with the mouse?

    Thank you in advance.
    Best
    Franco Amato

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Composition

    Quote Originally Posted by franco.amato View Post
    No, the doc says that.
    Maybe you should try it?

    How can I select a region over a Pixmap/Image using composition with the mouse
    Composition is about painting, not selecting things. For painting the selection you can use QPainter::CompositionMode_Xor if you want (or any other composition actually).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Composition

    Quote Originally Posted by wysota View Post
    Maybe you should try it?



    Composition is about painting, not selecting things. For painting the selection you can use QPainter::CompositionMode_Xor if you want (or any other composition actually).
    I have to implement the mousePress/Move/ReleaseEvents right? Select a region and paint it?
    Or I'm wrong? I have to select a region in the audio waveform .
    Can I have a little example with some lines of code?

    Best Regards,
    Franco
    Franco Amato

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Composition

    You can do it many ways. QRubberBand docs has a nice example.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Composition

    Quote Originally Posted by wysota View Post
    You can do it many ways. QRubberBand docs has a nice example.
    dear wysota I tried to implement the rubberBand example but I always get a crash on the line
    Qt Code:
    1. rb->setGeometry( QRect( startSelection, QSize() ) );
    To copy to clipboard, switch view to plain text mode 

    This is mainly my code:

    Qt Code:
    1. void WaveWidget::mousePressEvent( QMouseEvent* pe )
    2. {
    3. if( pe->button() == Qt::LeftButton )
    4. {
    5. pe->accept();
    6. startSelection = pe->pos();
    7. qDebug() << pe->pos();
    8.  
    9. if( !rb )
    10. rb = new QRubberBand( QRubberBand::Rectangle, this );
    11.  
    12. rb->setGeometry( QRect( startSelection, QSize() ) );
    13. rb->show();
    14. }
    15. else
    16. pe->ignore();
    17. }
    To copy to clipboard, switch view to plain text mode 

    Where
    Qt Code:
    1. QPoint startSelection;
    To copy to clipboard, switch view to plain text mode 
    are private members of my WaveWidget class.

    I don't know where my code fails if I exactly copied the code of the doc.

    If I comment the setGeometry now it craches on the show method.
    Do you have an idea?
    Best Regards
    Last edited by franco.amato; 30th November 2009 at 23:32.
    Franco Amato

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Composition

    Did you initialize rb to 0 in the constructor?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Composition

    Quote Originally Posted by wysota View Post
    Did you initialize rb to 0 in the constructor?
    No this solved sorry for the trivial error.
    A question how can I change the color of the Rubberband region?

    Thankx,
    Franco Amato

Similar Threads

  1. [java] access to member in composition
    By mickey in forum General Programming
    Replies: 2
    Last Post: 21st June 2008, 22:24
  2. Replies: 3
    Last Post: 11th April 2008, 12:25
  3. colors composition
    By elcuco in forum Qt Programming
    Replies: 5
    Last Post: 12th November 2007, 20:51
  4. Interface composition and QObject
    By brcain in forum Qt Programming
    Replies: 9
    Last Post: 20th November 2006, 17:56

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.