0

I'm trying to build a program via Qt4, which was written on Qt5. My UI form have QPlainTextEdit and I receive following errors:

'class QPlainTextEdit' has no member named 'setSizeAdjustPolicy'; did you mean 'setSizePolicy'?
     pteNewAddr->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContentsOnFirstShow);
                 ^~~~~~~~~~~~~~~~~~~
                 setSizePolicy

'AdjustToContentsOnFirstShow' is not a member of 'QAbstractScrollArea'
     pteNewAddr->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContentsOnFirstShow);
                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~

I understand it is due to setSizeAdjustPolicy was not introduced in Qt4, but Qt4 is my target now, not Qt5. Still, in QtCreator designer for a QPlainTextEdit I have a field SizeAdjustPolicy and ui_*.h keep regenerating with:

<property name="sizeAdjustPolicy">
  <enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>

How can I solve this error?

m7913d
  • 10,244
  • 7
  • 28
  • 56
ans
  • 378
  • 1
  • 5
  • 18
  • Why are you (still) targetting Qt4? – m7913d Feb 18 '21 at 10:20
  • @m7913d, well I have to take it for granted as the project uses it, it was not me who decided to use QT4 – ans Feb 18 '21 at 10:26
  • 3
    When you want Qt4 compatibility you must edit your ui files with designer from Qt4. – chehrlic Feb 18 '21 at 11:02
  • It is a kind of mystery for me - "the Qt4 designer" - as the project is already set for Qt4. I guess it can be somehow resolved by deleting `ui` files for this window (keeping `cpp` and `h`) and re-creating them. – ans Feb 20 '21 at 06:24

0 Answers0