示例#1
0
//=========================================================================
void BubbleChartView::onDataSourceVisibilityChanged(int index)
{
    ChartDataProvider *dp = dataProvider();
    BlastTaxDataProviders *btdps = dp->getBlastTaxDataProviders();
    BlastTaxDataProvider *bProvider = btdps->at(index);
    bool visible = btdps->isVisible(index);
    for ( int i = 0; i < dp->data.count(); i++ )
    {
        if ( !dp->data.at(i).checked )
            continue;
        BlastTaxNode *node = dp->data.at(i).tax_nodes[index];
        if ( node == NULL )
            continue;
        GraphNode *gnode = node->getGnode();
        if ( visible )
        {
            if ( gnode == NULL )
                CreateGraphNode(node, bProvider);
        }
        else
        {
            if ( gnode != NULL )
                delete gnode;
        }
    }
    horizontalLegend.at(index)->setVisible(visible);
    grid.at(index)->setVisible(visible);
    showChart(true);
}
示例#2
0
//=========================================================================
void BubbleChartView::onTaxVisibilityChanged(quint32 index)
{
    ChartDataProvider *chartDataProvider = dataProvider();
    const BlastTaxNodes &btns = chartDataProvider->data.at(index).tax_nodes;
    bool createGNode = chartDataProvider->data.at(index).checked;
    for ( int i = 0; i < btns.size(); i++ )
    {
        BlastTaxDataProvider *bProvider = chartDataProvider->getBlastTaxDataProviders()->at(i);
        BlastTaxNode *node = btns.at(i);
        if ( node == NULL )
            continue;
        if ( createGNode )
        {
            CreateGraphNode(node, bProvider);
        }
        else
        {
            ChartGraphNode *gnode = (ChartGraphNode *) node->getGnode();
            if ( gnode != NULL )
                delete gnode;
        }
    }
    verticalLegend[index]->setVisible(chartDataProvider->data.at(index).checked);
    showChart(true);
}
示例#3
0
文件: widget.cpp 项目: raojun/Manager
void Widget::on_uptBtn_clicked()
{
    if(ui->typeComboBox->currentText()!="请选择类型")
    {
        showChart();
    }
}
示例#4
0
文件: widget.cpp 项目: raojun/Manager
void Widget::on_typeComboBox_currentIndexChanged(QString type)
{
    if (type!="请选择类型")
    {
        showChart();
    }
}
示例#5
0
//=========================================================================
void BubbleChartView::resizeEvent(QResizeEvent *e)
{
    QSize s = e->size();
    QRectF r = scene()->itemsBoundingRect();
    setChartRectSize(s.width()*0.8, r.height()/*s.height()*0.9*/);
    if ( dataProvider() != NULL )
        showChart();
}
示例#6
0
//=========================================================================
void BubbleChartView::fromJson(QJsonObject &json)
{
    try
    {
        QJsonObject jDp = json["Dp"].toObject();
        dataProvider()->fromJson(jDp);
        QJsonObject jConfig = json["Config"].toObject();
        getConfig()->fromJson(jConfig);
        prepareScene();
        header->setPlainText(json["Header"].toString());
        showChart();
    }
    catch (...)
    {
        QMessageBox::warning(this, "Error occured", "Cannot restore Bubble Chart from project configuration");
    }
}
示例#7
0
UIManager::UIManager() {
    mainWindow = new MainWindow();
    mainMenu = new MainMenu(mainWindow);
    navigationWindow = new NavigationWindow(mainWindow);
    settingsWindow = new SettingsForm(mainWindow);

    mainWindow->layout()->addWidget(mainMenu);
    mainWindow->layout()->addWidget(navigationWindow);
    mainWindow->layout()->addWidget(settingsWindow);
    toolbox = new ToolBox(navigationWindow);

    QObject::connect(mainWindow, SIGNAL(geometryChanged(QRect)), this, SLOT(mainWindowGeometryChanged(QRect)));
    QObject::connect(navigationWindow, SIGNAL(goBack()), this, SLOT(showMainMenu()));
    QObject::connect(navigationWindow, SIGNAL(toolboxButtonClicked()), this, SLOT(toggleToolbox()));
    QObject::connect(mainMenu, SIGNAL(close()), this, SLOT(close()));
    QObject::connect(mainMenu, SIGNAL(showChart()), this, SLOT(showChartWindow()));
    QObject::connect(mainMenu, SIGNAL(showSettings()), this, SLOT(showSettingsWindow()));
    QObject::connect(settingsWindow, SIGNAL(goBack()), this, SLOT(showMainMenu()));

    connectInstruments();
    mainWindow->show();
}
示例#8
0
//=========================================================================
BubbleChartView::BubbleChartView(BlastTaxDataProviders *_dataProviders, QWidget *parent, bool setRank)
    : DataGraphicsView(NULL, parent)
{
    flags |= DGF_BUBBLES | DGF_RANKS;
    config = new BubbleChartParameters();

    if ( setRank && mainWindow->getRank() == TR_NORANK )
        mainWindow->setRank(TR_SPECIES);

    if ( _dataProviders == NULL )
        _dataProviders = new BlastTaxDataProviders();

    taxDataProvider = new ChartDataProvider(_dataProviders, this);

    connect((ChartDataProvider *)taxDataProvider, SIGNAL(taxVisibilityChanged(quint32)), this, SLOT(onTaxVisibilityChanged(quint32)));
    connect((ChartDataProvider *)taxDataProvider, SIGNAL(cacheUpdated()), this, SLOT(onDataChanged()));

    QGraphicsScene *s = new QGraphicsScene(this);
    s->setItemIndexMethod(QGraphicsScene::NoIndex);
    setCacheMode(CacheBackground);
    setViewportUpdateMode(BoundingRectViewportUpdate);
    setRenderHint(QPainter::Antialiasing);
    setTransformationAnchor(AnchorUnderMouse);
    setMinimumSize(400, 200);
    setAlignment(Qt::AlignCenter);
    setScene(s);

    setChartRectSize(800, 800);

    propertiesAction = popupMenu.addAction("Properties...");
    connect(propertiesAction, SIGNAL(triggered(bool)), this, SLOT(showPropertiesDialog()));

    if ( _dataProviders->size() > 0 )
    {
        prepareScene();
        showChart();
    }
    onTaxRankChanged(mainWindow->getRank());
}