25 #include <qlineedit.h>
26 #include <qtextedit.h>
27 #include <qvalidator.h>
28 #include <qpushbutton.h>
29 #include <qmessagebox.h>
30 #include <qcolordialog.h>
34 : QDialog(parent, name)
36 setCaption(tr(
"Edit Text Properties"));
38 vert =
new QVBoxLayout(
this);
43 new QLabel(tr(
"Use LaTeX style for special characters, e.g. \\tau")+
45 tr(
"Use _{..} and ^{..} for sub- and super-positions."),
48 text =
new QTextEdit(
this);
49 text->setTextFormat(Qt::PlainText);
50 text->setWordWrap(QTextEdit::NoWrap);
51 text->setMinimumSize(350,150);
54 QHBox *h1 =
new QHBox(
this);
59 QHBox *h2 =
new QHBox(
this);
63 QHBox *h3 =
new QHBox(
this);
68 QPushButton *ButtOK =
new QPushButton(tr(
"&OK"),h3);
69 connect(ButtOK, SIGNAL(clicked()), SLOT(slotOkButton()));
70 QPushButton *ButtCancel =
new QPushButton(tr(
"&Cancel"),h3);
71 connect(ButtCancel, SIGNAL(clicked()), SLOT(reject()));
73 new QLabel(tr(
"Text color: "), h1);
75 ColorButt->setPaletteBackgroundColor(QColor(0,0,0));
76 connect(
ColorButt, SIGNAL(clicked()), SLOT(slotSetColor()));
78 QWidget *place1 =
new QWidget(h1);
79 h1->setStretchFactor(place1,5);
81 val50 =
new QIntValidator(1, 50,
this);
82 new QLabel(tr(
"Text size: "), h1);
88 QWidget *place2 =
new QWidget(h2);
89 h2->setStretchFactor(place2,5);
91 val360 =
new QIntValidator(0, 359,
this);
92 new QLabel(tr(
"Rotation angle: "), h2);
93 Angle =
new QLineEdit(h2);
95 Angle->setMaximumWidth(35);
109 void GraphicTextDialog::slotSetColor()
111 QColor
c = QColorDialog::getColor(
ColorButt->paletteBackgroundColor(),
this);
112 if(c.isValid())
ColorButt->setPaletteBackgroundColor(c);
116 void GraphicTextDialog::slotOkButton()
118 if(
text->length() < 1) {
119 QMessageBox::critical(
this, tr(
"Error"), tr(
"The text must not be empty!"));