Commit 727efcae authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: changed behaviour of CoWowEntry when loosing focus.

parent 68b6a7f1
......@@ -1028,7 +1028,7 @@ pwr_tStatus WFoeQt::create_window(int x_top, int y_top, int width_adb,
label->setFixedHeight(25);
textinput = new QLineEdit();
textinput->setFixedHeight(25);
QObject::connect(textinput, SIGNAL(editingFinished()), toplevel,
QObject::connect(textinput, SIGNAL(returnPressed()), toplevel,
SLOT(valchanged_textinput()));
statusbar->addWidget(label);
......
......@@ -186,6 +186,16 @@ void WAttQtWidget::focusInEvent(QFocusEvent* event)
QWidget::focusInEvent(event);
}
void WAttQtWidget::hide_cmd_entry()
{
watt->wattnav->set_inputfocus();
if (watt->input_open) {
watt->cmd_prompt->setVisible(false);
watt->input_open = 0;
}
}
void WAttQt::print(const char* title)
{
pwr_tStatus sts;
......@@ -419,8 +429,10 @@ WAttQt::WAttQt(QWidget* wa_parent_wid, void* wa_parent_ctx,
cmd_prompt = new QLabel("value > ");
cmd_entry = new CoWowEntryQt(&value_recall);
cmd_entry->set_hide_on_esc(true);
QObject::connect(cmd_entry, SIGNAL(editingFinished()), toplevel,
QObject::connect(cmd_entry, SIGNAL(returnPressed()), toplevel,
SLOT(activate_cmd_entry()));
QObject::connect(cmd_entry, SIGNAL(editingFinished()), toplevel,
SLOT(hide_cmd_entry()));
statusbar->addWidget(msg_label);
statusbar->addWidget(cmd_prompt);
......
......@@ -105,6 +105,7 @@ public slots:
void activate_cmd_scrolled_ok();
void activate_cmd_scrolled_ca();
void action_text_inserted();
void hide_cmd_entry();
private:
WAttQt* watt;
......
......@@ -470,7 +470,7 @@ WdaQt::WdaQt(QWidget* wa_parent_wid, void* wa_parent_ctx,
msg_label = new QLabel("");
cmd_prompt = new QLabel("value > ");
cmd_entry = new CoWowEntryQt(&value_recall);
QObject::connect(cmd_entry, SIGNAL(editingFinished()), toplevel,
QObject::connect(cmd_entry, SIGNAL(returnPressed()), toplevel,
SLOT(activate_cmd_entry()));
statusbar->addWidget(msg_label);
......
......@@ -2208,7 +2208,7 @@ WttQt::WttQt(void* wt_parent_ctx, QWidget* wt_parent_wid, const char* wt_name,
QObject::connect(cmd_entry, SIGNAL(returnPressed()), toplevel,
SLOT(valchanged_cmd_entry()));
QObject::connect(
cmd_entry, SIGNAL(hidden()), toplevel, SLOT(hide_cmd_entry()));
cmd_entry, SIGNAL(editingFinished()), toplevel, SLOT(hide_cmd_entry()));
statusbar->addWidget(msg_label);
statusbar->addWidget(cmd_prompt);
......
......@@ -368,9 +368,9 @@ NodelistInputDialogQt::NodelistInputDialogQt(
text2 = new QLineEdit();
text3 = new QLineEdit();
if (input_callback) {
connect(text, SIGNAL(editingFinished()), this, SLOT(activate_ok()));
connect(text2, SIGNAL(editingFinished()), this, SLOT(activate_ok()));
connect(text3, SIGNAL(editingFinished()), this, SLOT(activate_ok()));
connect(text, SIGNAL(returnPressed()), this, SLOT(activate_ok()));
connect(text2, SIGNAL(returnPressed()), this, SLOT(activate_ok()));
connect(text3, SIGNAL(returnPressed()), this, SLOT(activate_ok()));
}
label = new QLabel();
......
......@@ -687,12 +687,6 @@ void CoWowEntryQt::keyPressEvent(QKeyEvent* event)
QLineEdit::keyPressEvent(event);
}
void CoWowEntryQt::hideEvent(QHideEvent* event)
{
emit hidden();
QWidget::hideEvent(event);
}
//
// Modal Dialog with text and tree buttons
//
......@@ -735,12 +729,12 @@ CoWowModalDialogQt::CoWowModalDialogQt(QWidget* parent, const char* title,
if (!recall) {
textinput = new QLineEdit(this);
textinput->setMaxLength(input_length);
connect(textinput, SIGNAL(editingFinished()), this,
connect(textinput, SIGNAL(returnPressed()), this,
SLOT(modaldia_activate_cb()));
} else {
CoWowEntryQt* entry = new CoWowEntryQt(recall);
textinput = entry;
connect(textinput, SIGNAL(editingFinished()), this,
connect(textinput, SIGNAL(returnPressed()), this,
SLOT(modaldia_activate_cb()));
}
......
......@@ -47,8 +47,6 @@
#include <QWidget>
class CoWowEntryQt : public QLineEdit {
Q_OBJECT
public:
CoWowRecall* m_re;
bool m_hide_on_esc;
......@@ -65,12 +63,8 @@ public:
m_hide_on_esc = hide;
}
signals:
void hidden();
protected:
void keyPressEvent(QKeyEvent* event);
void hideEvent(QHideEvent* event);
};
class CoWowModalDialogQt : public QDialog {
......
......@@ -364,7 +364,7 @@ AttrQt::AttrQt(QWidget* a_parent_wid, void* a_parent_ctx, attr_eType a_type,
msg_label = new QLabel("");
cmd_prompt = new QLabel("value > ");
cmd_entry = new CoWowEntryQt(&value_recall);
QObject::connect(cmd_entry, SIGNAL(editingFinished()), toplevel,
QObject::connect(cmd_entry, SIGNAL(returnPressed()), toplevel,
SLOT(attr_activate_cmd_entry()));
statusbar->addWidget(msg_label);
......
......@@ -900,7 +900,7 @@ void GeCurveQt::create_minmax_dialog()
QLabel* min_label = new QLabel(translate_utf8("MinValue"));
min_label->setFixedWidth(100);
minmax_textmax_widget = new QLineEdit();
QObject::connect(minmax_textmax_widget, SIGNAL(editingFinished()), toplevel,
QObject::connect(minmax_textmax_widget, SIGNAL(returnPressed()), toplevel,
SLOT(activate_minmax_ok()));
QLabel* max_label = new QLabel(translate_utf8("MaxValue"));
max_label->setFixedWidth(100);
......
......@@ -1914,7 +1914,7 @@ GeQt::GeQt(void* x_parent_ctx, QWidget* x_parent_widget,
recall_entry = new CoWowEntryQt(cmd_recall);
recall_entry->setFixedHeight(25);
cursor_position = new QLabel(fl(""));
QObject::connect(recall_entry, SIGNAL(editingFinished()), toplevel,
QObject::connect(recall_entry, SIGNAL(returnPressed()), toplevel,
SLOT(valchanged_cmd_entry()));
statusbar->addWidget(msg_label);
......
......@@ -408,7 +408,7 @@ XAttQt::XAttQt(QWidget* xa_parent_wid, void* xa_parent_ctx,
msg_label = new QLabel("");
cmd_prompt = new QLabel("value > ");
cmd_entry = new CoWowEntryQt(&value_recall);
QObject::connect(cmd_entry, SIGNAL(editingFinished()), toplevel,
QObject::connect(cmd_entry, SIGNAL(returnPressed()), toplevel,
SLOT(activate_cmd_entry()));
statusbar->addWidget(msg_label);
......
......@@ -279,7 +279,7 @@ XAttOneQt::XAttOneQt(QWidget* xa_parent_wid, void* xa_parent_ctx,
cmd_prompt = new QLabel("value > ");
cmd_label = new QLabel("");
cmd_entry = new CoWowEntryQt(&value_recall);
QObject::connect(cmd_entry, SIGNAL(editingFinished()), toplevel,
QObject::connect(cmd_entry, SIGNAL(returnPressed()), toplevel,
SLOT(activate_cmd_entry()));
// Scrolled text input
......
......@@ -535,7 +535,7 @@ XColWindQt::XColWindQt(QWidget* xa_parent_wid, void* xa_parent_ctx,
msg_label = new QLabel("");
cmd_prompt = new QLabel("value > ");
cmd_entry = new CoWowEntryQt(&value_recall);
QObject::connect(cmd_entry, SIGNAL(editingFinished()), toplevel,
QObject::connect(cmd_entry, SIGNAL(returnPressed()), toplevel,
SLOT(activate_cmd_entry()));
statusbar->addWidget(msg_label);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment