Project

General

Profile

0001-Play-nice-with-older-Qt.patch

Squider, 04/21/2009 01:45 AM

View differences:

src/uisupport/inputline.cpp
28 28
#include "inputline.h"
29 29
#include "tabcompleter.h"
30 30

  
31
const int leftMargin = 3;
31
const int documentMargin = 3;
32 32

  
33 33
InputLine::InputLine(QWidget *parent)
34 34
  :
......
41 41
    tabCompleter(new TabCompleter(this))
42 42
{
43 43
  // Make the QTextEdit look like a QLineEdit
44
//#if QT_VERSION >= 0x040500
45
  document()->setDocumentMargin(leftMargin); // new in Qt 4.5 and we really don't want it here (except for Squider)
46
//#endif
44
#if QT_VERSION >= 0x040500
45
  document()->setDocumentMargin(documentMargin); // new in Qt 4.5 and we really don't want it here (except for Squider)
46
#endif
47 47
  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
48 48
  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
49 49
  setAcceptRichText(false);
......
221 221
  if(lineCount > 1) {
222 222
    setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
223 223
    QFontMetrics fm(font());
224
    setMinimumSize(QSize(0, lineCount * fm.lineSpacing() + 2 * frameWidth() + 2 * leftMargin));
224
    int h = lineCount * fm.lineSpacing() + 2 * frameWidth();
225
#   if QT_VERSION >= 0x040500
226
      h += 2 * documentMargin;
227
#   endif
228
    setMinimumSize(QSize(0, h));
225 229
  } else {
226 230
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
227 231
    setMinimumSize(QSize(0, 0));
228
-