Пример #1
0
void Toys::UpdateWindowFlags()
{
	for(TOY_LIST::const_iterator i=m_List.begin(); i!=m_List.end(); i++)
	{
		Toy *toy = *i;
		QPoint pos( toy->frameGeometry().topLeft() );
		Qt::WindowStates ws = toy->windowState();
		bool wasVisible = toy->isVisible();

		toy->hide();

		toy->setWindowFlags( GetWindowFlags() );

		if( ws.testFlag(Qt::WindowMinimized) )
		{
			toy->showMinimized();
		}
		else if( ws.testFlag(Qt::WindowMaximized) )
		{
			toy->showMaximized();
			if( !wasVisible )
				toy->close();
		}
		else
		{
			toy->move( pos );
			toy->showNormal();
			Toy::ClipToScreen( *toy );
			if( !wasVisible )
				toy->close();
		}
	}
}
Пример #2
0
void Toys::ActivateToy(size_t index)
{
	if(index < m_List.size())
	{
		Toy *toy = m_List[index];

		Qt::WindowStates ws = toy->windowState();

		if(	ws.testFlag(Qt::WindowMaximized) )
			toy->showMaximized();
		else
			toy->showNormal();

		toy->activateWindow();
	}
}
Пример #3
0
void KviMdiManager::processWindowStateChanged(Qt::WindowStates oldState, Qt::WindowStates newState)
{
	KviMdiChild *pMdiChild = qobject_cast<KviMdiChild *>(sender());
	if(!pMdiChild)
		return;

	//qDebug("%p [%s] old %d new %d", pMdiChild, pMdiChild->plainCaption().toUtf8().data(), (int) oldState, (int) newState);

	Qt::WindowStates diffState = oldState ^ newState;

	if(diffState.testFlag(Qt::WindowMinimized))
	{
		//minimized or unminimized
		pMdiChild->updateCaption();
		if(newState.testFlag(Qt::WindowMinimized) &&
			!m_bIgnoreSDIModeChange
		)
		{
			//a window have just been minimized, but we want another window to get activation
			focusPreviousTopChild();
		}
	}

	if(newState.testFlag(Qt::WindowActive) &&
		diffState.testFlag(Qt::WindowMaximized) &&
		!newState.testFlag(Qt::WindowMinimized) &&
		!m_bIgnoreSDIModeChange
	)
	{
		//i'm the active window and my maximized state has changed => update sdi mode
		setIsInSDIMode(newState.testFlag(Qt::WindowMaximized));
	}

	if(newState.testFlag(Qt::WindowActive) &&
		diffState.testFlag(Qt::WindowActive) &&
		pMdiChild->client() &&
		g_pMainWindow->isActiveWindow()
	)
	{
		//qDebug("subwindowactivated %p %s",pMdiChild, ((KviMdiChild*)pMdiChild)->plainCaption().toUtf8().data());
		g_pMainWindow->childWindowActivated((KviWindow *)((KviMdiChild*)pMdiChild)->client());
	}
}