コード例 #1
0
ファイル: ColMsgTable.cpp プロジェクト: javrillon/douml
ColMsgTable::ColMsgTable(QWidget * parent, ColDiagramView * v, ColMsgList & m)
    : MyTable(parent), rec(v->get_msgs() == m), view(v), msgs(m)
{
    //setSortingEnabled(true);
    setSelectionMode(NoSelection);	// single does not work

    setColumnCount(6);

    verticalHeader()->hide();
    setHorizontalHeaderLabel(ABS_RANK_COL, tr("Rank"));
    setHorizontalHeaderLabel(HI_RANK_COL, tr("Hierarchical rank"));
    setHorizontalHeaderLabel(FROM_COL, tr("From"));
    setHorizontalHeaderLabel(MSG_COL, tr("Message"));
    setHorizontalHeaderLabel(TO_COL, tr("To"));
    setHorizontalHeaderLabel(CMD_COL, tr("do"));

    refresh();

    connect(this, SIGNAL(pressed(QModelIndex)),
            this, SLOT(button_pressed(QModelIndex)));
}
コード例 #2
0
RelTable::RelTable(QWidget * parent, ClassInstanceData * inst, bool visit)
    : MyTable(parent)
{
    const QList<SlotRel> & rels = inst->get_relations();

    setRowCount(rels.count());
    setColumnCount((visit) ? 5 : 6);
    setSelectionMode(QTableWidget::SingleSelection);
    //setSortingEnabled(true);

    setHorizontalHeaderLabel(0, tr("Class Inst."));
    setHorizontalHeaderLabel(1, tr("Role"));
    setHorizontalHeaderLabel(2, tr("kind"));
    setHorizontalHeaderLabel(3, tr("Role"));
    setHorizontalHeaderLabel(4, tr("Class Inst."));
    setHorizontalHeaderLabel(5, tr("Delete"));

    QString role = inst->get_browser_node()->get_name() + QString(":") +
            inst->get_class()->get_name();
    int row = 0;
    QList<SlotRel>::ConstIterator it;

    for (it = rels.begin(); it != rels.end(); ++it)
        init_row(*it, row++, role, visit);

    setColumnStretchable(1, TRUE);
    setColumnStretchable(3, TRUE);
    adjustColumn(0);
    adjustColumn(2);
    adjustColumn(4);

    if (! visit)
        adjustColumn(5);

    connect(this, SIGNAL(pressed(int, int, int, const QPoint &)),
            this, SLOT(button_pressed(int, int, int, const QPoint &)));
}