]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QParagraphDialog.C
getting rid of even more qt3 convenience classes and unused headers...
[lyx.git] / src / frontends / qt4 / QParagraphDialog.C
1 /**
2  * \file QParagraphDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  * \author Edwin Leuven
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "QParagraphDialog.h"
15 #include "QParagraph.h"
16
17 #include <QLineEdit>
18 #include <QPushButton>
19 #include <QValidator>
20 #include <QWhatsThis>
21 #include <QCloseEvent>
22
23 #include "qt_helpers.h"
24
25 namespace lyx {
26 namespace frontend {
27
28 QParagraphDialog::QParagraphDialog(QParagraph * form)
29         : form_(form)
30 {
31         setupUi(this);
32
33         connect(okPB, SIGNAL(clicked()),
34                 form_, SLOT(slotOK()));
35         connect(applyPB, SIGNAL(clicked()),
36                 form_, SLOT(slotApply()));
37         connect(closePB, SIGNAL(clicked()),
38                 form_, SLOT(slotClose()));
39         connect(align, SIGNAL( activated(int) ), 
40                 this, SLOT( change_adaptor() ) );
41         connect(linespacing, SIGNAL( activated(int) ), 
42                 this, SLOT( change_adaptor() ) );
43         connect(linespacing, SIGNAL( activated(int) ), 
44                 this, SLOT( enableLinespacingValue(int) ) );
45         connect(linespacingValue, SIGNAL( textChanged(const QString&) ), 
46                 this, SLOT( change_adaptor() ) );
47         connect(indentCB, SIGNAL( toggled(bool) ), 
48                 this, SLOT( change_adaptor() ) );
49         connect(labelWidth, SIGNAL( textChanged(const QString&) ), 
50                 this, SLOT( change_adaptor() ) );
51
52         linespacingValue->setValidator(new QDoubleValidator(linespacingValue));
53
54         //Q3WhatsThis::add(labelWidth, qt_(
55         labelWidth->setWhatsThis( qt_(
56                 "As described in the User Guide, the length of"
57                 " this text will determine how wide the label part"
58                 " of each item is in environments like List and"
59                 " Description.\n"
60                 "\n"
61                 " Normally you won't need to set this,"
62                 " since the largest label width of all the"
63                 " items is used. But if you need to, you can"
64                 " change it here."
65         ));
66 }
67
68
69 void QParagraphDialog::closeEvent(QCloseEvent * e)
70 {
71         form_->slotWMHide();
72         e->accept();
73 }
74
75
76 void QParagraphDialog::change_adaptor()
77 {
78         form_->changed();
79 }
80
81
82 void QParagraphDialog::enableLinespacingValue(int)
83 {
84         bool const enable = linespacing->currentItem() == 4;
85         linespacingValue->setEnabled(enable);
86 }
87
88 } // namespace frontend
89 } // namespace lyx