예제 #1
0
void PageMemoryRights::RunAddrSize(duint addrin, duint sizein, QString pagetypein)
{
    addr = addrin;
    size = sizein;
    pagetype = pagetypein;

    QTableWidget* tableWidget = ui->pagetableWidget;
    tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    duint nr_pages = size / PAGE_SIZE;
    tableWidget->setColumnCount(2);
    tableWidget->setRowCount(nr_pages);
    tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString(tr("Address"))));
    tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(QString(tr("Rights"))));

    duint actual_addr;
    char rights[RIGHTS_STRING_SIZE];
    for(duint i = 0; i < nr_pages; i++)
    {
        actual_addr = addr + (i * PAGE_SIZE);
        tableWidget->setItem(i, 0, new QTableWidgetItem(ToPtrString(actual_addr)));
        if(DbgFunctions()->GetPageRights(actual_addr, rights))
            tableWidget->setItem(i, 1, new QTableWidgetItem(QString(rights)));
    }

    QModelIndex idx = (ui->pagetableWidget->model()->index(0, 0));
    ui->pagetableWidget->selectionModel()->select(idx, QItemSelectionModel::Select);
    idx = (ui->pagetableWidget->model()->index(0, 1));
    ui->pagetableWidget->selectionModel()->select(idx, QItemSelectionModel::Select);

    ui->radioFullaccess->setChecked(true);
    ui->chkPageguard->setCheckable(true);
    exec();
}
void TrainLinePanel::__initTableHeader()
{
    int listLineCount = ui->listWidget->count();
    for(int i = 0; i < listLineCount;i++)
    {
        QTableWidget *tableWidget = new QTableWidget;
        tableWidget->setAlternatingRowColors(true);
        tableWidget->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
        tableWidget->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);

    //    connect(tableWidget,SIGNAL(doubleClicked(QModelIndex)),keyboard,SLOT(show(QModelIndex)));

        tableWidget->verticalHeader()->setHidden(true);


        tableWidget->setColumnCount(10);
        tableWidget->setColumnHidden(9,true);
        tableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
        tableWidget->horizontalHeader()->setMinimumHeight(30);
        tableWidget->horizontalHeader()->setMinimumSectionSize(140);
        QTableWidgetItem* item = new QTableWidgetItem("Station number");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(0,item);
        item = new QTableWidgetItem("Station id");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(1,item);
        item = new QTableWidgetItem("Name(EN)");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(2,item);
        item = new QTableWidgetItem("Name(TH)");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(3,item);
        item = new QTableWidgetItem("Start time");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(4,item);
        item = new QTableWidgetItem("Arrive time");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(5,item);

        item = new QTableWidgetItem("Lng");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(6,item);

        item = new QTableWidgetItem("Lat");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(7,item);

        item = new QTableWidgetItem("Sea level");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(8,item);

        item = new QTableWidgetItem("Rowid");
        item->setTextAlignment(Qt::AlignHCenter);
        tableWidget->setHorizontalHeaderItem(9,item);

        ui->stackedWidget->addWidget(tableWidget);
    }
