PDA

View Full Version : sintax



mickey
26th May 2006, 18:09
hello guys; Can anyone learn me what is the "#if 1, #else, #endif" meant? Thanks


void myLabel::mousePressEvent(QMouseEvent* e) {
printf("press\n");
QDragObject *drobj;
if ( pixmap() ) {
drobj = new QImageDrag( pixmap()->convertToImage(), this );
#if 1
QPixmap pm;
pm.convertFromImage(pixmap()->convertToImage().smoothScale(
pixmap()->width()/3,pixmap()->height()/3));
drobj->setPixmap(pm,QPoint(-5,-7));
#else
// Try it.
(void)new DragMoviePlayer(drobj);
#endif
} else {
drobj = new QTextDrag( text(), this );
}
drobj->dragCopy();
}

Michiel
26th May 2006, 18:16
Those are precompiler constructs. The compiler checks the condition (which, I think, is always true in this case) and decides which code to parse and compile.

I don't understand why they're there, though. They don't seem to do anything useful.

mickey
26th May 2006, 18:36
sorry, I modified it; now, I'll know where it is!