34 #include <QColorDialog>
35 #include <QPushButton>
56 restoreGeometry (settings->value(
"annotation/geometry").toByteArray ());
59 connect (
ui->
button_box, SIGNAL (clicked (QAbstractButton *)),
63 connect (
ui->
edit_string, SIGNAL (textChanged (
const QString&)),
94 QDialogButtonBox::ButtonRole button_role =
ui->
button_box->buttonRole (button);
99 settings->setValue (
"annotation/geometry",saveGeometry ());
101 if (button_role == QDialogButtonBox::ApplyRole ||
102 button_role == QDialogButtonBox::AcceptRole)
107 if (button_role == QDialogButtonBox::RejectRole ||
108 button_role == QDialogButtonBox::AcceptRole)
125 position(0) =
ui->
sb_x->value ();
126 position(1) =
ui->
sb_y->value ();
150 for (
int i=0; i<len/2; i++)
152 std::string name =
props(i*2).string_value ();
154 if (name ==
"textbox")
157 int nels = position.
numel();
160 ui->
sb_x->setValue (position(0));
161 ui->
sb_y->setValue (position(1));
179 else if (name ==
"string")
184 else if (name ==
"fitboxtotext")
188 else if (name ==
"units")
192 else if (name ==
"horizontalalignment")
196 else if (name ==
"verticalalignment")
200 else if (name ==
"fontname")
204 else if (name ==
"fontsize")
208 else if (name ==
"fontweight")
212 else if (name ==
"fontangle")
216 else if (name ==
"color")
219 if (
props(1*i +1).is_matrix_type ())
222 color.setNamedColor (
props(2*i +1).string_value ().c_str ());
224 if (color.isValid ())
236 ui->
button_box->button (QDialogButtonBox::Ok)->setEnabled (str.length () > 0);
245 QColor color = widg->palette ().color (QPalette::Button);
247 color = QColorDialog::getColor(color,
this);
249 if (color.isValid ())
251 widg->setPalette (QPalette (color));
253 QString css = QString (
"background-color: %1; border: 1px solid %2;")
257 widg->setStyleSheet (css);
void edit_string_changed(const QString &str)
void setupUi(QDialog *annotation_dialog)
octave_idx_type numel(void) const
Number of elements in the array.
octave_idx_type length(void) const
octave_value_list & append(const octave_value &val)
QPushButton * cb_font_bold
QDoubleSpinBox * sb_width
QComboBox * cb_horz_align
void button_clicked(QAbstractButton *button)
QComboBox * cb_line_style
QDialogButtonBox * button_box
QColor fromRgb(const Matrix &rgb)
QPushButton * cb_font_italic
Matrix toRgb(const QColor &c)
static QSettings * get_settings(void)
QComboBox * cb_vert_align
QPushButton * btn_edge_color
octave_value_list ovl(const octave_value &a0)
QFontComboBox * cb_font_name
QCheckBox * cb_fit_box_to_text
octave_value_list get_properties() const
Ui::annotation_dialog * ui
QDoubleSpinBox * sb_height
QPushButton * btn_background_color
annotation_dialog(QWidget *parent, const octave_value_list &pr)