Example #1
0
EditProfileDialog::EditProfileDialog(QWidget* parent):
  QDialog(parent),
  m_profile(NULL)
{
  m_imageFileName = "";
  
  m_layout = new QVBoxLayout;

  m_imageLayout = new QHBoxLayout;
  
  m_imageLabel = new QLabel();
  m_imageLayout->addWidget(m_imageLabel);

  m_changeImageButton = new TextToolButton(tr("&Change picture"));
  m_imageLayout->addWidget(m_changeImageButton);

  connect(m_changeImageButton, SIGNAL(clicked()), this, SLOT(onChangeImage()));

  m_layout->addLayout(m_imageLayout);

  m_realNameLabel = new QLabel(tr("Real name"));
  m_layout->addWidget(m_realNameLabel);
  
  m_realNameEdit = new QLineEdit;
  m_layout->addWidget(m_realNameEdit);

  m_hometownLabel = new QLabel(tr("Hometown"));
  m_layout->addWidget(m_hometownLabel);

  m_hometownEdit = new QLineEdit;
  m_layout->addWidget(m_hometownEdit);

  m_bioLabel = new QLabel(tr("Bio"));
  m_layout->addWidget(m_bioLabel);

  m_bioEdit = new QTextEdit;
  m_layout->addWidget(m_bioEdit);

  m_buttonBox = new QDialogButtonBox(this);
  m_buttonBox->setOrientation(Qt::Horizontal);
  m_buttonBox->setStandardButtons(QDialogButtonBox::Ok | 
                                  QDialogButtonBox::Cancel);
  connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(onOKClicked()));
  connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

  m_layout->addWidget(m_buttonBox);
  
  setLayout(m_layout);
}
Example #2
0
void PasswordDialog::createLayout()
{
    title_icon_label_.setPixmap(QPixmap(":/images/dictionary_search.png"));
    content_widget_.setFixedHeight(defaultItemHeight() + 4 * SPACING);

    // hbox to layout line edit and buttons.
    hbox_.setContentsMargins(SPACING, 0, SPACING, 0);
    hbox_.setSpacing(SPACING * 4);

    // Line edit.
    text_edit_.setFixedHeight(defaultItemHeight());
    hbox_.addWidget(&text_edit_, 400);
    hbox_.addWidget(&ok_button_, 100);
    hbox_.addWidget(&clear_button_, 100);

    // Buttons.
    ok_button_.useDefaultHeight();
    show_plain_text_.setFixedHeight(defaultItemHeight());
    show_plain_text_.selectOnClicked(false);
    clear_button_.useDefaultHeight();

    show_plain_text_.setFocusPolicy(Qt::NoFocus);
    ok_button_.setFocusPolicy(Qt::NoFocus);
    show_plain_text_.selectOnClicked(false);
    clear_button_.setFocusPolicy(Qt::NoFocus);

    vbox_.addWidget(&show_plain_text_);

    // keyboard.
    keyboard_.attachReceiver(this);
    vbox_.addWidget(&keyboard_);

    // Setup connections.
    connect(&show_plain_text_, SIGNAL(clicked()), this, SLOT(onShowPlainTextClicked()), Qt::QueuedConnection);
    connect(&ok_button_, SIGNAL(clicked()), this, SLOT(onOKClicked()));
    connect(&clear_button_, SIGNAL(clicked()), &text_edit_, SLOT(clear()));
    connect(&timer_, SIGNAL(timeout()), this, SLOT(onTimeout()));
    connect(&text_edit_, SIGNAL(textChanged(const QString&)), this, SLOT(onTextChanged(const QString&)));

    // Install event filter
    show_plain_text_.installEventFilter(this);
    ok_button_.installEventFilter(this);
    clear_button_.installEventFilter(this);
    text_edit_.installEventFilter(this);
    keyboard_.installEventFilter(this);

    onShowPlainTextClicked();
}
Example #3
0
KNewEquityEntryDlg::KNewEquityEntryDlg(QWidget *parent)
    : kNewEquityEntryDecl(parent)
{
  setModal(true);
  edtFraction->setCalculatorButtonVisible(false);
  edtFraction->setPrecision(0);
  edtFraction->loadText("100");

  connect(btnOK, SIGNAL(clicked()), this, SLOT(onOKClicked()));
  connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));

  connect(edtFraction, SIGNAL(textChanged(QString)), this, SLOT(slotDataChanged()));
  connect(edtMarketSymbol, SIGNAL(textChanged(QString)), this, SLOT(slotDataChanged()));
  connect(edtEquityName, SIGNAL(textChanged(QString)), this, SLOT(slotDataChanged()));

  // add icons to buttons
  btnOK->setGuiItem(KStandardGuiItem::ok());
  btnCancel->setGuiItem(KStandardGuiItem::cancel());

  slotDataChanged();

  edtEquityName->setFocus();
}