main.cpp
来自「Linux 设计源代码」· C++ 代码 · 共 50 行
CPP
50 行
#include "MainWindow.h"#include "app_mysql.h"#include "LogonDialog.h"#include <kapp.h>#include <qmessagebox.h>int main( int argc, char **argv ){ char username[100]; char password[100]; KApplication a( argc, argv, "cdapp" ); LogonDialog *dialog = new LogonDialog(); while (1) { if (dialog->exec() == QDialog::Accepted) { strcpy(username, dialog->getUsername()); strcpy(password, dialog->getPassword()); if (database_start(username, password)) break; QMessageBox::information(0, "Title", "Could not Logon: Check username and/or password", QMessageBox::Ok); continue; } else { if (QMessageBox::information(0, "Title", "Are you sure you want to quit?", QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { return 0; } } } delete dialog; MainWindow *window = new MainWindow( "Cd App" ); window->resize( 600, 400 ); a.setMainWidget( window ); window->show(); return a.exec();}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?