Results 1 to 3 of 3

Thread: QDrag setPixmap failed with "XBM" format

  1. #1
    Join Date
    Feb 2007
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QDrag setPixmap failed with "XBM" format

    Hi all,
    I got trouble when QDrag setPixmap with "XBM" format.(X11 env.)
    You can reproduce it by modify exmaple ~qt4.x.src/examples/draganddrop/draggableicons/dragwidget.cpp
    Replace Line #110 ( drag->setPixmap(pixmap); ) with
    Qt Code:
    1. {
    2. static unsigned char drag_bits[] = {
    3. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    4. 0x00, 0x7f, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0xff, 0xc1, 0x0f,
    5. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x0f,
    6. 0x40, 0x10, 0x00, 0x40, 0x10, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00,
    7. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
    8.  
    9. QBitmap pixmap = QBitmap::fromData(
    10. QSize(20, 20), drag_bits, QImage::Format_Mono);
    11. pixmap.setMask(QPixmap::grabWidget(this).createHeuristicMask(true));
    12. drag->setPixmap((QPixmap)pixmap);
    13.  
    14. }
    To copy to clipboard, switch view to plain text mode 
    When we start dragging,
    we can find the icon is not xbm format, it become color not mono.
    And draggable icon contain background color

    Does anyone can help me?
    I need mono draggable icon.(XBM format)

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDrag setPixmap failed with "XBM" format

    QPixmap is always ARGB.

    Maybe if you explain what you're trying to achieve, I can help you with an example.

    Regards

  3. #3
    Join Date
    Feb 2007
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QDrag setPixmap failed with "XBM" format

    Hi Marcel,

    I try to start drag with an mono color icon/cursor. (XBM format, or QBitmap)
    May I achieve it?

    Regards

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.