本文整理汇总了C++中QMdiSubWindow::close方法的典型用法代码示例。如果您正苦于以下问题:C++ QMdiSubWindow::close方法的具体用法?C++ QMdiSubWindow::close怎么用?C++ QMdiSubWindow::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMdiSubWindow
的用法示例。
在下文中一共展示了QMdiSubWindow::close方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeWidget
void MdiAreaWidget::removeWidget(HTableData *w) {
if( subWindows.contains(w)) {
// this->mdiArea->removeSubWindow(w);
QMdiSubWindow* QMdiChild = qobject_cast<QMdiSubWindow*>(w->parentWidget());
QMdiChild->close();
this->subWindows.remove(w);
}
}
示例2: linkWith
bool ccPointPairRegistrationDlg::linkWith(ccGLWindow* win)
{
ccGLWindow* oldWin = m_associatedWin;
if (oldWin)
{
if (oldWin != win)
{
oldWin->disconnect(this);
}
oldWin->removeFromOwnDB(&m_alignedPoints);
m_alignedPoints.setDisplay(0);
oldWin->removeFromOwnDB(&m_refPoints);
m_refPoints.setDisplay(0);
m_pickingHub->removeListener(this);
}
if (!ccOverlayDialog::linkWith(win))
{
return false;
}
m_aligned.restore();
m_reference.restore();
if (oldWin && MainWindow::TheInstance())
{
QMdiSubWindow* subWindow = MainWindow::TheInstance()->getMDISubWindow(oldWin);
if (subWindow)
subWindow->close();
}
if (m_associatedWin)
{
if (!m_pickingHub->addListener(this, true))
{
ccLog::Error("Picking mechanism is already in use! Close the other tool first, and then restart this one.");
return false;
}
m_associatedWin->addToOwnDB(&m_alignedPoints);
m_associatedWin->addToOwnDB(&m_refPoints);
m_associatedWin->displayNewMessage(QString(), ccGLWindow::LOWER_LEFT_MESSAGE);
m_associatedWin->displayNewMessage("(you can add points 'manually' if necessary)", ccGLWindow::LOWER_LEFT_MESSAGE, true, 3600);
m_associatedWin->displayNewMessage(QString("Pick equivalent points on both clouds (at least %1 pairs - mind the order)").arg(MIN_PAIRS_COUNT), ccGLWindow::LOWER_LEFT_MESSAGE, true, 3600);
}
return true;
}
示例3: linkWith
bool ccPointPairRegistrationDlg::linkWith(ccGLWindow* win)
{
ccGLWindow* oldWin = m_associatedWin;
if (oldWin)
{
if (oldWin != win)
{
oldWin->disconnect(this);
}
oldWin->removeFromOwnDB(&m_alignedPoints);
m_alignedPoints.setDisplay(0);
oldWin->removeFromOwnDB(&m_refPoints);
m_refPoints.setDisplay(0);
oldWin->lockPickingMode(false);
oldWin->setPickingMode(ccGLWindow::DEFAULT_PICKING);
}
if (!ccOverlayDialog::linkWith(win))
{
return false;
}
m_aligned.restore();
m_reference.restore();
if (oldWin && MainWindow::TheInstance())
{
QMdiSubWindow* subWindow = MainWindow::TheInstance()->getMDISubWindow(oldWin);
if (subWindow)
subWindow->close();
}
if (m_associatedWin)
{
m_associatedWin->setPickingMode(ccGLWindow::POINT_OR_TRIANGLE_PICKING);
m_associatedWin->lockPickingMode(true);
connect(m_associatedWin, SIGNAL(itemPicked(ccHObject*, unsigned, int, int, const CCVector3&)), this, SLOT(processPickedItem(ccHObject*, unsigned, int, int, const CCVector3&)));
m_associatedWin->addToOwnDB(&m_alignedPoints);
m_associatedWin->addToOwnDB(&m_refPoints);
m_associatedWin->displayNewMessage(QString(), ccGLWindow::LOWER_LEFT_MESSAGE);
m_associatedWin->displayNewMessage("(you can add points 'manually' if necessary)", ccGLWindow::LOWER_LEFT_MESSAGE, true, 3600);
m_associatedWin->displayNewMessage(QString("Pick equivalent points on both clouds (at least %1 pairs - mind the order)").arg(MIN_PAIRS_COUNT), ccGLWindow::LOWER_LEFT_MESSAGE, true, 3600);
}
return true;
}
示例4: closeEvent
void MainWindow::closeEvent(QCloseEvent * event)
{
while (true) {
QMdiSubWindow * w = mdi->activeSubWindow();
if (w == NULL)
break;
if (w->close())
continue;
event->ignore();
return;
}
event->accept();
}
示例5: on_actionReload_triggered
//Reload opened file data
void MainWindow::on_actionReload_triggered()
{
if(_is_reloading) return;
_is_reloading=true;
BoolReseter rst(&_is_reloading);
Q_UNUSED(rst);
QString filePath;
QRect wnGeom;
if (activeChildWindow()==1)
{
LevelData FileData;
filePath = activeLvlEditWin()->curFile;
if(activeLvlEditWin()->isUntitled)
{
QMessageBox::warning(this, tr("File not saved"),
tr("File doesn't saved on disk."), QMessageBox::Ok);
return;
}
if (!QFileInfo(filePath).exists() ) {
QMessageBox::critical(this, tr("File open error"),
tr("Can't open the file.\nFile not exist."), QMessageBox::Ok);
return;
}
if(activeLvlEditWin()->LvlData.modified)
{
QMessageBox::StandardButton ret = QMessageBox::question(this, tr("Reload file and custom stuff"),
tr("Do you want to save before reload stuff?"), QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
if((ret==QMessageBox::Cancel)||(ret==0))
return;
else
if(ret==QMessageBox::Yes)
save();
}
//Open level file
FileData = FileFormats::OpenLevelFile(filePath);
if( !FileData.ReadFileValid ){
statusBar()->showMessage(tr("Reloading error"), 2000);
return;}
FileData.playmusic = GlobalSettings::autoPlayMusic;
activeLvlEditWin()->LvlData.modified = false;
QFile file(filePath+".meta");
if(QFileInfo(filePath+".meta").exists())
{
if (file.open(QIODevice::ReadOnly))
{
QString metaRaw;
QTextStream meta(&file);
meta.setCodec("UTF-8");
metaRaw = meta.readAll();
if(FileData.metaData.script)
{
delete FileData.metaData.script;
FileData.metaData.script = NULL;
}
FileData.metaData = FileFormats::ReadNonSMBX64MetaData(metaRaw, filePath+".meta");
}
else
{
QMessageBox::critical(this, tr("File open error"),
tr("Can't open the file."), QMessageBox::Ok);
}
}
//Remember last section ID and positions!
int lastSection=0;
QMap<int, QPair<long, long> > sectionPoss;
lastSection = activeLvlEditWin()->LvlData.CurSection;
SetCurrentLevelSection(lastSection);//Need to remember position of current section
for(int i=0; i<activeLvlEditWin()->LvlData.sections.size(); i++)
{
LevelSection sct = activeLvlEditWin()->LvlData.sections[i];
sectionPoss[sct.id]=QPair<long, long >(sct.PositionX, sct.PositionY);
}
activeLvlEditWin()->close();//Close old widget without closing of sub-window
//Get pointer to current sub-window
QMdiSubWindow *window = ui->centralWidget->activeSubWindow();
//Get geometry of current subwindow
wnGeom = ui->centralWidget->activeSubWindow()->geometry();
//delete window->widget();
LevelEdit *chLvlWin = new LevelEdit(window);
connect(chLvlWin, SIGNAL(forceReload()), this, SLOT(on_actionReload_triggered()));
window->setWidget(chLvlWin);
GraphicsWorkspace* gr = static_cast<GraphicsWorkspace *>(chLvlWin->getGraphicsView());
connect(gr, SIGNAL(zoomValueChanged(QString)), zoom, SLOT(setText(QString)));
//ui->centralWidget->activeSubWindow()->close();
LevelEdit *child = chLvlWin;//createLvlChild();
//.........这里部分代码省略.........
示例6: subWinClosed
/*!
* \param wid Window ID
*
* Runs when the specified Window ID is closed.
*/
void IdealIRC::subWinClosed(int wid)
{
subwindow_t empty;
empty.wid = -1;
subwindow_t sw = winlist.value(wid, empty);
if (sw.wid == -1)
return; // Nope.
if (sw.type == WT_STATUS) {
int statusCount = 0;
QHashIterator<int,subwindow_t> i(winlist);
while (i.hasNext())
if (i.next().value().type == WT_STATUS)
++statusCount;
if (statusCount <= 1)
return; // Nope.
}
std::cout << "Closing " << sw.widget->objectName().toStdString().c_str() << " (" << wid << ")" << std::endl;
scriptParent.resetMenuPtrList();
if (sw.type == WT_STATUS) {
// Closing a status window.
QList<QMdiSubWindow*> closeList; // List of subwindows for this status to close
QHashIterator<int,subwindow_t> i(winlist); // Iterate all windows
IConnection *con = conlist.value(wid); // Remember window id of status is always equal to connection id. KISS!
while (i.hasNext()) {
i.next();
subwindow_t s = i.value();
// This item may not be a subwindow of the status that's closing.
if (s.parent == wid) {
// This item is a child of the status
closeList.push_back(s.subwin);
con->freeWindow( s.widget->objectName() );
}
}
if (con->isSocketOpen())
con->closeConnection(); // Begin closing the socket.
// Close all its subwindows
int count = closeList.count()-1;
std::cout << " count : " << count << std::endl;
for (int i = 0; i <= count; i++) {
QMdiSubWindow *w = closeList.at(i);
w->close();
}
con->freeWindow("STATUS"); // Free status window lastly
if (! con->isSocketOpen())
delete con; // Socket wasn't open, delete connection object
}
else {
IConnection *con = conlist.value(sw.parent, NULL);
if (con != NULL)
con->freeWindow( sw.widget->objectName() );
winlist.remove(sw.wid);
}
if (sw.type == WT_CHANNEL) {
IConnection *con = conlist.value(sw.parent);
con->sockwrite("PART :" + sw.widget->objectName() );
}
if (sw.type == WT_STATUS)
wsw.delGroup(sw.wid);
else
wsw.delWindow(sw.wid);
ui->treeWidget->removeItemWidget(sw.treeitem, 0);
delete sw.treeitem;
delete sw.widget;
winlist.remove(wid);
/**
@note Do we need to delete the other pointers from subwindow_t ?
**/
}