Пример #1
0
void ShortcutsWidget::loadShortcuts(const QSettings &settings)
{
    MenuItems items = menuItems();
    ::loadShortcuts(&items, settings);

    m_actions.clear();
    m_shortcuts.clear();

    QTableWidget *table = ui->tableWidget;
    while (table->rowCount() > 0)
        table->removeRow(0);

    for (const auto &item : items) {
        MenuAction action;
        action.iconName = item.iconName;
        action.iconId = item.iconId;
        action.text = item.text;
        action.settingsKey = item.settingsKey;

        addShortcutRow(action);

        action.shortcutButton->setDefaultShortcut(item.defaultShortcut);
        for (const auto &shortcut : item.shortcuts)
            action.shortcutButton->addShortcut(shortcut);
    }

    addCommands( loadAllCommands() );
    addCommands( predefinedCommands() );
}
Пример #2
0
void GraphPlotDialog::setGraphVisibility(int currentVisibility)
{
    QTableWidget *currentList = NULL;
    QTableWidget *endList = NULL;
    if (currentVisibility == 1) {
        currentList = mUi.visibleGraph;
        endList = mUi.invisibleGraph;
    }
    else if (currentVisibility == 0) {
        currentList = mUi.invisibleGraph;
        endList = mUi.visibleGraph;
    }
    else {
        return;
    }
    QTableWidgetItem *item = currentList->takeItem(currentList->currentRow(), 0);
    QTableWidgetItem *valueItem = currentList->takeItem(currentList->currentRow(), 1);

    if (!item || !valueItem) {
        return;
    }
    currentList->removeRow(currentList->currentRow());
    unsigned graphId = item->data(Qt::UserRole).toUInt();
    mData[graphId].isSelected = false;
    int rowCount = endList->rowCount();
    endList->setRowCount(rowCount + 1);
    endList->setItem(rowCount, 0, item);
    endList->setItem(rowCount, 1, valueItem);
}
Пример #3
0
void model_import_dlg::on_texture_delete()
{
	QTableWidget * table = mesh_tab->findChild<QTableWidget*>("texturesTable");

	auto current = table->currentRow();

	table->removeRow(current);
}
Пример #4
0
void ShortcutsWidget::loadShortcuts(QSettings &settings)
{
    MenuItems items = menuItems();
    ::loadShortcuts(&items, settings);

    m_actions.clear();
    m_shortcuts.clear();

    QTableWidget *table = ui->tableWidget;
    while (table->rowCount() > 0)
        table->removeRow(0);


    foreach (const MenuItem &item, items) {
        MenuAction action;
        action.iconName = item.iconName;
        action.iconId = item.iconId;
        action.text = item.text;
        action.settingsKey = item.settingsKey;

        const int row = table->rowCount();
        table->insertRow(row);

        QTableWidgetItem *tableItem = new QTableWidgetItem();
        table->setItem(row, Columns::Empty, tableItem);
        tableItem->setFlags(Qt::NoItemFlags);

        tableItem = new QTableWidgetItem();
        action.tableItem = tableItem;
        table->setItem(row, Columns::Icon, tableItem);
        tableItem->setFlags(Qt::ItemIsEnabled);

        tableItem = new QTableWidgetItem(uiText(action.text));
        table->setItem(row, Columns::Text, tableItem);
        tableItem->setFlags(Qt::ItemIsEnabled);

        action.shortcutButton = new ShortcutButton(table);
        table->setCellWidget(row, Columns::Shortcut, action.shortcutButton);
        action.shortcutButton->setDefaultShortcut(item.defaultShortcut);
        foreach (const QKeySequence &shortcut, item.shortcuts)
            action.shortcutButton->addShortcut(shortcut);

        action.iconId = item.iconId;
        m_actions.append(action);

        m_shortcuts << item.shortcuts;
        m_timerCheckAmbiguous.start();

        connect( action.shortcutButton, SIGNAL(shortcutAdded(QKeySequence)),
                 this, SLOT(onShortcutAdded(QKeySequence)) );
        connect( action.shortcutButton, SIGNAL(shortcutRemoved(QKeySequence)),
                 this, SLOT(onShortcutRemoved(QKeySequence)) );
    }
Пример #5
0
void MigraineMainWindow::buildColumnsItems(TableInfo *info, int type)
{
    QTableWidget *tableWidget;

    if (type == SOURCE_COLUMNS)
        tableWidget = srcColumnsTableWidget;
    else if(type == TARGET_COLUMNS)
        tableWidget = tgtColumnsTableWidget;

    while (tableWidget->rowCount() > 0)
        tableWidget->removeRow(0);

    for (int i = 0; i < info->fieldNames().count(); i++)
    {
        QTableWidgetItem *fieldName = new QTableWidgetItem(info->fieldName(i), QTableWidgetItem::Type);
        QTableWidgetItem *fieldType = new QTableWidgetItem(info->fieldType(i), QTableWidgetItem::Type);
        tableWidget->insertRow(i);
        tableWidget->setItem(i, 0, fieldName);
        tableWidget->setItem(i, 1, fieldType);
    }
}
Пример #6
0
Recepcjonista::readClients()
{
    mSQL->get_result("SELECT * FROM klient");

    QTableWidget* tw = ui->klienci_tableWidget;
    tw->clear();
    while (tw->rowCount() > 0)
    {
        tw->removeRow(0);
    }
    tw->setHorizontalHeaderItem(0, new QTableWidgetItem("PESEL"));
    tw->setHorizontalHeaderItem(1, new QTableWidgetItem("Imię"));
    tw->setHorizontalHeaderItem(2, new QTableWidgetItem("Nazwisko"));
    tw->setHorizontalHeaderItem(3, new QTableWidgetItem("Adres"));
    tw->setHorizontalHeaderItem(4, new QTableWidgetItem("Nr telefonu"));
    tw->setHorizontalHeaderItem(5, new QTableWidgetItem("E-mail"));

    int row_count = 0;
    while(mSQL->get_row())
    {
        tw->insertRow(tw->rowCount());

        tw->setItem(row_count, 0, new QTableWidgetItem(QString::fromStdString(mSQL->el("PESEL"))));

        tw->setItem(row_count, 1, new QTableWidgetItem(QString::fromStdString(mSQL->el("Imię"))));

        tw->setItem(row_count, 2, new QTableWidgetItem(QString::fromStdString(mSQL->el("Nazwisko"))));

        string adres = mSQL->el("Miasto") + " " + mSQL->el("Ulica") + " " + mSQL->el("Nr budynku") + " " + mSQL->el("Kod pocztowy");
        tw->setItem(row_count, 3, new QTableWidgetItem(QString::fromStdString(adres)));

        tw->setItem(row_count, 4, new QTableWidgetItem(QString::fromStdString(mSQL->el("Nr telefonu"))));

        tw->setItem(row_count++, 5, new QTableWidgetItem(QString::fromStdString(mSQL->el("Email"))));
    }

}
Пример #7
0
void SessionAnalysisWidget::update(bool repaintCharts)
{
    gatherData();

    int rows = 0;

    QTableWidget *table = ui.lapTimeTableWidget;
    if (EventData::getInstance().getEventType() == LTPackets::PRACTICE_EVENT)
        table = ui.lapTimeTableWidgetFP;

    if (EventData::getInstance().getEventType() == LTPackets::QUALI_EVENT)
    {
        switch (ui.qualiTabWidget->currentIndex())
        {
            case 0: table = ui.lapTimeTableWidgetQuali; break;
            case 1: table = ui.lapTimeTableWidgetQ1; break;
            case 2: table = ui.lapTimeTableWidgetQ2; break;
            case 3: table = ui.lapTimeTableWidgetQ3; break;
        }
    }

    int firstPlace = 0;
	for (int i = 0; i < lapDataArray.size(); ++i)
	{
        if (lapInWindow(i))
        {
            if (rows == 0)
                firstPlace = i;
            if (rows + 1 >= table->rowCount())
            {
                table->insertRow(rows+1);
                table->setRowHeight(rows+1, 22);
            }

            if (lapDataArray[i].getCarID() < 0)
                continue;

            ColorsManager &sd = ColorsManager::getInstance();
            setItem(table, rows+1, 0, QString::number(rows+1)+".", Qt::ItemIsEnabled | Qt::ItemIsSelectable, Qt::AlignRight | Qt::AlignVCenter, sd.getColor(LTPackets::CYAN));

            QString s = EventData::getInstance().getDriversData()[lapDataArray[i].getCarID()-1].getDriverName();
            QTableWidgetItem *item = setItem(table, rows+1, 1, s, Qt::ItemIsEnabled | Qt::ItemIsSelectable, Qt::AlignLeft | Qt::AlignVCenter, sd.getColor(LTPackets::WHITE));
            item->setIcon(getDriverIcon(EventData::getInstance().getDriversData()[lapDataArray[i].getCarID()-1].getNumber()));


            setItem(table, rows+1, 2, lapDataArray[i].getTime().toString(), Qt::ItemIsEnabled | Qt::ItemIsSelectable, Qt::AlignCenter, sd.getColor(LTPackets::WHITE));

            s = (rows == 0 || !lapDataArray[i].getTime().isValid()) ? "" : "+" + DriverData::calculateGap(lapDataArray[i].getTime(), lapDataArray[firstPlace].getTime());
            setItem(table, rows+1, 3, s, Qt::ItemIsEnabled | Qt::ItemIsSelectable, Qt::AlignRight | Qt::AlignVCenter, sd.getColor(LTPackets::YELLOW));

            s = QString::number(lapDataArray[i].getLapNumber());
            if (EventData::getInstance().getEventType() == LTPackets::PRACTICE_EVENT)
                s = SeasonData::getInstance().getSessionDefaults().correctFPTime(lapDataArray[i].getPracticeLapExtraData().getSessionTime()).toString("h:mm:ss");//lapDataArray[i].sessionTime.toString("h:mm:ss") + " (" + QString::number(LTPackets::currentEventFPLength()-LTPackets::timeToMins(lapDataArray[i].sessionTime))+")";

            else if (EventData::getInstance().getEventType() == LTPackets::QUALI_EVENT)
                s = SeasonData::getInstance().getSessionDefaults().correctQualiTime(lapDataArray[i].getQualiLapExtraData().getSessionTime(), lapDataArray[i].getQualiLapExtraData().getQualiPeriod()).toString("mm:ss");

            setItem(table, rows+1, 4, s, Qt::ItemIsEnabled | Qt::ItemIsSelectable, Qt::AlignRight | Qt::AlignVCenter, sd.getColor(LTPackets::WHITE));

            if (ui.qualiTabWidget->currentIndex() == 0)
                setItem(table, rows+1, 5, QString::number(lapDataArray[i].getQualiLapExtraData().getQualiPeriod()), Qt::ItemIsEnabled | Qt::ItemIsSelectable, Qt::AlignRight | Qt::AlignVCenter, sd.getColor(LTPackets::WHITE));

            ++rows;
        }
	}
    if (rows < table->rowCount()-1)
    {
        for (int i = table->rowCount()-1; i > rows; --i)
            table->removeRow(i);
    }

    if (repaintCharts)
    {
        if (EventData::getInstance().getEventType() == LTPackets::RACE_EVENT)
        {
            ui.sessionLapTimesChart->setData(lapDataArray);
            ui.sessionLapTimesChart->update();

            ui.sessionPositionsChart->setData(lapDataArray);
            ui.sessionPositionsChart->update();

            ui.sessionGapsChart->setData(lapDataArray);
            ui.sessionGapsChart->update();
        }
        if (EventData::getInstance().getEventType() == LTPackets::PRACTICE_EVENT)
        {
            ui.sessionLapTimesChartFP->setData(lapDataArray);
            ui.sessionLapTimesChartFP->update();
        }
        if (EventData::getInstance().getEventType() == LTPackets::QUALI_EVENT)
        {
            switch (ui.qualiTabWidget->currentIndex())
            {
                case 0:
                    ui.sessionLapTimesChartQuali->setData(lapDataArray);
                    ui.sessionLapTimesChartQuali->update();
                break;

                case 1:
                    ui.sessionLapTimesChartQ1->setData(lapDataArray);
                    ui.sessionLapTimesChartQ1->update();
                    break;

                case 2:
                    ui.sessionLapTimesChartQ2->setData(lapDataArray);
                    ui.sessionLapTimesChartQ2->update();
                    break;

                case 3:
                    ui.sessionLapTimesChartQ3->setData(lapDataArray);
                    ui.sessionLapTimesChartQ3->update();
                    break;
            }
        }
    }
}
Пример #8
0
void TSController::processDataParams(){
    //    qDebug()<<"TSController::processDataParams";
    qDebug()<<"this is result button !";
    QTableWidget *qtw = ui->resultsTable;
    qtw->setColumnCount(2);
    qtw->setRowCount(12);
    qtw->verticalHeader()->setVisible(false);
    qtw->setHorizontalHeaderLabels(QString(tr("Параметр;Значение")).split(";"));
    qtw->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
    /* tsanalitics* ga = new tsanalitics();
    tstempanalitic* gao = new tstempanalitic();
    tstempanalitic* gai = new tstempanalitic();*/
    float AvgExpirationSpeed=0, MaxExpirationSpeed=0, AvgExpirationTime=0, AvgInspirationTime=0,
            AvgRoundTime=0, AvgTempIn=0, AvgTempOut=0, AvgTempInMinusAvgTempOut=0,  BreathingVolume=0, MVL=0, MinuteVentilation=0;
    float InspirationFrequency=0;
    int *vo = curveBuffer->volume();
    int *ti = curveBuffer->tempIn();
    int *to = curveBuffer->tempOut();
    QVector<int> volume,temp_in,temp_out;
    for(int i=0;i<curveBuffer->getLenght();i++){
        volume.push_back(vo[i]);
        temp_in.push_back(ti[i]);
        temp_out.push_back(to[i]);
    }
    VolumeSolver* vs = new VolumeSolver(volume,temp_in,temp_out);

    AvgExpirationSpeed = vs->getAverageExpirationSpeed();
    qtw->setItem(1,0,getQTableWidgetItem(tr("Средняя скорость выдоха(л/с)")));
    qtw->setItem(1,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr((int)AvgExpirationSpeed)))));

    MaxExpirationSpeed = vs->getMaxExpirationSpeed();
    qtw->setItem(2,0,getQTableWidgetItem(tr("Максимальная скорость выдоха(л/с)")));
    qtw->setItem(2,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr((int)MaxExpirationSpeed)))));

    AvgExpirationTime = vs->getAverageExpirationTime();
    qtw->setItem(3,0,getQTableWidgetItem(tr("Среднее время выдоха(с)")));
    qtw->setItem(3,1,getQTableWidgetItem((QString::number((float)AvgExpirationTime))));

    AvgInspirationTime = vs->getAverageInspirationTime();
    qtw->setItem(4,0,getQTableWidgetItem(tr("Среднее время вдоха(с)")));
    qtw->setItem(4,1,getQTableWidgetItem((QString::number((float)AvgInspirationTime))));

    AvgRoundTime = vs->getAverageCycleTime();
    qtw->setItem(5,0,getQTableWidgetItem(tr("Средняя время цикла(с)")));
    qtw->setItem(5,1,getQTableWidgetItem((QString::number((float)AvgRoundTime))));

    InspirationFrequency = vs->getInspirationFrequancyInOneMinute();
    qtw->setItem(6,0,getQTableWidgetItem(tr("Частота дыхания(ед/мин)")));
    qtw->setItem(6,1,getQTableWidgetItem((QString::number(InspirationFrequency))));

    MinuteVentilation = vs->getMinuteVentilation();
    qtw->setItem(8,0,getQTableWidgetItem(tr("Минутная вентиляция легких(л)")));
    qtw->setItem(8,1,getQTableWidgetItem(QString::number(curveBuffer->volToLtr(MinuteVentilation))));

    BreathingVolume = vs->getAverageInspiratonVentilation();
    qtw->setItem(7,0,getQTableWidgetItem(tr("Дыхательный объем(л)")));
    qtw->setItem(7,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr((int)BreathingVolume)))));

    MVL = vs->getTotalVentilation();
    qtw->setItem(9,0,getQTableWidgetItem(tr("Суммарная вентиляция легких(л)")));
    qtw->setItem(9,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr((int)MVL)))));

    //ga->clear();

    AvgTempIn = vs->getAverageInspirationTempetature();
    qtw->setItem(10,0,getQTableWidgetItem(tr("Средняя температура вдоха( 'C)")));
    qtw->setItem(10,1,getQTableWidgetItem(QString::number(curveBuffer->tempInToDeg(AvgTempIn))));
    //gai->clear();

    AvgTempOut = vs->getAverageExpirationTempetature();
    qtw->setItem(11,0,getQTableWidgetItem(tr("Средняя температура выдоха( 'C)")));
    qtw->setItem(11,1,getQTableWidgetItem(QString::number(curveBuffer->tempOutToDeg(AvgTempOut))));

    AvgTempInMinusAvgTempOut = AvgTempOut-AvgTempIn;
    qtw->setItem(12,0,getQTableWidgetItem(tr("Средняя Твдоха-Средняя Твыдоха( 'C)")));
    qtw->setItem(12,1,getQTableWidgetItem(curveBuffer->tempOutToDeg(AvgTempOut)-curveBuffer->tempInToDeg(AvgTempIn)));

    qtw->removeRow(0);
    qtw->show();
    delete vs;
}
Пример #9
0
void TSController::processDataParams(){

    TSCurveBuffer *cb= new TSCurveBuffer;

    readerThread->readd();
    //TSUsb3000Reader *rdr= readerThread->getReader();
    //rdr->read();
    //rdr->initDevice(cb);
    /*rdr->read();*/
    qDebug()<<"this is result button !";
    QTableWidget *qtw = ui->resultsTable;
    qtw->setColumnCount(2);
    qtw->setRowCount(11);
    qtw->verticalHeader()->setVisible(false);
    qtw->setHorizontalHeaderLabels(QString(tr("Параметр;Значение")).split(";"));
    qtw->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
    tsanalitics* ga = new tsanalitics();
    tstempanalitic* gao = new tstempanalitic();
    tstempanalitic* gai = new tstempanalitic();
    int AvgExpirationSpeed=0, MaxExpirationSpeed=0, AvgExpirationTime=0, AvgInspirationTime=0,
            AvgRoundTime=0, AvgTempIn=0, AvgTempOut=0, AvgTempInMinusAvgTempOut=0,  BreathingVolume=0, MVL=0;
    float InspirationFrequency=0;
    int i=0;
    int *vo = curveBuffer->volume();
    for(i=0;i<curveBuffer->getLenght();i++){
        ga->append(vo[i]);
    }
    ga->approximate();

    int *ti = curveBuffer->tempIn();
    for(i=0;i<curveBuffer->getLenght();i++){
        gai->append(ti[i]);
    }
    gai->findExtremums();
    gai->deleteBadExtremums();

    int *to = curveBuffer->tempOut();
    for(i=0;i<curveBuffer->getLenght();i++){
        gao->append(to[i]);
    }
    gao->findExtremums();
    gao->deleteBadExtremums();

    AvgExpirationSpeed = ga->getAvgExpiratorySpeed();
    qtw->setItem(1,0,getQTableWidgetItem(tr("Средняя скорость выдоха(л/с)")));
    qtw->setItem(1,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr(AvgExpirationSpeed)))));

    MaxExpirationSpeed = ga->getMaxExpiratorySpeed();
    qtw->setItem(2,0,getQTableWidgetItem(tr("Максимальная скорость выдоха(л/с)")));
    qtw->setItem(2,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr(100*MaxExpirationSpeed)))));

    AvgExpirationTime = ga->getAvgExpiratoryTime();
    qtw->setItem(3,0,getQTableWidgetItem(tr("Среднее время выдоха(с)")));
    qtw->setItem(3,1,getQTableWidgetItem((QString::number((float)AvgExpirationTime/100))));

    AvgInspirationTime = ga->getAvgInspiratoryTime();
    qtw->setItem(4,0,getQTableWidgetItem(tr("Среднее время вдоха(с)")));
    qtw->setItem(4,1,getQTableWidgetItem((QString::number((float)AvgInspirationTime/100))));

    AvgRoundTime = AvgExpirationTime+AvgInspirationTime;
    qtw->setItem(5,0,getQTableWidgetItem(tr("Средняя время цикла(с)")));
    qtw->setItem(5,1,getQTableWidgetItem((QString::number((float)AvgRoundTime/100))));

    InspirationFrequency = ga->getFrequency();
    qtw->setItem(6,0,getQTableWidgetItem(tr("Частота дыхания(ед/мин)")));
    qtw->setItem(6,1,getQTableWidgetItem((QString::number(InspirationFrequency))));

    BreathingVolume = ga->getBreathingVolume();
    qtw->setItem(7,0,getQTableWidgetItem(tr("Дыхательный объем(л)")));
    qtw->setItem(7,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr(BreathingVolume)))));

    MVL = ga->getMVL();
    qtw->setItem(8,0,getQTableWidgetItem(tr("Максимальная вентиляция легких(л)")));
    qtw->setItem(8,1,getQTableWidgetItem(QString::number(fabs(curveBuffer->volToLtr(MVL)))));

    ga->clear();

    AvgTempIn = gai->getMinAvgs();
    qtw->setItem(9,0,getQTableWidgetItem(tr("Средняя температура вдоха( 'C)")));
    qtw->setItem(9,1,getQTableWidgetItem(QString::number(curveBuffer->tempInToDeg(AvgTempIn))));
    gai->clear();

    AvgTempOut = gao->getMaxAvgs();
    qtw->setItem(10,0,getQTableWidgetItem(tr("Средняя температура выдоха( 'C)")));
    qtw->setItem(10,1,getQTableWidgetItem(QString::number(curveBuffer->tempOutToDeg(AvgTempOut))));

    AvgTempInMinusAvgTempOut = AvgTempOut-AvgTempIn;
    qtw->setItem(11,0,getQTableWidgetItem(tr("Средняя Твдоха-Средняя Твыдоха( 'C)")));
    qtw->setItem(11,1,getQTableWidgetItem(curveBuffer->tempOutToDeg(AvgTempOut)-curveBuffer->tempInToDeg(AvgTempIn)));
    qtw->removeRow(0);

    qtw->show();
}