Пример #1
0
void MainWindow::clearObjectTable()
{
    QTableWidget *table = ui->objectsTableWidget;
    table->clear();
    table->setRowCount(0);
    table->setColumnCount(0);
}
Пример #2
0
void Table::clear(bool suppressSignals)
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    bool oldSignalsState = tablewidget->blockSignals(suppressSignals);
    tablewidget->clear(); // or clearContents() ?
    tablewidget->blockSignals(oldSignalsState);
}
Пример #3
0
void RcManagerDlg::updateFileInfoTable()
{
    QTableWidget* tb = ui->tb_file_list;
    QStringList header;
    const QVector<FILEINFO>& fileInfos = m_parse.getFileInfoList();
    header << "Index" << "Name" << "Offset" << "Length" << "Type";
    tb->clear();
    tb->setRowCount(fileInfos.count());
    tb->setColumnCount(5);
    tb->setHorizontalHeaderLabels(header);
    ui->tb_file_list->setHorizontalHeaderLabels(header);

    int row = 0;
    foreach(const FILEINFO& info, fileInfos)
    {
        QTableWidgetItem* indexItem = new QTableWidgetItem(QString("%1").arg(info.index));
        if(!indexItem)
        {
            continue;
        }

        indexItem->setData(WRCINDEXROLE, info.index);
        tb->setItem(row, INDEX, indexItem);
        tb->setItem(row, NAME, new QTableWidgetItem(QString(info.name)));
        tb->setItem(row, OFFSET, new QTableWidgetItem(QString("%1").arg(info.offset)));
        tb->setItem(row, LENGTH, new QTableWidgetItem(QString("%1").arg(info.length)));
        tb->setItem(row, TYPE, new QTableWidgetItem(QString("%1").arg(info.type)));
        row++;
    }
Пример #4
0
void TableView::reset()
{
	INFO("Reset")
    QTableWidget* table =  getTableWidget();
    if(0!=table)
    {
        table->clear();
      //  QStringList headers = _header.split(";", QString::SkipEmptyParts);
        table->setColumnCount(_header.count());
        table->setHorizontalHeaderLabels(_header);
    }
}
Пример #5
0
void MainWindow::fillDayTable(QTableWidget& tableDay, int daysInMonth)
{
    tableDay.clear();
    tableDay.setRowCount(0);

    int j = 0;
    QTableWidgetItem *newItem;
    tableDay.setColumnCount(1);
    for(int i = 1; i < daysInMonth+1; i++)
    {
        tableDay.insertRow(j);
        newItem = new QTableWidgetItem();
        newItem->setText(QString::number(i));
        tableDay.setItem(j, 0, newItem);
        if(i == selDate_.day())
            tableDay.item(j, 0)->setBackground(Qt::red);
        else
            tableDay.item(j, 0)->setBackground(Qt::yellow);
        j++;
    }
    standartStuffForAllTables(*ui->twDay);
}
Пример #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"))));
    }

}