예제 #1
0
void KVocTrainTable::menuTriggerTimeout()
{
  delayTimer->stop();
  if (triggerSect == -1)
    return;

  int mt = triggerSect;
  triggerSect = -1;

  QHeader *header = horizontalHeader();
  int x = leftMargin();
  for (int i = 0; i < mt; ++i)
    x += header->sectionSize(i);
  QPoint mpos = mapToGlobal(QPoint(x, topMargin()));

  if (mt != KV_COL_MARK)
    emit rightButtonClicked(mt, mpos.x(), mpos.y());

  QMouseEvent me(QEvent::MouseButtonRelease, QPoint(0, 0), QMouseEvent::LeftButton, QMouseEvent::LeftButton);
  QApplication::sendEvent(header, &me);
}
void isiTapResults::adjustTableColumnWidth()
	{
	QRect rc;
	QHeader *header;
	QString qText;
	int nColumn, nRow, nWidth, nWtd;
	int nRows = IDC_CHAN->numRows();
	for(nColumn=0; nColumn<5; ++nColumn)
		{
		header = IDC_CHAN->horizontalHeader();
		qText = IDC_CHAN->text(0, nColumn); 
		GetTextRectangle(IDC_CHAN,qText, rc);
		nWidth = header->sectionSize(nColumn);
		for(nRow=1; nRow<nRows; ++nRow)
			{
			qText = IDC_CHAN->text(0, nColumn); 
			GetTextRectangle(IDC_CHAN,qText, rc);
			nWtd = rc.width()+4;
			if(nWidth < nWtd) nWidth = nWtd;
			}
		header->resizeSection(nColumn, nWidth);
		}
	}