当前位置: 首页>>代码示例>>C++>>正文


C++ QWidget::icon方法代码示例

本文整理汇总了C++中QWidget::icon方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidget::icon方法的具体用法?C++ QWidget::icon怎么用?C++ QWidget::icon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWidget的用法示例。


在下文中一共展示了QWidget::icon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: eventFilter

bool DMainWindow::eventFilter(QObject *obj, QEvent *ev)
{
    QWidget *w = (QWidget*)obj;
    if (!m_widgets.contains(w))
        return KParts::MainWindow::eventFilter(obj, ev);
    
    if ((m_currentWidget != w) && (ev->type() == QEvent::FocusIn))
    {
        m_currentWidget = w;
        emit widgetChanged(w);
    }
    else if (ev->type() == QEvent::IconChange)
    {
        if (m_widgetTabs.contains(w))
        {
            DTabWidget *tab = m_widgetTabs[w];
            tab->setTabIconSet(w, w->icon() ? (*(w->icon())) : QPixmap());
        }
    }
    else if (ev->type() == QEvent::CaptionChange)
    {
        kdDebug() << "caption change" << endl;
    }

    return KParts::MainWindow::eventFilter(obj, ev);
}
开发者ID:BackupTheBerlios,项目名称:kludoteca-svn,代码行数:26,代码来源:dmainwindow.cpp

示例2: eventFilter


//.........这里部分代码省略.........
      QApplication::sendEvent(obj, ev);
      ev->aq_ignore = false;
      AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::Show)));
      return true;
    }

    case QEvent::Hide: {
      ev->aq_ignore = true;
      QApplication::sendEvent(obj, ev);
      ev->aq_ignore = false;
      QWidget *w = AQ_WIDGET(obj);
      if (w->isTopLevel()) {
        //printf("hide %p %s\n", w, w->QObject::name());
        //if (AQWEBAPP->lastDeactivate_)
        //  printf("hide lastDeactivate_ %p %s\n", AQWEBAPP->lastDeactivate_, AQWEBAPP->lastDeactivate_->QObject::name());
        if (AQWEBAPP->lastDeactivate_ == w)
          AQWEBAPP->lastDeactivate_ = 0;
        AQWidgetInfo *wInfo = AQWEBAPP->createdWidgets_.find(w);
        if (wInfo && wInfo->backActive_) {
          //printf("hide backActive_ %p %s\n", wInfo->backActive_, wInfo->backActive_->QObject::name());
          if (AQWEBAPP->createdWidgets_.find(wInfo->backActive_))
            wInfo->backActive_->setActiveWindow();
          wInfo->backActive_ = 0;
        }
      }
      AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::Hide)));
      //break;
      return true;
    }

    case QEvent::Move: {
      QMoveEvent *mv = static_cast<QMoveEvent *>(ev);
      if (mv->pos() != mv->oldPos())
        AQWEBAPP->postAQEvent(new AQEvent(obj, new QMoveEvent(mv->pos(), mv->oldPos())));
      break;
    }

    case QEvent::Resize: {
      QResizeEvent *rs = static_cast<QResizeEvent *>(ev);
      if (rs->size() != rs->oldSize())
        AQWEBAPP->postAQEvent(new AQEvent(obj, new QResizeEvent(rs->size(), rs->oldSize())));
      break;
    }

    case QEvent::Reparent: {
      AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::Reparent)));
      break;
    }

    case QEvent::WindowActivate: {
      QWidget *w = AQ_WIDGET(obj);
      if (w->isTopLevel()) {
        //printf("activate %p %s\n", w, w->QObject::name());
        if (AQWEBAPP->lastDeactivate_ && AQWEBAPP->lastDeactivate_ != w) {
          AQWidgetInfo *wInfo = AQWEBAPP->createdWidgets_.find(w);
          if (wInfo) {
            wInfo->backActive_ = AQWEBAPP->lastDeactivate_;
            //printf("activate backActive_ %p %s\n", wInfo->backActive_, wInfo->backActive_->QObject::name());
          }
        }
        AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::WindowActivate)));
      }
      break;
    }

    case QEvent::WindowDeactivate: {
      QWidget *w = AQ_WIDGET(obj);
      if (w->isTopLevel()) {
        //printf("deactivate %p %s\n", w, w->QObject::name());
        AQWEBAPP->lastDeactivate_ = w;
        AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::WindowDeactivate)));
      }
      break;
    }

    case QEvent::CaptionChange: {
      QWidget *w = AQ_WIDGET(obj);
      if (w->isTopLevel() && !w->isPopup())
        aq_notify_gui_args_event(w, "xgen",
                                 QString::fromLatin1("caption:") +
                                 w->caption());
      break;
    }

    case QEvent::IconChange: {
      QWidget *w = AQ_WIDGET(obj);
      if (w->isTopLevel() && !w->isPopup())
        aq_notify_gui_args_event(w, "xgen",
                                 QString::fromLatin1("icon:") +
                                 QString::number(aq_store_pixmap(w, w->icon()), 36));
      break;
    }
  }

#ifdef AQ_USE_NOTIFY
  return QApplication::notify(obj, ev);
#else
  return false;
#endif
}
开发者ID:fusiodarts,项目名称:nebula,代码行数:101,代码来源:AQWebApplication.cpp


注:本文中的QWidget::icon方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。