void Dialog::on_pushButton_clicked() { MyDialog dialog; dialog.setModal(true); dialog.exec(); }
bool QxmlApp::OnInit() { ////@begin QxmlApp initialisation // Remove the comment markers above and below this block // to make permanent changes to the code. MyDialog *dialog = new MyDialog(NULL,-1,"QXML",wxPoint(50,50), wxSize(450,350),wxDEFAULT_DIALOG_STYLE); #if wxUSE_XPM wxImage::AddHandler( new wxXPMHandler ); #endif #if wxUSE_LIBPNG wxImage::AddHandler( new wxPNGHandler ); #endif #if wxUSE_LIBJPEG wxImage::AddHandler( new wxJPEGHandler ); #endif #if wxUSE_GIF wxImage::AddHandler( new wxGIFHandler ); #endif ////@end QxmlApp initialisation if (dialog->ShowModal() == wxID_OK) { } dialog->Destroy(); return true; }
//--------------------------------------------------------------------------- int main(int argc, char *argv[]) { QApplication app(argc, argv); MyDialog windowTop; windowTop.show(); return app.exec(); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hp, LPSTR cmdLine, int nShow) { MyDialog dlg; GetCursorPos(&dlg.p); if(dlg.DoModal(hInstance, NULL) == IDOK){ SetCursorPos(dlg.p.x,dlg.p.y); } return 0; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); MyWidget w; MyDialog dialog; //新建MyDialog类对象 if(dialog.exec() == QDialog::Accepted){ //判断dialog执行结果 w.show(); //如果是按下了“进入主界面”按钮,则显示主界面 return a.exec(); //程序正常运行 } else return 0; //否则,退出程序 }
void Remind::on_addReminder_clicked()//if add reminder button clicked shoots up a dialog to add a reminder { MyDialog mdialog; mdialog.setModal(true); mdialog.exec(); if (!mdialog.isActiveWindow()) { search(); } }
void MyFrame::OnTest1(wxCommandEvent& WXUNUSED(event)) { #if ( defined(__WXPM__) || defined(__WXMSW__) ) && !defined(__WXUNIVERSAL__) MyDialog dialog; if (dialog.LoadNativeDialog(this, _T("dialog1"))) { dialog.ShowModal(); } #else wxMessageBox(_T("No native dialog support"),_T("Platform limitation")); #endif }
int main(int argc, char **argv) { QApplication app(argc, argv); MyObject obj; MyDialog dialog; dialog.connect(dialog.aButton, SIGNAL(clicked()), SLOT(close())); dialog.show(); return app.exec(); }
int main(int argc, char* argv[]) { QApplication app(argc, argv); MyDialog* dialog = new MyDialog; //MyDialog dialog; QObject::connect(dialog, SIGNAL(onKeywordMatched(const QString&)), &app, SLOT(quit())); dialog->show(); return app.exec(); }
// 重新登录按钮 void MyWidget::on_pushButton_clicked() { // 先关闭主界面,其实是隐藏起来了,并没有真正退出 close(); // 新建MyDialog对象 MyDialog dlg; // 如果按下了“进入主窗口”按钮,则再次显示主界面 // 否则,因为现在已经没有显示的界面了,所以程序将退出 if(dlg.exec()== QDialog::Accepted) show(); }
MyGui() : m_layout(this), m_button("Show Dialog"), m_dialog(this) { m_button.setObjectName("button"); m_dialog.setObjectName("dialog"); m_layout.addWidget(&m_label); m_layout.addWidget(&m_button); QMetaObject::connectSlotsByName(this); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); //支持Tr中文 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));//支持中文文件名显示 QFont font; font.setStyleStrategy(QFont::PreferDefault); //font.setPointSize(160);//实际上是16的字号,但设成16却不行 //font.setFamily(("wenquanyi")); //font.setBold(false); a.setFont(font); MyDialog *w = new MyDialog; //w->showMaximized();//最大化显示 w->setWindowTitle("GPS评估程序"); w->show(); return a.exec(); }
int main() { ALLEGRO_DISPLAY *display; ALLEGRO_TIMER *tick_timer; if (!al_init()) { TRACE("Allegro init failed!\n"); return 1; } al_init_font_addon(); al_init_image_addon(); al_init_primitives_addon(); al_install_keyboard(); al_install_mouse(); display = al_create_display(640, 480); if (!display) { TRACE("Display init failed!\n"); return 1; } al_hide_mouse_cursor(display); /* Must set this before calling InstallMASkinG() ! */ MAS::SetLogicRate(1.0 / 0.02); /* MASkinG must be initialized after the display. */ if (InstallMASkinG("allegro.cfg") != MAS::Error::NONE ) { TRACE("MA5kinG init failed!\n"); return 1; } tick_timer = al_create_timer(0.02); queue = al_create_event_queue(); al_register_event_source(queue, (ALLEGRO_EVENT_SOURCE *) al_get_keyboard_event_source()); al_register_event_source(queue, (ALLEGRO_EVENT_SOURCE *) al_get_mouse_event_source()); al_register_event_source(queue, (ALLEGRO_EVENT_SOURCE *) display); al_register_event_source(queue, (ALLEGRO_EVENT_SOURCE *) tick_timer); // create a new dialog on the current display MyDialog *dlg = new MyDialog(); al_start_timer(tick_timer); /* You have to call this manually. */ dlg->Start(); while (!dlg->ShouldClose()) { ALLEGRO_EVENT event; al_wait_for_event(queue, &event); switch (event.type) { case ALLEGRO_EVENT_TIMER: if (event.timer.source == tick_timer) { dlg->DoTick(); /* Skip the drawing if we've got more events to process. */ if (!al_event_queue_is_empty(queue)) continue; /* Redraw the screen */ al_clear_to_color(al_map_rgb(0, 0, 0)); dlg->Draw(); al_flip_display(); } else /* Oh, it must be the game timer. */ dlg->ProcessEvent(&event); break; default: dlg->ProcessEvent(&event); } } /* You have to call this manually. */ dlg->End(); // delete the dialog delete dlg; ExitMASkinG(); return 0; }
Q_SLOT void on_button_clicked() { m_dialog.show(); }