alfa_wu
30th April 2007, 08:36
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
{
static unsigned char drag_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7f, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0xff, 0xc1, 0x0f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x0f,
0x40, 0x10, 0x00, 0x40, 0x10, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
QBitmap pixmap = QBitmap::fromData(
QSize(20, 20), drag_bits, QImage::Format_Mono);
pixmap.setMask(QPixmap::grabWidget(this).createHeu risticMask(true));
drag->setPixmap((QPixmap)pixmap);
}
When we start dragging,
we can find the icon is not xbm format, it become color not mono.:confused:
And draggable icon contain background color :confused:
Does anyone can help me?
I need mono draggable icon.(XBM format)
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
{
static unsigned char drag_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7f, 0x00, 0x00, 0x41, 0x00, 0x00, 0x41, 0x00, 0xff, 0xc1, 0x0f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf0, 0x0f,
0x40, 0x10, 0x00, 0x40, 0x10, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
QBitmap pixmap = QBitmap::fromData(
QSize(20, 20), drag_bits, QImage::Format_Mono);
pixmap.setMask(QPixmap::grabWidget(this).createHeu risticMask(true));
drag->setPixmap((QPixmap)pixmap);
}
When we start dragging,
we can find the icon is not xbm format, it become color not mono.:confused:
And draggable icon contain background color :confused:
Does anyone can help me?
I need mono draggable icon.(XBM format)