void KeyValuesTable::AdjustColumnCount(bool isReadOnly) { int colCount = isReadOnly ? 2 : 3; int currentCount = columnCount(); for(int current = currentCount - 1; current > -1; current--) removeColumn(0); for(int current(0); current < colCount ; current++) { insertColumn(current); //horizontalHeader()-> setLabel(current, colNames[current]); QTableWidgetItem * item = horizontalHeaderItem(current); if(!item) { item = new QTableWidgetItem(); setHorizontalHeaderItem(current, item); } horizontalHeaderItem(current)->setText(colNames[current]); } setColumnStretchable(1, true); if(!isReadOnly) { setColumnStretchable(2, false); resizeColumnToContents(2); } horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive); horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive); }
ConstraintTable::ConstraintTable(QWidget * parent, ConstraintCanvas * c) : Q3Table(c->elements.count(), 4, parent) { setSorting(true); setSelectionMode(NoSelection); setRowMovingEnabled(FALSE); horizontalHeader()->setLabel(0, TR("visible")); horizontalHeader()->setLabel(1, " "); horizontalHeader()->setLabel(2, TR("element")); horizontalHeader()->setLabel(3, TR("constraint")); setColumnStretchable(0, FALSE); setColumnStretchable(1, FALSE); int row; bool v = c->indicate_visible; Q3ValueList<BrowserNode *> & hv = c->hidden_visible; BrowserNodeList & elts = c->elements; BrowserNode * bn; QString yes = TR(" yes"); QString empty; elts.sort(); for (bn = elts.first(), row = 0; bn != 0; bn = elts.next(), row += 1) { if ((v) ? hv.findIndex(bn) != -1 : hv.findIndex(bn) == -1) setText(row, 0, yes); setPixmap(row, 1, *(bn->pixmap(0))); TableItem * ti; ti = new TableItem(this, Q3TableItem::Never, bn->full_name(TRUE)); ti->setReplaceable(FALSE); setItem(row, 2, ti); QString s = toUnicode(bn->constraint()); int n = s.count('\n'); ti = new TableItem(this, Q3TableItem::Never, s); ti->setReplaceable(FALSE); setItem(row, 3, ti); if (n != 0) { // note : adjustRow(row) does nothing setRowHeight(row, rowHeight(row) * (n + 1)); } } adjustColumn(0); adjustColumn(1); setColumnStretchable(2, TRUE); setColumnStretchable(3, TRUE); connect(this, SIGNAL(pressed(int, int, int, const QPoint &)), this, SLOT(button_pressed(int, int, int, const QPoint &))); }
ConnectionTable::ConnectionTable( QWidget *parent, const char *name ) : QTable( 0, 4, parent, name ) { setSorting( TRUE ); setShowGrid( FALSE ); setFocusStyle( FollowStyle ); setSelectionMode( SingleRow ); horizontalHeader()->setLabel( 0, tr( "Sender" ) ); horizontalHeader()->setLabel( 1, tr( "Signal" ) ); horizontalHeader()->setLabel( 2, tr( "Receiver" ) ); horizontalHeader()->setLabel( 3, tr( "Slot" ) ); setColumnStretchable( 0, TRUE ); setColumnStretchable( 1, TRUE ); setColumnStretchable( 2, TRUE ); setColumnStretchable( 3, TRUE ); }
void ColMsgTable::refresh() { setNumRows(0); flat_msg_list.clear(); refresh(msgs); adjustColumn(ABS_RANK_COL); adjustColumn(HI_RANK_COL); adjustColumn(FROM_COL); adjustColumn(TO_COL); adjustColumn(CMD_COL); setColumnStretchable(MSG_COL, TRUE); }
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 &))); }
KWidgetListbox::KWidgetListbox(QWidget *parent, const char *name) : QTable(parent, name) { setNumRows(0); setNumCols(1); setColumnStretchable(0, true); setLeftMargin(0); setTopMargin(0); horizontalHeader()->hide(); verticalHeader()->hide(); setSelectionMode(QTable::NoSelection); setFocusStyle(QTable::FollowStyle); connect(this, SIGNAL(currentChanged(int, int)), this, SLOT(selectionChanged(int, int))); setHScrollBarMode(QScrollView::AlwaysOff); setVScrollBarMode(QScrollView::Auto); }
Calender::Calender(QWidget *parent, const char *name, WeekStarts wS, bool dLZ) : QTable(6, 7, parent, name) { QFont serifFont( "Times", 10); setLeftMargin(2); setDragEnabled(false); setFont(serifFont); weekStarts = wS; dayLeadingZero = dLZ; int i; for (i = 0; i < 7; i++) { setColumnStretchable(i, true); } for (i = 0; i < 6; i++) { setRowStretchable(i, true); } QObject::connect(this, SIGNAL(doubleClicked(int, int, int, const QPoint&)), this, SLOT(selectedLine(int, int, int, const QPoint&))); }
bool QTable::qt_invoke( int _id, QUObject* _o ) { switch ( _id - staticMetaObject()->slotOffset() ) { case 0: setNumRows((int)static_QUType_int.get(_o+1)); break; case 1: setNumCols((int)static_QUType_int.get(_o+1)); break; case 2: setShowGrid((bool)static_QUType_bool.get(_o+1)); break; case 3: hideRow((int)static_QUType_int.get(_o+1)); break; case 4: hideColumn((int)static_QUType_int.get(_o+1)); break; case 5: showRow((int)static_QUType_int.get(_o+1)); break; case 6: showColumn((int)static_QUType_int.get(_o+1)); break; case 7: static_QUType_bool.set(_o,isRowHidden((int)static_QUType_int.get(_o+1))); break; case 8: static_QUType_bool.set(_o,isColumnHidden((int)static_QUType_int.get(_o+1))); break; case 9: setColumnWidth((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 10: setRowHeight((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 11: adjustColumn((int)static_QUType_int.get(_o+1)); break; case 12: adjustRow((int)static_QUType_int.get(_o+1)); break; case 13: setColumnStretchable((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break; case 14: setRowStretchable((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break; case 15: static_QUType_bool.set(_o,isColumnStretchable((int)static_QUType_int.get(_o+1))); break; case 16: static_QUType_bool.set(_o,isRowStretchable((int)static_QUType_int.get(_o+1))); break; case 17: setSorting((bool)static_QUType_bool.get(_o+1)); break; case 18: swapRows((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 19: swapRows((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(bool)static_QUType_bool.get(_o+3)); break; case 20: swapColumns((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 21: swapColumns((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(bool)static_QUType_bool.get(_o+3)); break; case 22: swapCells((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3),(int)static_QUType_int.get(_o+4)); break; case 23: setLeftMargin((int)static_QUType_int.get(_o+1)); break; case 24: setTopMargin((int)static_QUType_int.get(_o+1)); break; case 25: setCurrentCell((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 26: clearSelection(); break; case 27: clearSelection((bool)static_QUType_bool.get(_o+1)); break; case 28: setColumnMovingEnabled((bool)static_QUType_bool.get(_o+1)); break; case 29: setRowMovingEnabled((bool)static_QUType_bool.get(_o+1)); break; case 30: setReadOnly((bool)static_QUType_bool.get(_o+1)); break; case 31: setRowReadOnly((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break; case 32: setColumnReadOnly((int)static_QUType_int.get(_o+1),(bool)static_QUType_bool.get(_o+2)); break; case 33: setDragEnabled((bool)static_QUType_bool.get(_o+1)); break; case 34: static_QUType_bool.set(_o,dragEnabled()); break; case 35: insertRows((int)static_QUType_int.get(_o+1)); break; case 36: insertRows((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 37: insertColumns((int)static_QUType_int.get(_o+1)); break; case 38: insertColumns((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 39: removeRow((int)static_QUType_int.get(_o+1)); break; case 40: removeRows((const QMemArray<int>&)*((const QMemArray<int>*)static_QUType_ptr.get(_o+1))); break; case 41: removeColumn((int)static_QUType_int.get(_o+1)); break; case 42: removeColumns((const QMemArray<int>&)*((const QMemArray<int>*)static_QUType_ptr.get(_o+1))); break; case 43: editCell((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break; case 44: editCell((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(bool)static_QUType_bool.get(_o+3)); break; case 45: setRowLabels((const QStringList&)*((const QStringList*)static_QUType_ptr.get(_o+1))); break; case 46: setColumnLabels((const QStringList&)*((const QStringList*)static_QUType_ptr.get(_o+1))); break; case 47: columnWidthChanged((int)static_QUType_int.get(_o+1)); break; case 48: rowHeightChanged((int)static_QUType_int.get(_o+1)); break; case 49: columnIndexChanged((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3)); break; case 50: rowIndexChanged((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3)); break; case 51: columnClicked((int)static_QUType_int.get(_o+1)); break; case 52: doAutoScroll(); break; case 53: doValueChanged(); break; case 54: updateGeometriesSlot(); break; default: return QScrollView::qt_invoke( _id, _o ); } return TRUE; }
KeyValuesTable::KeyValuesTable(HaveKeyValueData * hv, QWidget * parent, bool isReadOnly) : StringTable(((hv == 0) ? 0 : hv->get_n_keys()) + ((isReadOnly) ? 0 : 1), (isReadOnly) ? 2 : 3, parent, isReadOnly) { horizontalHeader()->setLabel(0, TR("Key")); horizontalHeader()->setLabel(1, TR("Value")); if (!isReadOnly) horizontalHeader()->setLabel(2, TR("do")); int index; int sup = 0; if(hv) sup = hv->get_n_keys(); if (isReadOnly) { for (index = 0; index < sup; index += 1) { TableItem * ti; ti = new TableItem(this, Q3TableItem::Never, toUnicode(hv->get_key(index))); ti->setReplaceable(FALSE); setItem(index, 0, ti); QString s = toUnicode(hv->get_value(index)); int n = s.count('\n'); ti = new TableItem(this, Q3TableItem::Never, s); ti->setReplaceable(FALSE); setItem(index, 1, ti); if (n != 0) { // note : adjustRow(index) does nothing setRowHeight(index, rowHeight(index) * (n + 1)); } } } else { props.setAutoDelete(TRUE); QStringList items; for (index = 0; index < sup; index += 1) { QString k = toUnicode(hv->get_key(index)); QString v = toUnicode(hv->get_value(index)); QStringList * psl = props[k]; setText(index, 0, k); if (psl != 0) setItem(index, 1, new ComboItem(this, v, *psl, FALSE)); if ((k.contains(':') == 2) && ProfiledStereotypes::enumerated(k, items)) { psl = new QStringList(items); props.insert(k, psl); setItem(index, 1, new ComboItem(this, v, *psl, FALSE)); } else setItem(index, 1, new MLinesItem(this, v)); setText(index, 2, QString()); setRowStretchable(index, TRUE); } setText(index, 0, QString()); setItem(index, 1, new MLinesItem(this, QString())); setText(index, 2, QString()); setRowStretchable(index, TRUE); } horizontalHeader()->setResizeEnabled(TRUE, 0); //setColumnStretchable (0, TRUE); setColumnStretchable(1, TRUE); if (! isReadOnly) { adjustColumn(2); setColumnStretchable(2, FALSE); } }
void KeyValuesTable::updateThisFromNode(HaveKeyValueData *hv, bool isReadOnly) { if (!isReadOnly) { if(numCols() == 2) insertColumns(2); horizontalHeader()->setLabel(2, TR("do")); } else { if(numCols() == 3) removeColumn(2); } int index; int sup = 0; if(hv) sup = hv->get_n_keys(); int rowCount = numRows(); for (index = rowCount - 1; index > sup; index -= 1) removeRow(index); if (isReadOnly) { for (index = 0; index < sup; index += 1) { TableItem * tiKey = nullptr; TableItem * tiValue = nullptr; QString s = toUnicode(hv->get_value(index)); int n = s.count('\n'); if(index == numRows() || numRows() == 0) { tiKey = new TableItem(this, Q3TableItem::Never, toUnicode(hv->get_key(index))); tiValue = new TableItem(this, Q3TableItem::Never, s); setItem(index, 0, tiKey); setItem(index, 1, tiValue); } else { tiKey = dynamic_cast<TableItem*>(item(index, 0)); tiKey->setText(hv->get_key(index)); tiValue = dynamic_cast<TableItem*>(item(index, 1)); tiValue->setText(s); } tiKey->setReplaceable(FALSE); tiValue->setReplaceable(FALSE); if (n != 0) { // note : adjustRow(index) does nothing setRowHeight(index, rowHeight(index) * (n + 1)); } } } else { props.setAutoDelete(TRUE); QStringList items; for (index = 0; index < sup; index += 1) { QString k = toUnicode(hv->get_key(index)); QString v = toUnicode(hv->get_value(index)); QStringList * psl = props[k]; setText(index, 0, k); if (psl != 0) setItem(index, 1, new ComboItem(this, v, *psl, FALSE)); if ((k.contains(':') == 2) && ProfiledStereotypes::enumerated(k, items)) { psl = new QStringList(items); props.insert(k, psl); setItem(index, 1, new ComboItem(this, v, *psl, FALSE)); } else setItem(index, 1, new MLinesItem(this, v)); setText(index, 2, QString()); setRowStretchable(index, TRUE); } if(index == numRows()) insertRows(numRows()); setText(index, 0, QString()); setItem(index, 1, new MLinesItem(this, QString())); setText(index, 2, QString()); setRowStretchable(index, TRUE); } horizontalHeader()->setResizeEnabled(TRUE, 0); //setColumnStretchable (0, TRUE); setColumnStretchable(1, TRUE); if (! isReadOnly) { adjustColumn(2); setColumnStretchable(2, FALSE); } }