QAccessibleInterface *QAccessibleMdiSubWindow::child(int index) const { QMdiSubWindow *source = mdiSubWindow(); if (index != 0 || !source->widget()) return 0; return QAccessible::queryAccessibleInterface(source->widget()); }
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 LogWindowTest::run() { while (!MainWindow::_instance) Sleep(500); auto& area = *MainWindow::instance().mdiArea; while (area.subWindowList().size() == 0) Sleep(1000); QMdiSubWindow *window = area.subWindowList().at(0); //area.setActiveSubWindow(window); LogWindow *logView = qobject_cast<LogWindow *>(window->widget()); QTimer scrollTimer; // log_trace(0) << "thread" << currentThreadId(); connect(this, &LogWindowTest::scrolltable, logView->mainView_.data(), [logView](QModelIndex index) { // log_trace(0) << "thread" << currentThreadId(); logView->mainView_->scrollTo(index); }); connect(&scrollTimer, &QTimer::timeout, this, [this, &logView]() { auto pos = rand() % 40000; auto model = logView->model(); //QModelIndex index = model->currentIndex(); auto index = logView->model()->index(pos, 0); //model->setCurrentIndex(index); emit scrolltable(index); //logView->_logView->scrollTo(index); }); scrollTimer.start(100); exec(); }
void App::closeEvent(QCloseEvent* e) { /* Accept the close event by default */ e->accept(); QListIterator <QMdiSubWindow*> it( qobject_cast<QMdiArea*> (centralWidget())->subWindowList()); while (it.hasNext() == true) { QLCFixtureEditor* editor; QMdiSubWindow* sub; sub = it.next(); Q_ASSERT(sub != NULL); editor = static_cast<QLCFixtureEditor*> (sub->widget()); Q_ASSERT(editor != NULL); editor->show(); editor->setFocus(); if (editor->close() == false) { /* Ignore the close event if just one editor refuses */ e->ignore(); break; } } }
Editor *MainWindow::activeEditor() { QMdiSubWindow *subWindow = mdiArea->activeSubWindow(); if (subWindow) return qobject_cast<Editor *>(subWindow->widget()); return 0; }
void CMainWindow::resizeSubMDI(const QSize &size) { QMdiSubWindow *activeSubWindow = 0; QList<QMdiSubWindow *> windowList = m_centralWidget->subWindowList(); if (windowList.size() > 0) { activeSubWindow = windowList.last(); if (0 == activeSubWindow) { return; } } else { return; } CDrawBoardFrame *frame = (CDrawBoardFrame *)activeSubWindow->widget(); if (0 == frame) { return; } frame->setMinimumSize(size); activeSubWindow->resize(QSize(size.width() + 14, size.height() + 43)); frame = 0; activeSubWindow = 0; }
QWidget * MainWindow::get_current_window() { QMdiSubWindow * w = mdi->currentSubWindow(); if (!w) return NULL; return w->widget(); }
void CGMainWindow::applyFilter(BaseFilter* filter) { QMdiSubWindow *active = ui->mdiArea->activeSubWindow(); if (active != NULL) { MdiElement* activeElement = dynamic_cast<MdiElement*> (active->widget()); QImage image = activeElement->pixmap().toImage(); QImage result; if (!activeElement->isRubberBandVisible()) { result = filter->process(image); } else { QRectF selection = activeElement->getSelectionRect(); QRect boundingRect = QRect(selection.left(), selection.top(), selection.width(), selection.height()); boundingRect = boundingRect.intersect(image.rect()); QImage toProcess = image.copy(boundingRect); QImage areaResult = filter->process(toProcess); result = image; for (int i = boundingRect.left(); i < boundingRect.right(); ++i) { for (int j = boundingRect.top(); j < boundingRect.bottom(); ++j) { result.setPixel(i, j, areaResult.pixel(i - boundingRect.left(), j - boundingRect.top())); } } activeElement->hideRubberBand(); } QPixmap pixmap = QPixmap::fromImage(result); activeElement->setPixmap(pixmap); } }
// ============================================================================= ITimeTrackingWindow* MainWindow::getActiveWindow() const { QMdiSubWindow *subWindow = mMdiArea->activeSubWindow(); if (subWindow) { return qobject_cast<TimeTrackingWindow*>(subWindow->widget()); } return NULL; }
PicEditWindow* MainWindow::activePicEdit(){ QMdiSubWindow* subWindow = mdiArea->activeSubWindow(); if(subWindow){ return qobject_cast<PicEditWindow*>(subWindow->widget()); }else{ return 0; } }
void QMdiAreaContainer::remove(int index) { QList<QMdiSubWindow *> subWins = m_mdiArea->subWindowList(QMdiArea::CreationOrder); if (index >= 0 && index < subWins.size()) { QMdiSubWindow *f = subWins.at(index); m_mdiArea->removeSubWindow(f->widget()); delete f; } }
ImageWindow* WindowService::getCurrentImageWindow() { QMdiSubWindow* sw = _mdi->currentSubWindow(); if(sw != NULL) { ImageWindow* imw = dynamic_cast<ImageWindow*>(sw->widget()); return imw; } else return NULL; }
void MainWindow::showStringsTable() { QMdiSubWindow *wnd = mdi->currentSubWindow(); if (wnd) { DB2Window *w = (DB2Window*)wnd->widget(); w->showStringsList(); } }
void MainWindow::SaveImage() { QMdiSubWindow *win = ui->mdiArea->currentSubWindow(); if(win != NULL){ CanvasWidgetContainer *wid = dynamic_cast<CanvasWidgetContainer*>(win->widget()); if(wid != NULL){ wid->SaveImage(); } } }
ImageTabs* PidMain::getCurrentImageWindow() { QMdiSubWindow *activeWindow = mdiArea->activeSubWindow(); if (activeWindow == NULL) return NULL; else return (ImageTabs*)activeWindow->widget(); }
void MainWindow::showFormatString() { QMdiSubWindow *wnd = mdi->currentSubWindow(); if (wnd) { DB2Window *w = (DB2Window*)wnd->widget(); w->showFormatString(); } }
void MainWindow::setFilterDlg() { QMdiSubWindow *wnd = mdi->currentSubWindow(); if (wnd) { DB2Window *w = (DB2Window*)wnd->widget(); w->setFilter(); } }
void MainWindow::readSettings() { QSettings settings("NUbots", "NUView"); qDebug() <<"Start Reading Settings"; // Restore the main window. settings.beginGroup("mainWindow"); restoreGeometry(settings.value("geometry").toByteArray()); // Set previous position/size restoreState(settings.value("state").toByteArray()); // restore the other main widgets layout. // openFile(settings.value("logFile").toString()); settings.endGroup(); int numWindows = settings.beginReadArray("midWindows"); // Get midi windows settings for (int i = 0; i < numWindows; ++i) { settings.setArrayIndex(i); // set to element QString windowType = settings.value("type").toString(); // Get the window type if(windowType == "unknown") { continue; } else if(windowType == "GLDisplay") { QMdiSubWindow* tempGl = createGLDisplay(); tempGl->restoreGeometry(settings.value("geometry").toByteArray()); GLDisplay *GLDisp = qobject_cast<GLDisplay *>(tempGl->widget()); GLDisp->restoreState(settings.value("state").toByteArray()); } else if(windowType == "locWmGlDisplay") { QMdiSubWindow* tempLocwm = createLocWmGlDisplay(); tempLocwm->restoreGeometry(settings.value("geometry").toByteArray()); locWmGlDisplay *lwmDisp = qobject_cast<locWmGlDisplay *>(tempLocwm->widget()); lwmDisp->restoreState(settings.value("state").toByteArray()); } else if(windowType == "LUTGlDisplay") { QMdiSubWindow* tempLUTDisp = createLUTGlDisplay(); tempLUTDisp->restoreGeometry(settings.value("geometry").toByteArray()); LUTGlDisplay *lwmDisp = qobject_cast<LUTGlDisplay *>(tempLUTDisp->widget()); lwmDisp->restoreState(settings.value("state").toByteArray()); } } }
//TODO: debug, this seems circular, maybe not necessary void CodeArea::selectRevision(Revision *r) { QMdiSubWindow *sub = subWindowMap[r]; //if we closed the window and it is invisible, make it visible if ( sub && !sub->isVisible() ) { sub->show(); sub->widget()->show(); } setActiveSubWindow( sub ); }
void CMainWindow::slotLoad() { // get an image file from a file dialog QString filename = QFileDialog::getOpenFileName(this, "Open Image", ".", "Images(*.bmp *.jpg *.png)"); if (filename.isEmpty()) { return; } // open the image QImage *img = new QImage(filename); if (!img->load(filename)) { QMessageBox::warning(this, "Load error", "Could not load file"); return; } // create a subwindow QFileInfo imgInfo(filename); QString mN = imgInfo.baseName(); int mW = img->size().width(); int mH = img->size().height(); slotNewDrawBoard(mN, mW, mH); // retrieve the subwindow from the central mdi widget QMdiSubWindow *activeSubWindow = m_centralWidget->activeSubWindow(); if (0 == activeSubWindow) { return; } CDrawBoardFrame *drawFrame = (CDrawBoardFrame *)activeSubWindow->widget(); if (0 == drawFrame) { return; } // retrieve the drawboard pointer from local map QString mName = drawFrame->getName(); if (!drawBoards.contains(mName)) { return; } // initialize the draboard with the loaded image CDrawBoard *drawBoard = drawBoards.value(drawFrame->getName()); drawBoard->slotLoad(filename, img); drawBoard = 0; drawFrame = 0; delete img; img = 0; }
void CGMainWindow::on_actionRecognize_text_activated() { QMdiSubWindow *active = ui->mdiArea->activeSubWindow(); if (active != NULL) { MdiElement* activeElement = dynamic_cast<MdiElement*> (active->widget()); QImage image = activeElement->pixmap().toImage(); CharacterRecognizator recognizator(image); // recognizator.recognize(); QMessageBox::information(this, "Recognization result", recognizator.recognize(), QMessageBox::Ok); } }
/*! 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); } }
void App::slotFileSaveAs() { QLCFixtureEditor* editor; QMdiSubWindow* sub; sub = (qobject_cast<QMdiArea*> (centralWidget()))->activeSubWindow(); if (sub == NULL) return; editor = static_cast<QLCFixtureEditor*> (sub->widget()); if (editor == NULL) return; editor->saveAs(); }
void CGMainWindow::on_actionShow_Histogram_activated() { QMdiSubWindow *active = ui->mdiArea->activeSubWindow(); if (active != NULL) { MdiElement* activeElement = dynamic_cast<MdiElement*> (active->widget()); QImage image = activeElement->pixmap().toImage(); if (histogramDialog == NULL) { histogramDialog = new DialogHistogramm(this); } histogramDialog->show(CGAlgorithm::calculatePixels(image)); } }
void CGMainWindow::on_actionSave_activated() { QMdiSubWindow *active = ui->mdiArea->activeSubWindow(); if (active != NULL) { QString path = QFileDialog::getSaveFileName(this, QString(), QString(), "PNG (*.png);; JPG (*.jpg);; BMP(*.bmp);; JPEG(*.jpeg);; TIFF (*.tiff);; PPM (*.ppm)"); if (path != "") { MdiElement* activeElement = dynamic_cast<MdiElement*> (active->widget()); int comressionLevel = QInputDialog::getInt(this, "Compression Level", "Choose compession level", 50, 0, 100, 1); activeElement->pixmap().save(path, 0, 100 - comressionLevel); } } }
void CMainWindow::slotSave() { QMdiSubWindow *activeSubWindow = m_centralWidget->activeSubWindow(); if (0 == activeSubWindow) { return; } CDrawBoard *drawBoard = (CDrawBoard *)activeSubWindow->widget(); if (0 == drawBoard) { return; } QString filename = QFileDialog::getSaveFileName(this, QString(tr("Save Image")), QString(), "Images(*.bmp *.jpg *.png)"); if (!filename.isEmpty()) { drawBoard->slotSave(filename); } }
//点击 void CprogManage::clickItem(QTreeWidgetItem *item, int column) { int type; QString QStr; QTreeWidgetItem *lastItem,*screenItem; QMdiSubWindow *subWin; int index; lastItem = getCurItem(); /* qDebug("lastItem str:%s,\r\ncurItem str:%s", \ (lastItem == 0)?"null":(const char *)lastItem->data(0, Qt::UserRole).toString().toLocal8Bit(),\ (const char *)item->data(0, Qt::UserRole).toString().toLocal8Bit()); */ if(lastItem == item) //同一个项目点击 { if(item != (QTreeWidgetItem *)0) { index = treeWidget->indexOfTopLevelItem(w->screenArea->screenItem); subWin= getSubWinByIndex(w->mdiArea, index); if(subWin != (QMdiSubWindow *)0) subWin->show(); } return; } if(lastItem != (QTreeWidgetItem *)0) { //w->property->getSettingsFromWidget(lastItem); } if(item EQ (QTreeWidgetItem *)0) { qDebug("no item left"); w->actionEnProc(NULL_PROPERTY); return; } saveCurItem(item); type = checkItemType(item); //w->actionEnProc(type); //更新当前屏幕 if(type EQ SCREEN_PROPERTY) { screenItem = item; } else if(type EQ PROG_PROPERTY) { screenItem = item->parent(); } else if(type EQ AREA_PROPERTY) { screenItem = item->parent()->parent(); } else { screenItem = item->parent()->parent()->parent(); } index = treeWidget->indexOfTopLevelItem(screenItem); if(index >= 0) { subWin= getSubWinByIndex(w->mdiArea, index); QTreeWidgetItem *oldScreenItem = w->screenArea->screenItem; if((CscreenArea *)subWin->widget() != w->screenArea) { w->screenArea = (CscreenArea *)subWin->widget(); //w->screenArea->screenSettingsInit(screenItem); } if(subWin->isHidden()) subWin->show(); QObject::disconnect(w->mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), w, SLOT(updateTreeWidget(QMdiSubWindow*))); if(w->mdiArea->activeSubWindow()!=subWin) w->mdiArea->setActiveSubWindow(subWin); QObject::connect(w->mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), w, SLOT(updateTreeWidget(QMdiSubWindow*))); w->MDISubWinClickFlag = 0; //更新当前显示屏参数 QString screenStr = screenItem->data(0, Qt::UserRole).toString(); getScreenCardParaFromSettings(screenStr, Screen_Para, Card_Para); w->setActonsEnable(); //设置所有图标 if(oldScreenItem != w->screenArea->screenItem) { mainObj->emitScreenChangeSignal(); //w->screenCardParaChangeProc(); } }