void DMXSlider::paintEvent(QPaintEvent* e) { QWidget::paintEvent(e); if (verticalLabel().isEmpty() == false) { QPainter p(this); p.rotate(270); p.drawText(-(height() - 20), 20, verticalLabel()); } }
UserRegistrationDialogPrivate::UserRegistrationDialogPrivate(UserRegistrationDialog * dialog) : QObject(dialog), dialog(dialog), avatarChanged(false) { emailConfirmNoticeTemplate = QString( "You will shortly receive a confirmation email to the address you just " "registered (%1). Before you can log in to Utopia Documents for the first " "time, you must follow the instructions in that email to active your " "account." ); dialog->setFixedWidth(500); QVBoxLayout * dialogLayout = new QVBoxLayout(dialog); dialogLayout->setSpacing(0); dialogLayout->setContentsMargins(0, 0, 0, 0); gridLayout = new QGridLayout; gridLayout->setSpacing(8); gridLayout->setContentsMargins(12, 12, 12, 0); dialogLayout->addLayout(gridLayout); QLabel * stepLabel = verticalLabel("Step 1", dialog); gridLayout->addWidget(stepLabel, 0, 0, 9, 1, Qt::AlignLeft); QLabel * msgLabel = new QLabel; msgLabel->setText( "Please provide some personal information about yourself here. You can also " "choose a profile picture for your account. This information will be visible " "to other users." ); msgLabel->setWordWrap(true); gridLayout->addWidget(msgLabel, 1, 1, 1, 4); // Title QLabel * titleLabel = new QLabel("Title:"); gridLayout->addWidget(titleLabel, 2, 1, Qt::AlignRight); title = new QComboBox; title->setEditable(true); gridLayout->addWidget(title, 2, 2); // Forename QLabel * forenameLabel = new QLabel("Forename:"); gridLayout->addWidget(forenameLabel, 3, 1, Qt::AlignRight); forename = new QLineEdit; gridLayout->addWidget(forename, 3, 2); // Surname QLabel * surnameLabel = new QLabel("Surname:"); gridLayout->addWidget(surnameLabel, 4, 1, Qt::AlignRight); surname = new QLineEdit; gridLayout->addWidget(surname, 4, 2); // Institution QLabel * institutionLabel = new QLabel("Institution:"); gridLayout->addWidget(institutionLabel, 5, 1, Qt::AlignRight); institution = new QLineEdit; gridLayout->addWidget(institution, 5, 2); QFrame * avatarFrame = new QFrame; avatarFrame->setObjectName("avatarFrame"); avatarFrame->setFixedSize(128, 128); QVBoxLayout * avatarFrameLayout = new QVBoxLayout(avatarFrame); avatarFrameLayout->setContentsMargins(1, 1, 1, 1); avatar = new QLabel; avatar->setScaledContents(true); avatar->installEventFilter(this); avatar->setCursor(Qt::PointingHandCursor); avatar->setToolTip("Choose picture..."); avatarFrameLayout->addWidget(avatar); gridLayout->addWidget(avatarFrame, 2, 3, 5, 2, Qt::AlignTop | Qt::AlignHCenter); QPushButton * avatarButton = new QPushButton("Choose picture..."); connect(avatarButton, SIGNAL(clicked()), this, SLOT(pickAvatar())); gridLayout->addWidget(avatarButton, 7, 1, 1, 4, Qt::AlignTop | Qt::AlignRight); ///////////////////////////////////////////////////////////////////////////////// // Email address // Email stepLabel = verticalLabel("Step 2", dialog); gridLayout->addWidget(stepLabel, 9, 0, 4, 1, Qt::AlignLeft); emailDisclaimer = new QLabel( "You will use your email address to log in to Utopia. You will need to " "confirm your email address before you can use your account; instructions " "will be emailed to this address." ); emailDisclaimer->setWordWrap(true); gridLayout->addWidget(emailDisclaimer, 10, 1, 1, 4); QLabel * emailLabel = new QLabel("Email address:"); gridLayout->addWidget(emailLabel, 11, 1, Qt::AlignRight); email = new QLineEdit; gridLayout->addWidget(email, 11, 2, 1, 2); emailErrorIcon = new QLabel; emailErrorIcon->setFixedSize(20, 20); gridLayout->addWidget(emailErrorIcon, 11, 4, 1, 1, Qt::AlignCenter); emailErrorText = new QLabel; emailErrorText->setObjectName("errorLabel"); emailErrorText->setWordWrap(true); emailErrorText->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); connect(emailErrorText, SIGNAL(linkActivated(const QString &)), this, SLOT(onLinkActivated(const QString &))); emailErrorText->hide(); gridLayout->addWidget(emailErrorText, 12, 2, 1, 2); stepLabel = verticalLabel("Step 3", dialog); gridLayout->addWidget(stepLabel, 13, 0, 5, 1, Qt::AlignLeft); passwordDisclaimer = new QLabel( "Please choose (and confirm) a password for your new account. A combination " "of letters, numbers and other characters that is not easy to guess will be " "more secure." ); passwordDisclaimer->setWordWrap(true); gridLayout->addWidget(passwordDisclaimer, 14, 1, 1, 4); // Password 1 QLabel * newPassword1Label = new QLabel("Password:"******"Retype password:"******"errorLabel"); newPasswordErrorText->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); newPasswordErrorText->hide(); gridLayout->addWidget(newPasswordErrorText, 17, 2, 1, 2); ///////////////////////////////////////////////////////////////////////////////// // Control buttons QHBoxLayout * buttonLayout = new QHBoxLayout; buttonLayout->setContentsMargins(12, 12, 12, 12); buttonLayout->setSpacing(8); QPushButton * okButton = new QPushButton("Register"); okButton->setDefault(true); connect(okButton, SIGNAL(clicked()), this, SLOT(onOkButtonClicked())); QPushButton * cancelButton = new QPushButton("Cancel"); cancelButton->setDefault(false); connect(cancelButton, SIGNAL(clicked()), this, SLOT(onCancelButtonClicked())); spinner = new Utopia::Spinner; spinner->setFixedSize(18, 18); buttonLayout->addWidget(cancelButton, 0); buttonLayout->addStretch(1); buttonLayout->addWidget(spinner, 0); buttonLayout->addWidget(okButton, 0); dialogLayout->addStretch(1); dialogLayout->addLayout(buttonLayout, 0); // Layout gridLayout->setColumnStretch(0, 0); gridLayout->setColumnStretch(1, 0); gridLayout->setColumnStretch(2, 100); gridLayout->setColumnStretch(3, 1); gridLayout->setColumnStretch(4, 0); gridLayout->setColumnMinimumWidth(0, stepLabel->minimumWidth() + 10); gridLayout->setRowStretch(6, 1); dialog->setFixedHeight(dialog->heightForWidth(500)); dialog->setSizeGripEnabled(false); }