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


C++ KDockWidget::dockManager方法代码示例

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


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

示例1: eventFilter

bool KMdiDockContainer::eventFilter( TQObject *obj, TQEvent *event )
{
	switch ( event->type() )
	{
	case TQEvent::MouseButtonPress:
	{
		KMultiTabBarTab* kmtbTab = tqt_dynamic_cast<KMultiTabBarTab*>( obj );
		if ( !kmtbTab )
		{
			kdDebug(760) << k_funcinfo << "Got a mouse button press but we have no tab" << endl;
			break;
		}

		KDockWidget* w = m_revMap[ kmtbTab->id() ];
		if ( !w )
		{
			kdDebug(760) << k_funcinfo << "Got a mouse button press but we have no widget" << endl;
			break;
		}

		if ( !w->getHeader() )
		{
			kdDebug(760) << k_funcinfo << "Got a mouse button press but we have no header" << endl;
			break;
		}

		KDockWidgetHeader *hdr = ::tqqt_cast<KDockWidgetHeader*>( w->getHeader() );
		if ( !hdr )
		{
			kdDebug(760) << "Wrong header type in KMdiDockContainer::eventFilter" << endl;
			break;
		}

		m_dockManager = w->dockManager();
		m_dragPanel = TQT_TQOBJECT(hdr->dragPanel());

		if ( m_dragPanel )
			m_movingState = WaitingForMoveStart;

		delete m_startEvent;
		m_startEvent = new TQMouseEvent( * ( ( TQMouseEvent* ) event ) );
	}
	break;
	case TQEvent::MouseButtonRelease:
		if ( m_movingState == Moving )
		{
			m_movingState = NotMoving;
			TQApplication::postEvent( m_dragPanel, new TQMouseEvent( * ( ( TQMouseEvent* ) event ) ) );
			delete m_startEvent;
			m_startEvent = 0;
		}
	case TQEvent::MouseMove:
		if ( m_movingState == WaitingForMoveStart )
		{
			TQPoint p( ( ( TQMouseEvent* ) event )->pos() - m_startEvent->pos() );
			if ( p.manhattanLength() > TDEGlobalSettings::dndEventDelay() )
			{
				m_dockManager->eventFilter( m_dragPanel, TQT_TQEVENT(m_startEvent) );
				m_dockManager->eventFilter( m_dragPanel, event );
				m_movingState = Moving;
			}
		}
		else if ( m_movingState == Moving )
			m_dockManager->eventFilter( m_dragPanel, event );

		break;
	default:
		break;

	}
	return false;

}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:73,代码来源:tdemdidockcontainer.cpp

示例2: eventFilter

bool DockContainer::eventFilter(QObject *obj, QEvent *event)
{
    if(obj == m_tb)
    {
        if((event->type() == QEvent::Resize) && (m_ws->isHidden()))
        {
            QSize size = ((QResizeEvent *)event)->size();
            if(m_vertical)
                parentDockWidget()->setForcedFixedWidth(size.width());
            else
                parentDockWidget()->setForcedFixedHeight(size.height());
        }
    }
    else
        switch(event->type())
        {
            case QEvent::MouseButtonPress:
            {
                KDockWidget *w = m_revMap[dynamic_cast< KMultiTabBarTab * >(obj)->id()];
                if(!w)
                {
                    kdDebug() << "NoWidget" << endl;
                    break;
                }
                if(!w->getHeader())
                {
                    kdDebug() << "NO HEADER" << endl;
                    break;
                }
                KDockWidgetHeader *hdr = static_cast< KDockWidgetHeader * >(w->getHeader()->qt_cast("KDockWidgetHeader"));
                if(!hdr)
                {
                    kdDebug() << "Wrong header type in DockContainer::eventFilter" << endl;
                    break;
                }
                m_dockManager = w->dockManager();
                m_dragPanel = hdr->dragPanel();
                if(m_dragPanel)
                    m_movingState = WaitingForMoveStart;
                delete m_startEvent;
                m_startEvent = new QMouseEvent(*((QMouseEvent *)event));
            }
            break;
            case QEvent::MouseButtonRelease:
                if(m_movingState == Moving)
                {
                    m_movingState = NotMoving;
                    QApplication::postEvent(m_dragPanel, new QMouseEvent(*((QMouseEvent *)event)));
                    delete m_startEvent;
                    m_startEvent = 0;
                }
                break;
            case QEvent::MouseMove:
                if(m_movingState == WaitingForMoveStart)
                {
                    QPoint p(((QMouseEvent *)event)->pos() - m_startEvent->pos());
                    if(p.manhattanLength() > KGlobalSettings::dndEventDelay())
                    {
                        m_dockManager->eventFilter(m_dragPanel, m_startEvent);
                        m_dockManager->eventFilter(m_dragPanel, event);
                        m_movingState = Moving;
                    }
                }
                else if(m_movingState == Moving)
                {
                    m_dockManager->eventFilter(m_dragPanel, event);
                }
                break;
            default:
                break;
        }
    return false;
}
开发者ID:,项目名称:,代码行数:73,代码来源:


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