コード例 #1
0
ファイル: DlgSelectVars.cpp プロジェクト: cephdon/OMOptim
DlgSelectVars::DlgSelectVars(MOVector<Variable> * variables, QList<VariableCausality> causalities,MOVector<Variable>* alreadySelected)
{
    _useOpt = false;
    _variables = variables;

    if(alreadySelected)
        _selectedVars=alreadySelected;
    else
        _selectedVars=new MOVector<Variable>(false);

    QGridLayout* allLayout = new QGridLayout(this);
    QGridLayout* varLayout = new QGridLayout(this);

    widgetSelectVars = new WidgetSelectVars(_variables,this,causalities,_selectedVars);
    varLayout->addWidget(widgetSelectVars);

    pushOk = new QPushButton("Ok",this);
    pushCancel = new QPushButton("Cancel",this);

    allLayout->addLayout(varLayout,0,0,1,3);
    allLayout->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum),1,0);
    allLayout->addWidget(pushCancel,1,1,1,1);
    allLayout->addWidget(pushOk,1,2,1,1);
    this->setLayout(allLayout);

    connect(pushOk,SIGNAL(clicked()),this,SLOT(pushedOk()));
    connect(pushCancel,SIGNAL(clicked()),this,SLOT(pushedCancel()));
}
コード例 #2
0
CompositeEffectConfigWidget::CompositeEffectConfigWidget(QWidget *parent)
        : KoFilterEffectConfigWidgetBase(parent), m_effect(0)
{
    QGridLayout * g = new QGridLayout(this);

    g->addWidget(new QLabel(i18n("Operation"), this), 0, 0);

    m_operation = new KComboBox(this);
    m_operation->addItem("Over");
    m_operation->addItem("In");
    m_operation->addItem("Out");
    m_operation->addItem("Atop");
    m_operation->addItem("Xor");
    m_operation->addItem("Arithmetic");
    g->addWidget(m_operation, 0, 1);

    m_arithmeticWidget = new QWidget(this);
    QGridLayout * arithmeticLayout = new QGridLayout(m_arithmeticWidget);
    for (int i = 0; i < 4; ++i) {
        m_k[i] = new KDoubleNumInput(m_arithmeticWidget);
        arithmeticLayout->addWidget(new QLabel(QString("k%1").arg(i + 1)), i / 2, (2*i) % 4);
        arithmeticLayout->addWidget(m_k[i], i / 2, (2*i + 1) % 4);
        connect(m_k[i], SIGNAL(valueChanged(double)), this, SLOT(valueChanged()));
    }
    m_arithmeticWidget->setContentsMargins(0, 0, 0, 0);
    g->addWidget(m_arithmeticWidget, 1, 0, 1, 2);
    g->addItem(new QSpacerItem(0, 1, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding), 2, 0);

    connect(m_operation, SIGNAL(currentIndexChanged(int)), this, SLOT(operationChanged(int)));
}
コード例 #3
0
CreateFolderDialog::CreateFolderDialog(QWidget *parent) :
    QFrame(parent)
  , m_pNameEdit(new QLineEdit(this))
  , m_pLabel(new QLabel("Enter folder name:", this))
{
	setFixedHeight(100);

	QPushButton* pOkBut = new QPushButton("OK", this);
	QPushButton* pCancelBut = new QPushButton("Cancel", this);
	connect(pOkBut, SIGNAL(clicked()), SLOT(createFolder()));
	connect(pCancelBut, SIGNAL(clicked()), SIGNAL(Close()));
    pOkBut->setObjectName("ok_but");
    pCancelBut->setObjectName("cancel_but");
    pOkBut->setFixedSize(70, 26);
    pCancelBut->setFixedSize(70, 26);
    m_pLabel->setObjectName("question_label");

	pOkBut->setDefault(true);

	QGridLayout* pMainLayout = new QGridLayout(this);
	pMainLayout->addWidget(m_pLabel, 0, 0, 1, 2);
	pMainLayout->addWidget(m_pNameEdit, 1, 0, 1, 3);
	pMainLayout->addWidget(pOkBut, 2, 1);
	pMainLayout->addWidget(pCancelBut, 2, 2);

	QSpacerItem* pSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Fixed);
    pMainLayout->addItem(pSpacer, 2, 0);

}
コード例 #4
0
WQPrintDialogPage::WQPrintDialogPage(QWidget *parent) : QWidget(parent)
{
  setWindowTitle(i18n("Vocabulary Options"));

  QGridLayout * l = new QGridLayout(this);
  l->setSpacing(KDialog::spacingHint());
  l->setMargin(KDialog::marginHint());
  QSpacerItem * s = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
  l->addItem(s, 1, 0, 1, 1);

  g = new QGroupBox(i18n("Select Type of Printout"), this );
  QVBoxLayout * vboxLayout = new QVBoxLayout(g);
  vboxLayout->setSpacing(KDialog::spacingHint());
  vboxLayout->setMargin(KDialog::marginHint());

  bg = new QButtonGroup(this);

  QRadioButton *rb = new QRadioButton(i18n("Vocabulary &list"),g);
  rb->setWhatsThis(i18n("Select to print the vocabulary as displayed in the editor"));
  vboxLayout->addWidget(rb);
  bg->addButton(rb, Prefs::EnumPrintStyle::List);

  rb = new QRadioButton(i18n("Vocabulary e&xam"),g);
  rb->setWhatsThis(i18n("Select to print the vocabulary as a vocabulary exam"));
  vboxLayout->addWidget(rb);
  bg->addButton(rb, Prefs::EnumPrintStyle::Exam);

  rb = new QRadioButton(i18n("&Flashcards"),g);
  rb->setWhatsThis(i18n("Select to print flashcards"));
  vboxLayout->addWidget(rb);
  bg->addButton(rb, Prefs::EnumPrintStyle::Flashcard);

  l->addWidget(g, 0, 0, 1, 1);
}
コード例 #5
0
PoolSizeTriggerSettingWidget::PoolSizeTriggerSettingWidget(QWidget *parent)
    : AbstractTriggerSettingWidget(parent)
{
    m_VectorLabel = new QLabel(this);
    m_VectorLabel->setText(tr("Size of the pool that the trigger targets"));
    m_SideLabel = new QLabel(this);
    m_SideLabel->setText(tr("Side of the pool size where the trigger passes"));
    m_vectorEdit = new QLineEdit(this);
    m_vectorEdit->setToolTip(tr("Accepts Vectors"));
    m_vectorEdit->setValidator(BloombergVector().GetValidator(this));
    m_sideCombo = new QComboBox(this);
    m_sideCombo->addItem(tr("Bigger"), static_cast<quint8>(PoolSizeTrigger::TriggerSide::Bigger));
    m_sideCombo->addItem(tr("Smaller"), static_cast<quint8>(PoolSizeTrigger::TriggerSide::Smaller));
    m_sideCombo->addItem(tr("Exactly"), static_cast<quint8>(PoolSizeTrigger::TriggerSide::Exactly));
    m_sideCombo->addItem(tr("Bigger or Equal"), static_cast<quint8>(PoolSizeTrigger::TriggerSide::BiggerOrEqual));
    m_sideCombo->addItem(tr("Smaller or Equal"), static_cast<quint8>(PoolSizeTrigger::TriggerSide::SmallerOrEqual));

    connect(m_vectorEdit, &QLineEdit::textChanged, this, &AbstractTriggerSettingWidget::somethingChanged);
    connect(m_sideCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &AbstractTriggerSettingWidget::somethingChanged);

    QGridLayout* mainLay = new QGridLayout(this);
    mainLay->addWidget(m_VectorLabel, 0, 0);
    mainLay->addWidget(m_vectorEdit, 0, 1);
    mainLay->addWidget(m_SideLabel, 1, 0);
    mainLay->addWidget(m_sideCombo, 1, 1);
    mainLay->addItem(new QSpacerItem(20, 20, QSizePolicy::Preferred, QSizePolicy::Expanding), 2, 0, 1, 2);
}
コード例 #6
0
ファイル: AddressDialog.cpp プロジェクト: JERUKA9/QMPlay2
AddressDialog::AddressDialog( QWidget *p ) :
	QDialog( p ), addrB( Qt::Vertical )
{
	setWindowTitle( tr( "Dodaj adres" ) );

	QDialogButtonBox *buttonBox = new QDialogButtonBox;
	buttonBox->setStandardButtons( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
	connect( buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
	connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );

	QComboBox &pB = addrB.getComboBox();
	int idx = pB.findText( QMPlay2Core.getSettings().getString( "AddressDialog/Choice" ) );
	if ( idx > -1 )
		pB.setCurrentIndex( idx );

	addAndPlayB.setText( tr( "Odtwarzaj" ) );
	addAndPlayB.setChecked( QMPlay2Core.getSettings().getBool( "AddressDialog/AddAndPlay", true ) );

	QGridLayout *layout = new QGridLayout( this );
	layout->addWidget( &addrB, 0, 0, 1, 2 );
	layout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ), 1, 0, 1, 2 ); //vSpacer
	layout->addWidget( &addAndPlayB, 2, 0, 1, 1 );
	layout->addWidget( buttonBox, 2, 1, 1, 1 );
	layout->setMargin( 3 );

	addrB.setFocus();
	resize( 625, 0 );
}
コード例 #7
0
ファイル: errors.cpp プロジェクト: cobr123/qtVlc
ErrorsDialog::ErrorsDialog( intf_thread_t *_p_intf )
             : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf )
{
    setWindowTitle( qtr( "Errors" ) );
    setWindowRole( "vlc-errors" );
    resize( 500 , 300 );

    QGridLayout *layout = new QGridLayout( this );

    QDialogButtonBox *buttonBox = new QDialogButtonBox;
    QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
    QPushButton *clearButton = new QPushButton( qtr( "&Clear" ) );
    buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
    buttonBox->addButton( clearButton, QDialogButtonBox::ActionRole );

    messages = new QTextEdit();
    messages->setReadOnly( true );
    messages->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    stopShowing = new QCheckBox( qtr( "Hide future errors" ) );

    layout->addWidget( messages, 0, 0, 1, 3 );
    layout->addWidget( stopShowing, 1, 0 );
    layout->addItem( new QSpacerItem( 200, 20, QSizePolicy::Expanding ), 2,0 );
    layout->addWidget( buttonBox, 2, 2 );

    CONNECT( buttonBox, accepted(), this, close() );
    BUTTONACT( clearButton, clear() );
    BUTTONACT( stopShowing, dontShow() );
}
コード例 #8
0
SoundUserConfig::SoundUserConfig(QWidget *parent, void *data, SoundPlugin *plugin)
        : SoundUserConfigBase(parent)
{
    m_plugin = plugin;
    SoundUserData *user_data = (SoundUserData*)data;
    string s;
    s = plugin->fullName(user_data->Alert);
    edtAlert->setText(QFile::decodeName(s.c_str()));
    QGridLayout *lay = static_cast<QGridLayout*>(layout());
    if (lay == NULL)
        return;
    unsigned n = 1;
    CommandDef *cmd;
    CommandsMapIterator it(m_plugin->core->messageTypes);
    while ((cmd = ++it) != NULL){
        MessageDef *def = (MessageDef*)(cmd->param);
        if ((def == NULL) || (def->base_type) || (cmd->icon == NULL) || (def->flags & MESSAGE_HIDDEN))
            continue;
        QLabel *lbl = new QLabel(this);
        lbl->setAlignment(AlignRight);
        lbl->setText(i18n(def->singular, def->plural, 1) + ":");
        lay->addWidget(lbl, n, 0);
        EditSound *snd = new EditSound(this);
        snd->setText(QFile::decodeName(m_plugin->messageSound(cmd->id, user_data).c_str()));
        lay->addWidget(snd, n, 1);
        m_sounds.insert(MAP_SOUND::value_type(cmd->id, snd));
        n++;
    }
    lay->addItem(new QSpacerItem(n, 1, QSizePolicy::Minimum, QSizePolicy::Expanding));

}
コード例 #9
0
DeviceWizardConnection::DeviceWizardConnection(QWidget *parent)
    : QWizardPage(parent)
{
    this->setTitle(tr("Add Power Supply"));
    this->setSubTitle(tr("Test the connection to your power supply"));
    this->setPixmap(QWizard::LogoPixmap, QPixmap(":/icons/device32.png"));
    QGridLayout *gridl = new QGridLayout();
    this->setLayout(gridl);

    this->devID = "";

    this->startTest = new QPushButton("Test connection");
    gridl->addWidget(this->startTest, 0, 0);
    gridl->addItem(new QSpacerItem(1, 1, QSizePolicy::Policy::Expanding,
                                   QSizePolicy::Policy::Minimum),
                   0, 1);
    this->txt = new QPlainTextEdit();
    this->txt->setReadOnly(true);
    this->txt->setStyleSheet(
        "QPlainTextEdit {background-color: #000000; color: #F3F3F3}");
    gridl->addWidget(this->txt, 1, 0, 1, 2);
    this->txt->setPlainText("Idle");

    this->t = std::unique_ptr<QThread>(new QThread());

    QObject::connect(this->startTest, &QPushButton::clicked, this,
                     &DeviceWizardConnection::testConnection);

    registerField("deviceIdentification", this, "deviceID");
}
コード例 #10
0
ファイル: githubmodule.cpp プロジェクト: arcan1s/reportabug
/**
 * @fn githubFinished
 */