//    connect(tableWidget,SIGNAL(itemChanged(QTableWidgetItem*)),this,SLOT(updateDatabase(QTableWidgetItem*)));
}
예제 #3
0
파일: Legend.cpp 프로젝트: mcr/dnssec-tools
Legend::Legend(QWidget *parent) :
    QDialog(parent)
{
    QLabel *label;
    QVBoxLayout *layout = new QVBoxLayout();
    setLayout(layout);

    DNSData d;
    Node *n = new Node(0);

    layout->addWidget(label = new QLabel(tr("<h2>DNSSEC-Nodes Coloring Legend</h2>")));
    label->setAlignment(Qt::AlignHCenter);

    QList<int> statuses;
    statuses << DNSData::UNKNOWN <<  DNSData::TRUSTED <<  DNSData::VALIDATED <<  DNSData::DNE
             << DNSData::FAILED <<  DNSData::IGNORE << (DNSData::DNE | DNSData::VALIDATED);

    // Add the legend widget
    QTableWidget *table = new QTableWidget(statuses.count(), 2, this);
    layout->addWidget(table);

    table->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Node")));
    table->setHorizontalHeaderItem(1, new QTableWidgetItem(tr("Description")));
    table->verticalHeader()->hide();

    QPointF rect = n->boundingRect().bottomRight() - n->boundingRect().topLeft();
    QSize size(rect.x() + 2, rect.y() + 2);
    QPointF br = n->boundingRect().bottomRight();

    int row = 0;
    foreach(int status, statuses) {
        QTableWidgetItem *item = new QTableWidgetItem(d.DNSSECStatusForEnum(status));
        item->setFlags(Qt::ItemIsEnabled);
        item->setBackgroundColor(n->getColorForStatus(status).lighter());
        table->setItem(row, 1, item);

        Node *node = new Node(0);
        QPixmap pm = QPixmap(size);
        QPainter painter(&pm);

        node->addSubData(DNSData("", status));

        painter.setBackground(Qt::white);
        painter.setBrush(Qt::white);
        painter.drawRect(-5, -5, size.width() + 5, size.height() + 5);
        painter.translate(br.x(), br.y());
        node->paint(&painter, 0, 0);

        QIcon icon = QIcon(pm);
        item = new QTableWidgetItem(icon, "");
        item->setFlags(Qt::ItemIsEnabled);
        table->setItem(row, 0, item);

        row++;
    }
예제 #4
0
QTableWidget *PublicTalks::getPersons(int type)
{
    std::vector<sql_item> vt;
//    QString str = "SELECT yleisokokous.pvm, henkilot.nimi, henkilot.id, henkilot.etunimi "
//                  "FROM henkilot LEFT JOIN yleisokokous ON henkilot.id = yleisokokous.puheenjohtaja_id "
//                  "WHERE ohjelmatyypit & " + QString::number(type) + " GROUP BY henkilot.id";
    QString str = "SELECT yleisokokous.pvm, henkilot.nimi, henkilot.id, henkilot.etunimi "
                  "FROM henkilot LEFT JOIN yleisokokous ON henkilot.id = yleisokokous.";
    if(type == person::chairman) {
        str.append("puheenjohtaja_id");
    } else {
        str.append("vt_lukija_id");
    }
    str.append(" WHERE ohjelmatyypit & " + QString::number(type) + " GROUP BY henkilot.id");

    vt = sql.selectSql(str);

    QTableWidget *vttable = new QTableWidget();
    vttable->horizontalHeader()->show();
    vttable->verticalHeader()->setVisible(false);
    vttable->setColumnCount(3);
    vttable->setColumnHidden(0,true);
    vttable->setColumnWidth(1,150);
    vttable->setColumnWidth(2,100);
    vttable->setMinimumWidth(270);
    vttable->setSortingEnabled(true);

    vttable->setHorizontalHeaderItem(1,new QTableWidgetItem(QObject::tr("Name")));
    vttable->setHorizontalHeaderItem(2,new QTableWidgetItem(QObject::tr("Last")));

    vttable->setRowCount(vt.size()+1);
    vttable->setItem(0,0,new QTableWidgetItem(""));
    for(unsigned int i = 0; i < vt.size(); i++) {
        vttable->setItem(i+1,0,new QTableWidgetItem(vt[i].getValue("id")));
        vttable->setItem(i+1,1,new QTableWidgetItem(vt[i].getValue("nimi") + " " + vt[i].getValue("etunimi")));
        vttable->setItem(i+1,2,new QTableWidgetItem(vt[i].getValue("pvm")));
    }
    return vttable;
}
예제 #5
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"))));
    }

}
예제 #6
0
void
CLOAD_WORKSHEET::
CreateTable(QTabWidget * tabWidget, QString tabName, quint64 rowCount)
{
    quint64 columnCount = 12;

    // Table attributes
    QTableWidget * tableWidget = new QTableWidget();
    QHeaderView * header = tableWidget->horizontalHeader();
    header->setSectionResizeMode(QHeaderView::Stretch);
    header->setStretchLastSection(true);
    tableWidget->setAlternatingRowColors(true);
    tableWidget->setRowCount(rowCount);
    tableWidget->setColumnCount(columnCount);

    // set table column header
    tableWidget->setHorizontalHeaderItem(0,new QTableWidgetItem("Name"));
    tableWidget->setHorizontalHeaderItem(1,new QTableWidgetItem("Value"));
    tableWidget->setHorizontalHeaderItem(2,new QTableWidgetItem("Value Range"));
    tableWidget->setHorizontalHeaderItem(3,new QTableWidgetItem("    Type   "));
    tableWidget->setHorizontalHeaderItem(4,new QTableWidgetItem("Conversion"));
    tableWidget->setHorizontalHeaderItem(5,new QTableWidgetItem("Byte Offset"));
    tableWidget->setHorizontalHeaderItem(6,new QTableWidgetItem("Bit Offset"));
    tableWidget->setHorizontalHeaderItem(7,new QTableWidgetItem("Bit Size"));
    tableWidget->setHorizontalHeaderItem(8,new QTableWidgetItem("Field Used"));
    tableWidget->setHorizontalHeaderItem(9,new QTableWidgetItem("Low Byte First"));
    tableWidget->setHorizontalHeaderItem(10,new QTableWidgetItem("Group"));
    tableWidget->setHorizontalHeaderItem(11,new QTableWidgetItem("Encoding Factor"));

    tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(4, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(5, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(6, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(7, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(8, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(9, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(10, QHeaderView::ResizeToContents);
    tableWidget->horizontalHeader()->setSectionResizeMode(11, QHeaderView::ResizeToContents);

    // add tab
    tabWidget->addTab(tableWidget, tabName);    
}
예제 #7
0
void MainWindow::on_actionShortcuts_triggered() {

	QTableWidget* scTable = new QTableWidget();

	scTable->setRowCount(0);
	scTable->setColumnCount(2);

	scTable->setHorizontalHeaderItem(0, new QTableWidgetItem("Shortcut"));
	scTable->setHorizontalHeaderItem(1, new QTableWidgetItem("Description"));
	scTable->verticalHeader()->hide();


	QLinkedList<QPair<QString, QString>> scList;

	//read from file in resources and add to linked list
	QFile shortcutFile(":Shortcuts/resources/shortcuts.txt");

	if (!shortcutFile.open(QIODevice::ReadOnly | QIODevice::Text))
		return;

	QString line;
	while (!shortcutFile.atEnd()) {
		QTextStream stream(&shortcutFile);
		while (!stream.atEnd()) {
			line = stream.readLine();
			QStringList shortCutAndDescription = line.split(':');
			if (shortCutAndDescription.size() == 2) {
				scList.append(QPair<QString, QString>(shortCutAndDescription[0], shortCutAndDescription[1]));
			}
		}

	}

	QLinkedList<QPair<QString, QString>>::const_iterator sc;
	for (sc = scList.constBegin(); sc != scList.constEnd(); ++sc) {
		scTable->insertRow(scTable->rowCount());


		QTableWidgetItem* scKey = new QTableWidgetItem(sc->first);
		QTableWidgetItem* scKeyInfo = new QTableWidgetItem(sc->second);
		scKey->setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
		scKeyInfo->setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable);

		scTable->setItem(scTable->rowCount() - 1, 0, scKey);
		scTable->setItem(scTable->rowCount() - 1, 1, scKeyInfo);
	}


	//scTable->horizontalHeader()->setStretchLastSection( true ); 
	scTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

	QWidget* outerWidget = new QWidget();
	outerWidget->setWindowTitle("Shortcuts");
	outerWidget->resize(scTable->size());
	QVBoxLayout* vLayout = new QVBoxLayout();

	vLayout->addWidget(scTable);

	outerWidget->setLayout(vLayout);


	outerWidget->show();
}
DocumentMetaConfigurationPage::DocumentMetaConfigurationPage(RosegardenDocument *doc,
        QWidget *parent) :
    TabbedConfigurationPage(doc, parent)
{
    m_headersPage = new HeadersConfigurationPage(this, doc);
    addTab(m_headersPage, tr("Headers"));

    Composition &comp = doc->getComposition();
    std::set
    <TrackId> usedTracks;

    int audioSegments = 0, internalSegments = 0;
    for (Composition::iterator ci = comp.begin();
            ci != comp.end(); ++ci) {
        usedTracks.insert((*ci)->getTrack());
        if ((*ci)->getType() == Segment::Audio)
            ++audioSegments;
        else
            ++internalSegments;
    }

    QFrame *frame = new QFrame(m_tabWidget);
    frame->setContentsMargins(10, 10, 10, 10);
    QGridLayout *layout = new QGridLayout(frame);
    layout->setSpacing(5);

    layout->addWidget(new QLabel(tr("Filename:"), frame), 0, 0);
    layout->addWidget(new QLabel(doc->getTitle(), frame), 0, 1);

    layout->addWidget(new QLabel(tr("Formal duration (to end marker):"), frame), 1, 0);
    timeT d = comp.getEndMarker();
    RealTime rtd = comp.getElapsedRealTime(d);
    layout->addWidget(new QLabel(durationToString(comp, 0, d, rtd), frame), 1, 1);

    layout->addWidget(new QLabel(tr("Playing duration:"), frame), 2, 0);
    d = comp.getDuration();
    rtd = comp.getElapsedRealTime(d);
    layout->addWidget(new QLabel(durationToString(comp, 0, d, rtd), frame), 2, 1);

    layout->addWidget(new QLabel(tr("Tracks:"), frame), 3, 0);
    layout->addWidget(new QLabel(tr("%1 used, %2 total")
                                 .arg(usedTracks.size())
                                 .arg(comp.getNbTracks()),
                                 frame), 3, 1);

    layout->addWidget(new QLabel(tr("Segments:"), frame), 4, 0);
    layout->addWidget(new QLabel(tr("%1 MIDI, %2 audio, %3 total")
                                 .arg(internalSegments)
                                 .arg(audioSegments)
                                 .arg(internalSegments + audioSegments),
                                 frame), 4, 1);

    layout->setRowStretch(5, 2);

    addTab(frame, tr("Statistics"));

    frame = new QFrame(m_tabWidget);
    frame->setContentsMargins(10, 10, 10, 10);
    layout = new QGridLayout(frame);
    layout->setSpacing(5);

    QTableWidget *table = new QTableWidget(1, 11, frame); // , "Segment Table"
    table->setObjectName("StyledTable");
    table->setAlternatingRowColors(true);
    //table->setSelectionMode(QTableWidget::NoSelection);
    table->setSelectionBehavior( QAbstractItemView::SelectRows );
    table->setSelectionMode( QAbstractItemView::SingleSelection );
    table->setSortingEnabled(true);

    table->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr("Type")));    // p1=column
    table->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr("Track")));
    table->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr("Label")));
    table->setHorizontalHeaderItem( 3, new QTableWidgetItem( tr("Time")));
    table->setHorizontalHeaderItem( 4, new QTableWidgetItem( tr("Duration")));
    table->setHorizontalHeaderItem( 5, new QTableWidgetItem( tr("Events")));
    table->setHorizontalHeaderItem( 6, new QTableWidgetItem( tr("Polyphony")));
    table->setHorizontalHeaderItem( 7, new QTableWidgetItem( tr("Repeat")));
    table->setHorizontalHeaderItem( 8, new QTableWidgetItem( tr("Quantize")));
    table->setHorizontalHeaderItem( 9, new QTableWidgetItem( tr("Transpose")));
    table->setHorizontalHeaderItem( 10, new QTableWidgetItem( tr("Delay")));

    //table->setNumRows(audioSegments + internalSegments);
    table->setRowCount(audioSegments + internalSegments);

    table->setColumnWidth(0, 50);
    table->setColumnWidth(1, 50);
    table->setColumnWidth(2, 150);
    table->setColumnWidth(3, 80);
    table->setColumnWidth(4, 80);
    table->setColumnWidth(5, 80);
    table->setColumnWidth(6, 80);
    table->setColumnWidth(7, 80);
    table->setColumnWidth(8, 80);
    table->setColumnWidth(9, 80);
    table->setColumnWidth(10, 80);

    int i = 0;

    for (Composition::iterator ci = comp.begin();
            ci != comp.end(); ++ci) {

        Segment *s = *ci;

        table->setItem(i, 0, new SegmentDataItem
                       (table,
                        s->getType() == Segment::Audio ?
                        tr("Audio") : tr("MIDI")));

        table->setItem(i, 1, new SegmentDataItem
                       (table,
                        QString("%1").arg(s->getTrack() + 1)));

        QPixmap colourPixmap(16, 16);
        Colour colour =
            comp.getSegmentColourMap().getColourByIndex(s->getColourIndex());
        colourPixmap.fill(GUIPalette::convertColour(colour));

        table->setItem(i, 2,
                       new QTableWidgetItem( colourPixmap, strtoqstr(s->getLabel())) );
//        new QTableWidgetItem(table, QTableWidgetItem::Never,
        //                         strtoqstr(s->getLabel()),
        //                               colourPixmap));

        table->setItem(i, 3, new SegmentDataItem
                       (table,
                        QString("%1").arg(s->getStartTime())));

        table->setItem(i, 4, new SegmentDataItem
                       (table,
                        QString("%1").arg(s->getEndMarkerTime() -
                                          s->getStartTime())));

        std::set<long> notesOn;
        std::multimap<timeT, long> noteOffs;
        int events = 0, notes = 0, poly = 0, maxPoly = 0;

        for (Segment::iterator si = s->begin();
                s->isBeforeEndMarker(si); ++si) {
            ++events;
            if ((*si)->isa(Note::EventType)) {
                ++notes;
                timeT startTime = (*si)->getAbsoluteTime();
                timeT endTime = startTime + (*si)->getDuration();
                if (endTime == startTime) continue;
                while (!noteOffs.empty() &&
                        (startTime >= noteOffs.begin()->first)) {
                    notesOn.erase(noteOffs.begin()->second);
                    noteOffs.erase(noteOffs.begin());
                }
                long pitch = 0;
                (*si)->get<Int>(BaseProperties::PITCH, pitch);
                notesOn.insert(pitch);
                noteOffs.insert(std::multimap<timeT, long>::value_type(endTime, pitch));
                poly = notesOn.size();
                if (poly > maxPoly) maxPoly = poly;
            }
        }

        table->setItem(i, 5, new SegmentDataItem
                       (table,
                        QString("%1").arg(events)));

        table->setItem(i, 6, new SegmentDataItem
                       (table,
                        QString("%1").arg(maxPoly)));

        table->setItem(i, 7, new SegmentDataItem
                       (table,
                        s->isRepeating() ? tr("Yes") : tr("No")));

        timeT discard;

        if (s->getQuantizer() && s->hasQuantization()) {
            timeT unit = s->getQuantizer()->getUnit();
            table->setItem(i, 8, new SegmentDataItem
                           (table,
                            NotationStrings::makeNoteMenuLabel
                            (unit, true, discard, false)));
        } else {
            table->setItem(i, 8, new SegmentDataItem
                           (table,
                            tr("Off")));
        }

        table->setItem(i, 9, new SegmentDataItem
                       (table,
                        QString("%1").arg(s->getTranspose())));

        if (s->getDelay() != 0) {
            if (s->getRealTimeDelay() != RealTime::zeroTime) {
                table->setItem(i, 10, new SegmentDataItem
                               (table,
                                QString("%1 + %2 ms")
                                .arg(NotationStrings::makeNoteMenuLabel
                                     (s->getDelay(), true, discard, false))
                                .arg(s->getRealTimeDelay().sec * 1000 +
                                     s->getRealTimeDelay().msec())));
            } else {
                table->setItem(i, 10, new SegmentDataItem
                               (table,
                                NotationStrings::makeNoteMenuLabel
                                (s->getDelay(), true, discard, false)));
            }
        } else if (s->getRealTimeDelay() != RealTime::zeroTime) {
            table->setItem(i, 10, new SegmentDataItem
                           (table,
                            QString("%2 ms")
                            .arg(s->getRealTimeDelay().sec * 1000 +
                                 s->getRealTimeDelay().msec())));
        } else {
            table->setItem(i, 10, new SegmentDataItem
                           (table,
                            tr("None")));
        }

        ++i;
    }

    layout->addWidget(table, 0, 0);

    addTab(frame, tr("Segment Summary"));

}
예제 #9
0
void InfoDialog::setupUi(const Tags &tags)
{
  int row = 0;
  QVBoxLayout *layout = new QVBoxLayout;

  layout->setContentsMargins(0,0,0,0);

  setWindowTitle(tr("EXIF information"));
  if (!tags.fileName().isEmpty())
    setWindowTitle(windowTitle() + " - " + QFileInfo(tags.fileName()).fileName());
  setWindowIcon(QIcon(":images/exif_info"));

  if (tags.size())
  {
    QMapIterator<int, QPair<Tag, Data> > tag(tags);
    QTableWidget *tableWidget = new QTableWidget(tags.size(),2,this);

    tableWidget->setAlternatingRowColors(true);
    tableWidget->verticalHeader()->setVisible(false);
    tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    tableWidget->setSelectionMode(QAbstractItemView::NoSelection);
    tableWidget->setHorizontalHeaderItem(0,new QTableWidgetItem(tr("Tag")));
    tableWidget->setHorizontalHeaderItem(1,new QTableWidgetItem(tr("Value")));
    tableWidget->horizontalHeader()->setStretchLastSection(true);

    while (tag.hasNext())
    {
      QTableWidgetItem *item;
      QPair<Tag,Data> exifValue = tag.next().value();

      item = new QTableWidgetItem(exifValue.first.title);
      item->setToolTip(exifValue.first.description.split(". ",QString::SkipEmptyParts).join("\n"));
      tableWidget->setItem(row,0,item);
      item = new QTableWidgetItem(exifValue.second.readableValue);
      item->setToolTip(exifValue.first.description.split(". ",QString::SkipEmptyParts).join("\n"));
      tableWidget->setItem(row++,1,item);
    }

    tableWidget->resizeColumnsToContents();
    tableWidget->resizeRowsToContents();

    layout->addWidget(tableWidget);
  }
  else
  {
    QLabel *label = new QLabel(tr("No EXIF information available"),this);
    label->setAlignment(Qt::AlignCenter);
    layout->addWidget(label);
  }

#ifdef Q_WS_MAC
  QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok,Qt::Horizontal,this);

  connect(buttonBox,SIGNAL(accepted()),this,SLOT(close()));

  layout->addWidget(buttonBox);
#endif

  setLayout(layout);

  resize(600,400);
}
예제 #10
0
void Table::setColumnHeaderText(int column, std::string text)
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    return tablewidget->setHorizontalHeaderItem(column, new QTableWidgetItem(QString::fromStdString(text)));
}