コード例 #1
0
ファイル: gui.cpp プロジェクト: Pik-9/qTox
QString GUI::_passwordDialog(const QString& cancel, const QString& body)
{
    // we use a hack. It is considered that closing the dialog without explicitly clicking
    // disable history is confusing. But we can't distinguish between clicking the cancel
    // button and closing the dialog. So instead, we reverse the Ok and Cancel roles,
    // so that nothing but explicitly clicking disable history closes the dialog
    QString ret;
    QInputDialog dialog;
    dialog.setWindowTitle(tr("Enter your password"));
    dialog.setOkButtonText(cancel);
    dialog.setCancelButtonText(tr("Decrypt"));
    dialog.setInputMode(QInputDialog::TextInput);
    dialog.setTextEchoMode(QLineEdit::Password);
    dialog.setLabelText(body);

    // problem with previous hack: the default button is disable history, not decrypt.
    // use another hack to reverse the default buttons.
    // http://www.qtcentre.org/threads/49924-Change-property-of-QInputDialog-button
    QList<QDialogButtonBox*> l = dialog.findChildren<QDialogButtonBox*>();
    if (!l.isEmpty())
    {
        QPushButton* ok     = l.first()->button(QDialogButtonBox::Ok);
        QPushButton* cancel = l.first()->button(QDialogButtonBox::Cancel);
        if (ok && cancel)
        {
            ok->setAutoDefault(false);
            ok->setDefault(false);
            ok->setText(QApplication::tr("Ok"));
            cancel->setAutoDefault(true);
            cancel->setDefault(true);
            cancel->setText(QApplication::tr("Cancel"));
        }
        else
        {
            qWarning() << "PasswordDialog: Missing button!";
        }
    }
    else
    {
        qWarning() << "PasswordDialog: No QDialogButtonBox!";
    }

    // using similar code, set QLabels to wrap
    for (auto* label : dialog.findChildren<QLabel*>())
        label->setWordWrap(true);

    while (true)
    {
        int val = dialog.exec();
        if (val == QDialog::Accepted)
            return QString();

        ret = dialog.textValue();
        if (!ret.isEmpty())
            return ret;

        dialog.setTextValue("");
        dialog.setLabelText(body + "\n\n" + tr("You must enter a non-empty password:"));
    }
}
コード例 #2
0
DesktopUpdateAvailableDialog::DesktopUpdateAvailableDialog(
                                    const DesktopUpdateInfo& updateInfo,
                                    QWidget *parent) :
      QDialog(parent),
      updateInfo_(updateInfo),
      ui(new Ui::DesktopUpdateAvailableDialog())
{
   ui->setupUi(this);
   ui->lblIcon->setFixedSize(QSize(64, 64));
   ui->label->setText(updateInfo.updateMessage);

   ui->buttonBox->clear();
   QPushButton* pDownload = new QPushButton(QString::fromUtf8("Download..."));
   ui->buttonBox->addButton(pDownload, QDialogButtonBox::AcceptRole);
   pDownload->setAutoDefault(false);
   pDownload->setDefault(true);

   QPushButton* pRemindLater = new QPushButton(QString::fromUtf8("Remind Later"));
   ui->buttonBox->addButton(pRemindLater, QDialogButtonBox::RejectRole);
   pRemindLater->setAutoDefault(false);

   QPushButton* pIgnoreUpdate = new QPushButton(QString::fromUtf8("Ignore Update"));
   ui->buttonBox->addButton(pIgnoreUpdate, QDialogButtonBox::DestructiveRole);
   pIgnoreUpdate->setAutoDefault(false);
   pIgnoreUpdate->setEnabled(!updateInfo.isUrgent);
   connect(pIgnoreUpdate, SIGNAL(clicked()),
           this, SLOT(permanentlyIgnoreUpdate()));

   pRemindLater->setFocus();
}
コード例 #3
0
void SurfaceSettingsDialog::initDialog(){
    QLineEdit* uEdit = ui->uDivisionCountLineEdit;
    QLineEdit* vEdit = ui->vDivisionCountLineEdit;

    QIntValidator* intValidator = new QIntValidator(0, 1000, NULL);

    uEdit->setValidator(intValidator);
    vEdit->setValidator(intValidator);

    std::string uStr;
    std::string vStr;

    uStr = std::to_string(Surface::uDivisionCount);
    vStr = std::to_string(Surface::vDivisionCount);

    QString uQStr = QString::fromStdString(uStr);
    QString vQStr = QString::fromStdString(vStr);

    uEdit->setText(uQStr);
    vEdit->setText(vQStr);

    QPushButton* cancelButton = ui->cancelButton;
    QPushButton* okButton = ui->okButton;

    okButton->setDefault(true);
    okButton->setAutoDefault(false);

    cancelButton->setDefault(false);
    cancelButton->setAutoDefault(false);
}
コード例 #4
0
QtGradientDialog::QtGradientDialog(QWidget *parent)
    : QDialog(parent), d_ptr(new QtGradientDialogPrivate())
{
//    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    d_ptr->q_ptr = this;
    d_ptr->m_ui.setupUi(this);
    QPushButton *button = d_ptr->m_ui.buttonBox->button(QDialogButtonBox::Ok);
    if (button)
        button->setAutoDefault(false);
    button = d_ptr->m_ui.buttonBox->button(QDialogButtonBox::Cancel);
    if (button)
        button->setAutoDefault(false);
    connect(d_ptr->m_ui.gradientEditor, SIGNAL(aboutToShowDetails(bool,int)),
            this, SLOT(slotAboutToShowDetails(bool,int)));
}
コード例 #5
0
ファイル: mkdir_dialog.cpp プロジェクト: sansajn/aexplor
mkdir_dialog::mkdir_dialog(std::string const & path, QWidget * parent)
	: QDialog(parent)
{
	QVBoxLayout * layout = new QVBoxLayout(this);

	QLabel * label = new QLabel;
	label->setText(QString("Create new folder in:\n%1").arg(path.c_str()));
	layout->addWidget(label);

	_dirname = new QLineEdit;
	_dirname->setClearButtonEnabled(true);
	_dirname->setText("New Folder");
	_dirname->selectAll();
	layout->addWidget(_dirname);

	QHBoxLayout * button_layout = new QHBoxLayout;

	QPushButton * ok = new QPushButton("&Ok");
	ok->setAutoDefault(true);
	connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
	button_layout->addWidget(ok);

	QPushButton * cancel = new QPushButton("&Cancel");
	connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
	button_layout->addWidget(cancel);

	layout->addLayout(button_layout);

	setWindowTitle("New Folder");
}
コード例 #6
0
ファイル: ShareDialog.cpp プロジェクト: Timmmm/lastfm-desktop
ShareDialog::ShareDialog( const Track& track, QWidget* parent )
    : unicorn::Dialog( parent, Qt::Tool ),
      ui( new Ui::ShareDialog ),
      m_track( track )
{
    ui->setupUi( this );

    ui->recipients->setType( ItemSelectorWidget::User );

    ui->icon->setScaledContents( true );
    ui->icon->setHref( m_track.www() );

    enableDisableOk();

    connect( ui->message, SIGNAL(textChanged()), SLOT(updateCharacterLimit()));
    connect( ui->message, SIGNAL(textChanged()), SLOT(enableDisableOk()));
    connect( ui->recipients, SIGNAL(changed()), SLOT(enableDisableOk()));

    ui->title->setText( unicorn::Label::anchor( m_track.www().toString(), m_track.title() ) );

    if ( m_track.album().isNull() )
        ui->description->setText( tr( "A track by %1" ).arg( unicorn::Label::anchor( m_track.artist().www().toString(), m_track.artist().name() ) ) );
    else
        ui->description->setText( tr( "A track by %1 from the release %2" ).arg( unicorn::Label::anchor( m_track.artist().www().toString(), m_track.artist().name() ), unicorn::Label::anchor( m_track.album().www().toString(), m_track.album() ) ) );

    m_imageFetcher = new TrackImageFetcher( m_track, Track::MediumImage );
    connect( m_imageFetcher, SIGNAL(finished(QPixmap)), ui->icon, SLOT(setPixmap(QPixmap)) );
    m_imageFetcher->startAlbum();

    QPushButton* dummyDefault = ui->buttons->addButton( QDialogButtonBox::Help );
    dummyDefault->setDefault( true );
    dummyDefault->setAutoDefault( true );
    dummyDefault->setVisible( false );
}
コード例 #7
0
ファイル: qwwtipwidget.cpp プロジェクト: TeamKami/KamiCmd
void QwwTipWidgetPrivate::initUi() {
    Q_Q(QwwTipWidget);
    QHBoxLayout *l = new QHBoxLayout;
    m_check = new QCheckBox;
    m_check->setChecked(true);
    l->addWidget(m_check);
    l->addStretch();
    m_prev = new QPushButton;
    m_prev->setIcon(QPixmap(":/wwwidgets/arrowleft.png"));
    l->addWidget(m_prev);
    m_next = new QPushButton;
    m_next->setIcon(QPixmap(":/wwwidgets/arrowright.png"));
    l->addWidget(m_next);
    m_close = new QPushButton;
    m_close->setDefault(true);
    m_close->setAutoDefault(true);
    l->addWidget(m_close);
    QVBoxLayout *vl = new QVBoxLayout(q);
    m_browser = new QTextBrowser;
    m_browser->setOpenExternalLinks(true);
    vl->addWidget(m_browser);
    vl->addLayout(l);
    q->connect(m_close, SIGNAL(clicked()), q, SIGNAL(closed()));
    q->connect(m_prev, SIGNAL(clicked()), q, SLOT(prevTip()));
    q->connect(m_next, SIGNAL(clicked()), q, SLOT(nextTip()));
    q->setTabOrder(m_close, m_next);
    q->setTabOrder(m_next, m_prev);
    q->setTabOrder(m_prev, m_check);
    q->setTabOrder(m_check, m_close);
    q->setFocusProxy(m_close);
    retranslateUi();
}
コード例 #8
0
ShutdownDialog::ShutdownDialog(QWidget *parent)
	: QDialog(parent)
{
	QLabel *reasonLabel = new QLabel(tr("&Reason for shutdown:"));
	reasonEdit = new QLineEdit;
	reasonLabel->setBuddy(reasonEdit);
	QLabel *minutesLabel = new QLabel(tr("&Time until shutdown (minutes):"));
	minutesEdit = new QSpinBox;
	minutesLabel->setBuddy(minutesEdit);
	minutesEdit->setMinimum(0);
	minutesEdit->setValue(5);
	
	QPushButton *okButton = new QPushButton(tr("&OK"));
	okButton->setAutoDefault(true);
	okButton->setDefault(true);
	connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
	QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
	
	QHBoxLayout *buttonLayout = new QHBoxLayout;
	buttonLayout->addStretch();
	buttonLayout->addWidget(okButton);
	buttonLayout->addWidget(cancelButton);
	
	QGridLayout *mainLayout = new QGridLayout;
	mainLayout->addWidget(reasonLabel, 0, 0);
	mainLayout->addWidget(reasonEdit, 0, 1);
	mainLayout->addWidget(minutesLabel, 1, 0);
	mainLayout->addWidget(minutesEdit, 1, 1);
	mainLayout->addLayout(buttonLayout, 2, 0, 1, 2);
	
	setLayout(mainLayout);
	setWindowTitle(tr("Shut down server"));
}
コード例 #9
0
QPushButton *ScriptDebugger::createButton(const QString &text, const char *slot, QWidget *parent)
{
	QPushButton *button = new QPushButton(text, parent);
	connect(button, SIGNAL(pressed()), this, slot);
	button->setDefault(false);
	button->setAutoDefault(false);
	return button;
}
コード例 #10
0
RequestDetailsDlg::RequestDetailsDlg(Request* request, QWidget *parent)
    : QDialog(parent)
    ,m_request(request)
    ,m_gist(new Gist(parent))
{
    connect(m_gist, SIGNAL(published(QString)), this, SLOT(slotGistUrl(QString)));
    QGridLayout *gridLayout = new QGridLayout(this);

    QHBoxLayout *phLayout = new QHBoxLayout;

    QPushButton *cliboard = new QPushButton(QIcon(":/clipboard_32.png"), "", this);
    cliboard->setAutoDefault(false);
    cliboard->setToolTip(tr("Copy details of request/response to clipboard"));
    cliboard->setWhatsThis(tr("Send request/response to cliboard"));
    connect(cliboard, SIGNAL(clicked()), this, SLOT(slotSendToBuffer()));

    QPushButton *share = new QPushButton(QIcon(":/cloud302_32.png"), "", this);
    share->setAutoDefault(false);
    share->setToolTip(tr("Share request at gist"));
    share->setWhatsThis(tr("Share request at gist"));
    connect(share, SIGNAL(clicked()), this, SLOT(slotSendToGist()));

    phLayout->addWidget(cliboard);
    phLayout->addSpacing(2);
    phLayout->addWidget(share);

    m_viewRequest = new QTextEdit(this);
    m_viewRequest->setFont(QFont("Monospace"));
    m_viewRequest->setReadOnly(true);
    m_viewRequest->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    m_viewRequest->setHtml(m_request->requestToHtml());

    m_viewResponse = new QTextEdit(this);
    m_viewResponse->setFont(QFont("Monospace"));
    m_viewResponse->setReadOnly(true);
    m_viewResponse->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    m_viewResponse->setHtml(m_request->responseToHtml());

    gridLayout->addItem(phLayout, 0, 0, 1, 2, Qt::AlignLeft);
    gridLayout->addWidget(m_viewRequest, 1, 0, 1, 1);
    gridLayout->addWidget(m_viewResponse, 1, 1, 1, 1);
    gridLayout->setContentsMargins(0,0,0,0);
    gridLayout->setMargin(0);
    resize(900, 500);
}
コード例 #11
0
void symbolDialog::initMinGreekChars()
{
for (int i=0;i<25;i++)
	{
	QPushButton *btn = new QPushButton(QChar(i+0x3B1), GroupBox1, 0);
	btn->setMaximumWidth(30);
	btn->setFlat ( true );
	btn->setAutoDefault (false);
	}
}
コード例 #12
0
ファイル: SymbolDialog.cpp プロジェクト: DanNixon/mantid
void SymbolDialog::initNumberSymbols() {
  int i, counter = 0;
  for (i = 0; i <= (0x216B - 0x2153); i++, counter++) {
    QPushButton *btn = new QPushButton(QString(QChar(i + 0x2153)));
    btn->setMaximumWidth(40);
    btn->setFlat(true);
    btn->setAutoDefault(false);
    buttons->addButton(btn, counter + 1);
    gridLayout->addWidget(btn, counter / 8, counter % 8);
  }
  for (i = 0; i <= (0x217B - 0x2170); i++, counter++) {
    QPushButton *btn = new QPushButton(QString(QChar(i + 0x2170)));
    btn->setMaximumWidth(40);
    btn->setFlat(true);
    btn->setAutoDefault(false);
    buttons->addButton(btn, counter + 1);
    gridLayout->addWidget(btn, counter / 8, counter % 8);
  }
  numButtons = counter;
}
コード例 #13
0
ファイル: SymbolDialog.cpp プロジェクト: DanNixon/mantid
void SymbolDialog::initLowerGreekChars() {
  int counter = 0;
  for (int i = 0; i <= (0x3C9 - 0x3B1); i++, counter++) {
    QPushButton *btn = new QPushButton(QString(QChar(i + 0x3B1)));
    btn->setMaximumWidth(40);
    btn->setFlat(true);
    btn->setAutoDefault(false);
    buttons->addButton(btn, counter + 1);
    gridLayout->addWidget(btn, counter / 5, counter % 5);
  }
}
コード例 #14
0
ファイル: PhDialogButtonBox.cpp プロジェクト: EMATech/Joker
void PhDialogButtonBox::showEvent(QShowEvent *)
{
	// Unset the Cancel button from default
	QPushButton * cancelBtn = this->button(QDialogButtonBox::Cancel);
	if(cancelBtn) {
		cancelBtn->setAutoDefault(false);
		cancelBtn->setDefault(false);
		cancelBtn->setText(tr("Cancel"));
		PHDEBUG << "Set cancel";
	}

	// Set the Ok Button to default
	QPushButton * okBtn = this->button(QDialogButtonBox::Ok);
	if(okBtn) {
		okBtn->setAutoDefault(true);
		okBtn->setDefault(true);
		okBtn->setText(tr("Ok"));
		PHDEBUG << "Set Ok";
	}
}
コード例 #15
0
void SymbolDialog::initArrowSymbols()
{
	int i, counter = 0;
	for ( i=0 ; i <= (0x219B-0x2190) ; i++,counter++ )
	{
		QPushButton *btn = new QPushButton(QString(QChar(i+0x2190)));
		btn->setMaximumWidth(40);
		btn->setFlat ( true );
		btn->setAutoDefault (false);
		buttons->addButton(btn,counter+1);
		gridLayout->addWidget(btn,counter/6,counter%6);
	}
	for ( i=0 ; i <= (0x21A7-0x21A4) ; i++,counter++ )
	{
		QPushButton *btn = new QPushButton(QString(QChar(i+0x21A4)));
		btn->setMaximumWidth(40);
		btn->setFlat ( true );
		btn->setAutoDefault (false);
		buttons->addButton(btn,counter+1);
		gridLayout->addWidget(btn,counter/6,counter%6);
	}
	for ( i=0 ; i <= (0x21D5-0x21CD) ; i++,counter++ )
	{
		QPushButton *btn = new QPushButton(QString(QChar(i+0x21CD)));
		btn->setMaximumWidth(40);
		btn->setFlat ( true );
		btn->setAutoDefault (false);
		buttons->addButton(btn,counter+1);
		gridLayout->addWidget(btn,counter/6,counter%6);
	}
	for ( i=0 ; i <= (0x21E9-0x21E6) ; i++,counter++ )
	{
		QPushButton *btn = new QPushButton(QString(QChar(i+0x21E6)));
		btn->setMaximumWidth(40);
		btn->setFlat ( true );
		btn->setAutoDefault (false);
		buttons->addButton(btn,counter+1);
		gridLayout->addWidget(btn,counter/6,counter%6);
	}
	numButtons = counter;
}
コード例 #16
0
ファイル: SymbolDialog.cpp プロジェクト: DanNixon/mantid
void SymbolDialog::initUpperGreekChars() {
  int i, counter = 0;
  for (i = 0; i <= (0x394 - 0x393); i++, counter++) {
    QPushButton *btn = new QPushButton(QString(QChar(i + 0x393)));
    btn->setMaximumWidth(40);
    btn->setFlat(true);
    btn->setAutoDefault(false);
    buttons->addButton(btn, counter + 1);
    gridLayout->addWidget(btn, counter / 5, counter % 5);
  }

  for (i = 0; i <= (0x3A0 - 0x398); i += 3, counter++) {
    QPushButton *btn = new QPushButton(QString(QChar(i + 0x398)));
    btn->setMaximumWidth(40);
    btn->setFlat(true);
    btn->setAutoDefault(false);
    buttons->addButton(btn, counter + 1);
    gridLayout->addWidget(btn, counter / 5, counter % 5);
  }

  for (i = 0; i <= (0x3A6 - 0x3A0); i += 3, counter++) {
    QPushButton *btn = new QPushButton(QString(QChar(i + 0x3A0)));
    btn->setMaximumWidth(40);
    btn->setFlat(true);
    btn->setAutoDefault(false);
    buttons->addButton(btn, counter + 1);
    gridLayout->addWidget(btn, counter / 5, counter % 5);
  }

  for (i = 0; i <= (0x3A9 - 0x3A8); i++, counter++) {
    QPushButton *btn = new QPushButton(QString(QChar(i + 0x3A8)));
    btn->setMaximumWidth(40);
    btn->setFlat(true);
    btn->setAutoDefault(false);
    buttons->addButton(btn, counter + 1);
    gridLayout->addWidget(btn, counter / 5, counter % 5);
  }

  numButtons = counter;
}
コード例 #17
0
    //  NewPromotedClassPanel
    NewPromotedClassPanel::NewPromotedClassPanel(const QStringList &baseClasses,
                                                   int selectedBaseClass,
                                                   QWidget *parent) :
        QGroupBox(parent),
        m_baseClassCombo(new  QComboBox),
        m_classNameEdit(new QLineEdit),
        m_includeFileEdit(new QLineEdit),
        m_globalIncludeCheckBox(new QCheckBox),
        m_addButton(new QPushButton(tr("Add")))
    {
        setTitle(tr("New Promoted Class"));
        setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
        QHBoxLayout *hboxLayout = new QHBoxLayout(this);

        m_classNameEdit->setValidator(new QRegExpValidator(QRegExp(QStringLiteral("[_a-zA-Z:][:_a-zA-Z0-9]*")), m_classNameEdit));
        connect(m_classNameEdit,   &QLineEdit::textChanged,
                this, &NewPromotedClassPanel::slotNameChanged);
        connect(m_includeFileEdit, &QLineEdit::textChanged,
                this, &NewPromotedClassPanel::slotIncludeFileChanged);

        m_baseClassCombo->setEditable(false);
        m_baseClassCombo->addItems(baseClasses);
        if (selectedBaseClass != -1)
            m_baseClassCombo->setCurrentIndex(selectedBaseClass);

        // Grid
        QFormLayout *formLayout = new QFormLayout();
        formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); // Mac
        formLayout->addRow(tr("Base class name:"),     m_baseClassCombo);
        formLayout->addRow(tr("Promoted class name:"), m_classNameEdit);
        formLayout->addRow(tr("Header file:"),         m_includeFileEdit);
        formLayout->addRow(tr("Global include"),       m_globalIncludeCheckBox);
        hboxLayout->addLayout(formLayout);
        hboxLayout->addItem(new QSpacerItem(15, 0, QSizePolicy::Fixed, QSizePolicy::Ignored));
        // Button box
        QVBoxLayout *buttonLayout = new QVBoxLayout();

        m_addButton->setAutoDefault(false);
        connect(m_addButton, &QAbstractButton::clicked, this, &NewPromotedClassPanel::slotAdd);
        m_addButton->setEnabled(false);
        buttonLayout->addWidget(m_addButton);

        QPushButton *resetButton = new QPushButton(tr("Reset"));
        resetButton->setAutoDefault(false);
        connect(resetButton, &QAbstractButton::clicked, this, &NewPromotedClassPanel::slotReset);

        buttonLayout->addWidget(resetButton);
        buttonLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::Expanding));
        hboxLayout->addLayout(buttonLayout);

        enableButtons();
    }
