QLintEdit and keyPressEvent problem
I have 7 QLineEdits in a QHBoxLayout. Each of these QLineEdits are activated for "User" input by the user pressing a "Function Key"/"PushButton".
Each one of the lineEdit are configuree the same
Code:
boxLayout->addLayout ( inputStripLayout );
lbCategory
= new QLabel(" Category #");
lbCategory->setFont ( fb );
inputStripLayout->addWidget ( lbCategory );
leCNum->setAlignment ( Qt::AlignCenter );
leCNum->setPalette ( palE );
leCNum->setFont ( fb );
leCNum->setMaximumWidth(30);
leCNum->setEnabled(false);
inputStripLayout->addWidget ( leCNum);
leCName->setAlignment ( Qt::AlignCenter );
leCName->setPalette ( palB );
leCName->setFont ( fb );
leCName->setText ( "Category" );
inputStripLayout->addWidget ( leCName );
lbGroup
= new QLabel(" Group #");
lbGroup->setFont ( fb );
inputStripLayout->addWidget ( lbGroup );
leGNum->setAlignment ( Qt::AlignCenter );
leGNum->setPalette ( palE );
leGNum->setFont ( fb );
leGNum->setMaximumWidth(30);
leGNum->setEnabled(false);
inputStripLayout->addWidget ( leGNum);
leGName->setAlignment ( Qt::AlignCenter );
leGName->setPalette ( palB );
leGName->setFont ( fb );
leGName->setText ( "Group" );
inputStripLayout->addWidget ( leGName );
etc.
All seven activate the following when the "enter/return" key is pressed
Code:
/// slotGetUserInput
void BaseForm
::slotGetUserInput ( QString caller
) {
index = caller;
emit setMessageBox("base 724 index = " + index);
if(index == "CNum")
textItem = leCNum->text();
else if(index == "CName")
textItem = leCName->text();
else if(index == "GNum")
textItem = leGNum->text();
else if(index == "GName")
textItem = leGName->text();
else if(index == "DNum")
textItem = leDNum->text();
else if(index == "DName")
textItem = leDName->text();
else if(index == "SNum")
textItem = leSNum->text();
}
but only the first two activate
Code:
/// slotFromKeyboard-
void BaseForm::slotFromKeyboard()
{
inputText = textItem;
emit setMessageBox("base 749 inputTtxt:\n" + textItem);
}
The "pushbutton is similar for all lineEdits[I know I am missing somthing but haven't been able to find it. Please Help
Re: QLintEdit and keyPressEvent problem
you need to give us some information to do so.
show us the "glue":
* what are those pushbuttons you are referring to?
* how do you connect signals to slots?
Re: QLintEdit and keyPressEvent problem
I have attached (i hope) a snapshot of the user interface I want to use for a "DiscGear" disc storage device. I am experimenting with a modified "command line " type interface to eliminate the "learning curve" The pushbuttons are all similar
Code:
/// Pb5-------------------------------------------------------------------------------------/// Pb5
void BaseForm::slotPb5() // call "help" function
{
if (Pb5->text() == "~") return; /// the button is blank, no action
leCName->clear();
leCName->setEnabled(true);
leCName->setFocus();
emit setupFunction("CName");
return;
}
and
Code:
/// Pb7-------------------------------------------------------------------------------------/// Pb7
void BaseForm::slotPb7() // call "help" function
{
if (Pb7->text() == "~") return; /// the button is blank, no action
leGName->clear();
leGName->setEnabled(true);
leGName->setFocus();
emit setupFunction("GName");
return;
}
both access
Code:
void BaseForm
::slotSetupFunction(QString item
) {
emit setMessageBox("base 564 we is here from " + item);
emit getUserInput(item);
}
Pb5 activates the "key press event" but Pb7 does not.
Nuts, the attachment didn't work. Apparently I have used up my allotment of attachments and I don't know how to get rid of the old ones. I need help here also.
thanks.
Re: QLintEdit and keyPressEvent problem
could you prepare a compilable example which represent the trouble?
Re: QLintEdit and keyPressEvent problem
If I could get rid of the old attachments, I could attach an example, but in essence, there are a row of QLineEdits with row of keyboard Fn numbers below. When the "User" presses a Fn key, the QLineEdit widget above it gets the "focus". He then keys in some text and presses the enter/return key. The function keys can be pressed in any order. The problem is that the program only gets the text from the first two QLineEdits. I hope this helps
Re: QLintEdit and keyPressEvent problem
how do you think this can help us? ;) if you need a help than you should show us compilable code. :)
Re: QLintEdit and keyPressEvent problem
I do not have comparable code. I am trying to develop a user friendly program interface.
I go back to command line programming, where the program told the user, with prompts, what the user had to key in. The program reads what the user had keyed in and did it's thing. Simple Simple Simple.
Here I have seven options available to the user. He can select any option by pressing the appropriate function key. When he presses one a "help Box" opens up with instructions specifically for the selected item. The user then enters the information asked for in th QLineEdit. and presses the return/enter key and the program takes it from there. THAT IS ALL THERE IS TO IT.
The problem is the program only gets the information from the first two QLineEdit boxes.
I know I can do the same thing with an option menu, but that is not what I want to do.
Since I have two of them working and five of them not working with the SAME CODE I am
perplexed.
If somebody would tell me how to erase the Attachments I have used in earlier posts, I could use one here, you would see where I'm coming from. Thanks
Re: QLintEdit and keyPressEvent problem
what is the aim of using inputting information trought GUI to a console app?
PS. attachment manager is located "User CP"->"Miscellaneous"->"Attachments".
Re: QLintEdit and keyPressEvent problem
Well, I tried to write a simple program to demonstrate my problem. Well in doing so, I discovered my problem. I was mis-using the "keyPressEvent". Now to revise my program.
I want to thank you all for trying to help a stupid old man.