Hey,
I have an issue I can't seem to solve. In my application I create a pop-up window using QWidget. It shows up fine, accepts keyboard no problem. I connected a button. the reminder of the code doesn't really matter, saves data - that's all. But I want the button to close the pop-up, which also works 100% correctly. My issue is that when it closes, comes back to where the app were before the pop-up, I can't seem to be able to input anything to QLineEdits in the displayed window from the keyboard (that previously worked). I tried resetting them by using qLineEditName.setRealOnly(false); or even qLineEditName.setAcceptDrops(true);
It's all in c++ obv.
Honestly, no clue what I'm missing.
P.S. I know making a global variable is a big no-no in regards to the esthetics of the code but hopefully it can be forgiven :)
QWidget* popUpNewTime;
QTimeEdit* timeChoicePopUP;
QPushButton *button1;
void edit::on_addTime_clicked() {
//Creating pop-up with time choice and a save button
popUpNewTime = new QWidget(this, Qt::Popup);
popUpNewTime->setWindowModality(Qt::WindowModal);
QRect rect = QStyle::alignedRect(layoutDirection(), Qt::AlignBottom, QSize(width()/4, height()/6), geometry());
popUpNewTime->setGeometry(rect);
QVBoxLayout* layout = new QVBoxLayout(popUpNewTime);
timeChoicePopUP = new QTimeEdit();
button1 = new QPushButton("SAVE");
layout->addWidget(timeChoicePopUP);
layout->addWidget(button1);
timeChoicePopUP->activateWindow();
timeChoicePopUP->grabKeyboard();
popUpNewTime->show();
connect(button1,&QPushButton::clicked,this, &edit::addingTime);
}
void edit::addingTime() {
timeChoicePopUP->close();
button1->close();
popUpNewTime->close();
}