//绘制从父节点往子节点绘制 bool XWidget::responseEvent(X_Event *event) { if(!visible) { return false; } #ifdef USE_MOUSE if(event->type >= X_MOUSEMOTION && event->type <= X_MOUSEBUTTONUP ) { //如果鼠标或者点击在矩形内 if(devEvent(event)){ return true; }else { switch(event->type) { case SDL_MOUSEMOTION: { mouseLeaveEvent(event); } break; } } } #endif else if(event->type >= X_PAINT) { onPaint(event->type); } return false; // 处理本组件消息................. }
void UIShowPanel::createUI( int marginX, int marginY, int width, int height ) { // Title this->title = new QLabel( this ); this->title->setStyleSheet( "font-size: 30px;" ); this->title->move( marginX, this->engineProperties->get( "TVSHOW_TITLE_Y_SPACE" ).toInt() ); // Categorie this->categorie = new QLabel( this ); this->categorie->move( marginX, this->title->pos().y() + this->title->height() + this->engineProperties->get("TVSHOW_DECALLAGE_TITLE_CATEGORIE").toInt( )); // Stars int i, size = this->engineProperties->get( "MAX_STARS" ).toInt(), starSpace = this->engineProperties->get( "STAR_SPACE" ).toInt(); const QPixmap *emptyPixmap = this->enginePicture->getPicture( PICTURE_STAR_EMPTY ); for( i = 0; i < size; i++ ) { JLabel *star = new JLabel( this ); star->setPixmap( *emptyPixmap ); star->move( marginX + i * emptyPixmap->width() + starSpace, this->categorie->pos().y() + this->categorie->height() ); this->connect( star, SIGNAL(mouseEnterEvent()), this, SLOT(changeStarsHover())); this->connect( star, SIGNAL(mouseLeaveEvent()), this, SLOT(changeStarsLeave())); this->connect( star, SIGNAL(mouseRelease()), this, SLOT(starClicked())); this->stars.push_back( star ); } int ySpace = 30; // Status this->show_status = new QLabel( this ); this->show_status->move( this->engineProperties->get( "TVSHOW_CALQUE_LEFT" ).toInt(), marginY ); this->show_status->setStyleSheet( "font-size: 12px" ); // Started this->show_started = new QLabel( this ); this->show_started->move( this->show_status->pos().x(), marginY + ySpace ); this->show_started->setStyleSheet( "font-size: 12px" ); // Ended this->show_ended = new QLabel( this ); this->show_ended->move( this->show_status->pos().x(), marginY + 2 * ySpace ); this->show_ended->setStyleSheet( "font-size: 12px" ); // Country this->show_country = new QLabel( this ); this->show_country->move( this->show_status->pos().x(), marginY + 3 * ySpace ); this->show_country->setStyleSheet( "font-size: 12px" ); // Episode list this->listConteneur = new QWidget( this ); this->listConteneur->move( this->engineProperties->get( "TVSHOW_CALQUE_LIST_LEFT" ).toInt(), this->engineProperties->get( "TVSHOW_CALQUE_LIST_TOP" ).toInt() ); this->listConteneur->setFixedSize( width - this->listConteneur->width() - this->engineProperties->get( "TVSHOW_X_DECALLAGE" ).toInt(), height - this->listConteneur->pos().y() - this->engineProperties->get( "TVSHOW_X_DECALLAGE" ).toInt() ); this->moveConteneur = new QWidget( this->listConteneur ); // Options panel this->optionsPanel = new UIOptionsPanel( this->engineProperties, this->enginePicture, this->engineLanguage, this->engineProperties->get( "OPTIONSPANEL_HEIGHT" ).toInt() - 2 * this->engineProperties->get( "OPTIONSPANEL.MARGIN.Y" ).toInt(), this ); this->optionsPanel->setNormalPosX( width - this->optionsPanel->getMinLeftWIdth() ); this->optionsPanel->move( width - this->optionsPanel->getMinLeftWIdth(), this->engineProperties->get( "OPTIONSPANEL_MARGIN_Y" ).toInt() ); }
void Widget::handleMouseLeave(MouseFocusEvent &event) { hasMouseOver_ = false ; mouseLeaveEvent(event); }