Use of popup window
-
wrote on 14 Jun 2011, 08:52 last edited by
hello friends
actually i want to use popwindow instead of messagebox in my app..so i dont know whether there is a facilities of using popup in qt..please anyone suggest me...
regards
rahulEdit: moved. Yet again: just because you want your app to work on mobile, doesn't make everything you ask belong in that forum; Andre
-
wrote on 14 Jun 2011, 08:57 last edited by
Create a QWidget. Set it's window flag
@
QWidget* popupWidget = new QWidget();
popupWidget->setWindowFlags(Qt::Popup);
@ -
wrote on 14 Jun 2011, 09:05 last edited by
can you please explain me how this can be done..actually i have no idea about it..how can i show this popup on click of my button..moreever in the popup i wnat to set three buttons once once for addition,next for save..,and last one for cancel...and on click of each button particular operation is performed..please suggest me..
regards
Rahul -
wrote on 14 Jun 2011, 09:10 last edited by
QMessageBox::StandardButton
-
wrote on 14 Jun 2011, 09:14 last edited by
Actually i have used QMessageBox::StandardButton but in this case..only ok and cancel button is added..but i want the name of my button as "ADD","SAVE","CANCEL"..and moreever it adds only two action ie ok and cancel...and while using these messagebox in my device it will appear on bottom part..but i want it in middle..
-
wrote on 14 Jun 2011, 09:21 last edited by
you might want to "check out":http://doc.qt.nokia.com/4.7/qmessagebox.html#addButton
-
wrote on 14 Jun 2011, 09:21 last edited by
QMessageBox::addButton()
and set a parent for centered display.
-
wrote on 14 Jun 2011, 09:38 last edited by
hello volker
I have tried it like this..it work but it add only one button at a time..
@QMessageBox messageBox(this);
QAbstractButton *addButton =
messageBox.addButton(tr("Add"), QMessageBox::ActionRole);messageBox.exec(); if (messageBox.clickedButton() == addButton) exit(0);@
i mean to say that if i want to add two or more button the same messagebox than what should i do here if i add another button say save in the message box than it only display save button ..
-
wrote on 14 Jun 2011, 09:50 last edited by
Does the API doc state that it's forbidden to call addButton() twice?
-
wrote on 14 Jun 2011, 09:53 last edited by
that thing i havent found in the API but when i write
@QAbstractButton *saveButton =
messageBox.addButton(tr("save"), QMessageBox::ActionRole);@ in the above code than it overide the previous button -
wrote on 14 Jun 2011, 10:09 last edited by
No.
Neither on a Mac nor on Linux.
I cannot check on mobile platforms, but I seriously doubt it's different there.
-
wrote on 14 Jun 2011, 10:14 last edited by
If you want to do that.. use the static members of QMessageBox and pass the StandardButtons with "|" like Ok | Cancel.
"Documentation":http://doc.qt.nokia.com/latest/qmessagebox.html#static-public-members
-
wrote on 14 Jun 2011, 11:00 last edited by
actually i want to change the name of each action in messagebox by my own names..means can i change
QMessageBox ::Ok with QMessageBox ::AddNew.. -
wrote on 14 Jun 2011, 11:10 last edited by
Did you try reading the documentation for QMessageBox? Did you find a method there to gain access to the actual buttons? If no, you did not look hard enough, and should look again. Come on: you have been told over and over again to read the docs better. You are even telling others to do that. The time you have wasted on this (and other topics) would be better spend studying the documentation.
-
wrote on 14 Jun 2011, 12:03 last edited by
yeh i have tried the doc example its working but the thing is that in simulator it show all three button in message box but in device it only show two buttons instead of three..the code i have written is..
@QMessageBox msgBox;
QPushButton *connectButton = msgBox.addButton(tr("Ok"), QMessageBox::ActionRole);
QPushButton *connectButton1 = msgBox.addButton(tr("AddNotes"), QMessageBox::ActionRole);
QPushButton *abortButton = msgBox.addButton(QMessageBox::Abort);msgBox.exec(); if (msgBox.clickedButton() == connectButton) { // connect } else if (msgBox.clickedButton() == abortButton) { // abort }@
1/15