本文整理汇总了C++中QMessageBox::activateWindow方法的典型用法代码示例。如果您正苦于以下问题:C++ QMessageBox::activateWindow方法的具体用法?C++ QMessageBox::activateWindow怎么用?C++ QMessageBox::activateWindow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMessageBox
的用法示例。
在下文中一共展示了QMessageBox::activateWindow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_crash_message_to_server
static void send_crash_message_to_server(QString message, QString plugin_names, QString emergency_save_filename, Crash_Type crash_type){
fprintf(stderr,"Got message:\n%s\n",message.toUtf8().constData());
bool is_crash = crash_type==CT_CRASH;
{
QMessageBox box;
box.setIcon(QMessageBox::Critical);
box.addButton("SEND", QMessageBox::AcceptRole);
box.addButton("DON'T SEND", QMessageBox::RejectRole);
if (crash_type==CT_CRASH)
box.setText("Radium Crashed. :((");
else if (crash_type==CT_ERROR)
box.setText("Error! Radium is in a state it should not be in.\n(Note that Radium has NOT crashed)\n");
else
box.setText("Warning! Radium is in a state it should not be in.\n(Note that Radium has NOT crashed, you can continue working)\n");
bool dosave = emergency_save_filename!=QString(NOEMERGENCYSAVE);
box.setInformativeText(QString("This %0 will be automatically reported when you press \"SEND\".\n"
"\n"
"The report is sent anonymously, and will only be seen by the author of Radium.\n"
"\n"
"Only the information in \"Show details...\" is sent.\n"
"\n"
"Please don't report the same %0 more than two or three times.\n"
).arg(crash_type==CT_CRASH ? "crash" : crash_type==CT_ERROR ? "error" : "warning")
+ ( (is_crash && plugin_names != NOPLUGINNAMES)
? QString("\nPlease note that the following third party plugins: \"" + plugin_names + "\" was/were currently processing audio. It/they might be responsible for the crash.\n")
: QString())
+ (crash_type==CT_ERROR ? "\nAfterwards, you should save your work and start the program again.\n\nIf this window just pops up again immediately after closing it, just hide it instead." : "")
+ (dosave ? "\nAn emergency version of your song has been saved as \""+emergency_save_filename+"\". However, this file should not be trusted. It could be malformed. (it is most likely okay though)" : "")
+ "\n"
);
box.setDetailedText(message);
QLabel space(" ");
box.layout()->addWidget(&space);
QLabel text_edit_label("<br><br>"
"Please also include additional information below.<br>"
"<br>"
"The best type of help you "
"can give is to write "
"down<br>a step by step "
"recipe in the following "
"format:"
"<br><br>"
"1. Start Radium<br>"
"2. Move the cursor to track 3.<br>"
"3. Press the Q button.<br>"
"4. Radium crashes<br>"
"<br>"
"<b>Note: Sometimes it is virtually impossible to fix the bug<br>"
"without a recipe on how to reproduce the bug</b><br>"
"<br>"
);
//text_edit.setMinimumWidth(1000000);
//text_edit.setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
box.layout()->addWidget(&text_edit_label);
QLabel space2(" ");
box.layout()->addWidget(&space2);
QTextEdit text_edit;
text_edit.setText("<Please add recipe and/or email address here>");
//text_edit.setMinimumWidth(1000000);
//text_edit.setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum));
box.layout()->addWidget(&text_edit);
if (crash_type==CT_CRASH)
box.setWindowTitle("Report crash");
else if (crash_type==CT_ERROR)
box.setWindowTitle("Report error");
else
box.setWindowTitle("Report warning");
box.show();
box.activateWindow();
box.raise();
//box.stackUnder(box.parentWidget());
box.setWindowFlags(Qt::WindowStaysOnTopHint);
box.setWindowModality(Qt::ApplicationModal);
#ifdef FOR_WINDOWS
HWND wnd=box.winId();
SetFocus(wnd);
SetWindowPos(wnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
#endif
int ret = box.exec();
if(ret==QMessageBox::AcceptRole){
//.........这里部分代码省略.........