コード例 #1
0
TEST(LuaUIOperationsTest, Rotate) {
	QApplication app(argc, argv);
	LuaInterface luaInterface;
	auto L = luaInterface.luaState();

	luaInterface.hideUI(true);
	luaInterface.initLua();

	auto mdiArea = LuaIntf::Lua::getGlobal<QMdiArea*>(L, "mdiArea");

	if(mdiArea->subWindowList().count() == 0) {
		LuaIntf::LuaRef(L, "new_file")();
	}

	mdiArea->setActiveSubWindow(mdiArea->subWindowList().at(0));

	auto mdiChild = dynamic_cast<CadMdiChild*>(mdiArea->activeSubWindow()->widget());
	auto storageManager = mdiChild->storageManager();
	auto documentCanvas = mdiChild->viewer()->documentCanvas();

	lc::entity::Line_CSPtr createdEntity;
	std::vector<lc::entity::CADEntity_CSPtr> entities;

	entities = storageManager->entityContainer().asVector();

	for(auto entity : entities) {
		storageManager->removeEntity(entity);
	}

	EXPECT_EQ(0, storageManager->entityContainer().asVector().size());



	LuaIntf::LuaRef(L, "create_line")();
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(0, 0));
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(100, 100));

	EXPECT_EQ(1, storageManager->entityContainer().asVector().size()) << "Line was not created";



	documentCanvas->makeSelection(0, 0, 100, 100, false, false);
	documentCanvas->closeSelection();

	EXPECT_EQ(1, mdiChild->selection().size()) << "Entity not selected";



	LuaIntf::LuaRef(L, "rotate_selected_entities")();
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(0, 0));
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(0, 100));
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(100, 0));

	entities = storageManager->entityContainer().asVector();
	createdEntity = std::dynamic_pointer_cast<const lc::entity::Line>(entities.at(0));

	EXPECT_EQ(lc::geo::Coordinate(0, 0), createdEntity->start());
	EXPECT_EQ(lc::geo::Coordinate(100, -100), createdEntity->end());
}
コード例 #2
0
ファイル: Workspace.cpp プロジェクト: corburn/ISIS
  /**
   * Repopulates the list of MdiCubeViewports and returns a pointer to this list.
   * Ownership is not given to the caller.
   *
   * @return std::vector<MdiCubeViewport*>*
   */
  QVector< MdiCubeViewport * > * Workspace::cubeViewportList() {
    p_cubeViewportList->clear();

    for(int i = 0; i < subWindowList().size(); i++) {
      p_cubeViewportList->push_back((MdiCubeViewport *)
                                    subWindowList()[i]->widget()->layout()->itemAt(0)->widget());
    }

    return p_cubeViewportList;
  }
コード例 #3
0
/*!
    Save project settings related to signal generation. The settings are
    stored in \a project.
*/
void UiGeneratorArea::saveProject(QSettings &project)
{
    GeneratorDevice* device = DeviceManager::instance()
            .activeDevice()->generatorDevice();

    project.remove("digitalGenerator");
    project.remove("analogGenerator");
    if (device != NULL) {

        if (device->maxNumDigitalSignals() > 0) {

            bool digEnabled = (subWindowList().indexOf(mDigitalWin) != -1);

            project.beginGroup("digitalGenerator");

            project.setValue("enabled", digEnabled);
            project.setValue("rate", mDigitalGenerator->rate());

            project.beginWriteArray("signals");

            QList<DigitalSignal*> digitalList = device->digitalSignals();
            for (int i = 0; i < digitalList.size(); i++) {
                DigitalSignal* s = digitalList.at(i);
                project.setArrayIndex(i);
                project.setValue("meta", s->toSettingsString());
            }

            project.endArray();

            project.endGroup();
        }

        if (device->maxNumAnalogSignals() > 0) {

            bool anEnabled  = (subWindowList().indexOf(mAnalogWin) != -1);

            project.beginGroup("analogGenerator");
            project.setValue("enabled", anEnabled);

            project.beginWriteArray("signals");

            QList<AnalogSignal*> analogList = device->analogSignals();
            for (int i = 0; i < analogList.size(); i++) {
                AnalogSignal* s = analogList.at(i);
                project.setArrayIndex(i);
                project.setValue("meta", s->toSettingsString());
            }

            project.endArray();

            project.endGroup();
        }

    }
}
コード例 #4
0
ファイル: Workspace.cpp プロジェクト: corburn/ISIS
  void Workspace::addBrowseView(QString cubename) {
    /* Close the last browse window if necessary.  */
    if (subWindowList().size()) {
      QWeakPointer<QMdiSubWindow> windowToRemove =
          subWindowList()[subWindowList().size() - 1];

      removeSubWindow(windowToRemove.data());

      delete windowToRemove.data();
    }

    addCubeViewport(cubename);
  }
