18 #include <QtGui/QApplication>
19 #include <QtGui/QResizeEvent>
31 setObjectName(
"CScanContainerWidget");
33 horizontalHeader()->setStretchLastSection(
true);
35 horizontalHeader()->hide();
36 verticalHeader()->hide();
43 setSelectionMode(QAbstractItemView::NoSelection);
55 std::vector< QWidget * > ret;
58 int i, imax = rowCount();
60 for (i = 0; i < imax; ++i)
62 tmpWidget = cellWidget(i, 1);
65 ret.push_back(tmpWidget);
78 setRowCount(rowCount() + 1);
80 int i = rowCount() - 1;
87 connect(tmpUD, SIGNAL(del(
int)),
this, SLOT(
slotDel(
int)));
88 connect(tmpUD, SIGNAL(up(
int)),
this, SLOT(
slotUp(
int)));
89 connect(tmpUD, SIGNAL(down(
int)),
this, SLOT(
slotDown(
int)));
90 connect(tmpUD, SIGNAL(copy(
int)),
this, SLOT(
slotCopy(
int)));
91 setCellWidget(i, 0, tmpUD);
99 tmpWidget->
setIndex(i - 1,
false,
false);
103 setCellWidget(i, 1, widget);
116 row = rowCount() - 1;
128 connect(tmpUD, SIGNAL(del(
int)),
this, SLOT(
slotDel(
int)));
129 connect(tmpUD, SIGNAL(up(
int)),
this, SLOT(
slotUp(
int)));
130 connect(tmpUD, SIGNAL(down(
int)),
this, SLOT(
slotDown(
int)));
131 connect(tmpUD, SIGNAL(copy(
int)),
this, SLOT(
slotCopy(
int)));
133 setCellWidget(i, 0, tmpUD);
136 setCellWidget(i, 1, widget);
144 if (index <= 0)
return;
151 if (index >= rowCount() - 1)
return;
153 QWidget * pWidget = cellWidget(index, 1);
154 QWidget * pNewWidget = NULL;
156 if (pWidget->objectName() ==
"CScanWidgetScan")
159 pNewWidget =
new CScanWidgetScan(*static_cast< CScanWidgetScan * >(pWidget),
this);
161 else if (pWidget->objectName() ==
"CScanWidgetRandom")
164 pNewWidget =
new CScanWidgetRandom(*static_cast< CScanWidgetRandom * >(pWidget),
this);
166 else if (pWidget->objectName() ==
"CScanWidgetRepeat")
169 pNewWidget =
new CScanWidgetRepeat(*static_cast< CScanWidgetRepeat * >(pWidget),
this);
172 if (pNewWidget != NULL)
197 for (i = 0; i < imax; ++i)
205 tmp->
setIndex(i, (tmp_last == NULL), (tmp_next == NULL));
213 qApp->processEvents();
215 resizeRowsToContents();
216 resizeColumnsToContents();
224 QTableWidget::resizeEvent(e);
226 resizeRowsToContents();
227 resizeColumnsToContents();