9 DiffViewFrame::DiffViewFrame(QWidget
*parent
) : QWidget(parent
)
11 QVBoxLayout
*layout
= new QVBoxLayout();
12 QSplitter
*splitter
= new QSplitter(Qt::Horizontal
);
13 DiffView
*original
= new DiffView(true);
14 DiffView
*modified
= new DiffView(false);
15 QScrollArea
*orig
= new QScrollArea();
16 QScrollArea
*modif
= new QScrollArea();
19 orig
->setWidget(original
);
20 orig
->setWidgetResizable(true);
21 orig
->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff
);
22 modif
->setWidget(modified
);
23 modif
->setWidgetResizable(true);
25 splitter
->addWidget(orig
);
26 splitter
->addWidget(modif
);
28 layout
->addWidget(splitter
);
33 QScrollBar
*orig_vertical
= orig
->verticalScrollBar();
34 QScrollBar
*modif_vertical
= modif
->verticalScrollBar();
35 QScrollBar
*orig_horizontal
= orig
->horizontalScrollBar();
36 QScrollBar
*modif_horizontal
= modif
->horizontalScrollBar();
38 connect(orig_vertical
, SIGNAL(valueChanged(int)), modif_vertical
,
40 connect(modif_vertical
, SIGNAL(valueChanged(int)), orig_vertical
,
42 connect(orig_horizontal
, SIGNAL(valueChanged(int)), modif_horizontal
,
44 connect(modif_horizontal
, SIGNAL(valueChanged(int)), orig_horizontal
,
50 void DiffView::paintEvent(QPaintEvent
*e
)
53 QPainter
painter(this);
55 height
= Diff::instance()->paintOriginal(painter
);
57 height
= Diff::instance()->paintModified(painter
);
60 setFixedHeight(height
);
61 setMinimumWidth(Settings::max_line_width
);