Results 1 to 20 of 23

Thread: Pictures won't display - possible qt coordinate system confusion

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Pictures won't display - possible qt coordinate system confusion

    Quote Originally Posted by jpn View Post
    The copy constructor of QGraphicsPixmapItem is private which means that you cannot copy QGraphicsPixmapItems.

    The easiest way is to use the convenience method of QGraphicsScene:
    Qt Code:
    1. QGraphicsPixmapItem* item = scene->addPixmap(pixmap);
    2. item->setPos(...);
    To copy to clipboard, switch view to plain text mode 
    but you can create QGraphicsPixmapItems yourself as well:
    Qt Code:
    1. QGraphicsPixmapItem* item = new QGraphicsPixmapItem(pixmap, parent);
    2. scene->addItem(item);
    3. item->setPos(...);
    To copy to clipboard, switch view to plain text mode 
    And one more question: why is the copy contructor of QGraphicsPixmapItem private, I mean, what do we gain with that?

    Thank you very very much for help, let me now dig into it and i will report results.
    Qt 5.3 Opensource & Creator 3.1.2

  2. #2
    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: Pictures won't display - possible qt coordinate system confusion

    Quote Originally Posted by MarkoSan View Post
    And one more question: why is the copy contructor of QGraphicsPixmapItem private, I mean, what do we gain with that?
    It's a programmatical technique to prevent objects from getting copied. Sometimes it makes no sense to copy an object, like a QObject or a QGraphicsItem. Both QObjects and QGraphicsItems are organized in object trees where each object has an optional parent and children. What should happen when such object is copied? Should children get copied? Should parent get copied as well? Should possible signal-slot connections get copied? What person A would expect to happen would be most likely different than person B would expect. The result would be chaotic no matter how the functionality was implemented. Therefore it's just better to prevent it from happening.

    PS. Did you notice that your signature says "kUbutnu"?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Pictures won't display - possible qt coordinate system confusion

    Quote Originally Posted by jpn View Post
    It's a programmatical technique to prevent objects from getting copied. Sometimes it makes no sense to copy an object, like a QObject or a QGraphicsItem. Both QObjects and QGraphicsItems are organized in object trees where each object has an optional parent and children. What should happen when such object is copied? Should children get copied? Should parent get copied as well? Should possible signal-slot connections get copied? What person A would expect to happen would be most likely different than person B would expect. The result would be chaotic no matter how the functionality was implemented. Therefore it's just better to prevent it from happening.

    PS. Did you notice that your signature says "kUbutnu"?
    Thanks for explanation, and, YES, I DID NOTICE my signature says kUbutnu , but I wondered who will correct me first. I bet on wysotta but you did it before him.
    Qt 5.3 Opensource & Creator 3.1.2

  4. #4
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Pictures won't display - possible qt coordinate system confusion

    Ok, jpn, I again tumbed into wall. Loaded pics are different sizes, how do I limit the size of every loaded pic to, for example, to 100x100 points?
    Qt 5.3 Opensource & Creator 3.1.2

  5. #5
    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: Pictures won't display - possible qt coordinate system confusion

    Quote Originally Posted by MarkoSan View Post
    I wondered who will correct me first. I bet on wysotta but you did it before him.
    Heh, it's been buggering me for a while but I couldn't resist myself anymore..

    Quote Originally Posted by MarkoSan View Post
    Ok, jpn, I again tumbed into wall. Loaded pics are different sizes, how do I limit the size of every loaded pic to, for example, to 100x100 points?
    Well, it depends a bit what you want to achieve. Both QPixmap and graphics items are scalable. See QPixmap::scaled() and QGraphicsItem::scale().
    J-P Nurmi

  6. #6
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Pictures won't display - possible qt coordinate system confusion

    Well, these pictures will be placed on "ghost" circle coordinates. And this is ugly if every pic has different size, so every created pixmap must be scaled to predefined size, let me try.

    And, let me correct signature so you will not bothered again.
    Qt 5.3 Opensource & Creator 3.1.2

  7. #7
    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: Pictures won't display - possible qt coordinate system confusion

    Warning: out of topic
    Quote Originally Posted by MarkoSan View Post
    And, let me correct signature
    One might still argue about its "correctness". Or did you ever see it written like that?
    J-P Nurmi

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

    Default Re: Pictures won't display - possible qt coordinate system confusion

    Quote Originally Posted by jpn View Post
    Warning: out of topic

    One might still argue about its "correctness".
    I would... It's Kubuntu or KUbuntu. The "K" stands for KDE which is written with a capital letter.

  9. #9
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Pictures won't display - possible qt coordinate system confusion

    Quote Originally Posted by wysota View Post
    I would... It's Kubuntu or KUbuntu. The "K" stands for KDE which is written with a capital letter.
    Yeah, man, I've been waiting for genius wysotta to comment previous "warning". Now I must go back to code.
    Qt 5.3 Opensource & Creator 3.1.2

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

    Default Re: Pictures won't display - possible qt coordinate system confusion

    My name spells with a single "t". Don't mess it up, please. It's a Slavic name, so you shouldn't be making any mistakes in it.

  11. #11
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Pictures won't display - possible qt coordinate system confusion

    I am very sorry if I got you insulted. It won't happen again.
    Qt 5.3 Opensource & Creator 3.1.2

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

    Default Re: Pictures won't display - possible qt coordinate system confusion

    You didn't but I prefer my name to be spelled correctly.

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

    Default Re: Pictures won't display - possible qt coordinate system confusion

    Quote Originally Posted by MarkoSan View Post
    I bet on wysotta but you did it before him.
    I don't read signatures

    About your question: use QPixmap::scaled() or QImage::scaled().

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
  •  
Qt is a trademark of The Qt Company.