ZLQtApplicationWindow::LineEditParameter::LineEditParameter(QToolBar *toolbar, ZLQtApplicationWindow &window, const ZLToolbar::ParameterItem &textFieldItem) : QLineEdit(toolbar), myWindow(window), myActionId(textFieldItem.actionId()) {
	setAlignment(Qt::AlignHCenter);
	setFocusPolicy(ClickFocus);
	setMaxLength(textFieldItem.maxWidth());
	setMaximumWidth(textFieldItem.maxWidth() * 12 + 12);
	QToolTip::add(this, QString::fromUtf8(textFieldItem.tooltip().c_str()));
	myWindow.addVisualParameter(textFieldItem.parameterId(), this);
}
Пример #2
0
ZLGtkApplicationWindow::GtkEntryParameter::GtkEntryParameter(ZLGtkApplicationWindow &window, const ZLToolbar::ParameterItem &item) : myWindow(window), myItem(item) {
	if (item.type() == ZLToolbar::Item::COMBO_BOX) {
		myWidget = gtk_combo_box_entry_new_text();
		myEntry = GTK_ENTRY(GTK_BIN(myWidget)->child);
		ZLGtkSignalUtil::connectSignal(GTK_OBJECT(myEntry), "changed", GTK_SIGNAL_FUNC(::onValueChanged), this);
	} else {
		myWidget = gtk_entry_new();
		myEntry = GTK_ENTRY(myWidget);
	}
	gtk_entry_set_alignment(myEntry, 0.5);
	gtk_entry_set_width_chars(myEntry, item.maxWidth());
	gtk_entry_set_max_length(myEntry, item.maxWidth());
	if (item.symbolSet() == ZLToolbar::ParameterItem::SET_DIGITS) {
		hildon_gtk_entry_set_input_mode(myEntry, HILDON_GTK_INPUT_MODE_NUMERIC);
	} else {
		hildon_gtk_entry_set_input_mode(myEntry, HILDON_GTK_INPUT_MODE_FULL);
	}
	ZLGtkSignalUtil::connectSignal(GTK_OBJECT(myEntry), "key_press_event", GTK_SIGNAL_FUNC(::onKeyPressed), this);
}