void GithubModule::githubFinished(QNetworkReply *reply)
{
    if (debug) qDebug() << "[GithubModule]" << "[githubFinished]";
    if (debug) qDebug() << "[GithubModule]" << "[githubFinished]" << ":" << "Error state" << reply->error();
    if (debug) qDebug() << "[GithubModule]" << "[githubFinished]" << ":" << "Reply size" << reply->readBufferSize();

    bool state = true;
    QString answer = reply->readAll();
    if (debug) qDebug() << "[GithubModule]" << "[replyFinished]" << ":" << answer;
    QString messageBody, messageTitle;
    QMessageBox::Icon icon = QMessageBox::NoIcon;
    if (answer.contains(QString("\"html_url\":"))) {
        QString url;
        for (int i=0; i<answer.split(QChar(',')).count(); i++)
            if (answer.split(QChar(','))[i].split(QChar(':'))[0] == QString("\"html_url\"")) {
                url = answer.split(QChar(','))[i].split(QString("\"html_url\":"))[1].remove(QChar('"'));
                break;
            }
        messageBody += QString("%1\n").arg(QApplication::translate("Reportabug", "Message has been sended"));
        messageBody += QString("Url: %2").arg(url);
        messageTitle = QApplication::translate("Reportabug", "Done!");
        icon = QMessageBox::Information;
        state = true;
    }
    else if (answer.contains(QString("\"Bad credentials\""))) {
        messageBody += QApplication::translate("Reportabug", "Incorrect username or password");
        messageTitle = QApplication::translate("Reportabug", "Error!");
        icon = QMessageBox::Critical;
        state = false;
    }
    else {
        messageBody += QApplication::translate("Reportabug", "An error occurs");
        messageTitle = QApplication::translate("Reportabug", "Error!");
        icon = QMessageBox::Critical;
        state = false;
    }
    reply->deleteLater();

    QMessageBox messageBox;
    messageBox.setText(messageTitle);
    messageBox.setInformativeText(messageBody);
    messageBox.setIcon(icon);
    messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Retry);
    messageBox.setDefaultButton(QMessageBox::Ok);
    QSpacerItem *horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout *layout = (QGridLayout *)messageBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    int ret = messageBox.exec();

    switch (ret) {
    case QMessageBox::Ok:
        if (state) mainWindow->close();
        break;
    case QMessageBox::Retry:
        if (state) mainWindow->externalUpdateTab();
        break;
    default:
        break;
    }
}
コード例 #11
0
void MainWindow::generateReportFromDataRange()
{
    QString absolutePath = QFileDialog::getSaveFileName(this,"Zapisz raport", QString(), tr("Pdf document (*.pdf)"));

    if(absolutePath.trimmed().isEmpty())
        return;

    DialogBusy dialogBusy;
    dialogBusy.setModal(true);
    dialogBusy.setLabelText("Trwa generowanie raportu...");
    dialogBusy.show();

    this->ct->reports->reportFromDataRange(ui->reportDataRangeFrom->value(), ui->reportDataRangeTo->value(), this->getSelectedObjectName(), absolutePath);

    dialogBusy.close();

    QMessageBox msgBox;
    msgBox.setInformativeText(QString::fromUtf8("Raport został pomyślnie wygenerowany."));
    msgBox.setStandardButtons(QMessageBox::Ok);
    msgBox.setDefaultButton(QMessageBox::Ok);
    msgBox.setIcon(QMessageBox::Information);
    msgBox.setWindowTitle(QString::fromUtf8("Raport"));

    // workaround for not working setMinimumWidth:
    QSpacerItem* horizontalSpacer = new QSpacerItem(350, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout* layout = (QGridLayout*)msgBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());

    msgBox.exec();
}
コード例 #12
0
	void ItemHandlerGroupbox::Handle (const QDomElement& item, QWidget *pwidget)
	{
		QGroupBox *box = new QGroupBox (XSD_->GetLabel (item));
		box->setObjectName (item.attribute ("property"));
		QGridLayout *groupLayout = new QGridLayout ();
		groupLayout->setContentsMargins (2, 2, 2, 2);
		box->setLayout (groupLayout);
		box->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
		box->setCheckable (true);

		QVariant value = XSD_->GetValue (item);

		box->setChecked (value.toBool ());
		connect (box,
				SIGNAL (toggled (bool)),
				this,
				SLOT (updatePreferences ()));
		box->setProperty ("ItemHandler",
				QVariant::fromValue<QObject*> (this));

		XSD_->ParseEntity (item, box);

		QGridLayout *lay = qobject_cast<QGridLayout*> (pwidget->layout ());
		lay->addWidget (box, lay->rowCount (), 0, 1, 2);
		QSpacerItem *verticalSpacer = new QSpacerItem (10, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
		lay->addItem (verticalSpacer, lay->rowCount (), 0);
	}
コード例 #13
0
ファイル: annotationwidgets.cpp プロジェクト: bwegge/okular
QWidget * AnnotationWidget::createAppearanceWidget()
{
    QWidget * widget = new QWidget();
    QGridLayout * gridlayout = new QGridLayout( widget );

    QLabel * tmplabel = new QLabel( i18n( "&Color:" ), widget );
    gridlayout->addWidget( tmplabel, 0, 0, Qt::AlignRight );
    m_colorBn = new KColorButton( widget );
    m_colorBn->setColor( m_ann->style().color() );
    tmplabel->setBuddy( m_colorBn );
    gridlayout->addWidget( m_colorBn, 0, 1 );

    tmplabel = new QLabel( i18n( "&Opacity:" ), widget );
    gridlayout->addWidget( tmplabel, 1, 0, Qt::AlignRight );
    m_opacity = new KIntNumInput( widget );
    m_opacity->setRange( 0, 100 );
    m_opacity->setValue( (int)( m_ann->style().opacity() * 100 ) );
    m_opacity->setSuffix( i18nc( "Suffix for the opacity level, eg '80 %'", " %" ) );
    tmplabel->setBuddy( m_opacity );
    gridlayout->addWidget( m_opacity, 1, 1 );

    QWidget * styleWidget = createStyleWidget();
    if ( styleWidget )
        gridlayout->addWidget( styleWidget, 2, 0, 1, 2 );

    gridlayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Fixed, QSizePolicy::MinimumExpanding ), 3, 0 );

    connect( m_colorBn, SIGNAL(changed(QColor)), this, SIGNAL(dataChanged()) );
    connect( m_opacity, SIGNAL(valueChanged(int)), this, SIGNAL(dataChanged()) );

    return widget;
}
コード例 #14
0
void DrugEnginesPreferences::setDataToUi()
{
    // Get all IDrugEngine objects
    QList<DrugsDB::IDrugEngine *> engines = pluginManager()->getObjects<DrugsDB::IDrugEngine>();
    QGridLayout *scrollLayout = qobject_cast<QGridLayout*>(ui->scrollAreaWidgetContents->layout());
    scrollLayout->setSpacing(24);
    for(int i=0; i < engines.count(); ++i) {
        DrugsDB::IDrugEngine *engine = engines.at(i);
        // Create widget
//        QWidget *w = new QWidget(this);
//        QGridLayout *l = new QGridLayout(w);
//        w->setLayout(l);
//        l->setMargin(0);
        // with checkbox
        QCheckBox *box = new QCheckBox(this);
        box->setText(engine->shortName() + ", " + engine->name());
        box->setToolTip(engine->tooltip());
        box->setChecked(engine->isActive());
        box->setIcon(engine->icon());
        // and a small explanation
//        QTextBrowser *browser = new QTextBrowser(w);
//        browser->setText(engines.at(i));
        scrollLayout->addWidget(box, i, 0);
        connect(box, SIGNAL(clicked(bool)), engine, SLOT(setActive(bool)));
    }
    QSpacerItem *s = new QSpacerItem(20,20, QSizePolicy::Expanding, QSizePolicy::Expanding);
    scrollLayout->addItem(s, engines.count()+1, 0);
}
コード例 #15
0
void UIScaleFactorEditor::prepare()
{
    m_pMainLayout = new QGridLayout;
    if (!m_pMainLayout)
        return;
    QMargins margins = m_pMainLayout->contentsMargins();
    m_pMainLayout->setContentsMargins(0, margins.top(), 0, margins.bottom());
    m_pMonitorComboBox = new QComboBox;
    if (m_pMonitorComboBox)
    {
        m_pMainLayout->addWidget(m_pMonitorComboBox, 0, 0);
        m_pMonitorComboBox->insertItem(0, "All Monitors");
        connect(m_pMonitorComboBox ,static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
                this, &UIScaleFactorEditor::sltMonitorComboIndexChanged);
    }

    QGridLayout *pSliderLayout = new QGridLayout;
    pSliderLayout->setSpacing(0);
    m_pScaleSlider = new QIAdvancedSlider;
    {
        pSliderLayout->addWidget(m_pScaleSlider, 0, 0, 1, 3);
        m_pScaleSlider->setMinimum(100);
        m_pScaleSlider->setMaximum(200);
        m_pScaleSlider->setPageStep(10);
        m_pScaleSlider->setSingleStep(1);
        m_pScaleSlider->setTickInterval(10);
        m_pScaleSlider->setSnappingEnabled(true);
        connect(m_pScaleSlider, static_cast<void(QIAdvancedSlider::*)(int)>(&QIAdvancedSlider::valueChanged),
                this, &UIScaleFactorEditor::sltScaleSliderValueChanged);
    }

    m_pMinScaleLabel = new QLabel;
    if (m_pMinScaleLabel)
        pSliderLayout->addWidget(m_pMinScaleLabel, 1, 0);

    QSpacerItem *pSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
    if (pSpacer)
        pSliderLayout->addItem(pSpacer, 1, 1);

    m_pMaxScaleLabel = new QLabel;
    if (m_pMaxScaleLabel)
        pSliderLayout->addWidget(m_pMaxScaleLabel, 1, 2);

    m_pMainLayout->addLayout(pSliderLayout, 0, 1, 2, 1);

    m_pScaleSpinBox = new QSpinBox;
    if (m_pScaleSpinBox)
    {
        m_pMainLayout->addWidget(m_pScaleSpinBox, 0, 3);
        m_pScaleSpinBox->setSuffix("%");
        m_pScaleSpinBox->setMinimum(100);
        m_pScaleSpinBox->setMaximum(200);
        connect(m_pScaleSpinBox ,static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
                this, &UIScaleFactorEditor::sltScaleSpinBoxValueChanged);
    }

    configureScaleFactorMinMaxValues();
    setLayout(m_pMainLayout);
    retranslateUi();
}
コード例 #16
0
DeviceSettingArctechSelflearning::DeviceSettingArctechSelflearning(Device *device, QWidget *parent)
    : DeviceSetting(device, parent)
{
    QGridLayout *gridLayout = new QGridLayout(this);
    gridLayout->setSpacing(6);
    gridLayout->setMargin(9);
    gridLayout->setObjectName(QString::fromUtf8("gridLayout"));

    gridLayout->addItem( new QSpacerItem(20, 109, QSizePolicy::Minimum, QSizePolicy::Expanding), 0, 0 );

    QLabel *labelRemotecodeTitle = new QLabel(this);
    labelRemotecodeTitle->setObjectName(QString::fromUtf8("labelRemotecodeTitle"));
    labelRemotecodeTitle->setAlignment(Qt::AlignCenter);
    labelRemotecodeTitle->setText( tr("Remote code") );
    gridLayout->addWidget(labelRemotecodeTitle, 1, 0);

    QLabel *labelUnitcodeTitle = new QLabel(this);
    labelUnitcodeTitle->setObjectName(QString::fromUtf8("labelUnitcodeTitle"));
    labelUnitcodeTitle->setAlignment(Qt::AlignCenter);
    labelUnitcodeTitle->setText( tr("Unitcode") );
    gridLayout->addWidget(labelUnitcodeTitle, 1, 1);

    spinRemotecode = new QSpinBox(this);
    spinRemotecode->setObjectName(QString::fromUtf8("unitcode"));
    spinRemotecode->setMinimum(1);
    spinRemotecode->setMaximum(67108863);
    gridLayout->addWidget(spinRemotecode, 2, 0);

    spinUnitcode = new QSpinBox(this);
    spinUnitcode->setObjectName(QString::fromUtf8("unitcode"));
    spinUnitcode->setMinimum(1);
    spinUnitcode->setMaximum(16);
    gridLayout->addWidget(spinUnitcode, 2, 1);

    gridLayout->addItem( new QSpacerItem(20, 109, QSizePolicy::Minimum, QSizePolicy::Expanding), 3, 0 );

    spinRemotecode->setValue( device->parameter("house", "1").toInt() );
    spinUnitcode->setValue( device->parameter("unit", "1").toInt() );

    QPushButton *randomButton = new QPushButton( tr("Randomize"), this);
    connect(randomButton, SIGNAL(clicked()), this, SLOT(randomizeCode()));
    gridLayout->addWidget( randomButton, 3, 0 );

    //Seed the random number generator at widget creation
    srand( (unsigned int)time( NULL ) );

}
コード例 #17
0
QWizardPage *AuthenticationWizard::createMVPage()
{
	QWizardPage *page = new QWizardPage();
	page->setTitle(i18nc("@title", "Manual Verification"));

	QGridLayout *layout = new QGridLayout();
    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding), 0, 0);

	QLabel *lMessage1 = new QLabel(i18nc("@info",
                "Contact <b>%1</b> via another secure channel and verify that the following fingerprint is correct:", contact));
	lMessage1->setWordWrap(true);
	layout->addWidget(lMessage1);
    QLabel *lFingerprint = new QLabel(QLatin1String("<b>") + chAdapter->remoteFingerprint() + QLatin1String("</b>"));
    lFingerprint->setAlignment(Qt::AlignCenter);
    lFingerprint->setTextInteractionFlags(Qt::TextSelectableByMouse);
	layout->addWidget(lFingerprint);

	cbManualAuth = new QComboBox();
	cbManualAuth->addItem(i18nc("@item:inlistbox ...verified that", "I have not"));
	cbManualAuth->addItem(i18nc("@item:inlistbox ...verified that", "I have"));
	cbManualAuth->setSizeAdjustPolicy(QComboBox::AdjustToContents);

	if(chAdapter->otrTrustLevel() == KTp::OTRTrustLevelPrivate) {
		cbManualAuth->setCurrentIndex(1);
	} else {
		cbManualAuth->setCurrentIndex(0);
	}

	QLabel *lMessage2 = new QLabel(i18nc("@info:label I have...",
                "verified that this is in fact the correct fingerprint for <b>%1</b>.", contact));
	lMessage2->setWordWrap(true);

	QHBoxLayout *verifyLayout = new QHBoxLayout();
	verifyLayout->addWidget(cbManualAuth, 0, Qt::AlignLeft);
    verifyLayout->addSpacing(5);
	verifyLayout->addWidget(lMessage2, 1);

	QFrame *frame = new QFrame();
	frame->setLayout(verifyLayout);
	layout->addWidget(frame);

    layout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding), 6, 0);
    layout->setVerticalSpacing(15);
	page->setLayout(layout);

	return page;
}
コード例 #18
0
ファイル: AboutContainer.cpp プロジェクト: KDE/kwave
//***************************************************************************
void Kwave::AboutContributor::updateLayout()
{
    if (layout()) delete layout();

    int row = 0;
    if (!m_text[0] || !m_text[0]->text().isEmpty()) { ++row; }
    if (!m_text[1] || !m_text[1]->text().isEmpty()) { ++row; }
    if (!m_text[2] || !m_text[2]->text().isEmpty()) { ++row; }
    if (!m_text[3] || !m_text[3]->text().isEmpty()) { ++row; }

    QGridLayout *gbox;
    if (row == 0) {
	gbox = new QGridLayout(this);
	Q_ASSERT(gbox);
	if (!gbox) return;
	gbox->setSpacing(1);
	for (int i=0; i<4; ++i)
	    if (m_text[i]) m_text[i]->hide();
    } else {
	if (m_text[0] && m_text[0]->text().isEmpty()) {
	    gbox = new QGridLayout(this);
	    Q_ASSERT(gbox);
	    if (!gbox) return;
	    gbox->setMargin(frameWidth()+1);
	    gbox->setSpacing(2);
	} else {
	    gbox = new QGridLayout(this);
	    Q_ASSERT(gbox);
	    if (!gbox) return;
	    gbox->setMargin(frameWidth()+1);
	    gbox->setSpacing(2);
	    gbox->addItem(new QSpacerItem(20, 0), 0, 0);
	    gbox->setColumnStretch(1, 10);
	}

	for (int i = 0, r = 0; i < 4; ++i) {
	    if (!m_text[i]) continue;

	    if (i != 3) {
		m_text[i]->setFixedHeight(fontMetrics().lineSpacing());
	    }

	    if (!m_text[i]->text().isEmpty()) {
		if (!i) {
		    gbox->addWidget(m_text[i], r, 0, 1, 2, Qt::AlignLeft);
		} else {
		    gbox->addWidget(m_text[i], r, 1, Qt::AlignLeft );
		}
		m_text[i]->show();
		++r;
	    } else {
		m_text[i]->hide();
	    }
	}
    }

    gbox->activate();
    setMinimumSize(sizeHint());
}
コード例 #19
0
ファイル: mainwindow.cpp プロジェクト: ttendohv/GuessWho17B
void MainWindow::createGameWidget() {
    // Creates a push button for the Guess who button
    QPushButton *guessWho = new QPushButton(tr(""));
    guessWho->setFixedSize(280,200);
    guessWho->setStyleSheet("QPushButton{background-image:url(:/program/images/Guess.png); border-style: none;}"
                            "QPushButton:hover{background-image:url(:/program/images/Guess-Hover.png);}"
                            "QPushButton:pressed{background-image:url(:/program/images/Guess-Clicked.png);}");
    connect(guessWho, SIGNAL(clicked()), this, SLOT(guessWhoClicked()));

    // Creates a textBrowser that loads in the opponent's replies
    replyBox = new QTextBrowser;
    replyBox->setFixedSize(300,400);

    QString oppResponse;

    //if (some bool passed from GameManager == true){
    oppResponse = "<font color='red'>Opponent says</font>: Yes";
    replyBox->append(oppResponse);
    //}
    // else
    oppResponse = "<font color='blue'>Opponent says</font>: No";
    replyBox->append(oppResponse);

    // Sets up a grid layout for the main window
    QGridLayout *mainLayout = new QGridLayout;

    // Sets up vertical spacers to go occupy rows in grid layout
    QSpacerItem *vertSpacer = new QSpacerItem(0, 15, QSizePolicy::Fixed, QSizePolicy::Fixed);
    QSpacerItem *vertSpacer2 = new QSpacerItem(0, 40, QSizePolicy::Fixed, QSizePolicy::Fixed);
    QSpacerItem *vertSpacer3 = new QSpacerItem(0, 30, QSizePolicy::Fixed, QSizePolicy::Fixed);

    // Sets up the layout
    mainLayout->addItem(vertSpacer, 0, 0, 1, 3);
    mainLayout->addWidget(charGroupBox, 1, 0, 3, 3);
    mainLayout->addItem(vertSpacer2, 4, 0, 1, 3);
    mainLayout->addWidget(questionGroupBox, 5, 0, 2, 2);
    mainLayout->addWidget(guessWho, 5, 2, 2, 1, Qt::AlignRight);
    mainLayout->addWidget(yourCharGroupBox, 1, 3, 1, 1, Qt::AlignHCenter);
    mainLayout->addWidget(replyBox, 2, 3, 2, 1, Qt::AlignHCenter);
    mainLayout->addWidget(miscGroupBox, 5, 3, 2, 1, Qt::AlignHCenter);
    mainLayout->addItem(vertSpacer3, 7, 0, 1, 3);

    gameWidget = new QWidget;
    gameWidget->setLayout(mainLayout);
}
コード例 #20
0
ファイル: NodeBox.cpp プロジェクト: doudoushuixiu/nao-autism
void NodeBox::init()
{
	setTitle("Nodes statuses");

	QGridLayout* layout = new QGridLayout;

	//Add required nodes to nodes information vector
	NodeInformation openniTrackerNode;
	openniTrackerNode._name = "/openni_tracker";
	openniTrackerNode._startCommand = "rosrun openni_tracker openni_tracker &";

	_nodeInformationVector.push_back(openniTrackerNode);

	NodeInformation naoBehaviorsNode;
	naoBehaviorsNode._name = "/nao_behaviors";
	naoBehaviorsNode._startCommand = "rosrun nao_driver nao_behaviors.py --pip=$NAO_IP";

	_nodeInformationVector.push_back(naoBehaviorsNode);

	NodeInformation naoSpeechNode;
	naoSpeechNode._name = "/nao_speech";
	naoSpeechNode._startCommand = "rosrun nao_driver nao_speech.py --pip=$NAO_IP";

	_nodeInformationVector.push_back(naoSpeechNode);

	int rowNumber = 0;
	for (int i=0;i<_nodeInformationVector.size();i++){
		NodeInformation& current = _nodeInformationVector[i];

		NodeInformationGroup grp;
		grp._layout = new QGridLayout;
		grp._nameLabel = new QLabel(QString::fromStdString(current._name));
		grp._statusLabel = new QLabel("Unknown");

		_nodeMap.insert(std::pair<std::string, NodeInformationGroup>(current._name, grp));

		QLabel* nameLabel = new QLabel("Node name:");
		QLabel* statusLabel = new QLabel("Node status:");

		grp._layout->addWidget(nameLabel, 0, 0);
		grp._layout->addWidget(grp._nameLabel, 0, 1);
		grp._layout->addWidget(statusLabel, 1, 0);
		grp._layout->addWidget(grp._statusLabel, 1, 1);

		layout->addItem(grp._layout, rowNumber, 0);
		rowNumber++;
	}

	setLayout(layout);

	//Start thread for checking running nodes
	_nodeCheckingThread = boost::thread(&NodeBox::run, this);
	//_nodeCheckingThread.start_thread();

	QObject::connect(this, SIGNAL(nodeInformationRefresh()),
			this, SLOT(onNodeInformationRefresh()));
}
コード例 #21
0
void QGridLayoutProto::addItem(QLayoutItem *item, int row, int column, int rowspan, int columnSpan, Qt::Alignment alignment)
{
  QGridLayout *griditem = qscriptvalue_cast<QGridLayout*>(thisObject());
  if (DEBUG)
    qDebug("QGridLayoutProto(%p, %d, %d, %d, %d, %d) called",
           item, row, column, rowspan, columnSpan, (int)alignment);
  if (griditem)
    griditem->addItem(item, row, column, rowspan, columnSpan, alignment);
}
コード例 #22
0
ファイル: watchdialog.cpp プロジェクト: KDE/cervisia
WatchDialog::WatchDialog(ActionType action, QWidget *parent)
    : QDialog(parent)
{
    setWindowTitle( (action==Add)? i18n("CVS Watch Add") : i18n("CVS Watch Remove") );
    setModal(true);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
    connect(buttonBox, &QDialogButtonBox::helpRequested, this, &WatchDialog::slotHelp);
    QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    QLabel *textlabel = new QLabel
    ( (action==Add)? i18n("Add watches for the following events:")
      :  i18n("Remove watches for the following events:"));
    mainLayout->addWidget(textlabel);

    all_button = new QRadioButton(i18n("&All"));
    mainLayout->addWidget(all_button);
    all_button->setFocus();
    all_button->setChecked(true);

    only_button = new QRadioButton(i18n("&Only:"));
    mainLayout->addWidget(only_button);

    QGridLayout *eventslayout = new QGridLayout();
    mainLayout->addLayout(eventslayout);
    eventslayout->addItem(new QSpacerItem(20, 0), 0, 0);
    eventslayout->setColumnStretch(0, 0);
    eventslayout->setColumnStretch(1, 1);

    commitbox = new QCheckBox(i18n("&Commits"));
    commitbox->setEnabled(false);
    eventslayout->addWidget(commitbox, 0, 1);

    editbox = new QCheckBox(i18n("&Edits"));
    editbox->setEnabled(false);
    eventslayout->addWidget(editbox, 1, 1);

    uneditbox = new QCheckBox(i18n("&Unedits"));
    uneditbox->setEnabled(false);
    eventslayout->addWidget(uneditbox, 2, 1);

    QButtonGroup* group = new QButtonGroup(this);
    group->addButton(all_button);
    group->addButton(only_button);

    mainLayout->addWidget(buttonBox);

    connect(only_button, SIGNAL(toggled(bool)), commitbox, SLOT(setEnabled(bool)));
    connect(only_button, SIGNAL(toggled(bool)), editbox, SLOT(setEnabled(bool)));
    connect(only_button, SIGNAL(toggled(bool)), uneditbox, SLOT(setEnabled(bool)));
}
コード例 #23
0
QtlBrowserDialog::QtlBrowserDialog(QWidget *parent, const QString& url, const QString& title, const QString& icon) :
    QtlDialog(parent),
    _text(0)
{
    // Dialog layout.
    resize(750, 580);
    QGridLayout* gridLayout = new QGridLayout(this);

    // Top row: buttons.
    QPushButton* buttonBackward = new QPushButton(this);
    buttonBackward->setStyleSheet(QStringLiteral("border: none;"));
    buttonBackward->setIcon(QIcon(QPixmap(browser_left_xpm)));
    gridLayout->addWidget(buttonBackward, 0, 0);

    QPushButton* buttonForward = new QPushButton(this);
    buttonForward->setStyleSheet(QStringLiteral("border: none;"));
    buttonForward->setIcon(QIcon(QPixmap(browser_right_xpm)));
    gridLayout->addWidget(buttonForward, 0, 1);

    QPushButton* buttonHome = new QPushButton(this);
    buttonHome->setStyleSheet(QStringLiteral("border: none;"));
    buttonHome->setIcon(QIcon(QPixmap(browser_home_xpm)));
    gridLayout->addWidget(buttonHome, 0, 2);

    QSpacerItem* horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
    gridLayout->addItem(horizontalSpacer, 0, 3);

    QPushButton* buttonClose = new QPushButton(tr("Close"), this);
    gridLayout->addWidget(buttonClose, 0, 4);

    // Second row: text window.
    _text = new QTextBrowser(this);
    _text->setOpenExternalLinks(true);
    _text->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard |
                                   Qt::LinksAccessibleByMouse |
                                   Qt::TextBrowserInteraction |
                                   Qt::TextSelectableByKeyboard |
                                   Qt::TextSelectableByMouse);
    gridLayout->addWidget(_text, 1, 0, 1, 5);

    // Enable / disable navigation buttons when content is available.
    connect(_text, &QTextBrowser::backwardAvailable, buttonBackward, &QPushButton::setEnabled);
    connect(_text, &QTextBrowser::forwardAvailable,  buttonForward,  &QPushButton::setEnabled);

    // Navigation actions.
    connect(buttonBackward, &QPushButton::clicked, _text, &QTextBrowser::backward);
    connect(buttonForward,  &QPushButton::clicked, _text, &QTextBrowser::forward);
    connect(buttonHome,     &QPushButton::clicked, _text, &QTextBrowser::home);
    connect(buttonClose,    &QPushButton::clicked, this,  &QtlBrowserDialog::accept);

    // Set the user-defined properties.
    setWindowTitle(title);
    if (!icon.isEmpty()) {
        setWindowIcon(QIcon(icon));
    }
    setUrl(url);
}
コード例 #24
0
ファイル: matdbaboutdialog.cpp プロジェクト: Negusbuk/MatDB
VersionPage::VersionPage(QWidget *parent)
    : QWizardPage(parent)
{
    setTitle(tr("Version"));

    QVBoxLayout *layout = new QVBoxLayout;
    setLayout(layout);

    QGridLayout *grid = new QGridLayout;
    layout->addLayout(grid);

    QString release = MATDBRELEASESTR;
    release += " (";
    release += QString::number(MATDBRELEASE);
    release += ")";
    grid->addWidget(new QLabel(tr("MatDB Version")), 1, 0);
    grid->addWidget(new QLabel(release), 1, 1);
    grid->addItem(new QSpacerItem(10, 10, QSizePolicy::Maximum),
                  1, 2);

    grid->addWidget(new QLabel(tr("tag")), 2, 0);
    grid->addWidget(new QLabel(MATDBTAGSTR), 2, 1);
    grid->addItem(new QSpacerItem(10, 10, QSizePolicy::Maximum),
                  2, 2);

    grid->addWidget(new QLabel(tr("git version")), 3, 0);
    grid->addWidget(new QLabel(MATDBGITTAGSTR), 3, 1);
    grid->addItem(new QSpacerItem(10, 10, QSizePolicy::Maximum),
                  3, 2);

    grid->addWidget(new QLabel(tr("Qt Version")), 4, 0);
    grid->addWidget(new QLabel(qVersion()), 4, 1);
    grid->addItem(new QSpacerItem(10, 10, QSizePolicy::Maximum),
                  4, 2);

    QTextEdit *copyright = new QTextEdit(this);
    layout->addWidget(copyright);
    copyright->setReadOnly(true);

    QFile file(":/html/COPYRIGHT.html");
    file.open(QFile::ReadOnly);
    copyright->setHtml(file.readAll());
    file.close();
}
コード例 #25
0
DomainListView::DomainListView(KConfig *config,const QString &title,
		QWidget *parent,const char *name) :
	QGroupBox(title, parent, name), config(config) {
  setColumnLayout(0, Qt::Vertical);
  layout()->setSpacing(0);
  layout()->setMargin(0);
  QGridLayout* thisLayout = new QGridLayout(layout());
  thisLayout->setAlignment(Qt::AlignTop);
  thisLayout->setSpacing(KDialog::spacingHint());
  thisLayout->setMargin(KDialog::marginHint());

  domainSpecificLV = new KListView(this);
  domainSpecificLV->addColumn(i18n("Host/Domain"));
  domainSpecificLV->addColumn(i18n("Policy"), 100);
  connect(domainSpecificLV,SIGNAL(doubleClicked(QListViewItem *)), SLOT(changePressed()));
  connect(domainSpecificLV,SIGNAL(returnPressed(QListViewItem *)), SLOT(changePressed()));
  connect(domainSpecificLV, SIGNAL( executed( QListViewItem *)), SLOT( updateButton()));
  connect(domainSpecificLV, SIGNAL(selectionChanged()), SLOT(updateButton()));
  thisLayout->addMultiCellWidget(domainSpecificLV, 0, 5, 0, 0);

  addDomainPB = new QPushButton(i18n("&New..."), this);
  thisLayout->addWidget(addDomainPB, 0, 1);
  connect(addDomainPB, SIGNAL(clicked()), SLOT(addPressed()));

  changeDomainPB = new QPushButton( i18n("Chan&ge..."), this);
  thisLayout->addWidget(changeDomainPB, 1, 1);
  connect(changeDomainPB, SIGNAL(clicked()), this, SLOT(changePressed()));

  deleteDomainPB = new QPushButton(i18n("De&lete"), this);
  thisLayout->addWidget(deleteDomainPB, 2, 1);
  connect(deleteDomainPB, SIGNAL(clicked()), this, SLOT(deletePressed()));

  importDomainPB = new QPushButton(i18n("&Import..."), this);
  thisLayout->addWidget(importDomainPB, 3, 1);
  connect(importDomainPB, SIGNAL(clicked()), this, SLOT(importPressed()));
  importDomainPB->setEnabled(false);
  importDomainPB->hide();

  exportDomainPB = new QPushButton(i18n("&Export..."), this);
  thisLayout->addWidget(exportDomainPB, 4, 1);
  connect(exportDomainPB, SIGNAL(clicked()), this, SLOT(exportPressed()));
  exportDomainPB->setEnabled(false);
  exportDomainPB->hide();

  QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding);
  thisLayout->addItem(spacer, 5, 1);

  QWhatsThis::add( addDomainPB, i18n("Click on this button to manually add a host or domain "
                                       "specific policy.") );
  QWhatsThis::add( changeDomainPB, i18n("Click on this button to change the policy for the "
                                          "host or domain selected in the list box.") );
  QWhatsThis::add( deleteDomainPB, i18n("Click on this button to delete the policy for the "
                                          "host or domain selected in the list box.") );
  updateButton();
}
コード例 #26
0
void CharacterSelectDialog::initDialog(const QChar &_chr, const QString &_font)
{
    QWidget *page = mainWidget()/*plainPage()*/;

    QGridLayout *grid = new QGridLayout(page);
    grid->setMargin(0);

    d->charSelect = new KCharSelect(page, 0);
    d->charSelect->setCurrentChar(_chr);
    d->charSelect->setCurrentFont(QFont(_font));
    connect(d->charSelect, SIGNAL(charSelected(QChar)), this, SLOT(slotDoubleClicked()));
    d->charSelect->resize(d->charSelect->sizeHint());
//     d->charSelect->enableFontCombo( true );
    grid->addWidget(d->charSelect, 0, 0);

    grid->addItem(new QSpacerItem(d->charSelect->width(), 0), 0, 0);
    grid->addItem(new QSpacerItem(0, d->charSelect->height()), 0, 0);
    grid->setRowStretch(0, 0);
    d->charSelect->setFocus();
}
コード例 #27
0
AboutDialog::AboutDialog(QWidget *parent) :
    QDialog(parent)
{
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
    setWindowTitle("About");

    QGridLayout* layout = new QGridLayout(this);
    layout->setSizeConstraint(QLayout::SetFixedSize);

    const int SPACER_SIZE = 8;
    const QString Url("<a href=\"%2\">%1</a>");

    QLabel* iconLabel = new QLabel(this);
    iconLabel->setPixmap(QPixmap(":/icons/icon64.png"));
    iconLabel->setFixedSize(64 + 4, 64 + 4);

    QLabel* applicationNameLabel = getLabel(AppInfo::name, 16, true, Qt::AlignLeft);

    QLabel* versionLabel = getLabel(QString("version %1").arg(AppInfo::version), 8, false, Qt::AlignLeft);

    QLabel* buildDateLabel = getLabel(QString("Build date: %1").arg(AppInfo::buildDate), 8, false, Qt::AlignLeft);

    QLabel* iconsSourceLabel = getLabel(QString("%1 %2").arg("This application uses").arg(Url.arg("FatCow icons").arg("http://www.fatcow.com/free-icons")), 8, false, Qt::AlignLeft);
    iconsSourceLabel->setOpenExternalLinks(true);

    QLabel* licenseLabel = getLabel(QString("License: %1").arg(AppInfo::license), 8, false, Qt::AlignLeft);

    QLabel* copyrightLabel = getLabel(QString("(c) %1, %2").arg(AppInfo::years).arg(Url.arg(AppInfo::author).arg(AppInfo::Url)), 8, false, Qt::AlignCenter);
    copyrightLabel->setOpenExternalLinks(true);

    layout->addWidget(iconLabel,                                0, 0, 3, 1);
    layout->addWidget(applicationNameLabel,                     0, 1, 1, 2);
    layout->addWidget(versionLabel,                             1, 1, 1, 2);
    layout->addWidget(buildDateLabel,                           2, 1, 1, 2);
    layout->addItem(new QSpacerItem(SPACER_SIZE, SPACER_SIZE),  3, 2, 1, 1);
    layout->addWidget(iconsSourceLabel,                         4, 0, 1, 3);
    layout->addItem(new QSpacerItem(SPACER_SIZE, SPACER_SIZE),  5, 2, 1, 1);
    layout->addWidget(licenseLabel,                             6, 0, 1, 3);
    layout->addItem(new QSpacerItem(SPACER_SIZE, SPACER_SIZE),  7, 2, 1, 1);
    layout->addWidget(copyrightLabel,                           8, 0, 1, 3);
}
コード例 #28
0
void PreferenceDialog::on_seeInfoButton_clicked() {
    QMessageBox msgBox;
    msgBox.setText(tr("This data will help improve this application and won't be shared with anyone."));
    msgBox.setDetailedText(uinfo->printJSON());
    msgBox.setStandardButtons(QMessageBox::Ok);
    msgBox.setDefaultButton(QMessageBox::Ok);
    //Fixed size hack
    QSpacerItem* horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    QGridLayout* layout = (QGridLayout*)msgBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    msgBox.exec();
}
コード例 #29
0
void MainWindow::on_actionHelp_triggered()
{
    QSound::play(":/sound/moogle.wav");
    QMessageBox messageBox;
    QSpacerItem* horizontalSpacer = new QSpacerItem(300, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    messageBox.setIconPixmap(QPixmap(":/icon/mog"));
    messageBox.setText("Input the number of cards you obtained since your last reset, and the number of times you've loaded the World Map since your last reset, in order.\nFor example, if you just started the game, obtained the 3 cards from Ticketmaster, went once on the World Map, obtained one card from a random encounter in the Ice Cavern, and went one more time on the World Map before reaching Dali, you would input 3 / 1 / 1 / 1 in this order.\nIf you need help on a specific part of the window, simply hover your mouse on it, a tooltip should appear.");
    messageBox.setWindowTitle("Help meeeeeee, kupo...");
    QGridLayout* layout = (QGridLayout*)messageBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    messageBox.exec();
}
コード例 #30
0
void MainWindow::on_actionKupo_triggered()
{
    QSound::play(":/sound/moogle.wav");
    QMessageBox messageBox;
    QSpacerItem* horizontalSpacer = new QSpacerItem(200, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
    messageBox.setIconPixmap(QPixmap(":/icon/mog"));
    messageBox.setText("Kupo !");
    messageBox.setWindowTitle("Kupo ?");
    QGridLayout* layout = (QGridLayout*)messageBox.layout();
    layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
    messageBox.exec();
}