Customizing your Login Box

The procedure for creating a customized login box.

Prerequisites

In order to build your own Login Box, you will firstly need to download Qt Creator. This software is available from the Qt website: http://qt-project.org/downloads#qt-creator. Download the version for your Operating System.

How does it work?

Default login box:


The figure is a screen shot of a default login box created with Qt Creator. See the surrounding text for information on how to build your own Login Box.

Figure 1. Default login box

To create the the login box you need to run the Qt Designer Form (included in Qt Creator). Select New File or Project, then in sub-category File and Classes select Qt, and, at the end, choose Qt Designer Form. Select Widget as template.

Now that you're in the Qt Designer Form, you have some rules to respect. You need the following items:
  • a QWidget for the form
  • a QPushButton named m_OKPushButton for the OK button
  • a QPushButton named m_CancelPushButton for the cancel button
  • a QLabel named m_UserNameLabel for the label dedicated to the user name
  • a QLabel named m_PasswordLabel for the label dedicated to the password
  • a QLineEdit named m_UserNameLineEdit for the edit field where the user enters his name
  • a QLineEdit named m_PasswordLineEdit for the edit field where the user enters his password
  • a QCheckBox named m_SaveCheckBox for the checkbox which allows the password to be saved
Optional :
  • a QLabel named m_TextLabel if you're using a customized message when asking for the password again (See Connection Strings)

Then you can assign it to a shortcut and it will be used instead of the default login box.

Tips

  • As it is done in a Genero layout, use a Vertical Layout and Horizontal Layout as much as possible to correctly align and organize your widgets with each other.
  • We strongly recommend you embed all elements in a Grid layout (QGridLayout). GDC will always resize the Login Box to its minimum size. When previewing (Alt+Shift+R or Tools -> Form Editor -> Preview ) your form in the Qt Designer Form, you should not be able to resize it to very tiny size. Using a grid layout around the various items should help to avoid this. The other solution is to specify a minimum size for the QWidget Form. For this, change the parameters (Width, Height) of the attribute minimumSize of the QWidget Form.
  • Use Horizontal and Vertical Spacers to better control the free space.
  • You are free to add some widgets which are usually not used in a login box: TextEdit, RadioButton, and so on.

Sample

This login box is produced by a customized .ui file. You can request a copy of this file from your local support.


The figure is a screen shot of a customized login box.

Figure 2. Customized login box example