void PixmapDialog::setPixmap( const QPixmap &pixmap ) { contents_pixmap = pixmap; if ( !resizable ) { label->setPixmap( contents_pixmap ); label->update(); update(); int left, top, right, bottom; getLabelOffset( left, top, right, bottom ); int xoffset = size().width(); int yoffset = size().height(); resize( QSize( contents_pixmap.width() + left + right, contents_pixmap.height() + top + bottom ) ); xoffset = xoffset - size().width(); yoffset = yoffset - size().height(); move( pos().x() + xoffset, pos().y() + yoffset ); update(); } else { resized(); } }
void PixmapDialog::showEvent( QShowEvent *event ) { int xoffset = size().width(); int yoffset = size().height(); resized_on_show = false; if ( !resizable ) { int left, top, right, bottom; getLabelOffset( left, top, right, bottom ); if ( size() != QSize( contents_pixmap.width() + left + right, contents_pixmap.height() + top + bottom ) ) { resized_on_show = true; resize( QSize( contents_pixmap.width() + left + right, contents_pixmap.height() + top + bottom ) ); } } else { resized(); } if ( resized_on_show ) { xoffset = xoffset - size().width(); yoffset = yoffset - size().height(); move( pos().x() + xoffset, pos().y() + yoffset ); emit( showSignal() ); return; } Plasma::Dialog::showEvent( event ); }
void PixmapListDialog::setImageList( const QList<QByteArray> &list ) { contents_image_list = list; if ( contents_image_list.size() <= 0 ) return; if ( current_image < 0 || current_image > contents_image_list.size() ) { current_image = 0; left_icon->setPixmap( QPixmap() ); left_icon_hover = false; if ( contents_image_list.size() > 1 ) { if ( right_icon_hover ) right_icon->setPixmap( right_icon_pixmap_lighter ); else right_icon->setPixmap( right_icon_pixmap ); } } if ( current_image == 0 ) { left_icon->setPixmap( QPixmap() ); left_icon_hover = false; } else { if ( left_icon_hover ) left_icon->setPixmap( left_icon_pixmap_lighter ); else left_icon->setPixmap( left_icon_pixmap ); } if ( current_image < contents_image_list.size() - 1 ) { if ( right_icon_hover ) right_icon->setPixmap( right_icon_pixmap_lighter ); else right_icon->setPixmap( right_icon_pixmap ); } else { right_icon->setPixmap( QPixmap() ); right_icon_hover = false; } if ( !resizable ) { int left, top, right, bottom; getLabelOffset( left, top, right, bottom ); QImage tmp_image; tmp_image.loadFromData( contents_image_list.at( current_image ) ); resize( QSize( tmp_image.width() + left + right, tmp_image.height() + top + bottom ) ); setMovie( contents_image_list.at( current_image ) ); } else { resized(); } }
void PixmapDialog::mousePressEvent( QMouseEvent *event ) { if ( event->button() == Qt::LeftButton ) { int left, top, right, bottom; getLabelOffset( left, top, right, bottom ); if ( !isHidden() && QRect( left, top, label->size().width(), label->size().height() ).contains( event->pos(), true ) ) { hide(); emit( hidden() ); return; } } Plasma::Dialog::mousePressEvent( event ); }
void getImmediate(char *code,char *arg, int curIndex) { int i = 16; int imm; int bitmask = 0x8000; if(isdigit(arg[0]) || arg[0] == '-') { sscanf(arg, "%d", &imm); } else { imm = getLabelOffset(arg,curIndex); } while(bitmask) { if(bitmask & imm) { code[i] = '1'; } i++; bitmask = bitmask/2; } }