]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QCharacterDialog.C
Fix unreported bug related to 3246 by Richard Heck:
[lyx.git] / src / frontends / qt4 / QCharacterDialog.C
1 /**
2  * \file QCharacterDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "QCharacterDialog.h"
14
15 #include "QCharacter.h"
16
17 #include <qcheckbox.h>
18 #include <qpushbutton.h>
19 #include <QCloseEvent>
20
21 namespace lyx {
22 namespace frontend {
23
24 QCharacterDialog::QCharacterDialog(QCharacter * form)
25         : form_(form)
26 {
27         setupUi(this);
28         connect(okPB, SIGNAL(clicked()),
29                 form_, SLOT(slotOK()));
30         connect(applyPB, SIGNAL(clicked()),
31                 form_, SLOT(slotApply()));
32         connect(closePB, SIGNAL(clicked()),
33                 form_, SLOT(slotClose()));
34
35     connect( miscCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
36     connect( sizeCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
37     connect( familyCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
38     connect( seriesCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
39     connect( shapeCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
40     connect( colorCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
41     connect( langCO, SIGNAL( activated(int) ), this, SLOT( change_adaptor() ) );
42     connect( toggleallCB, SIGNAL( clicked() ), this, SLOT( change_adaptor() ) );
43 }
44
45
46 void QCharacterDialog::change_adaptor()
47 {
48         form_->changed();
49
50         if (!autoapplyCB->isChecked())
51                 return;
52
53         // to be really good here, we should set the combos to the values of
54         // the current text, and make it appear as "no change" if the values
55         // stay the same between applys. Might be difficult though wrt to a
56         // moved cursor - jbl
57         form_->slotApply();
58         familyCO->setCurrentIndex(0);
59         seriesCO->setCurrentIndex(0);
60         sizeCO->setCurrentIndex(0);
61         shapeCO->setCurrentIndex(0);
62         miscCO->setCurrentIndex(0);
63         langCO->setCurrentIndex(0);
64         colorCO->setCurrentIndex(0);
65 }
66
67
68 void QCharacterDialog::closeEvent(QCloseEvent * e)
69 {
70         form_->slotWMHide();
71         e->accept();
72 }
73
74 } // namespace frontend
75 } // namespace lyx
76
77 #include "QCharacterDialog_moc.cpp"