void QMdiAreaContainer::addWidget(QWidget *widget)
{
    QMdiSubWindow *frame = m_mdiArea->addSubWindow(widget, Qt::Window);
    frame->show();
    m_mdiArea->cascadeSubWindows();
    positionNewMdiChild(m_mdiArea, frame);
}
Beispiel #2
0
void MWMDIManagerImpl::addMDIWindow(MWMDIWindow* w) {
    bool contains = getWindowById(w->getId())!=NULL;
    if (contains) {
        assert(0); //must never happen
        return;
    }
    w->setParent(mdiArea);
    QMdiSubWindow* qw = mdiArea->addSubWindow(w);
    qw->setWindowTitle(w->windowTitle());
    QIcon icon = w->windowIcon();
    if (icon.isNull()) {
        icon = QIcon(":/ugene/images/ugene_16.png");
    }
    qw->setWindowIcon(icon);
    //qw->setAttribute(Qt::WA_NativeWindow);
    MDIItem* i = new MDIItem(w, qw);
    items.append(i);
    qw->installEventFilter(this);

    uiLog.trace(QString("Adding window: '%1'").arg(w->windowTitle()));

    updateState();

    emit si_windowAdded(w);

    if (items.count() == 1 && defaultIsMaximized) {
        qw->showMaximized();
    } else {
        qw->show();
    }
    qw->raise();
}
Beispiel #3
0
void PERPMainWindow::openForm(const QString &actionName)
{
	QString tableName = actionName;
	tableName.replace("table_", "");
	QString formName = QString("mdiform_%1").arg(tableName);
	if ( d->m_mapeoVentanas.contains(formName) ) {
		d->m_mdiArea->setActiveSubWindow(d->m_mapeoVentanas.value(formName));
		return;
	}
	DBFormDlg *dlg = new DBFormDlg(tableName, this);
	if ( dlg->openSuccess() ) {
		// Muy importante para el mapeo MDI
		dlg->setObjectName(formName);
		dlg->setAttribute(Qt::WA_DeleteOnClose);
		QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
		dlg->init();
		QApplication::restoreOverrideCursor();

		QMdiSubWindow *subWin = d->m_mdiArea->addSubWindow(dlg);
		d->m_mapeoVentanas.insert(formName, subWin);
		subWin->setOption(QMdiSubWindow::RubberBandResize, true);
		subWin->setOption(QMdiSubWindow::RubberBandMove, true);
		// Guardamos una referencia al objeto
		subWin->setAttribute(Qt::WA_DeleteOnClose);
		QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
		subWin->show();
		QApplication::restoreOverrideCursor();

		connect (dlg, SIGNAL(closingWindow(QWidget *)), this, SLOT(closeSubWindow(QWidget *)));
		connect (subWin, SIGNAL(aboutToActivate()), dlg, SLOT(refreshFilterTableView()));
		configuracion.applyDimensionForm(subWin);
	} else {
Beispiel #4
0
void App::loadFixtureDefinition(const QString& path)
{
    QLCFixtureDef* fixtureDef = NULL;

    /* Attempt to create a fixture definition from the selected file */
    QString error(tr("Unrecognized file extension: %1").arg(path));
    if (path.toLower().endsWith(KExtFixture) == true)
        fixtureDef = loadQXF(path, error);
    else if (path.toLower().endsWith(KExtAvolitesFixture) == true)
        fixtureDef = loadD4(path, error);
    else
        fixtureDef = NULL;

    if (fixtureDef != NULL)
    {
        /* Create a new sub window and put a fixture editor widget
           in that sub window with the newly-created fixture def */
        QMdiSubWindow* sub = new QMdiSubWindow(centralWidget());
        QLCFixtureEditor* editor = new QLCFixtureEditor(sub, fixtureDef, path);

        sub->setWidget(editor);
        sub->setAttribute(Qt::WA_DeleteOnClose);
        qobject_cast<QMdiArea*> (centralWidget())->addSubWindow(sub);

        editor->show();
        sub->show();
    }
    else
    {
        QMessageBox::warning(this, tr("Fixture loading failed"),
                             tr("Unable to load fixture definition: ") + error);
    }
}
Beispiel #5
0
void App::loadFixtureDefinition(const QString& path)
{
	/* Attempt to create a fixture definition from the selected file */
	QLCFixtureDef* fixtureDef = new QLCFixtureDef();
	QFile::FileError error = fixtureDef->loadXML(path);
	if (error == QFile::NoError)
	{
		QLCFixtureEditor* editor;
		QMdiSubWindow* sub;

		/* Create a new sub window and put a fixture editor widget
		   in that sub window with the newly-created fixture def */
		sub = new QMdiSubWindow(centralWidget());
		editor = new QLCFixtureEditor(sub, fixtureDef, path);

		sub->setWidget(editor);
		sub->setAttribute(Qt::WA_DeleteOnClose);
		qobject_cast<QMdiArea*> (centralWidget())->addSubWindow(sub);

		editor->show();
		sub->show();
	}
	else
	{
		delete fixtureDef;
		QMessageBox::warning(this, tr("Fixture loading failed"),
			tr("Unable to load fixture definition: ") +
			QLCFile::errorString(error));
	}
}
Beispiel #6
0
void MainWindow::fileNew() {
    if (_sdata)
        if (!_sdata->isSaved())
            maybeSave();
        fileClose();
    // if project exist,
        // if not saved,
            //maybe save?
        // close


    // run wizard
    QMdiSubWindow * world = _mdiArea->addSubWindow(new WorldWidget());
    world->setWindowTitle("*untitled");
    world->setMinimumSize(300, 200);
    world->show();

    _sdata = new SimulationData();
    _sdata->setSaved(false);

    connect(_sdata, SIGNAL(fileNameChanged(QString)), world, SLOT(setWindowTitle(QString)));

    SensorNetwork net(40);
    net.push();
    net.start();

    _fileSaveAsAct->setEnabled(true);
    _fileCloseAct->setEnabled(true);
}
inline QMdiSubWindow *MainWindow::CreateTable(ETable aType, Table *aTable)
{
    QMdiSubWindow *sw = mdiArea->addSubWindow(aTable);
    sw->show();
    mapTable.insert(aType, aTable);
    connect(aTable, SIGNAL(destroyed(QObject *)), this, SLOT(DestroyTable(QObject *)));
    return sw;
}
Workspace::Workspace(PreviewFrame *parent)
    : QMdiArea(parent)
{
    previewFrame = parent;
    PreviewWidget *previewWidget = previewFrame->widget();
    QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window);
    frame->move(10, 10);
    frame->show();
}
Beispiel #9
0
void MainWindow::new_combo_trade()
{
    ComboTradeDialog *comboTradeDialog = new ComboTradeDialog;
    QMdiSubWindow *qMdiSubWindow = ui_->mdiArea_combo->addSubWindow(comboTradeDialog);
    qMdiSubWindow->setAttribute(Qt::WA_DeleteOnClose);
    qMdiSubWindow->setFixedSize(320, 240);
    qMdiSubWindow->setWindowFlags(qMdiSubWindow->windowFlags()& ~Qt::WindowMaximizeButtonHint& ~Qt::WindowMinimizeButtonHint);
    qMdiSubWindow->show();
}
Workspace::Workspace(PreviewFrame* parent, const char* name)
    : QMdiArea(parent)
{
    previewFrame = parent;
    PreviewWidget *previewWidget = previewFrame->widget();
    setObjectName(QLatin1String(name));
    QMdiSubWindow *frame = addSubWindow(previewWidget, Qt::Window);
    frame->move(10,10);
    frame->show();
}
Beispiel #11
0
void FileNewController::react() {
   qDebug() << "Creating new window";
   EditSubWindow *newEditWindow = new EditSubWindow(&mdiMain);
   BufferRef buffer = bufferPool.getEmptyBuffer();
   newEditWindow->setBuffer(buffer);
   newEditWindow->show();
   QMdiSubWindow *subWindow = mdiMain.addSubWindow(newEditWindow);
   subWindow->setAttribute(Qt::WA_DeleteOnClose);
   subWindow->show();
}
Beispiel #12
0
//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 );
}
Beispiel #13
0
void MainWindow::addEditor(Editor *editor)
{
    connect(editor, SIGNAL(copyAvailable(bool)),
            cutAction, SLOT(setEnabled(bool)));
    connect(editor, SIGNAL(copyAvailable(bool)),
            copyAction, SLOT(setEnabled(bool)));

    QMdiSubWindow *subWindow = mdiArea->addSubWindow(editor);
    windowMenu->addAction(editor->windowMenuAction());
    windowActionGroup->addAction(editor->windowMenuAction());
    subWindow->show();
}
// =============================================================================
ITimeTrackingWindow * MainWindow::createSubWindow(const QString& userName, const QDate& tmpDate) {
    DEBUG_OBJ("");

    ITimeTrackingWindow * timeTrackingWindow = new TimeTrackingWindow(&mSubject, userName, tmpDate, this);
    DEBUG("Opening subWindow " + userName + ", date: " + tmpDate.toString());
    QMdiSubWindow *subWindow = mMdiArea->addSubWindow(timeTrackingWindow);
    // TODO Update events in MDI
    // *windowMenu->addAction(editor->windowMenuAction());
    //  windowActionGroup->addAction(editor->windowMenuAction());

    subWindow->show();
    return timeTrackingWindow;
}
Beispiel #15
0
// 新建文件菜单
void MainWindow::on_action_New_triggered()
{
    // 新建文本编辑器部件
    QTextEdit *edit = new QTextEdit(this);

    // 使用QMdiArea类的addSubWindow()函数创建子窗口,以文本编辑器为中心部件
    QMdiSubWindow *child = ui->mdiArea->addSubWindow(edit);

    child->setWindowTitle(tr("多文档编辑器子窗口"));

    // 显示子窗口
    child->show();
}
Beispiel #16
0
void WindowService::addImage(const QString& id, ImageWindow* image)
{
    if(_widgets.find(id) != _widgets.end())
    {
        QMdiSubWindow* sw = _mdi->addSubWindow(image);
        _widgets[id] << sw;

        SubWindowController* swc = new SubWindowController(id, sw);

        QObject::connect(sw, SIGNAL(aboutToActivate()), image, SLOT(activated()));

        QObject::connect(sw, SIGNAL(destroyed()), swc, SLOT(closeSubWindow()));
        QObject::connect(swc, SIGNAL(removeFromWindowsMap(const QString&, QMdiSubWindow*)), this, SLOT(removeSubWindow(const QString&,QMdiSubWindow*)));

        sw->show();
    }
Beispiel #17
0
void MainWindow::new_swing_trade()
{
    QString contractName = tr("Exchange-Contract-").append(QString("%1").arg(swing_counter_));
    SwingTradeDialog *swingTradeDialog = new SwingTradeDialog(contractName, swing_counter_, disp_, this);

    connect(swingTradeDialog, SIGNAL(update_contract(QString)), this, SLOT(update_swing_contract(QString)));

    QMdiSubWindow *qMdiSubWindow = ui_->mdiArea_swing->addSubWindow(swingTradeDialog);
    qMdiSubWindow->setAttribute(Qt::WA_DeleteOnClose);
    qMdiSubWindow->setFixedSize(265, 440);
    qMdiSubWindow->setWindowFlags(qMdiSubWindow->windowFlags()& ~Qt::WindowMaximizeButtonHint& ~Qt::WindowMinimizeButtonHint);
    qMdiSubWindow->setWindowTitle(contractName);
    qMdiSubWindow->show();

    swing_counter_++;
    selcon_->setCurrentText(contractName);
}
Beispiel #18
0
void App::slotFileNew()
{
    QLCFixtureEditor* editor;
    QMdiSubWindow* sub;

    sub = new QMdiSubWindow(centralWidget());
    editor = new QLCFixtureEditor(sub, new QLCFixtureDef());

    sub->setWidget(editor);
    sub->setAttribute(Qt::WA_DeleteOnClose);
    sub->setWindowIcon(QIcon(":/fixture.png"));

    qobject_cast<QMdiArea*> (centralWidget())->addSubWindow(sub);

    editor->show();
    sub->show();
}
Beispiel #19
0
PlotWithCurves* Group::insertPlot()
{
    QMdiSubWindow* window = new QMdiSubWindow;
    {
        window->setMinimumSize(250, 150);
        window->setWindowIcon(QIcon(":/res/mainWindow/closeAllPlots.png"));
        window->setAttribute(Qt::WA_DeleteOnClose);
    }
    PlotWithCurves* plot = new PlotWithCurves(samplesManager, curvesManagerView, window);
    {
        plot->connect(plot, SIGNAL(destroyed()), this, SLOT(retitle()));
        window->setWidget(plot);
        addSubWindow(window);
        window->show();
        retitle();
    }
    return plot;
}
Beispiel #20
0
void
PidMain::openImage()
{
    QString path;

    path = QFileDialog::getOpenFileName(this,
        "Choose an image file to open",
        QString::null,
        "*.jpg *.jpeg");

    if (path != NULL)
    {
        ImageTabs *img = new ImageTabs(mdiArea, path);
        QMdiSubWindow *imgWindow = mdiArea->addSubWindow(img);
        imgWindow->setWindowTitle(path);
        imgWindow->show();
    }
}
Beispiel #21
0
void MainWindow::addNewPicEdit(const QString& fileName){
    // new a picEdit widget, which is outlined by a QScrollArea
    PicEdit* newImgEdit = new PicEdit(fileName);
    PicEditWindow* newImgContainer = new PicEditWindow(fileName);
    newImgContainer->setWidgetResizable(false);
    newImgContainer->setWidget(newImgEdit);

    // signals and slots
    connect(newImgEdit,SIGNAL(curImgWasModified()),newImgContainer,SLOT(setPicEditModified()));
    connect(newImgContainer,SIGNAL(saveImgFile(const QString&)),newImgEdit,SLOT(saveFile(const QString&)));
    connect(newImgContainer,SIGNAL(reSizePicEdit(const QSize&)),newImgEdit,SLOT(reSizeSelf(const QSize&)));
    connect(newImgContainer,SIGNAL(reZoomPicEdit(int)),newImgEdit,SLOT(reZoomSelf(int)));

    // add the new picEdit widget to the mdiArea
    QMdiSubWindow* subWindow = mdiArea->addSubWindow(newImgContainer);
    subWindow->setContentsMargins(0,0,0,0);

    // show subWindow
    subWindow->show();
}
Beispiel #22
0
/**
 * @brief MainWindow::openMap Initialize and opens the given map.
 * @param map
 * @param notify Notifies all the clients that a new map has been opened if true.
 */
void MainWindow::openMap(Map *map, bool notify) {
    QListWidget *tokenList = ui->tokenPage->getUi()->m_tokenList;

    // Initialize Map with the MapServer
    if (m_Server != NULL) {
        Receiver *mapServerReceiver = m_Server->getReceiver(TargetCode::MAP_SERVER);
        MapServer *mapServer = dynamic_cast<MapServer*>(mapServerReceiver);
        map->setSenderServer(mapServer);
    }

    // Initialize Map with the MapClient
    Receiver *mapClientReceiver = m_Client->getReceiver(TargetCode::MAP_CLIENT);
    MapClient *mapClient = dynamic_cast<MapClient*>(mapClientReceiver);
    mapClient->addMapToList(map);
    map->setSenderClient(mapClient);

    QMdiSubWindow *subwindow = ui->tableArea->addSubWindow(map);
    subwindow->show();
    subwindow->move(0, 0);

    connect(tokenList, SIGNAL(currentItemChanged(QListWidgetItem*,  QListWidgetItem *)),
            map->getMapLayer(), SLOT(setTokenItem(QListWidgetItem*))
    );

    if (notify) {
        // Notifies all the clients that a new map has been opened
        Receiver *mapClientReceiver = m_Client->getReceiver(TargetCode::MAP_CLIENT);
        MapClient *mapClient = dynamic_cast<MapClient*>(mapClientReceiver);
        QString msg = QString("%1").arg(map->id());
        mapClient->sendMessageToServer(msg, (quint16) MapCodes::OPEN_MAP);
    }

    m_NotificationStacker.pushNotification("Une carte a été ouverte");

    // Connect to the LogClient
    TargetCode logClientCode(TargetCode::LOGGER_CLIENT);
    Receiver *logClientReceiver = m_Client->getReceiver(logClientCode);
    LogClient *logClient = dynamic_cast<LogClient*>(logClientReceiver);
    map->connectToLogger(logClient);
}
/*!
    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);
    }
}
/* Build Module GUI */
void IScale_DynClamp::Module::createGUI( void ) {

	QMdiSubWindow *subWindow  = new QMdiSubWindow;
	subWindow->setAttribute(Qt::WA_DeleteOnClose);
	subWindow->setWindowIcon(QIcon("/usr/local/lib/rtxi/RTXI-widget-icon.png"));
	subWindow->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | 
	                          Qt::WindowMinimizeButtonHint );
	MainWindow::getInstance()->createMdi(subWindow); 
	subWindow->setWidget(this);

	mainWindow = new IScale_DynClampUI(subWindow);
	// Construct Main Layout - vertical layout
	QVBoxLayout *layout = new QVBoxLayout(this);
	setLayout(layout);
	layout->addWidget(mainWindow);

	// Model Combo Box
	mainWindow->modelComboBox->addItem("LivRudy 2009");
	mainWindow->modelComboBox->addItem("FaberRudy 2000");

	// Set GUI refresh rate
	QTimer *timer = new QTimer(this);
	timer->start(500);

	// Set validators
	mainWindow->APDRepolEdit->setValidator( new QIntValidator(mainWindow->APDRepolEdit) );
	mainWindow->minAPDEdit->setValidator( new QIntValidator(mainWindow->minAPDEdit) );
	mainWindow->stimWindowEdit->setValidator( new QIntValidator(mainWindow->stimWindowEdit) );
	mainWindow->numTrialEdit->setValidator( new QIntValidator(mainWindow->numTrialEdit) );
	mainWindow->intervalTimeEdit->setValidator( new QIntValidator(mainWindow->intervalTimeEdit) );
	mainWindow->BCLEdit->setValidator( new QDoubleValidator(mainWindow->BCLEdit) );
	mainWindow->stimMagEdit->setValidator( new QDoubleValidator(mainWindow->stimMagEdit) );
	mainWindow->stimLengthEdit->setValidator( new QDoubleValidator(mainWindow->stimLengthEdit) );
	mainWindow->CmEdit->setValidator( new QDoubleValidator(mainWindow->CmEdit) );
	mainWindow->LJPEdit->setValidator( new QDoubleValidator(mainWindow->CmEdit) );

	// Connect MainWindow elements to slot functions
	QObject::connect( mainWindow->addStepButton, SIGNAL(clicked(void)), 
	                  this, SLOT( addStep(void)) );
	QObject::connect( mainWindow->deleteStepButton, SIGNAL(clicked(void)), 
	                  this, SLOT( deleteStep(void)) );
	QObject::connect( mainWindow->saveProtocolButton, SIGNAL(clicked(void)), 
	                  this, SLOT( saveProtocol(void)) );
	QObject::connect( mainWindow->loadProtocolButton, SIGNAL(clicked(void)), 
	                  this, SLOT( loadProtocol(void)) );
	QObject::connect( mainWindow->clearProtocolButton, SIGNAL(clicked(void)), 
	                  this, SLOT( clearProtocol(void)) );
	QObject::connect( mainWindow->recordDataCheckBox, SIGNAL(clicked(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect( mainWindow->startProtocolButton, SIGNAL(toggled(bool)), 
	                  this, SLOT( toggleProtocol(void)) );
	QObject::connect( mainWindow->thresholdButton, SIGNAL(clicked(void)), 
	                  this, SLOT( toggleThreshold(void)) );
	QObject::connect( mainWindow->staticPacingButton, SIGNAL(clicked(void)), 
	                  this, SLOT( togglePace(void)) );
	QObject::connect( mainWindow->resetButton, SIGNAL(clicked(void)), 
	                  this, SLOT( reset(void)) );
	QObject::connect( mainWindow->modelComboBox, SIGNAL(activated(int)), 
	                  this, SLOT( changeModel(int)) );    
	QObject::connect( mainWindow->APDRepolEdit, SIGNAL(returnPressed(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect( mainWindow->minAPDEdit, SIGNAL(returnPressed(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect( mainWindow->stimWindowEdit, SIGNAL(returnPressed(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect( mainWindow->numTrialEdit, SIGNAL(returnPressed(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect( mainWindow->intervalTimeEdit, SIGNAL(returnPressed(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect( mainWindow->BCLEdit, SIGNAL(returnPressed(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect( mainWindow->stimMagEdit, SIGNAL(returnPressed(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect( mainWindow->stimLengthEdit, SIGNAL(returnPressed(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect( mainWindow->CmEdit, SIGNAL(returnPressed(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect( mainWindow->LJPEdit, SIGNAL(returnPressed(void)), 
	                  this, SLOT( modify(void)) );
	QObject::connect(timer, SIGNAL(timeout(void)), 
	                  this, SLOT(refreshDisplay(void)));

	// Connections to allow only one button being toggled at a time
	QObject::connect( mainWindow->thresholdButton, SIGNAL(toggled(bool)), 
	                  mainWindow->staticPacingButton, SLOT( setDisabled(bool)) );
	QObject::connect( mainWindow->thresholdButton, SIGNAL(toggled(bool)),
	                  mainWindow->startProtocolButton, SLOT( setDisabled(bool)) );
	QObject::connect( mainWindow->startProtocolButton, SIGNAL(toggled(bool)), 
	                  mainWindow->staticPacingButton, SLOT( setDisabled(bool)) );
	QObject::connect( mainWindow->startProtocolButton, SIGNAL(toggled(bool)), 
	                  mainWindow->thresholdButton, SLOT( setDisabled(bool)) );
	QObject::connect( mainWindow->staticPacingButton, SIGNAL(toggled(bool)), 
	                  mainWindow->thresholdButton, SLOT( setDisabled(bool)) );
	QObject::connect( mainWindow->staticPacingButton, SIGNAL(toggled(bool)), 
	                  mainWindow->startProtocolButton, SLOT( setDisabled(bool)) );

	// Connect states to workspace
	setData( Workspace::STATE, 0, &time );
	setData( Workspace::STATE, 1, &voltage );
	setData( Workspace::STATE, 2, &beatNum );
	setData( Workspace::STATE, 3, &APD );
	setData( Workspace::STATE, 4, &targetCurrent );
	setData( Workspace::STATE, 5, &scaledCurrent );

	subWindow->show();
	subWindow->adjustSize();
} // End createGUI()
void MainWindow::CreateWorkStatement()
{
    QMdiSubWindow *sw = mdiArea->addSubWindow(new WorkStatement(mdiArea));
    sw->show();
    sw->setWindowIcon(QIcon(":/Resource/Images/WorkStatement.ico"));
}
void MainWindow::CreateGanttChart()
{
    QMdiSubWindow *sw = mdiArea->addSubWindow(new GanttChart(mdiArea));
    sw->show();
    sw->setWindowIcon(QIcon(":/Resource/Images/GanttChart.png"));
}
Beispiel #27
0
///
/// \brief m点n次滤波
///
void FunDataPreprocessing::pointSmoothInValue()
{
    SAAbstractDatas* data = saUI->getSelectSingleData();
    if(nullptr == data)
    {
        return;
    }
    const QString idPoint = "points";
    const QString idPower = "power";
    const QString idIsPlot = "isPlot";
    SAPropertySetDialog dlg(saUI->getMainWindowPtr(),static_cast<SAPropertySetDialog::BrowserType>(SAGUIGlobalConfig::getDefaultPropertySetDialogType()));
    dlg.appendGroup(TR("property set"));
    dlg.appendEnumProperty(idPoint,TR("points")
                           ,{"3","5","7"}
                           ,0
                           ,TR("set smooth points"));
    dlg.appendEnumProperty(idPower,TR("power")
                           ,{"1","2","3"}
                           ,0
                           ,TR("set smooth power"));
    dlg.appendGroup(TR("plot set"));
    dlg.appendBoolProperty(idIsPlot,TR("is plot")
                           ,true
                           ,TR("is plot after calc"));
    if(QDialog::Accepted != dlg.exec())
    {
        return;
    }
    int point = 3;
    switch(dlg.getDataByID<int>(idPoint))
    {
    case 0:point = 3;break;
    case 1:point = 5;break;
    case 2:point = 7;break;
    default:point = 3;
    }
    int power = 1;
    switch(dlg.getDataByID<int>(idPower))
    {
    case 0:power = 1;break;
    case 1:power = 2;break;
    case 2:power = 3;break;
    default:power = 1;
    }
    std::shared_ptr<SAAbstractDatas> res = saFun::pointSmooth(data,point,power);
    if(nullptr == res)
    {
        saUI->showErrorMessageInfo(saFun::getLastErrorString());
        saUI->raiseMessageInfoDock();
        return;
    }
    saValueManager->addData(res);
    if(dlg.getDataByID<bool>(idIsPlot))
    {
        QMdiSubWindow* sub = saUI->createFigureWindow();
        SAFigureWindow* fig = saUI->getFigureWidgetFromMdiSubWindow(sub);
        SAChart2D* chart = fig->current2DPlot();
        if(nullptr == chart)
        {
            chart = fig->create2DPlot();
        }
        if(chart)
        {
            chart->addCurve(res.get());
        }
        saUI->raiseMainDock();
        sub->show();
    }
}
Beispiel #28
0
//点击
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();
        }

    }
void MainWindow::openPage( int type, quint32 accountid )
{
    if( type <= 0 )
        return;

    QUuid id;
    PageWidgetMember *tab = NULL;
    QString header;

    //usual window
    if( type != 13 )
    {
        if( !hList.contains( type, id ) )
        {
            //create page
            tab = createPage( type, accountid, header );
        }
        else
        {
            //show page
            setPageActive( id, accountid );
            return;
        }
    }
    //transactions window
    else if( type == 13 && accountid > 0 )
    {
        if( !hList.trContains( accountid, id ) )
        {
            tab = createPage( type, accountid, header );
        }
        else
        {
            setPageActive( id );
            return;
        }
    }

    // -------
    // -------

    if( tab == NULL )
        return;

    connect( tab, SIGNAL( closeRequest( const QUuid & ) ), this, SLOT( closePage( const QUuid & ) ) );
    connect( tab, SIGNAL( closed( int ) ), this, SLOT( closedPage( int ) ) );
    connect( tab, SIGNAL( headerChanged( const QString & ) ), this, SLOT( changeHeader( const QString & ) ) );

    //create an empty tab on tabwidget
    disconnect( tabWidget, SIGNAL( currentChanged(int) ), this, SLOT( setPageActive(int) ) );

    tabWidget->addTab( new QWidget(), header );
    tabWidget->setCurrentIndex( tabWidget->count()-1 );
    if( tab->hasIcon() )
        tabWidget->setTabIcon( tabWidget->count()-1, *tab->icon() );

    connect( tabWidget, SIGNAL( currentChanged(int) ), this, SLOT( setPageActive(int) ) );
    // ----

    //create and show window in MDI Area
    QMdiSubWindow *subW = new QMdiSubWindow(this);
    subW->setWidget( tab );
    subW->setWindowTitle( header );
    subW->setAttribute( Qt::WA_DeleteOnClose );
    mdiArea->addSubWindow( subW );
    subW->showMaximized();
    subW->show();
    // -----


    //creating a handler for the tab
    Handler *h = new Handler();
    h->id = QUuid::createUuid();
    h->accountid = accountid;
    h->type = type;
    h->number = tabWidget->count()-1;
    // -----

    tab->setHandler( *h );
    hList.append( h );
}
Beispiel #30
0
///
/// \brief sigma异常值判断
///
void sigmaDetectInValue(SAUIInterface* ui)
{

    SAAbstractDatas* data = ui->getSelectSingleData();
    if(nullptr == data)
    {
        return;
    }
    QList<SAFigureWindow*> figList;//用于保存当前主界面所有的绘图窗口
    SAPropertySetDialog dlg(ui->getMainWindowPtr(),static_cast<SAPropertySetDialog::BrowserType>(SAGUIGlobalConfig::getDefaultPropertySetDialogType()));
    const QString idSigma = "sigma";
    const QString idPlotInNewFigure = "isPlotInNewFigure";
    const QString idPlotOriginDataAndOutRangDataInNewFigure = "isPlotOriginDataAndOutRangDataInNewFigure";
    const QString idPlotDenoiseDataInNewFigure = "isPlotDenoiseDataInNewFigure";
    const QString idFigWindowList = "figureWindowList";
    const QString idIsPlotDenoiseDataInCurrentFig = "isPlotDenoiseDataInCurrentFig";
    const QString idIsPlotOutRangMarkInCurrentFig = "isPlotOutRangMarkInCurrentFig";
    dlg.appendGroup(TR("property set"));
    dlg.appendDoubleProperty(idSigma,TR("sigma")
                             ,0,std::numeric_limits<double>::max()
                             ,3
                           ,TR("set sigma value"));
    dlg.appendGroup(TR("out put set"));
    dlg.appendBoolProperty("isSaveOutRangIndex",TR("save out rang index"),false
                           ,TR("if this select true,will return the index which is out of sigma rang"));
    dlg.appendBoolProperty("isSaveOutRangData",TR("save out rang data"),false
                           ,TR("if this select true,will return the datas which is out of sigma rang"));
    dlg.appendGroup(TR("new figure set"));
    //
    auto propPlot = dlg.appendBoolProperty(idPlotInNewFigure,TR("plot in new chart"),true
                           ,TR("if this select true,will plot data in new figure"));
    auto propPlotOrigin = dlg.appendBoolProperty(idPlotOriginDataAndOutRangDataInNewFigure,TR("plot origin data"),true
                           ,TR("if this select true,will plot origin data in figure and will plot the out rang data"));
    auto propPlotDenoise = dlg.appendBoolProperty(idPlotDenoiseDataInNewFigure,TR("plot Denoise data"),true
                           ,TR("if this select true,will plot origin data in figure"));
    auto fun1 = [&](SAPropertySetDialog* dlg,QtProperty* prop,const QVariant& var){
        Q_UNUSED(dlg);
        Q_UNUSED(prop);
        propPlotOrigin->setEnabled(var.toBool());
        propPlotDenoise->setEnabled(var.toBool());
    };
    dlg.setPropertyChangEvent(propPlot,fun1);
    dlg.appendGroup(TR("current figure set"));
    auto propPlotCur = dlg.appendBoolProperty("isPlotInCurrentFigure",TR("plot in current chart"),false
                           ,TR("if this select true,will plot data in user select figure"));
    auto propFigSelVar = SAUIHelper::appenFigureListInPropertyDialog(&dlg
                                                         ,&figList
                                                        ,idFigWindowList
                                                        ,TR("select figure")
                                                        ,TR("choose the figure window to plot the out rang point"));
    propFigSelVar->setEnabled(false);
    auto propPlotDenoiseCurFig = dlg.appendBoolProperty(idIsPlotDenoiseDataInCurrentFig
                                                        ,TR("plot denoise data"),true
                                                      ,TR("if this select true,will plot denoise data in select figure"));
    propPlotDenoiseCurFig->setEnabled(false);
    auto propPlotOutRangMarkCurFig = dlg.appendBoolProperty(idIsPlotOutRangMarkInCurrentFig,TR("plot out rang data"),true
                                                      ,TR("if this select true,will plot out rang data in select figure"));
    propPlotOutRangMarkCurFig->setEnabled(false);
    auto fun2 = [&](SAPropertySetDialog* dlg,QtProperty* prop,const QVariant& var){
        Q_UNUSED(dlg);
        Q_UNUSED(prop);
        propFigSelVar->setEnabled(var.toBool());
        propPlotDenoiseCurFig->setEnabled(var.toBool());
        propPlotOutRangMarkCurFig->setEnabled(var.toBool());
    };
    dlg.setPropertyChangEvent(propPlotCur,fun2);
    if(QDialog::Accepted != dlg.exec())
    {
        return;
    }
    std::shared_ptr<SAAbstractDatas> waveDenoising = nullptr;
    std::shared_ptr<SAAbstractDatas> waveRemove = nullptr;
    std::shared_ptr<SAVectorInt> outRangIndex = nullptr;
    std::shared_ptr<SAVectorInt> inRangIndex = nullptr;
    std::tie(waveDenoising,waveRemove,outRangIndex,inRangIndex)
            = saFun::sigmaDenoising(data,dlg.getDataByID<double>(idSigma));

    if(nullptr == waveDenoising || nullptr == waveRemove)
    {
        ui->showErrorMessageInfo(saFun::getLastErrorString());
        ui->raiseMessageInfoDock();
        return;
    }
    //========================
    //save data to value manager
    //========================
    saValueManager->addData(waveDenoising);
    if(dlg.getDataByID<bool>("isSaveOutRangIndex"))
    {
        saValueManager->addData(outRangIndex);
    }
    if(dlg.getDataByID<bool>("isSaveOutRangData"))
    {
        saValueManager->addData(waveRemove);
    }
    //========================
    //plot
    //========================
    if(dlg.getDataByID<bool>(idPlotInNewFigure))
    {
        QMdiSubWindow* sub = ui->createFigureWindow();
        SAFigureWindow* fig = ui->getFigureWidgetFromMdiSubWindow(sub);
        SAChart2D* chart = fig->current2DPlot();
        if(nullptr == chart)
        {
            chart = fig->create2DPlot();
        }
        if(fig)
        {
            if(dlg.getDataByID<bool>(idPlotOriginDataAndOutRangDataInNewFigure))
            {
                chart->addCurve(data);
                if(SA::VectorPoint == data->getType() )
                {
                    QwtPlotCurve* cur = (QwtPlotCurve*)(chart->addCurve(waveRemove.get()));
                    if(cur)
                    {
                        SAChart::setCurveSymbol(cur,QwtSymbol::Cross,QSize(5,5));
                        SAChart::setCurveLinePenStyle(cur,Qt::NoPen);
                    }
                }
                else
                {
                    QwtPlotCurve* cur  = (QwtPlotCurve*)(chart->addCurve(outRangIndex.get(),waveRemove.get()));
                    if(cur)
                    {
                        SAChart::setCurveSymbol(cur,QwtSymbol::Cross,QSize(5,5));
                        SAChart::setCurveLinePenStyle(cur,Qt::NoPen);
                    }
                }
            }
            if(dlg.getDataByID<bool>(idPlotDenoiseDataInNewFigure))
            {
                if(SA::VectorPoint == data->getType() )
                {
                    chart->addCurve(waveDenoising.get());
                }
                else
                {
                    chart->addCurve(inRangIndex.get(),waveDenoising.get());
                }
            }
        }
        ui->raiseMainDock();
        sub->show();
    }
    if(dlg.getDataByID<bool>("isPlotInCurrentFigure"))
    {
        if(figList.size() <= 0)
        {
            return;
        }
        int index = dlg.getDataByID<int>(idFigWindowList);
        if(index <= 0)
        {
            return;
        }
        if((index-1) >= figList.size())
        {
            return;
        }
        SAFigureWindow* fig = figList[index-1];
        SAChart2D* chart = fig->current2DPlot();
        if(nullptr == chart)
        {
            chart = fig->create2DPlot();
        }
        if(dlg.getDataByID<bool>(idIsPlotDenoiseDataInCurrentFig))
        {
            if(SA::VectorPoint == data->getType() )
            {
                chart->addCurve(waveDenoising.get());
            }
            else
            {
                chart->addCurve(inRangIndex.get(),waveDenoising.get());
            }
        }
        if(dlg.getDataByID<bool>(idIsPlotOutRangMarkInCurrentFig))
        {
            QwtPlotCurve* cur = nullptr;
            if(SA::VectorPoint == data->getType() )
            {
                cur = (QwtPlotCurve*)(chart->addCurve(waveRemove.get()));
            }
            else
            {
                cur = (QwtPlotCurve*)(chart->addCurve(outRangIndex.get(),waveRemove.get()));
            }
            if(cur)
            {
                SAChart::setCurveSymbol(cur,QwtSymbol::Cross,QSize(5,5));
                SAChart::setCurveLinePenStyle(cur,Qt::NoPen);
            }
        }
    }
}