예제 #1
0
NielsenVis::NielsenVis(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::NielsenVis),
    hasDDIData(false)
{
    ui->setupUi(this);

    // Set the initial value of the status area
    ui->statusBar->showMessage("Please add the necessary CSV data files.");

    // Bind unique identifiers to the radio buttons
    ui->sortStyles->setId(ui->Name, ALPHA_SORT);
    ui->sortStyles->setId(ui->Int, INTER_SORT);
    ui->sortStyles->setId(ui->Plan, PLANN_SORT);
    ui->sortStyles->setId(ui->Final, FINAL_SORT);

    /////////////// END RADIO BUTTON STUFF ///////////////

    // Connect all radio buttons to DisplayManager sort orders
    connect(ui->sortStyles, SIGNAL(buttonClicked(int)), &renderer, SLOT(setSortOrder(int)));

    // Connect buttons to local file dialog functions
    connect(ui->Planning, SIGNAL(clicked()), this, SLOT(findPlanningData()));
    connect(ui->Interim, SIGNAL(clicked()), this, SLOT(findCurrentData()));
    connect(ui->FinalCsv, SIGNAL(clicked()), this, SLOT(findFinalData()));

    // Connect the gotDataFile signal to the display manager
    connect(this, SIGNAL(gotDataFile(string,eDataType)), &renderer, SLOT(updateFile(string,eDataType)));

    // Make the combo box populate when the DDIMatrix changes
    connect(&renderer, SIGNAL(ddiDataAdded(list<string>,list<string>)),
            this, SLOT(updateDDI(list<string>,list<string>)));
    connect(ui->PrimKey, SIGNAL(activated(int)), this, SLOT(populateCBox(int)));

    // Set off the event chain when the Add Graph button is clicked
    connect(ui->Add, SIGNAL(clicked()), this, SLOT(prepareChartAdd()));
    connect(this, SIGNAL(chartAddRequest(string,bool)), &renderer, SLOT(chartAdd(string, bool)));
    connect(&renderer, SIGNAL(requestRedraw()), ui->Render, SLOT(chartAdded()));

    // Make the display manager resize its contents when the window resizes
    connect(ui->Render, SIGNAL(resized(int,int)), &renderer, SLOT(renderAreaResized(int,int)));

    // Make the display manager report what files it has
    connect(&renderer, SIGNAL(updateStatusLine(QString)), ui->statusBar, SLOT(showMessage(QString)));

    // Allow display manager to handle mouse actions within the render area
    connect(ui->Render, SIGNAL(mouseMoved(int,int)), &renderer, SLOT(handleMouseMove(int,int)));
    connect(ui->Render, SIGNAL(mouseClicked()), &renderer, SLOT(handleClick()));

    ////////////// END EVENT BINDING //////////////////

    // Set the display manager on the render widget
    ui->Render->setDisplayManager(&renderer);
}
예제 #2
0
/**
 * Dodaje nowy wykres do kontrolki.
 *
 * Sprawdza, ile jest aktualnie wyświetlonych wykresów. Jeśli więcej niż 0,
 * chowa kartę początkową.
 *
 * @param plot wskaźnik do wykresu
 * @param tabLabel tytuł zakładki na pasku
 */
void ChartsWidget::addPlot(QwtPlot* plot, QString tabLabel)
{
    int index = ui->tabCharts->addTab(plot, tabLabel);
    plot->replot();
    ui->tabCharts->setCurrentIndex(index);
    emit chartAdded(index);

    chartsCount++;
    updateUi();
    if (chartsCount > 0)
        ui->tabCharts->removeTab(ui->tabCharts->indexOf(ui->tabInitial));
}