コード例 #18
0
ファイル: multisigdialog.cpp プロジェクト: michaili/PIVX
void MultisigDialog::on_addDestinationButton_clicked()
{
    QFrame* destinationFrame = new QFrame(ui->destinationsScrollAreaContents);
    destinationFrame->setObjectName(QStringLiteral("destinationFrame"));
    destinationFrame->setFrameShape(QFrame::StyledPanel);
    destinationFrame->setFrameShadow(QFrame::Raised);

    QVBoxLayout* frameLayout = new QVBoxLayout(destinationFrame);
    frameLayout->setObjectName(QStringLiteral("destinationFrameLayout"));
    QHBoxLayout* destinationLayout = new QHBoxLayout();
    destinationLayout->setSpacing(0);
    destinationLayout->setObjectName(QStringLiteral("destinationLayout"));
    QLabel* destinationAddressLabel = new QLabel(destinationFrame);
    destinationAddressLabel->setObjectName(QStringLiteral("destinationAddressLabel"));

    destinationLayout->addWidget(destinationAddressLabel);

    QValidatedLineEdit* destinationAddress = new QValidatedLineEdit(destinationFrame);
    destinationAddress->setObjectName(QStringLiteral("destinationAddress"));

    destinationLayout->addWidget(destinationAddress);

    QSpacerItem* horizontalSpacer = new QSpacerItem(10, 20, QSizePolicy::Fixed, QSizePolicy::Minimum);
    destinationLayout->addItem(horizontalSpacer);

    QLabel* destinationAmountLabel = new QLabel(destinationFrame);
    destinationAmountLabel->setObjectName(QStringLiteral("destinationAmountLabel"));

    destinationLayout->addWidget(destinationAmountLabel);

    BitcoinAmountField* destinationAmount = new BitcoinAmountField(destinationFrame);
    destinationAmount->setObjectName(QStringLiteral("destinationAmount"));

    destinationAddressLabel->setText(QApplication::translate("MultisigDialog", strprintf("%i. Address: ", ui->destinationsList->count()+1).c_str(), 0));
    destinationAmountLabel->setText(QApplication::translate("MultisigDialog", "Amount: ", 0));

    destinationLayout->addWidget(destinationAmount);

    QPushButton* destinationDeleteButton = new QPushButton(destinationFrame);
    destinationDeleteButton->setObjectName(QStringLiteral("destinationDeleteButton"));
    QIcon icon;
    icon.addFile(QStringLiteral(":/icons/remove"), QSize(), QIcon::Normal, QIcon::Off);
    destinationDeleteButton->setIcon(icon);
    destinationDeleteButton->setAutoDefault(false);
    connect(destinationDeleteButton, SIGNAL(clicked()), this, SLOT(deleteFrame()));
    destinationLayout->addWidget(destinationDeleteButton);

    frameLayout->addLayout(destinationLayout);

    ui->destinationsList->addWidget(destinationFrame);
}
コード例 #19
0
ファイル: filterdlgimpl.cpp プロジェクト: Iownnoname/qt
void FilterDlgImpl::_setupUi()
{
    QGridLayout *gridLayout = new QGridLayout(this);
    gridLayout->setObjectName(QStringLiteral("gridLayout"));

    QHBoxLayout *horizontalLayout = new QHBoxLayout();
    horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));

    QLabel *label = new QLabel(tr("Filtred type operations:"), this);
    horizontalLayout->addWidget(label);

    m_typeTrasnaction = new QComboBox(this);

    QIcon icon;
    icon.addFile(QStringLiteral(":/img/cash2.png"), QSize(), QIcon::Normal, QIcon::Off);
    m_typeTrasnaction->addItem(icon, tr("All"));

    QIcon icon1;
    icon1.addFile(QStringLiteral(":/img/cash-add.png"), QSize(), QIcon::Normal, QIcon::Off);
    m_typeTrasnaction->addItem(icon1, tr("Income"));

    QIcon icon2;
    icon2.addFile(QStringLiteral(":/img/cash-delete.png"), QSize(), QIcon::Normal, QIcon::Off);
    m_typeTrasnaction->addItem(icon2, tr("Expense"));

    horizontalLayout->addWidget(m_typeTrasnaction);

    gridLayout->addLayout(horizontalLayout, 0, 0, 1, 1);

    QPushButton *filterBtn = new QPushButton(tr("Filter"), this);
    filterBtn->setDefault(true);

    gridLayout->addWidget(filterBtn, 0, 1, 1, 1);

    m_query = new QueryTable(this);
    gridLayout->addWidget(m_query, 1, 0, 2, 1);

    QPushButton *closeBtn = new QPushButton(tr("Close"), this);
    closeBtn->setAutoDefault(true);
    closeBtn->setDefault(false);
    gridLayout->addWidget(closeBtn, 1, 1, 1, 1);

    QSpacerItem *verticalSpacer = new QSpacerItem(20, 194, QSizePolicy::Minimum, QSizePolicy::Expanding);
    gridLayout->addItem(verticalSpacer, 2, 1, 1, 1);

    QWidget::setTabOrder(filterBtn, closeBtn);

    connect(closeBtn, SIGNAL(clicked()), this, SLOT(reject()));
    connect(filterBtn, SIGNAL(clicked()), this, SLOT(slot_filter()));
}
コード例 #20
0
// ----------------- CodeDialog
CodeDialog::CodeDialog(QWidget *parent) :
    QDialog(parent),
    m_impl(new CodeDialogPrivate)
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    QVBoxLayout *vBoxLayout = new QVBoxLayout;

    // Edit tool bar
    QToolBar *toolBar = new QToolBar;

    const QIcon saveIcon = createIconSet(QLatin1String("filesave.png"));
    QAction *saveAction = toolBar->addAction(saveIcon, tr("Save..."));
    connect(saveAction, SIGNAL(triggered()), this, SLOT(slotSaveAs()));

    const QIcon copyIcon = createIconSet(QLatin1String("editcopy.png"));
    QAction *copyAction = toolBar->addAction(copyIcon, tr("Copy All"));
    connect(copyAction, SIGNAL(triggered()), this, SLOT(copyAll()));

    QAction *findAction = toolBar->addAction(
                              TextEditFindWidget::findIconSet(),
                              tr("&Find in Text..."),
                              m_impl->m_findWidget, SLOT(activate()));
    findAction->setShortcut(QKeySequence::Find);

    vBoxLayout->addWidget(toolBar);

    // Edit
    m_impl->m_textEdit->setReadOnly(true);
    m_impl->m_textEdit->setMinimumSize(QSize(
                                           m_impl->m_findWidget->minimumSize().width(),
                                           500));
    vBoxLayout->addWidget(m_impl->m_textEdit);

    // Find
    m_impl->m_findWidget->setTextEdit(m_impl->m_textEdit);
    vBoxLayout->addWidget(m_impl->m_findWidget);

    // Button box
    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    // Disable auto default
    QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
    closeButton->setAutoDefault(false);
    vBoxLayout->addWidget(buttonBox);

    setLayout(vBoxLayout);
}
コード例 #21
0
ファイル: projectdialog.cpp プロジェクト: golosio/XRayStudio
ProjectDialog::ProjectDialog(MainWindow *w, QString proj_dir, bool new_proj_flag, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ProjectDialog)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_DeleteOnClose);
    mainWindow = w;
    newProjectFlag = new_proj_flag;
    ui->projectFolderEdit->setText(proj_dir);
    QPushButton *nextButton;
    if (newProjectFlag) nextButton = new QPushButton(tr("Next >"));
    else nextButton = new QPushButton(tr("Ok"));
    nextButton->setAutoDefault(true);
    nextButton->setDefault(true);
    ui->buttonBox->addButton(nextButton, QDialogButtonBox::ActionRole);
}
コード例 #22
0
ファイル: CrashReporter.cpp プロジェクト: martijns/mumble
CrashReporter::CrashReporter(QWidget *p) : QDialog(p) {
    setWindowTitle(tr("Mumble Crash Report"));

    QVBoxLayout *vbl= new QVBoxLayout(this);

    QLabel *l;

    l = new QLabel(tr("<p><b>We're terribly sorry, but it seems Mumble has crashed. Do you want to send a crash report to the Mumble developers?</b></p>"
                      "<p>The crash report contains a partial copy of Mumble's memory at the time it crashed, and will help the developers fix the problem.</p>"));

    vbl->addWidget(l);

    QHBoxLayout *hbl = new QHBoxLayout();

    qleEmail = new QLineEdit(g.qs->value(QLatin1String("crashemail")).toString());
    l = new QLabel(tr("Email address (optional)"));
    l->setBuddy(qleEmail);

    hbl->addWidget(l);
    hbl->addWidget(qleEmail, 1);
    vbl->addLayout(hbl);

    qteDescription=new QTextEdit();
    l->setBuddy(qteDescription);
    l = new QLabel(tr("Please describe briefly, in English, what you were doing at the time of the crash"));

    vbl->addWidget(l);
    vbl->addWidget(qteDescription, 1);

    QPushButton *pbOk = new QPushButton(tr("Send Report"));
    pbOk->setDefault(true);

    QPushButton *pbCancel = new QPushButton(tr("Don't send report"));
    pbCancel->setAutoDefault(false);

    QDialogButtonBox *dbb = new QDialogButtonBox(Qt::Horizontal);
    dbb->addButton(pbOk, QDialogButtonBox::AcceptRole);
    dbb->addButton(pbCancel, QDialogButtonBox::RejectRole);
    connect(dbb, SIGNAL(accepted()), this, SLOT(accept()));
    connect(dbb, SIGNAL(rejected()), this, SLOT(reject()));
    vbl->addWidget(dbb);

    qelLoop = new QEventLoop(this);
    qpdProgress = NULL;
    qnrReply = NULL;
}
コード例 #23
0
ファイル: poppyupper.cpp プロジェクト: EricRFMA/PopUpperLib
//! Set the label (text) in the wandering dialog box.  Takes care of sizing the dialog so the text will
//! fit
//! Also has to create & position the "OK" button
void PoppyUpper::setLabel(const QString &theLabel)
{
  // create a new label, and resize everything to fit
  QVBoxLayout *layout = new QVBoxLayout;
  QLabel *myLabel = new QLabel(theLabel, this);
  QPushButton *goAway = new QPushButton("Go Away!", this);

  goAway->setAutoDefault(true);
  connect(goAway, &QPushButton::clicked,
          this, &PoppyUpper::goAwayClicked);

  layout->addWidget(myLabel);
  layout->addWidget(goAway);
  layout->setSpacing(10);  // make some elbow room
  setLayout(layout);
  adjustSize();
}
コード例 #24
0
ファイル: multisigdialog.cpp プロジェクト: michaili/PIVX
void MultisigDialog::on_addPrivKeyButton_clicked()
{
    if(isFirstPrivKey){//on first click the scroll area must show
        isFirstPrivKey = false;
        ui->keyScrollArea->show();
    }

    if(ui->keyList->count() > 14){
        ui->signButtonStatus->setStyleSheet("QTextEdit{ color: red }");
        ui->signButtonStatus->setText(tr("Maximum (15)"));
        return;
    }

    QFrame* keyFrame = new QFrame(ui->keyScrollAreaContents);

    keyFrame->setObjectName(QStringLiteral("keyFrame"));
    keyFrame->setFrameShape(QFrame::StyledPanel);
    keyFrame->setFrameShadow(QFrame::Raised);

    QHBoxLayout* keyLayout = new QHBoxLayout(keyFrame);
    keyLayout->setObjectName(QStringLiteral("keyLayout"));

    QLabel* keyLabel = new QLabel(keyFrame);
    keyLabel->setObjectName(QStringLiteral("keyLabel"));
    keyLabel->setText(QApplication::translate("MultisigDialog", strprintf("Key %i: ", (ui->keyList->count()+1)).c_str(), 0));
    keyLayout->addWidget(keyLabel);

    QLineEdit* key = new QLineEdit(keyFrame);
    key->setObjectName(QStringLiteral("key"));
    key->setEchoMode(QLineEdit::Password);
    keyLayout->addWidget(key);

    QPushButton* keyDeleteButton = new QPushButton(keyFrame);
    keyDeleteButton->setObjectName(QStringLiteral("keyDeleteButton"));
    QIcon icon;
    icon.addFile(QStringLiteral(":/icons/remove"), QSize(), QIcon::Normal, QIcon::Off);
    keyDeleteButton->setIcon(icon);
    keyDeleteButton->setAutoDefault(false);
    connect(keyDeleteButton, SIGNAL(clicked()), this, SLOT(deleteFrame()));
    keyLayout->addWidget(keyDeleteButton);

    ui->keyList->addWidget(keyFrame);
}
コード例 #25
0
void symbolDialog::initMajGreekChars()
{
new QPushButton(QChar(0x393), GroupBox1, 0);
new QPushButton(QChar(0x394), GroupBox1, 0);
new QPushButton(QChar(0x398), GroupBox1, 0);
new QPushButton(QChar(0x39B), GroupBox1, 0);
new QPushButton(QChar(0x39E), GroupBox1, 0);
new QPushButton(QChar(0x3A0), GroupBox1, 0);
new QPushButton(QChar(0x3A3), GroupBox1, 0);
new QPushButton(QChar(0x3A6), GroupBox1, 0);
new QPushButton(QChar(0x3A8), GroupBox1, 0);
new QPushButton(QChar(0x3A9), GroupBox1, 0);

for (int i=0;i<GroupBox1->count();i++)
	{
	QPushButton *btn = (QPushButton *) GroupBox1->find (i);
	btn->setMaximumWidth(30);
	btn->setFlat ( true );
	btn->setAutoDefault (false);
	}
}
コード例 #26
0
ファイル: NewItemDialog.cpp プロジェクト: moorepants/BTKCore
NewItemDialog::NewItemDialog(QWidget* parent)
: QDialog(parent)
{
  this->setupUi(this);
#if defined(Q_OS_MAC)
  this->setWindowFlags(Qt::Sheet);
  this->setWindowModality(Qt::WindowModal);
#elif defined(Q_OS_WIN)
  this->resize(330, 170);
#endif
  QPushButton* ok = this->buttonBox->button(QDialogButtonBox::Ok);
  ok->setDefault(true);
  ok->setEnabled(false);
  QPushButton* cancel = this->buttonBox->button(QDialogButtonBox::Cancel);
  cancel->setAutoDefault(false);
  
  connect(this->existingRadioButton, SIGNAL(toggled(bool)), this, SLOT(toggleExistingItem(bool)));
  connect(this->newRadioButton, SIGNAL(toggled(bool)), this, SLOT(toggleNewItem(bool)));
  connect(this->existingComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateButtonState(int)));
  connect(this->newLineEdit, SIGNAL(textChanged(QString)), this, SLOT(updateButtonState(QString)));
  
  this->existingComboBox->setEnabled(false);
  this->newRadioButton->setChecked(true);
};
コード例 #27
0
SmbConfConfigWidget::SmbConfConfigWidget(QWidget* parent) 
  : QWidget(parent,"configWidget")
{  

  QVBoxLayout *layout = new QVBoxLayout(this,5);

  QLabel *lbl = new QLabel(i18n("<p>The SAMBA configuration file <strong>'smb.conf'</strong>" \
                                " could not be found;</p>" \
                                "make sure you have SAMBA installed.\n\n"), this);

  QHBoxLayout *hbox = new QHBoxLayout(this);
  QPushButton *btn = new QPushButton(i18n("Specify Location"), this);
  connect(btn, SIGNAL(pressed()), this, SLOT( btnPressed()));

  btn->setDefault(false);
  btn->setAutoDefault(false);

  hbox->addStretch();
  hbox->addWidget(btn);

  layout->addWidget(lbl);
  layout->addLayout(hbox);
  layout->addStretch();
}
コード例 #28
0
ファイル: NewNameDlg.cpp プロジェクト: subprotocol/xflr5
void NewNameDlg::SetupLayout()
{
	QVBoxLayout *MainLayout = new QVBoxLayout;
	m_pctrlName = new QLineEdit(this);
	QHBoxLayout *CommandButtons = new QHBoxLayout;
	OKButton = new QPushButton(tr("OK"));
	OKButton->setAutoDefault(false);
	QPushButton *CancelButton = new QPushButton(tr("Cancel"));
	CancelButton->setAutoDefault(false);
	CommandButtons->addStretch(1);
	CommandButtons->addWidget(OKButton);
	CommandButtons->addStretch(1);
	CommandButtons->addWidget(CancelButton);
	CommandButtons->addStretch(1);
	
	MainLayout->addStretch(1);
	MainLayout->addWidget(m_pctrlName);
	MainLayout->addStretch(1);
	MainLayout->addLayout(CommandButtons);	
	setLayout(MainLayout);
	
	connect(OKButton, SIGNAL(clicked()),this, SLOT(OnOK()));
	connect(CancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
コード例 #29
0
//Constructors:
ActiveLearningDialog::ActiveLearningDialog(/*std::string validate,*/std::vector<QImage> snapshot, 
										   vtkSmartPointer<vtkTable> table,int classval,std::vector<int> rowvals,
										   int num_classes,QWidget *parent)
: QDialog(parent)
{
	this->setWindowTitle(tr("Validation Window: Validate Classifier Performance"));
	//this->setModal(true);
	this->setModal(false);

	rejectFlag = false;
	
	queries = rowvals;
	num_of_classes = num_classes;

	query_label.resize(rowvals.size());
	buttongroup.resize(rowvals.size());

	//Master Layout
	QGridLayout * layout = new QGridLayout;
	
	QHBoxLayout *topRow = new QHBoxLayout;
	std::vector<int>::iterator it; 
	
	//set font    
	QFont font;
	font.setPointSize(15);
	font.setBold(true);
	
	QString x = "All these samples have been classified as class  "+QString::number(classval);
	QLabel *ClassLabel = new QLabel(x, this);
	ClassLabel->setFont(font);
	layout->addWidget(ClassLabel,0,0);


	//Shows 5 samples at a time
	for(int i=0;i<snapshot.size();++i)
	{
		std::vector<QHBoxLayout *> rows  = Validation_Sample_Details(snapshot[i],table,classval,rowvals[i],i,num_classes);
		//layout->addLayout(rows[0],2*i+1,0,0);
		//layout->addLayout(rows[1],2*i+2,0,0);
		layout->addLayout(rows[0],i+1,0,0);
		layout->addLayout(rows[1],i+1,1,0);
	}

	//Done Button
	QPushButton *doneButton = new QPushButton("Done");
	connect(doneButton, SIGNAL(clicked()), this, SLOT(finished()));
	doneButton->setDefault(false);
	doneButton->setAutoDefault(false);


	//Cancel Button
	QPushButton *cancelButton = new QPushButton("Cancel");
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(rejectAction()));
	cancelButton->setDefault(false);
	cancelButton->setAutoDefault(false);

	//next Button
	QPushButton *nextButton = new QPushButton("Next");
	connect(nextButton, SIGNAL(clicked()), this, SLOT(nextquery()));
	nextButton->setDefault(false);
	nextButton->setAutoDefault(true);

	//Top-row of the window 
	QHBoxLayout *finalRow = new QHBoxLayout;
	finalRow->addWidget(nextButton,0,0);
	finalRow->addWidget(doneButton,0,0);
	finalRow->addWidget(cancelButton,0,0);

	layout->addLayout(finalRow,14,0,0);
	this->setLayout(layout);

	for(int i =0 ; i<query_label.size() ; ++i)
	{
		query_label[i].second = classval;// Used to check if no radiobutton was selected for any sample
	}

	//QLabel *channelLabel = new QLabel("Please ensure all the relevant channels which might affect classification are ON ", this);	
	this->resize(1200,1200);

}
コード例 #30
0
//Constructors:
ActiveLearningDialog::ActiveLearningDialog(std::vector<QImage> snapshot, vtkSmartPointer<vtkTable> table,int num_classes,std::vector<int> active_query,std::vector<int>top_feats,QWidget *parent)
: QDialog(parent)
{
	rejectFlag = false;
	queries = active_query;
	num_of_classes = num_classes;
	query_label.resize(snapshot.size());
	buttongroup.resize(snapshot.size());

	this->setWindowTitle(tr("Active Learning Window: Specify Class"));
	this->setModal(false);
	//Master Layout
	QGridLayout * layout = new QGridLayout;


	for(int i=0;i<snapshot.size();++i)
	{
	std::vector<QHBoxLayout *> rows  = Sample_Details(snapshot[i],table,num_classes,active_query[i],top_feats,i);
	layout->addLayout(rows[0],2*i,0,0);
	layout->addLayout(rows[1],2*i+1,0,0);
	}
	
	//Sample_Details(snapshot,table,num_classes,active_query,top_feats);
	////QLabel *channelLabel = new QLabel("Please ensure all the relevant channels which might affect classification are ON ", this);	
	////Master Layout
	//layout->addLayout(topRow,2,0,0);
	//layout->addLayout(botRow,3,0,0);


	//Done Button
	QPushButton *doneButton = new QPushButton("Done");
	connect(doneButton, SIGNAL(clicked()), this, SLOT(StartClassification()));
	doneButton->setDefault(false);
	doneButton->setAutoDefault(false);


	QPushButton *nextButton = new QPushButton("Next");
	connect(nextButton, SIGNAL(clicked()), this, SLOT(Retrain()));
	nextButton->setDefault(false);
	nextButton->setAutoDefault(true);


	//Cancel Button
	QPushButton *cancelButton = new QPushButton("Cancel");
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
	cancelButton->setDefault(false);
	cancelButton->setAutoDefault(false);

	//Top-row of the window 
	QHBoxLayout *finalRow = new QHBoxLayout;
	finalRow->addWidget(nextButton,0,0);
	finalRow->addWidget(doneButton,0,0);
	finalRow->addWidget(cancelButton,0,0);

	layout->addLayout(finalRow,2*snapshot.size()+2,0,0);
	this->setLayout(layout);
	
	
	for(int i =0 ; i<query_label.size() ; ++i)
	{
		query_label[i].second = -1;// Used to check if no radiobutton was selected for any sample
	}

	//QLabel *channelLabel = new QLabel("Please ensure all the relevant channels which might affect classification are ON ", this);	
	this->resize(300,300);
}