コード例 #5
0
ファイル: KviMdiManager.cpp プロジェクト: namikaze90/KVIrc
void KviMdiManager::focusPreviousTopChild(KviMdiChild * pExcludeThis)
{
	KviMdiChild * lpC = NULL;

	QList<QMdiSubWindow *> tmp = subWindowList(QMdiArea::StackingOrder);
	QListIterator<QMdiSubWindow*> wl(tmp);
	wl.toBack();

	while(wl.hasPrevious())
	{
		QMdiSubWindow * pSubWindow = wl.previous();

		if(!pSubWindow->inherits("KviMdiChild"))
			continue;

		lpC = static_cast<KviMdiChild *>(pSubWindow);

		if(lpC == pExcludeThis)
			continue;

		if(!lpC->isVisible())
			continue;

		if(lpC->state() != KviMdiChild::Minimized)
			break;
	}

	if(!lpC)
		return;

	showAndActivate(lpC);
}
コード例 #6
0
ファイル: app_area.cpp プロジェクト: mempko/firestr
        void app_area::handle_resize_hack()
        {
            auto l = subWindowList();
            auto o = count_open(l);
            if(o > 2) return;

            keep_open(l, 1);
        }
コード例 #7
0
ファイル: Group.cpp プロジェクト: rasmadeus/Rragraph
void Group::retitle()
{
    if(subWindowList().isEmpty()){
        emit noMorePlots();
    }
    else{
        foreach(QMdiSubWindow* window, subWindowList()){
            window->setWindowTitle(
                tr("Plot ") +  QString("№%1").arg(
                    subWindowList().indexOf(window) + 1
                )
            );
        }
        if(!subWindowList().isEmpty()){
            tile();
        }
    }
コード例 #8
0
/*!
    Returns true if the \a generator is enabled; otherwise it returns false.
*/
bool UiGeneratorArea::isGeneratorEnabled(UiGeneratorArea::GeneratorType generator)
{
    QMdiSubWindow* win = mDigitalWin;
    if (generator == AnalogGenerator) {
        win = mAnalogWin;
    }

    return (subWindowList().indexOf(win) != -1);
}
コード例 #9
0
ファイル: extendedtabwidget.cpp プロジェクト: aur1m/kbe
void ExtendedTabWidget::closeOtherDocuments()
{
    QWidget* currentWindow = currentWidget();
    QList<QWidget*> list = subWindowList();
    QList<QWidget*>::const_iterator it = list.begin();

    for(; it != list.end(); it++)
        if (*it != currentWindow)
            if (!(*it)->close())
                return;
}
コード例 #10
0
void CDropableMdiArea::dragEnterEvent(QDragEnterEvent *event)
{
	QList<QMdiSubWindow *> list = subWindowList() ;
	for ( int i = 0 ; i < list.size() ; i ++ ) {
		QMdiSubWindow *p = list.at(i) ;
		if ( p->rect().contains(event->pos()-p->pos()) ) {
			event->ignore();
			return ;
		}
	}

	event->accept();
}
コード例 #11
0
ファイル: app_area.cpp プロジェクト: mempko/firestr
        void app_area::clear_alerts()
        {
            for(auto sw :  subWindowList())
            {
                CHECK(sw);

                auto w  = sw->widget();
                CHECK(w);

                auto mw = dynamic_cast<gui::message*>(w);
                if(!mw) continue;

                mw->clear_alert();
            }
        }
コード例 #12
0
ファイル: KviMdiManager.cpp プロジェクト: namikaze90/KVIrc
void KviMdiManager::menuActivated(QAction *pAction)
{
    bool bOk=false;
    int id=pAction->data().toInt(&bOk);
    if(!bOk || id<100)return;
	id-=100;
	QList<QMdiSubWindow *> tmp = subWindowList(QMdiArea::StackingOrder);

	if(id >= tmp.count()) return;
	if (!tmp.at(id)->inherits("KviMdiChild")) return;

	KviMdiChild * lpC = (KviMdiChild *) tmp.at(id);

	if(!lpC) return;
    showAndActivate(lpC);
}
コード例 #13
0
ファイル: KviMdiManager.cpp プロジェクト: namikaze90/KVIrc
void KviMdiManager::ensureNoMaximized(KviMdiChild * lpExclude)
{
	QList<QMdiSubWindow*> tmp = subWindowList(QMdiArea::StackingOrder);
	QListIterator<QMdiSubWindow*> it(tmp);
	KviMdiChild * lpC;

	m_bIgnoreSDIModeChange = true;
	while (it.hasNext())
	{
		lpC = (KviMdiChild *) it.next();
		if(lpExclude == lpC)
			continue;
		if(lpC->windowState() & Qt::WindowMaximized)
			lpC->setWindowState(lpC->windowState() & ~Qt::WindowMaximized);
	}
	m_bIgnoreSDIModeChange = false;
}
コード例 #14
0
ファイル: KviMdiManager.cpp プロジェクト: namikaze90/KVIrc
void KviMdiManager::minimizeAll()
{
	setIsInSDIMode(false);

	QList<QMdiSubWindow*> tmp = subWindowList(QMdiArea::StackingOrder);
	QListIterator<QMdiSubWindow*> it(tmp);
	KviMdiChild * lpC;
	m_bIgnoreSDIModeChange = true;
	while (it.hasNext())
	{
		lpC = (KviMdiChild *) it.next();
		if(lpC->windowState() & Qt::WindowMinimized)
			continue;

		lpC->minimize();
	}
	m_bIgnoreSDIModeChange = false;
}
コード例 #15
0
ファイル: KviMdiManager.cpp プロジェクト: namikaze90/KVIrc
void KviMdiManager::expandHorizontal()
{
	setIsInSDIMode(false);

	QList<QMdiSubWindow*> tmp = subWindowList(QMdiArea::StackingOrder);
	QListIterator<QMdiSubWindow*> it(tmp);
	KviMdiChild * lpC;

	while (it.hasNext())
	{
		lpC = (KviMdiChild *) it.next();
		if(lpC->windowState() & Qt::WindowMinimized)
			continue;

		lpC->move(0,lpC->y());
		lpC->resize(viewport()->width(),lpC->height());
	}
}
コード例 #16
0
ファイル: KviMdiManager.cpp プロジェクト: namikaze90/KVIrc
int KviMdiManager::getVisibleChildCount()
{
	QList<QMdiSubWindow*> tmp = subWindowList(QMdiArea::StackingOrder);
	QListIterator<QMdiSubWindow*> it(tmp);
	KviMdiChild * lpC;
	int cnt = 0;

	while (it.hasNext())
	{
		lpC = (KviMdiChild *) it.next();
		if(lpC->windowState() & Qt::WindowMinimized)
			continue;

		cnt++;
	}

	return cnt;
}
コード例 #17
0
/*!
    Tile the windows. There is one window for digital signal generation
    and one window for analog signal generation.
*/
void UiGeneratorArea::tileSubWindows()
{
    QList<QMdiSubWindow*> windows = subWindowList();

    if (windows.size() == 0) return;

    int wHeight = (height()) / windows.size();

    int y = 0;
    for (int i = 0; i < windows.size(); i++) {
        QMdiSubWindow* win = windows.at(i);
        win->resize(width(), wHeight);
        win->move(0, y);
        y += wHeight;
    }

    mIsSubWindowsTiled = true;
}
コード例 #18
0
ファイル: KviMdiManager.cpp プロジェクト: namikaze90/KVIrc
void KviMdiManager::restoreAll()
{
	QList<QMdiSubWindow*> tmp = subWindowList(QMdiArea::StackingOrder);
	QListIterator<QMdiSubWindow*> it(tmp);
	KviMdiChild * lpC;

	while (it.hasNext())
	{
		lpC = (KviMdiChild *) it.next();
		if(!(lpC->windowState() & Qt::WindowMinimized))
			continue;

		lpC->restore();
	}

	if(!m_bInSDIMode && KVI_OPTION_BOOL(KviOption_boolAutoTileWindows))
		tile();
}
コード例 #19
0
ファイル: KviMdiManager.cpp プロジェクト: namikaze90/KVIrc
void KviMdiManager::cascadeMaximized()
{
	cascadeSubWindows();

	QList<QMdiSubWindow*> tmp = subWindowList(QMdiArea::StackingOrder);
	QListIterator<QMdiSubWindow*> it(tmp);
	KviMdiChild * lpC;

	while (it.hasNext())
	{
		lpC = (KviMdiChild *) it.next();
		if(lpC->windowState() & Qt::WindowMinimized)
			continue;

		QPoint pnt(lpC->pos());
		QSize curSize(viewport()->width() - pnt.x(),viewport()->height() - pnt.y());
		if((lpC->minimumSize().width() > curSize.width()) ||
			(lpC->minimumSize().height() > curSize.height()))lpC->resize(lpC->minimumSize());
		else lpC->resize(curSize);
	}
}
コード例 #20
0
/*!
    Enable/disable the \a generator according to \a enabled.
*/
void UiGeneratorArea::setGeneratorEnabled(GeneratorType generator, bool enabled)
{
    GeneratorDevice* device = DeviceManager::instance().activeDevice()
            ->generatorDevice();
    if (device == NULL) return;

    QMdiSubWindow* win;
    if (generator == AnalogGenerator) {
        win = mAnalogWin;
        device->enableAnalogGenerator(enabled);
    }
    else {
        win = mDigitalWin;
        device->enableDigitalGenerator(enabled);
    }

    bool added = (subWindowList().indexOf(win) != -1);

    if (enabled && !added) {
        addSubWindow(win);

        // for some reason the subwindow (win) can have a very small size
        // in some circumstances. Make sure it at least gets the same
        // size as its widget
        if (win->size().width() < win->widget()->size().width() ||
                win->size().height() < win->widget()->size().height()) {
            win->resize(win->widget()->size());
        }
        win->show();
        win->widget()->show();

    }
    else if (!enabled && added) {
        removeSubWindow(win);
    }
}
コード例 #21
0
void ImprovedWorkspace::setTabbedMode(bool isTabbed)
{
    if(isTabbed)
    {
        setViewMode(QMdiArea::TabbedView);
        //setTabsClosable ( true );
        setTabsMovable ( true );
        setTabPosition(QTabWidget::North);

        /// make all subwindows visible.
        foreach(QMdiSubWindow* tmp, subWindowList())
        {
            tmp->setVisible(true);
            QAction* tmpAct = m_map->key(tmp);
            if(NULL!=tmpAct)
            {
                tmpAct->setChecked(true);
            }
            if(NULL!=tmp->widget())
            {
                tmp->widget()->setVisible(true);
            }
        }
    }
コード例 #22
0
ファイル: KviMdiManager.cpp プロジェクト: namikaze90/KVIrc
void KviMdiManager::tileAllInternal(int maxWnds, bool bHorizontal) //int maxWnds,bool bHorizontal
{

	//NUM WINDOWS =           1,2,3,4,5,6,7,8,9
	static int colstable[9]={ 1,1,1,2,2,2,3,3,3 }; //num columns
	static int rowstable[9]={ 1,2,3,2,3,3,3,3,3 }; //num rows
	static int lastwindw[9]={ 1,1,1,1,2,1,3,2,1 }; //last window multiplier
	static int colrecall[9]={ 0,0,0,3,3,3,6,6,6 }; //adjust self
	static int rowrecall[9]={ 0,0,0,0,4,4,4,4,4 }; //adjust self

	int * pColstable = bHorizontal ? colstable : rowstable;
	int * pRowstable = bHorizontal ? rowstable : colstable;
	int * pColrecall = bHorizontal ? colrecall : rowrecall;
	int * pRowrecall = bHorizontal ? rowrecall : colrecall;

	if (g_pApp->kviClosingDown()) return;

	m_bInSDIMode=false;
	ensureNoMaximized();

	KviMdiChild * lpTop = (KviMdiChild*)activeSubWindow();
	if (!lpTop) return;

	int numVisible = getVisibleChildCount();

	if (numVisible < 1) return;

	int numToHandle = ((numVisible > maxWnds) ? maxWnds : numVisible);
	int xQuantum = viewport()->width() / pColstable[numToHandle-1];

	if(xQuantum < ((lpTop->minimumSize().width() > KVI_MDICHILD_MIN_WIDTH) ? lpTop->minimumSize().width() : KVI_MDICHILD_MIN_WIDTH))
	{
		if (pColrecall[numToHandle-1] == 0) qDebug("Tile : Not enouh space");
			else tileAllInternal(pColrecall[numToHandle-1], bHorizontal);
		return;
	}

	int yQuantum = viewport()->height() / pRowstable[numToHandle-1];

	if(yQuantum < ((lpTop->minimumSize().height() > KVI_MDICHILD_MIN_HEIGHT) ? lpTop->minimumSize().height() : KVI_MDICHILD_MIN_HEIGHT))
	{
		if (pRowrecall[numToHandle-1] == 0) qDebug("Tile : Not enough space");
			else tileAllInternal(pRowrecall[numToHandle-1], bHorizontal);
		return;
	}

	int curX = 0;
	int curY = 0;
	int curRow = 1;
	int curCol = 1;
	int curWin = 1;

	QList<QMdiSubWindow *> tmp = subWindowList(QMdiArea::StackingOrder);

	for(int i = 0; i < tmp.count(); i++)
	{
		KviMdiChild * lpC = (KviMdiChild*) tmp.at(i);

		if(lpC->state()!=KviMdiChild::Minimized)
		{
			if((curWin%numToHandle)==0)
			{
				lpC->move(curX, curY);
				lpC->resize(xQuantum * lastwindw[numToHandle-1], yQuantum);
			} else {
				lpC->move(curX, curY);
				lpC->resize(xQuantum, yQuantum);
			}
			//example : 12 windows : 3 cols 3 rows
			if (curCol < pColstable[numToHandle-1])
			{ //curCol < 3
				curX += xQuantum; //add a column in the same row
				curCol++;       //increase current column
			} else {
				curX = 0;         //new row
				curCol = 1;       //column 1
				if (curRow < pRowstable[numToHandle-1])
				{ //curRow < 3
					curY += yQuantum; //add a row
					curRow++;
				} else {
					curY = 0;         //restart from beginning
					curRow = 1;
				}
			}
			curWin++;
		}
	}
	if(lpTop)lpTop->setFocus();
}
コード例 #23
0
ファイル: KviMdiManager.cpp プロジェクト: namikaze90/KVIrc
void KviMdiManager::fillWindowPopup()
{
	m_pWindowPopup->clear();

	m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::CascadeWindows)),(__tr2qs("&Cascade Windows")),this,SLOT(cascadeWindows()));
	m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::CascadeWindows)),(__tr2qs("Cascade &Maximized")),this,SLOT(cascadeMaximized()));

    m_pWindowPopup->addSeparator();
	m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("&Tile Windows")),this,SLOT(tile()));

	m_pTileMethodPopup->clear();
    QAction * pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::AutoTileWindows)),(__tr2qs("&Auto Tile")),this,SLOT(toggleAutoTile()));
    pAction->setCheckable(true);
    pAction->setChecked(KVI_OPTION_BOOL(KviOption_boolAutoTileWindows));
    pAction->setData(-1);
    m_pTileMethodPopup->addSeparator();

    if(KVI_OPTION_UINT(KviOption_uintTileMethod) >= KVI_NUM_TILE_METHODS)
        KVI_OPTION_UINT(KviOption_uintTileMethod) = KVI_TILE_METHOD_PRAGMA9HOR;

    uint uSelectedMethod= KVI_OPTION_UINT(KviOption_uintTileMethod);
    pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Anodine's Full Grid")));
    pAction->setData(KVI_TILE_METHOD_ANODINE);
    pAction->setCheckable(true);
    if(uSelectedMethod==KVI_TILE_METHOD_ANODINE) pAction->setChecked(true);
    pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Horizontal 4-Grid")));
    pAction->setData(KVI_TILE_METHOD_PRAGMA4HOR);
    pAction->setCheckable(true);
    if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA4HOR) pAction->setChecked(true);
    pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Vertical 4-Grid")));
    pAction->setData(KVI_TILE_METHOD_PRAGMA4VER);
    pAction->setCheckable(true);
    if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA4VER) pAction->setChecked(true);
    pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Horizontal 6-Grid")));
    pAction->setData(KVI_TILE_METHOD_PRAGMA6HOR);
    pAction->setCheckable(true);
    if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA6HOR) pAction->setChecked(true);
    pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Vertical 6-Grid")));
    pAction->setData(KVI_TILE_METHOD_PRAGMA6VER);
    pAction->setCheckable(true);
    if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA6VER) pAction->setChecked(true);
    pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Horizontal 9-Grid")));
    pAction->setData(KVI_TILE_METHOD_PRAGMA9HOR);
    pAction->setCheckable(true);
    if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA9HOR) pAction->setChecked(true);
    pAction = m_pTileMethodPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Pragma's Vertical 9-Grid")));
    pAction->setData(KVI_TILE_METHOD_PRAGMA9VER);
    pAction->setCheckable(true);
    if(uSelectedMethod==KVI_TILE_METHOD_PRAGMA9VER) pAction->setChecked(true);

    pAction = m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::TileWindows)),(__tr2qs("Tile Met&hod")));
    pAction->setMenu(m_pTileMethodPopup);

    m_pWindowPopup->addSeparator();
	m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::MaxVertical)),(__tr2qs("Expand &Vertically")),this,SLOT(expandVertical()));
	m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::MaxHorizontal)),(__tr2qs("Expand &Horizontally")),this,SLOT(expandHorizontal()));

    m_pWindowPopup->addSeparator();
	m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Minimize)),(__tr2qs("Mi&nimize All")),this,SLOT(minimizeAll()));
	m_pWindowPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Restore)),(__tr2qs("&Restore all")),this,SLOT(restoreAll()));

    m_pWindowPopup->addSeparator();
	int i = 100;
	QString szItem;
	QString szCaption;
	QList<QMdiSubWindow*> tmp = subWindowList(QMdiArea::StackingOrder);
	QListIterator<QMdiSubWindow*> it(tmp);

	KviMdiChild * lpC;

	while (it.hasNext())
	{
		lpC = (KviMdiChild *) it.next();

		if (!lpC->inherits("KviMdiChild"))
		{
			i++;
			continue;
		}

		szItem.setNum(((uint)i)-99);
		szItem+=". ";

		szCaption = lpC->windowTitle();
		if(szCaption.length() > 30)
		{
			QString trail = szCaption.right(12);
			szCaption.truncate(12);
			szCaption+="...";
			szCaption+=trail;
		}

		if(lpC->state()==KviMdiChild::Minimized)
		{
			szItem+="(";
			szItem+=szCaption;
			szItem+=")";
		} else szItem+=szCaption;

		const QPixmap * pix = lpC->icon();

		if (pix && !(pix->isNull()))
		{
            pAction = m_pWindowPopup->addAction(*pix, szItem);
            pAction->setData(i);
		} else {
            pAction = m_pWindowPopup->addAction(szItem);
            pAction->setData(i);
        }

		//this is useless, since the windows are listed in stacking order, the active one
		//will always be the last anyway.
		//if(lpC==currentSubWindow())
		//	m_pWindowPopup->setItemChecked(i, true );
		i++;
	}
}