1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | import com.trolltech.qt.gui.*; public class LoginBox extends QWidget { /* Données dont un accès peut-être utile depuis le reste de la classe */ private QLineEdit loginLineEdit; private QLineEdit passwordLineEdit; private QLineEdit serverLineEdit; private QLineEdit portLineEdit; private QCheckBox sslCheckBox; private QLineEdit ressourceLineEdit; public LoginBox() { /** Login's GroupBox' **/ QGroupBox loginGroup = new QGroupBox(tr("Login's informations:")); /* Login Line Edit with Label */ QLabel loginLabel = new QLabel(tr("Jabber ID:")); loginLineEdit = new QLineEdit(); loginLineEdit.setFocus(); /* Password LineEdit with Label */ QLabel passwordLabel = new QLabel(tr("Password:")); passwordLineEdit = new QLineEdit(); passwordLineEdit.setEchoMode(QLineEdit.EchoMode.Password); /* Login's Layout */ QGridLayout loginLayout = new QGridLayout(); loginLayout.addWidget(loginLabel, 0, 0); loginLayout.addWidget(loginLineEdit, 0, 1); loginLayout.addWidget(passwordLabel, 1, 0); loginLayout.addWidget(passwordLineEdit, 1, 1); loginGroup.setLayout(loginLayout); /** Account GroupBox **/ QGroupBox accountGroup = new QGroupBox(tr("Server settings:")); /* Server Line Edit with Label */ QLabel serverLabel = new QLabel(tr("Server:")); serverLineEdit = new QLineEdit(); /* Port LineEdit with Label and SSL selection */ QLabel portLabel = new QLabel(tr("Port:")); portLineEdit = new QLineEdit("5222"); sslCheckBox = new QCheckBox(tr("Using SSL")); /* Ressource Line Edit with Label */ QLabel ressourceLabel = new QLabel(tr("Ressource:")); ressourceLineEdit = new QLineEdit("jTalk"); /* Login's Layout */ QGridLayout accountLayout = new QGridLayout(); accountLayout.addWidget(serverLabel, 0, 0); accountLayout.addWidget(serverLineEdit, 0, 1, 1, 2); accountLayout.addWidget(portLabel, 1, 0); accountLayout.addWidget(portLineEdit, 1, 1); accountLayout.addWidget(sslCheckBox, 1, 2); accountLayout.addWidget(ressourceLabel, 2, 0); accountLayout.addWidget(ressourceLineEdit, 2, 1, 1, 2); accountGroup.setLayout(accountLayout); /* Dialog Button Box */ QDialogButtonBox boutons = new QDialogButtonBox(); boutons.addButton(QDialogButtonBox.StandardButton.Ok); boutons.addButton(QDialogButtonBox.StandardButton.Cancel); // Dialog Layout QGridLayout layout = new QGridLayout(); layout.addWidget(loginGroup, 0, 0); layout.addWidget(accountGroup, 1, 0); layout.addWidget(boutons, 2, 0); setLayout(layout); setWindowTitle(tr("Jabber Account Configuration")); setLayout(layout); } public static void main(String args[]) { QApplication.initialize(args); LoginBox widget = new LoginBox(); widget.show(); QApplication.exec(); } } |
1 2 3 | QMessageBox.warning(null, tr("My Application"), tr("The document has been modified.\n"+ "Do you want to save your changes?"), new QMessageBox.StandardButtons(QMessageBox.StandardButton.Save, QMessageBox.StandardButton.Discard, QMessageBox.StandardButton.Cancel)); |

Changer de design |
En savoir plus |
Plan du site |
Politique d'accessibilité |
Règles |
RSS tutoriels |
RSS news
Édité par Simple IT SARL :
Nous contacter
| Notre blog | Revue de presse | Publicité
Y'a plus rien à lire, faut remonter maintenant !
Hébergement web - Correction de tutoriels - Créer un site
Vous souhaitez apparaître ici ? Contactez-nous.
203 Zéros connectés |
8 requêtes |
0.0229s (0.0116s)