Solved Problem with QMessagebox with IOS.. Application becomes unresponsive
-
@mrjj connect(ui->actionErase_Block,&QAction::triggered,this,&RapidMainDesigner::on_actionErase_Block_triggered_1,Qt::QueuedConnection);
I tried to override the slot connection done by default and tried to implement the connect with a QueuedConnection. However, the problem still persists.
Any other way to do this QueuedConnection?
-
@mrjj My IOS version is 11.4.1
-
@TheCrowKaka
HI
Well adding a new connection will not override the old one.
You could use disconnect.However, i was more thinking of
manually adding a new action from code and be using QueuedConnection to test
if that actually works then.
I read the link as he manually connected the actions and then it worked. -
@mrjj manually adding a new action and using QueuedConnection to test also did not work.
-
@TheCrowKaka
Ok. it sounded like the others got it working that way. but maybe not in all cases.
It sounds like its fixed in 5.9.4
What Qt are you on ? -
@mrjj I am using Qt5.10.1
-
@mrjj I dont see a solution to this problem. I was trying to solve it by creating a custom dialog box with buttons for asking user input.
Ideally, i should have a window that is translucent and a opaque frame with buttons and a label.
Do you think this will be feasible? -
@TheCrowKaka
Would it be possible to test with 5.9.4 ?Well the issues seems to be related to exec()
so a new dialog might not work better than QMessageBox
however , its worth a shot. -
@mrjj if I execute the dialog with exec in a static function, that seems to work.
Invoking the dialog this way works.
int ret = iosmsgbox::showmessagebox(tr("Do you really want to delete the block?"),QString(),tr("Yes"),tr("No"));
The dialog header...
#ifndef IOSMSGBOX_H #define IOSMSGBOX_H #include <QDialog> namespace Ui { class iosmsgbox; } class iosmsgbox : public QDialog { Q_OBJECT public: explicit iosmsgbox(const QString &message,const QString &btn1txt,const QString &btn2txt,const QString &btn3txt,QWidget *parent = 0); ~iosmsgbox(); static int showmessagebox(const QString &message,const QString &btn1txt,const QString &btn2txt,const QString &btn3txt,QWidget *parent = 0); private slots: void on_btn_1_clicked(); void on_btn_2_clicked(); void on_btn_3_clicked(); private: Ui::iosmsgbox *ui; int selvalue; }; #endif // IOSMSGBOX_H
The dialog cpp.
#include "iosmsgbox.h" #include "ui_iosmsgbox.h" iosmsgbox::iosmsgbox(const QString &message,const QString &btn1txt,const QString &btn2txt,const QString &btn3txt,QWidget *parent) : QDialog(parent), ui(new Ui::iosmsgbox) { ui->setupUi(this); selvalue=0; ui->btn_1->setVisible(!btn1txt.isEmpty()); ui->btn_1->setText(btn1txt); ui->btn_2->setVisible(!btn2txt.isEmpty()); ui->btn_2->setText(btn2txt); ui->btn_3->setVisible(!btn3txt.isEmpty()); ui->btn_3->setText(btn3txt); } iosmsgbox::~iosmsgbox() { delete ui; } int iosmsgbox::showmessagebox(const QString &message, const QString &btn1txt, const QString &btn2txt, const QString &btn3txt, QWidget *parent) { int returnvalue; iosmsgbox *mymsg = new iosmsgbox(message,btn1txt,btn2txt,btn3txt,parent); mymsg->exec(); returnvalue=mymsg->selvalue; mymsg->close(); delete mymsg; return returnvalue; } void iosmsgbox::on_btn_1_clicked() { selvalue=1; this->hide(); } void iosmsgbox::on_btn_2_clicked() { selvalue=2; this->hide(); } void iosmsgbox::on_btn_3_clicked() { selvalue=3; this->hide(); }
Now I am confused on how to make the background translucent and make just the buttons housed in the frame visible properly.
-
Ok, so its not directly related to exec().
Good test then.
One note. i dont think you have to new it. since exec is blocking.
...
iosmsgbox mymsg(message,btn1txt,btn2txt,btn3txt,parent);
mymsg.exec();
returnvalue=mymsg.selvalue;
mymsg.close();should work just as well.
- background translucent
Is the normal messagebox translucent ? or why you want this ?
- buttons housed in the frame visible properly.
You mean dialog is too small or why are they not ok ?
-
@mrjj
The Transluscent background and visible frame is only about trying to give the look similar to the messagebox.
But this workaround works for me.