PDA

View Full Version : QPixmap imcomplete rendering for QDrag and QCursor for Win XP 32 bit



welsper84
14th June 2010, 09:38
Hi, I just encountered this problem that seems prevalent in Win Xp 32 bit: the pixmaps that I created for for QDrag events are at least 180 pixels wide, but for some reason, the rendering is always shown to be cropped to 50 by 50 pixels. I have already set break points to check the size which is correct, but the rendering always show otherwise

I do not have this prob on Win 7 64 bit. Win Vista 64 bit and Win XP 64 bit

the drag Function:
void Test::performDrag()
{
QDrag* drag=new QDrag(this);
renderSelectedLayers();
QMimeData *mimeData=new QMimeData;
drag->setMimeData(mimeData);
drag->setPixmap(*m_map);
int test=drag->pixmap().width();
drag->exec(Qt::MoveAction);
}

Rendering Function
void Test::renderSelectedLayers()
{
//Double check the number of layers
int numberOfLayers=0;
for(size_t i=0; i<m_controller->getSelectedLayers().size(); ++i)
{
if(m_controller->getSelectedLayers()[i]->getType() == TimelineItem::kCel || m_controller->getSelectedLayers()[i]->getType() == TimelineItem::kCut
|| m_controller->getSelectedLayers()[i]->getParent() != m_controller->getActiveCelItem())
continue;

++numberOfLayers;
}

if(m_map)
delete m_map;
m_map=new QPixmap(width(), numberOfLayers*m_main_height);
m_map->fill(Qt::white);

QPainter painter(m_map);
painter.initFrom(this);
int count=0;
for(int i=0; i<static_cast<int>(m_controller->getSelectedLayers().size()); ++i)
{
if(m_controller->getSelectedLayers()[i]->getType() == TimelineItem::kCel || m_controller->getSelectedLayers()[i]->getType() == TimelineItem::kCut
|| m_controller->getSelectedLayers()[i]->getParent() != m_controller->getActiveCelItem())
continue;

painter.translate(0, count*m_main_height);
++count;
paintLayer(painter, m_controller->getSelectedLayers()[i], true);
painter.resetTransform();
}
}

nemmartins
29th June 2010, 16:59
Hi!

have u managed to get it working? I'm having the same problem under Windows XP. in Mac works as expected, but in windows, if I set the pixmap scaled to some size bigger than the original, only a quarter of the image will show.