Exemplo n.º 1
0
bool ChatList::setData(const QModelIndex &index, const QVariant &value, int role)
{
    QMdiSubWindow* chatw = getChatSubWindowByIndex(index);
    if (chatw == NULL)
        return false;

    switch (role)
    {
    default:
    case Qt::DisplayRole:
    case Qt::EditRole:
    case Qt::DecorationRole:
        return false;
    case Qt::CheckStateRole:
    {
        bool visible = chatw->isVisible();
        chatw->widget()->setVisible(!visible);
        chatw->setVisible(!visible);

    }

        return true;
    }



}
void viewGVpropertieslayout::actionAddGraph_triggered() {

    QCustomPlot * plot = new QCustomPlot;
    setupPlot(plot);

    QMdiSubWindow * mdiSubWin = viewGV->mdiarea->addSubWindow(plot);

    if (mdiSubWin != NULL) {
        mdiSubWin->setVisible(true);
    }
}
Exemplo n.º 3
0
QWidget*  ImprovedWorkspace::addWindow(QWidget* child,QAction* action)
{
    QMdiSubWindow* sub = addSubWindow(child);
    if(viewMode()==QMdiArea::TabbedView)
    {
        action->setChecked(true);
        sub->setVisible(true);
        child->setVisible(true);
    }
    insertActionAndSubWindow(action,sub);
    connect(action,SIGNAL(triggered()),this,SLOT(ensurePresent()));
    sub->setAttribute(Qt::WA_DeleteOnClose, false);
    child->setAttribute(Qt::WA_DeleteOnClose, false);
    sub->setObjectName(child->objectName());

    sub->installEventFilter(this);
    return sub;
}
Exemplo n.º 4
0
void ChatList::delChatWindow(ChatWindow* chatw)
{
    int pos = m_chatWindowList.indexOf(chatw);
    if (pos < 0)
        return;

    beginRemoveRows(QModelIndex(), pos, pos);

    m_chatMenu.removeAction(chatw->toggleViewAction());
    m_chatWindowList.removeOne(chatw);

    QMdiSubWindow* subWindow = m_chatSubWindowList.takeAt(pos);
    subWindow->setVisible(false);

    delete chatw;
    delete subWindow;

    endRemoveRows();
}
Exemplo n.º 5
0
void ChatList::addChatWindow(ChatWindow* chatw)
{

    connect(m_mainWindow, SIGNAL(closing()), chatw, SLOT(save()));
    int listSize = m_chatWindowList.size();
    beginInsertRows(QModelIndex(), listSize, listSize);


    m_chatMenu.addAction(chatw->toggleViewAction());
    connect(chatw, SIGNAL(ChatWindowHasChanged(ChatWindow *)), this, SLOT(changeChatWindow(ChatWindow *)));

    QMdiSubWindow* subWindowChat = static_cast<QMdiSubWindow*>(m_mainWindow->registerSubWindow(chatw,chatw->toggleViewAction()));

    connect(chatw->chat(), SIGNAL(changedName(QString)), subWindowChat, SLOT(setWindowTitle(QString)));
    m_chatWindowList.append(chatw);
    m_chatSubWindowList.append(subWindowChat);

    if((subWindowChat->height()<451)||(subWindowChat->width()<264))
    {
        subWindowChat->resize(264,451);
    }

    if(NULL!=subWindowChat)
    {
        chatw->setSubWindow(subWindowChat);
        subWindowChat->setWindowTitle(tr("%1 (Chat)").arg(chatw->getTitleFromChat()));
        subWindowChat->setWindowIcon(QIcon(":/chat.png"));
        subWindowChat->setAttribute(Qt::WA_DeleteOnClose, false);
        chatw->setAttribute(Qt::WA_DeleteOnClose, false);

        subWindowChat->setVisible(chatw->toggleViewAction()->isChecked());
    }


    endInsertRows();
}
Exemplo n.º 6
0
void TopWin::setIsMdiWin(bool val)
{
	if (MusEGlobal::unityWorkaround)
		return;
	
	if (val)
	{
		if (!isMdiWin())
		{
			_savedToolbarState = saveState();
			int width_temp=width();
			int height_temp=height();
			bool vis=isVisible();
			
			QMdiSubWindow* subwin = createMdiWrapper();
			muse->addMdiSubWindow(subwin);
			subwin->resize(width_temp, height_temp);
			subwin->move(0,0);
			subwin->setVisible(vis);
			this->QMainWindow::show(); //bypass the delegation to the subwin
			
			if (_sharesToolsAndMenu == _sharesWhenFree[_type])
				shareToolsAndMenu(_sharesWhenSubwin[_type]);
			
			fullscreenAction->setEnabled(false);
			fullscreenAction->setChecked(false);
			subwinAction->setChecked(true);
			muse->updateWindowMenu();
		}
		else
		{
			if (MusEGlobal::debugMsg) printf("TopWin::setIsMdiWin(true) called, but window is already a MDI win\n");
		}
	}
	else
	{
		if (isMdiWin())
		{
			int width_temp=width();
			int height_temp=height();
			bool vis=isVisible();

			QMdiSubWindow* mdisubwin_temp=mdisubwin;
			mdisubwin=NULL;
			setParent(NULL);
			mdisubwin_temp->hide();
			delete mdisubwin_temp;
			
			resize(width_temp, height_temp);
			setVisible(vis);

			if (_sharesToolsAndMenu == _sharesWhenSubwin[_type])
				shareToolsAndMenu(_sharesWhenFree[_type]);
						
			fullscreenAction->setEnabled(true);
			subwinAction->setChecked(false);
			muse->updateWindowMenu();
		}
		else
		{
			if (MusEGlobal::debugMsg) printf("TopWin::setIsMdiWin(false) called, but window is not a MDI win\n");
		}
	}
}