コード例 #1
0
void CMsgDataTimeControl::SizeChanged()
	{
	// TODO: No point to do all these calculations every time!
	if (iControlModeFlags & EMsgControlModeSizeChanging)
		{
		}
	else
		{
		TPoint editorPosition(iEditorLayout.TextRect().iTl.iX, iPosition.iY
				+ iEditorTop);

		TPoint captionPosition(iCaptionLayout.TextRect().iTl.iX, iPosition.iY
				+ iCaptionTop);

		iCaption->SetPosition(captionPosition);
		iCaption->MakeVisible(captionPosition.iY >= 0);

		TSize editorSize(iEditorLayout.TextRect().Width(),
				iEditorLayout.TextRect().Height());
		iTimeAndDateEditor->SetSize(editorSize);

		TRect editorRect(editorPosition, iTimeAndDateEditor->Size());

		if (editorRect != iTimeAndDateEditor->Rect())
			{
			iTimeAndDateEditor->SetRect(editorRect); // SetPosition cannot be used here
			}

		AknsUtils::RegisterControlPosition(this);
		AknsUtils::RegisterControlPosition(iCaption);

		AknsUtils::RegisterControlPosition(iTimeAndDateEditor);
		}

	}
コード例 #2
0
// Place the editor below the item...
void AMSamplePlatePre2013ItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const {
	Q_UNUSED(index)
	QRect itemRect = option.rect;
	QRect editorRect(itemRect.left(), itemRect.top()+itemRect.height()-26, itemRect.width(), 26);

	editor->setGeometry(editorRect);
}