Hi,
IMHO, that's the best,
there is a #define QT_VERSION 0x030302 in $(QTDIR)/include/qglobal.h
that can be used like this #if (QT_VERSION >= 0x030302) for example.
I've attached my previous diff with this kind of code.
I've parsed the changelog from the trolltech site but wasn't able to
track when the workaround wasn't needed anymore... So I used 3.3.2 as a
minimum value for this patch
thanks for the updated patch. As I am using 3.3.1 I can lower the patch
version by 1 :)))
Rather less encouraging is that, while looking through the qt
changelogs, I found the following statement (for 3.0.5)
<quote>
The version number format of QT_VERSION changed. It is now 0xmmiibb
(m = major, i = minor, b = bugfix). Qt 3.0.5's QT_VERSION is 0x030005.
</quote>
From an old qt-2.3.0 I figured that the old format was mib, i.e. 2.3.0
is 230. Anyway, I attached an updated diff, which works fine for me on
3.3.1; CVS is also updated.
Hope it helps,
Carsten
Index: OSGQFieldContainerView_qt.cpp
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/WindowSystem/QT/OSGQFieldContainerView_qt.cpp,v
retrieving revision 1.1
diff -u -r1.1 OSGQFieldContainerView_qt.cpp
--- OSGQFieldContainerView_qt.cpp 20 Jun 2003 16:56:15 -0000 1.1
+++ OSGQFieldContainerView_qt.cpp 3 Aug 2004 14:03:17 -0000
@@ -90,7 +90,7 @@
_pTable->setNumCols (3 );
_pTable->setReadOnly (true );
_pTable->setSelectionMode(QTable::NoSelection);
-
+
setFieldContainer(pFC);
}
@@ -142,8 +142,8 @@
if((uiFieldId < 1) || (uiFieldId > _pFC->getType().getNumFieldDescs()))
return;
- QFieldViewBase *pFView =
- dynamic_cast<QFieldViewBase *>(_pTable->cellWidget(uiFieldId-1,
+ QFieldViewBase *pFView =
+ dynamic_cast<QFieldViewBase *>(_pTable->cellWidget(uiFieldId-1,
ValueColumn ));
if(pFView)
@@ -171,7 +171,7 @@
{
if((uiFieldId < 1) || (uiFieldId > _pFC->getType().getNumFieldDescs()))
return;
-
+
QFieldViewBase *pFView =
dynamic_cast<QFieldViewBase *>(_pTable->cellWidget(uiFieldId - 1,
ValueColumn ));
@@ -208,7 +208,7 @@
QFieldContainerView::clearTable(void)
{
UInt32 rows = _pTable->numRows();
-
+
for(UInt32 i = rows; i > 0; --i)
{
_pTable->removeRow(i-1);
@@ -221,7 +221,7 @@
UInt32 uiNumFields = pFC->getType().getNumFieldDescs();
_pTable->setNumRows(uiNumFields);
-
+
for(UInt32 i = 0; i < uiNumFields; ++i)
{
@@ -230,47 +230,53 @@
QSFieldView *pSFView = new QSFieldView(pFC, i+1, uiAspect, this);
_pTable->setCellWidget(i, ValueColumn, pSFView );
- _pTable->setItem (i, ValueColumn,
+
+#if (QT_VERSION < 0x030301) || (QT_VERSION < 304)
+ _pTable->setItem (i, ValueColumn,
new QWidgetTableItem(_pTable));
-
- connect(pSFView,
- SIGNAL(clicked (FieldContainerPtr, UInt32,
+#endif
+
+ connect(pSFView,
+ SIGNAL(clicked (FieldContainerPtr, UInt32,
UInt32, ButtonState)),
- this,
- SLOT (onClicked (FieldContainerPtr, UInt32,
+ this,
+ SLOT (onClicked (FieldContainerPtr, UInt32,
UInt32, ButtonState)));
- connect(pSFView,
+ connect(pSFView,
SIGNAL(doubleClicked (FieldContainerPtr, UInt32,
UInt32, ButtonState)),
this,
- SLOT (onDoubleClicked(FieldContainerPtr, UInt32,
+ SLOT (onDoubleClicked(FieldContainerPtr, UInt32,
UInt32, ButtonState)));
_pTable->setText(i, NameColumn,
pFC->getType().getFieldDescription(i+1)->getCName());
- }
+ }
else
{
QMFieldView *pMFView = new QMFieldView(pFC, i+1, uiAspect, this);
-
+
_pTable->setCellWidget(i, ValueColumn, pMFView );
+
+#if (QT_VERSION < 0x030302) || (QT_VERSION < 304)
_pTable->setItem (i, ValueColumn,
new QWidgetTableItem(_pTable));
+#endif
- connect(pMFView,
- SIGNAL(clicked (FieldContainerPtr, UInt32,
+ connect(pMFView,
+ SIGNAL(clicked (FieldContainerPtr, UInt32,
UInt32, ButtonState)),
- this,
+ this,
SLOT (onClicked (FieldContainerPtr, UInt32,
UInt32, ButtonState)));
- connect(pMFView,
+ connect(pMFView,
SIGNAL(doubleClicked (FieldContainerPtr, UInt32,
UInt32, ButtonState)),
this,
SLOT (onDoubleClicked(FieldContainerPtr, UInt32,
UInt32, ButtonState)));
-
+
QString s(pFC->getType().getFieldDescription(i+1)->getCName());
-
+
if(pMFView->getFieldPtr()->getSize() >= 2)
{
s += "\n";
@@ -281,17 +287,17 @@
}
_pTable->setText(i, NameColumn, s);
}
-
+
_pTable->setText(i, TypeColumn,
pFC->getField(i+1)->getType().getCName());
}
-
+
for(UInt32 i=0; i<uiNumFields; ++i)
_pTable->adjustRow(i);
_pTable->adjustColumn(NameColumn );
_pTable->adjustColumn(ValueColumn);
-
+
if(_bShowTypeColumn)
{
_pTable->showColumn (TypeColumn);