Example #1
0
//! [4]
QGroupBox *Window::createSecondExclusiveGroup()
{
    QGroupBox *groupBox = new QGroupBox(tr("E&xclusive Radio Buttons"));
    groupBox->setCheckable(true);
    groupBox->setChecked(false);
//! [4]

//! [5]
    QRadioButton *radio1 = new QRadioButton(tr("Rad&io button 1"));
    QRadioButton *radio2 = new QRadioButton(tr("Radi&o button 2"));
    QRadioButton *radio3 = new QRadioButton(tr("Radio &button 3"));
    radio1->setChecked(true);
    QCheckBox *checkBox = new QCheckBox(tr("Ind&ependent checkbox"));
    checkBox->setChecked(true);
//! [5]

//! [6]
    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget(radio1);
    vbox->addWidget(radio2);
    vbox->addWidget(radio3);
    vbox->addWidget(checkBox);
    vbox->addStretch(1);
    groupBox->setLayout(vbox);

    return groupBox;
}
	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);
	}
NetworkProxyDialog::NetworkProxyDialog(QWidget *parent) :
    Dialog(parent),
    m_proxyTypeSelector(new ValueSelector(tr("Proxy type"), this)),
    m_hostEdit(new QLineEdit(this)),
    m_portEdit(new QLineEdit(this)),
    m_userEdit(new QLineEdit(this)),
    m_passEdit(new QLineEdit(this))
{
    setWindowTitle(tr("Network proxy"));
    
    m_proxyTypeSelector->setModel(new NetworkProxyTypeModel(this));
    m_proxyTypeSelector->setValue(Settings::instance()->networkProxyType());

    m_hostEdit->setMinimumWidth(380);
    m_hostEdit->setText(Settings::instance()->networkProxyHost());
    m_portEdit->setValidator(new QIntValidator(0, 100000, this));
    m_portEdit->setText(QString::number(Settings::instance()->networkProxyPort()));
    m_passEdit->setEchoMode(QLineEdit::Password);
    m_passEdit->setText(Settings::instance()->networkProxyPassword());
    m_userEdit->setText(Settings::instance()->networkProxyUsername());

    QGroupBox *proxyGroup = new QGroupBox(tr("Use network proxy"), this);
    proxyGroup->setCheckable(true);
    proxyGroup->setChecked(Settings::instance()->networkProxyEnabled());
    
    QGridLayout *proxyGrid = new QGridLayout(proxyGroup);
    proxyGrid->setContentsMargins(0, 0, 0, 0);
    proxyGrid->addWidget(m_proxyTypeSelector, 0, 0, 1, 2);
    proxyGrid->addWidget(new QLabel(tr("Host"), this), 1, 0, 1, 1);
    proxyGrid->addWidget(new QLabel(tr("Port"), this), 1, 1, 1, 1);
    proxyGrid->addWidget(m_hostEdit, 2, 0, 1, 1);
    proxyGrid->addWidget(m_portEdit, 2, 1, 1, 1);
    proxyGrid->addWidget(new QLabel(tr("Username"), this), 3, 0, 1, 2);
    proxyGrid->addWidget(m_userEdit, 4, 0, 1, 2);
    proxyGrid->addWidget(new QLabel(tr("Password"), this), 5, 0, 1, 2);
    proxyGrid->addWidget(m_passEdit, 6, 0, 1, 2);

    QWidget *scrollWidget = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout(scrollWidget);
    vbox->setContentsMargins(0, 0, 0, 0);
    vbox->addWidget(proxyGroup);
    QScrollArea *scrollArea = new QScrollArea(this);
    scrollArea->setWidgetResizable(true);
    scrollArea->setWidget(scrollWidget);

    QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Vertical, this);
    QHBoxLayout *hbox = new QHBoxLayout(this);
    hbox->addWidget(scrollArea);
    hbox->addWidget(buttonBox);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    connect(proxyGroup, SIGNAL(toggled(bool)), Settings::instance(), SLOT(setNetworkProxyEnabled(bool)));
    connect(m_proxyTypeSelector, SIGNAL(valueChanged(QVariant)), this, SLOT(setNetworkProxyType(QVariant)));
    connect(m_hostEdit, SIGNAL(textEdited(QString)), Settings::instance(), SLOT(setNetworkProxyHost(QString)));
    connect(m_portEdit, SIGNAL(textEdited(QString)), this, SLOT(setNetworkProxyPort(QString)));
    connect(m_userEdit, SIGNAL(textEdited(QString)), Settings::instance(), SLOT(setNetworkProxyUsername(QString)));
    connect(m_passEdit, SIGNAL(textEdited(QString)), Settings::instance(), SLOT(setNetworkProxyPassword(QString)));
}
Example #4
0
void QgsDualView::modifySort()
{
  if ( !mLayer )
    return;

  QgsAttributeTableConfig config = mConfig;

  QDialog orderByDlg;
  orderByDlg.setWindowTitle( tr( "Configure Attribute Table Sort Order" ) );
  QDialogButtonBox *dialogButtonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
  QGridLayout *layout = new QGridLayout();
  connect( dialogButtonBox, &QDialogButtonBox::accepted, &orderByDlg, &QDialog::accept );
  connect( dialogButtonBox, &QDialogButtonBox::rejected, &orderByDlg, &QDialog::reject );
  orderByDlg.setLayout( layout );

  QGroupBox *sortingGroupBox = new QGroupBox();
  sortingGroupBox->setTitle( tr( "Defined sort order in attribute table" ) );
  sortingGroupBox->setCheckable( true );
  sortingGroupBox->setChecked( !sortExpression().isEmpty() );
  layout->addWidget( sortingGroupBox );
  sortingGroupBox->setLayout( new QGridLayout() );

  QgsExpressionBuilderWidget *expressionBuilder = new QgsExpressionBuilderWidget();
  QgsExpressionContext context( QgsExpressionContextUtils::globalProjectLayerScopes( mLayer ) );
  expressionBuilder->setExpressionContext( context );
  expressionBuilder->setLayer( mLayer );
  expressionBuilder->loadFieldNames();
  expressionBuilder->loadRecent( QStringLiteral( "generic" ) );
  expressionBuilder->setExpressionText( sortExpression().isEmpty() ? mLayer->displayExpression() : sortExpression() );

  sortingGroupBox->layout()->addWidget( expressionBuilder );

  QCheckBox *cbxSortAscending = new QCheckBox( tr( "Sort ascending" ) );
  cbxSortAscending->setChecked( config.sortOrder() == Qt::AscendingOrder );
  sortingGroupBox->layout()->addWidget( cbxSortAscending );

  layout->addWidget( dialogButtonBox );
  if ( orderByDlg.exec() )
  {
    Qt::SortOrder sortOrder = cbxSortAscending->isChecked() ? Qt::AscendingOrder : Qt::DescendingOrder;
    if ( sortingGroupBox->isChecked() )
    {
      setSortExpression( expressionBuilder->expressionText(), sortOrder );
      config.setSortExpression( expressionBuilder->expressionText() );
      config.setSortOrder( sortOrder );
    }
    else
    {
      setSortExpression( QString(), sortOrder );
      config.setSortExpression( QString() );
    }

    setAttributeTableConfig( config );
  }
}
QGroupBox* RenderSettingsWindow::create_checkable_groupbox(
    const string&           widget_key,
    const QString&          label)
{
    QGroupBox* groupbox = new QGroupBox(label);
    m_widget_proxies[widget_key] = new GroupBoxProxy(groupbox);

    groupbox->setCheckable(true);

    return groupbox;
}
void GameBoard::configura()
{

    //Pausa o Jogo para as Configurações
    stopped();

    //Cria a nova janela de configurações
    QDialog *janelaconfig = new QDialog;


    //Textos da nova janela e de identificação dos botões
    QLabel *Titulo = new QLabel("<big><b>Configuracoes</b></big>");
    QLabel *Key_Menu = new QLabel("Menu de Atalhos: ");
    QLabel *Configur = new QLabel("Configurar Parametros: ");


    //Caixa de organização de grupos
    QGroupBox *confBox = new QGroupBox;
    confBox->setCheckable(false);
    confBox->setChecked(true);

    //Botões da janela de configuração
    QPushButton *keys = new QPushButton("Atalhos do Teclado");
    QPushButton *ajuste = new QPushButton("Ajustes de Jogo");
    QPushButton *voltar = new QPushButton("Voltar");

    connect(keys, SIGNAL(clicked()), SLOT(Menu()));
    connect(ajuste, SIGNAL(clicked()), SLOT(Settings()));
    connect(voltar, SIGNAL(clicked()), this, SLOT(continueGame()));
    connect(voltar, SIGNAL(clicked()), janelaconfig, SLOT(close()));


    //Ajuste do Layout da Página
    QGridLayout *toplay = new QGridLayout;
    toplay->addWidget(Key_Menu, 0, 0);
    toplay->addWidget(keys,0, 1);
    toplay->addWidget(Configur, 1, 0);
    toplay->addWidget(ajuste, 1, 1);
    toplay->addWidget(voltar, 2, 1);


    confBox->setLayout(toplay);

    QVBoxLayout *leftlay = new QVBoxLayout;
    leftlay->addWidget(Titulo);
    leftlay->addWidget(confBox);


    janelaconfig->setLayout(leftlay);
    janelaconfig->setMinimumSize(300, 230);

    janelaconfig->show();

}
Example #7
0
GNumericalExpressionSettingsWidget::GNumericalExpressionSettingsWidget( GNumericalExpression* numericalExpression, QObject* parent /*= NULL*/)	
{
	m_NumericalExpression = numericalExpression;

	QGroupBox* pExpressionSettings = new QGroupBox;
	QBoxLayout* pExpressionSettingsLayout = new QVBoxLayout;
	QBoxLayout* pExpressionEditLayout = new QHBoxLayout;
	pExpressionSettings->setFixedWidth(400);
	pExpressionSettings->setTitle("Expression Settings");
	pExpressionSettings->setLayout(pExpressionSettingsLayout);
	pExpressionEditLayout->insertWidget(0, new QLabel("Expression:"), 0);
	pExpressionEditLayout->insertWidget(1, m_NumericalExpression->m_Expression.ProvideNewParamLineEdit(pExpressionSettings), 0);
	pExpressionSettingsLayout->insertLayout(0, pExpressionEditLayout);

	QGroupBox* pVariableSettings = new QGroupBox;
	QGroupBox* pShowVariables = new QGroupBox;
	QBoxLayout* pShowVariablesLayout = new QVBoxLayout;
	QBoxLayout* pVariableSettingsLayout = new QVBoxLayout;
	QRadioButton* pLayoutVariablesVertically = new QRadioButton;
	QRadioButton* pLayoutVariablesHorizontally = new QRadioButton;
	QRadioButton* pLayoutVariablesGrid = new QRadioButton;
	pVariableSettings->setFixedWidth(400);
	pVariableSettings->setTitle("Variable Settings");
	pVariableSettings->setLayout(pVariableSettingsLayout);
	pShowVariables->setTitle("Show Variables");
	pShowVariables->setCheckable(true);
	pShowVariables->setLayout(pShowVariablesLayout);
	pLayoutVariablesHorizontally->setText("Layout: Horizontal");
	pShowVariablesLayout->insertWidget(0, pLayoutVariablesHorizontally);
	pLayoutVariablesVertically->setText("Layout: Vertical");
	pShowVariablesLayout->insertWidget(1, pLayoutVariablesVertically);
	pLayoutVariablesGrid->setText("Layout: Grid");
	pShowVariablesLayout->insertWidget(2, pLayoutVariablesGrid);
	pVariableSettingsLayout->insertWidget(0, pShowVariables);
	
	QPushButton* pAcceptButton = new QPushButton;
	QPushButton* pCloseButton = new QPushButton;
	QBoxLayout* pButtonLayout = new QHBoxLayout;
	pAcceptButton->setText("Accept");
	connect(pAcceptButton, SIGNAL(clicked(bool)), this, SLOT(Accept()));
	pCloseButton->setText("Close");
	connect(pCloseButton, SIGNAL(clicked(bool)), this, SLOT(close()));
	pButtonLayout->insertWidget(0, pAcceptButton, 1);
	pButtonLayout->insertWidget(1, pCloseButton, 1);

	QBoxLayout* pMainLayout = new QVBoxLayout;
	pMainLayout->setSizeConstraint(QLayout::SetFixedSize);
	setLayout(pMainLayout);
	pMainLayout->insertWidget(0, pExpressionSettings, 1);
	pMainLayout->insertWidget(1, pVariableSettings, 1);
	pMainLayout->insertLayout(2, pButtonLayout, 0);
}
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QWidget *window = new QWidget;

    QVBoxLayout *windowLayout = new QVBoxLayout(window);

    QGroupBox *language = new QGroupBox("Language");
    language->setAlignment(Qt::AlignHCenter);
    QVBoxLayout *languageLayout = new QVBoxLayout(language);
    QCheckBox *check1 = new QCheckBox;
    check1->setChecked(true);
    check1->setText("Java is good!");
    QCheckBox *check2 = new QCheckBox("C++ is good!");
    QCheckBox *check3 = new QCheckBox("Nothing is good!");
    check3->setTristate(true);

    languageLayout->addWidget(check1);
    languageLayout->addWidget(check2);
    languageLayout->addWidget(check3);
    windowLayout->addWidget(language);

    QGroupBox *os = new QGroupBox("Mobile OS");
    os->setAlignment(Qt::AlignRight);
    QVBoxLayout *osLayout = new QVBoxLayout;
    osLayout->addWidget(new QRadioButton("Android"));
    osLayout->addWidget(new QRadioButton("Windows Phone"));
    osLayout->addWidget(new QRadioButton("iOS"));
    osLayout->addStretch();
    os->setLayout(osLayout);
    windowLayout->addWidget(os);

    QGroupBox *phone = new QGroupBox("Smart Phone");
    phone->setCheckable(true);
    phone->setChecked(false);
    QHBoxLayout *phoneLayout = new QHBoxLayout(phone);
    phoneLayout->addWidget(new QCheckBox("Sumsung"));
    phoneLayout->addWidget(new QCheckBox("Xiao Mi"));
    phoneLayout->addWidget(new QCheckBox("HTC"));
    windowLayout->addWidget(phone);

    windowLayout->addStretch(1);

    window->show();

    return a.exec();
}
WorkbenchPage::WorkbenchPage(QWidget* parent):QWidget(parent), uComboBox(0), wSpinBox(0), hSpinBox(0), pLineEdit(0){
    QVBoxLayout* mainLayout = new QVBoxLayout(this);
    setLayout(mainLayout);

    QGroupBox* defaultSizeGroupBox = new QGroupBox(tr("Default Size"), this);
    QFormLayout* defaultSizeLayout = new QFormLayout(defaultSizeGroupBox);
    defaultSizeGroupBox->setLayout(defaultSizeLayout);
    QLabel* uLabel = new QLabel(tr("Unit:"), this);
    QLabel* wLabel = new QLabel(tr("Width:"), this);
    QLabel* hLabel = new QLabel(tr("Height:"), this);
    uComboBox = new QComboBox(this);
    uComboBox->addItem(tr("Pixel"));
    uComboBox->addItem(tr("Millimeter"));
    uComboBox->addItem(tr("Centimeter"));
    uComboBox->addItem(tr("Meter"));
    uComboBox->addItem(tr("Inch"));
    connect(uComboBox, SIGNAL(activated(const QString&)), this, SLOT(setWorkbenchSizeUnitSuffix(const QString&)));
    wSpinBox = new QSpinBox(this);
    hSpinBox = new QSpinBox(this);
    defaultSizeLayout->setWidget(0, QFormLayout::LabelRole, uLabel);
    defaultSizeLayout->setWidget(0, QFormLayout::FieldRole, uComboBox);
    defaultSizeLayout->setWidget(1, QFormLayout::LabelRole, wLabel);
    defaultSizeLayout->setWidget(1, QFormLayout::FieldRole, wSpinBox);
    defaultSizeLayout->setWidget(2, QFormLayout::LabelRole, hLabel);
    defaultSizeLayout->setWidget(2, QFormLayout::FieldRole, hSpinBox);
    
    mainLayout->addWidget(defaultSizeGroupBox);
    
    QGroupBox* autosaveGroupBox = new QGroupBox(tr("Autosave"), this);
    autosaveGroupBox->setCheckable(true);
    QFormLayout* autosaveLayout = new QFormLayout(autosaveGroupBox);
    autosaveGroupBox->setLayout(autosaveLayout);
    QLabel* pLabel = new QLabel(tr("Path:"), this);
    pLineEdit = new QLineEdit(this);
    QToolButton* pToolButton = new QToolButton(this);
    pToolButton->setText(tr("..."));
    connect(pToolButton, SIGNAL(clicked()), this, SLOT(getAutosavePath()));
    QHBoxLayout* pLayout = new QHBoxLayout();
    pLayout->addWidget(pLineEdit);
    pLayout->addWidget(pToolButton);
    autosaveLayout->setWidget(0, QFormLayout::LabelRole, pLabel);
    autosaveLayout->setLayout(0, QFormLayout::FieldRole, pLayout);
//    autosaveLayout->setWidget(0, QFormLayout::FieldRole, pLineEdit);
    
    mainLayout->addWidget(autosaveGroupBox);
}
Example #10
0
//! [10]
QGroupBox *Window::createPushButtonGroup()
{
    QGroupBox *groupBox = new QGroupBox(tr("&Push Buttons"));
    groupBox->setCheckable(true);
    groupBox->setChecked(true);
//! [10]

//! [11]
    QPushButton *pushButton = new QPushButton(tr("&Normal Button"));
    QPushButton *toggleButton = new QPushButton(tr("&Toggle Button"));
    toggleButton->setCheckable(true);
    toggleButton->setChecked(true);
    QPushButton *flatButton = new QPushButton(tr("&Flat Button"));
    flatButton->setFlat(true);
//! [11]

//! [12]
    QPushButton *popupButton = new QPushButton(tr("Pop&up Button"));
    QMenu *menu = new QMenu(this);
    menu->addAction(tr("&First Item"));
    menu->addAction(tr("&Second Item"));
    menu->addAction(tr("&Third Item"));
    menu->addAction(tr("F&ourth Item"));
    popupButton->setMenu(menu);
//! [12]

    QAction *newAction = menu->addAction(tr("Submenu"));
    QMenu *subMenu = new QMenu(tr("Popup Submenu"));
    subMenu->addAction(tr("Item 1"));
    subMenu->addAction(tr("Item 2"));
    subMenu->addAction(tr("Item 3"));
    newAction->setMenu(subMenu);

//! [13]
    QVBoxLayout *vbox = new QVBoxLayout;
    vbox->addWidget(pushButton);
    vbox->addWidget(toggleButton);
    vbox->addWidget(flatButton);
    vbox->addWidget(popupButton);
    vbox->addStretch(1);
    groupBox->setLayout(vbox);

    return groupBox;
}
void LDViewExportOption::populate(void)
{
	QWidget *parent;
	parent = m_box;
    LDExporterSettingList &settings = m_exporter->getSettings();
    LDExporterSettingList::iterator it;

	if (m_box != NULL)
	{
//		scrollArea->removeChild(m_box);
		scrollArea->adjustSize();
		delete m_box;
	}
	m_box = new QWidget(scrollArea);
	m_box->setObjectName("m_box");
	m_lay = new QVBoxLayout();
	m_lay->setObjectName("m_lay");
	m_lay->setMargin(11);
	m_lay->setSpacing(4);
	m_box->setLayout(m_lay);
	QVBoxLayout *vbl= NULL;
    std::stack<int> groupSizes;
	std::stack<QWidget *> parents;
    int groupSize = 0;
    for (it = settings.begin(); it != settings.end(); it++)
    {
        bool inGroup = groupSize > 0;

        if (groupSize > 0)
        {
            groupSize--;
            if (groupSize == 0)
            {
                // We just got to the end of a group, so pop the previous
                // groupSize value off the groupSizes stack.
                groupSize = groupSizes.top();
                groupSizes.pop();
				parent = parents.top();
				parents.pop();
//				vbl = new QVBoxLayout(parent->layout());
				//vbl = NULL;
            }
        }
        if (it->getGroupSize() > 0)
        {
            // This item is the start of a group.
            if (inGroup)
            {
                // At the beginning of this iteration we were in a group, so
                // use a bool setting instead of a group setting.
				QString qstmp;
				ucstringtoqstring(qstmp,it->getName());

				QCheckBox *check;
				check = new QCheckBox(qstmp,parent);
				check->setObjectName(qstmp);
				check->setChecked(it->getBoolValue());
				m_settings[&*it] = check;
				if (vbl)
				{
					vbl->addWidget(check);
					m_groups[vbl][&*it] = check;
				}
            }
            else
            {
                // Top level group; use a group setting.
				if (vbl)
				{
                	QSpacerItem *sp = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
                	QHBoxLayout *hbox;
                	QPushButton *rg;
                	hbox = new QHBoxLayout();
                	rg = new QPushButton("Reset Group");
                	hbox->addItem(sp);
                	hbox->addWidget(rg);
					rg->setObjectName("Reset Group");
                	vbl->addLayout(hbox);
					connect( rg, SIGNAL( clicked() ), this, SLOT( doResetGroup() ) );
				}
				QString qstmp;
				ucstringtoqstring(qstmp,it->getName());
				QGroupBox *gb;
				gb = new QGroupBox (qstmp, m_box);
				gb->setObjectName(qstmp);
				m_lay->addWidget(gb);
				vbl = new QVBoxLayout(gb);
				gb->setLayout(vbl);
				parent=gb;
				if (it->getType() == LDExporterSetting::TBool)
				{
					gb->setCheckable(true);
					gb->setChecked(it->getBoolValue());
					m_settings[&*it] = gb;
					m_groups[vbl][&*it] = gb;
				}
            }
			parents.push(parent);
            // We're now in a new group, so push the current groupSize onto
            // the groupSizes stack.
            groupSizes.push(groupSize);
            // Update groupSize based on the new group's size.
            groupSize = it->getGroupSize();
        }
        else
        {
            // This setting isn't the start of a group; add the appropriate type
            // of option UI to the canvas.
			QString qstmp;
			ucstringtoqstring(qstmp,it->getName());
			QHBoxLayout *hbox;
			QVBoxLayout *vbox;
			QLineEdit *li;
			QLabel *label;
			QHBoxLayout *hbox2;
			QCheckBox *check;
			hbox = new QHBoxLayout();
			hbox->setSpacing(4);
            switch (it->getType())
            {
            case LDExporterSetting::TBool:
				check = new QCheckBox(qstmp);
				check->setChecked(it->getBoolValue());
				check->setObjectName(qstmp);
				hbox->addWidget(check);
				m_settings[&*it] = check;
				if (vbl != NULL)
				{
					m_groups[vbl][&*it] = check;
				}
                break;
            case LDExporterSetting::TFloat:
            case LDExporterSetting::TLong:
				// Long and float are intentionally handeled the same.
				label = new QLabel(qstmp);
				label->setObjectName(qstmp);
				hbox->addWidget(label);
				li = new QLineEdit(qstmp);
				li->setObjectName(qstmp);
				hbox->addWidget(li);
				ucstringtoqstring(qstmp,it->getStringValue());
				li->setText(qstmp);
				m_settings[&*it] = li;
				if (vbl != NULL)
				{
					m_groups[vbl][&*it] = li;
				}
                break;
            case LDExporterSetting::TString:
				vbox = new QVBoxLayout();
				vbox->setSpacing(4);
				hbox->addLayout(vbox);
				label = new QLabel(qstmp);
				vbox->addWidget(label);
				hbox2 = new QHBoxLayout();
				hbox2->setSpacing(4);
				vbox->addLayout(hbox2);
				li = new QLineEdit(qstmp);
				hbox2->addWidget(li);
				ucstringtoqstring(qstmp,it->getStringValue());
				li->setText(qstmp);
				m_settings[&*it] = li;
				if (vbl != NULL)
				{
					m_groups[vbl][&*it] = li;
				}
				if (it->isPath())
				{
					QPushButton *but = new QPushButton();
					but->setText(TCObject::ls("LDXBrowse..."));
					hbox2->addWidget(but);
					connect( but, SIGNAL( clicked() ), this, SLOT( doBrowse()));
					m_button[but]=li;
				}
                break;
            case LDExporterSetting::TEnum:
				vbox = new QVBoxLayout();
				vbox->setSpacing(4);
				hbox->addLayout(vbox);
                label = new QLabel(qstmp);
		vbox->addWidget(label);
				QComboBox *combo;
				combo = new QComboBox();
				vbox->addWidget(combo);
				for (size_t i = 0; i < it->getOptions().size(); i++)
				{
					ucstringtoqstring(qstmp,it->getOptions()[i]);
					combo->addItem(qstmp);
				}
				combo->setCurrentIndex(it->getSelectedOption());
				m_settings[&*it] = combo;
				if (vbl != NULL)
				{
					m_groups[vbl][&*it] = combo;
				}
                break;
            default:
                throw "not implemented";
            }
			if (it->getTooltip().size() > 0)
			{
				ucstringtoqstring(qstmp, it->getTooltip());
				//QToolTip::add(hbox, qstmp);
			}
			if (vbl) vbl->addLayout(hbox);
        }
	}
    if (vbl)
    {
        QSpacerItem *sp = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        QHBoxLayout *hbox;
        QPushButton *rg;
        hbox = new QHBoxLayout();
        rg = new QPushButton("Reset Group");
		rg->setObjectName("Reset Group");
        hbox->addItem(sp);
        hbox->addWidget(rg);
        vbl->addLayout(hbox);
		connect( rg, SIGNAL( clicked() ), this, SLOT( doResetGroup() ) );
    }

	m_lay->addStretch();
	scrollArea->setWidget(m_box);
	m_box->adjustSize();
	scrollArea->adjustSize();
//	resize(width() + m_box->width() - scrollArea->visibleWidth(), height());
	setFixedWidth(width());
}
MouseSettingsPage::MouseSettingsPage(AntiMicroSettings *settings, QWidget *parent) :
    QWizardPage(parent)
{
    this->settings = settings;

    setTitle(tr("Mouse Settings"));
    setSubTitle(tr("Customize settings used for mouse emulation"));
    QVBoxLayout *tempMainLayout = new QVBoxLayout;
    setLayout(tempMainLayout);

#ifdef Q_OS_WIN
    QCheckBox *disablePrecision = new QCheckBox(tr("Disable Enhance Pointer Precision"));
    disablePrecision->setToolTip(tr("Disable the \"Enhanced Pointer Precision\" Windows setting\n"
                                    "while antimicro is running. Disabling \"Enhanced Pointer Precision\"\n"
                                    "will allow mouse movement within antimicro to be more\n"
                                    "precise."));
    tempMainLayout->addWidget(disablePrecision);
    tempMainLayout->addSpacerItem(new QSpacerItem(10, 10));
    registerField("disableEnhancePrecision", disablePrecision);
#endif

    QGroupBox *smoothingGroupBox = new QGroupBox(tr("Smoothing"));
    smoothingGroupBox->setCheckable(true);
    smoothingGroupBox->setChecked(false);
    registerField("mouseSmoothing", smoothingGroupBox, "checked", SIGNAL(toggled(bool)));

    layout()->addWidget(smoothingGroupBox);

    QVBoxLayout *tempVLayout = new QVBoxLayout;

    QHBoxLayout *tempHLayout = new QHBoxLayout;
    QLabel *tempLabel = new QLabel(tr("History Buffer:"));
    QSpinBox *tempSpinBox = new QSpinBox;
    tempSpinBox->setMinimum(1);
    tempSpinBox->setMaximum(30);
    tempSpinBox->setValue(10);
    tempLabel->setBuddy(tempSpinBox);
    registerField("historyBuffer", tempSpinBox);

    tempHLayout->addWidget(tempLabel);
    tempHLayout->addWidget(tempSpinBox);
    tempVLayout->addLayout(tempHLayout);

    tempHLayout = new QHBoxLayout;
    tempLabel = new QLabel(tr("Weight Modifier:"));
    QDoubleSpinBox *tempDoubleSpinBox = new QDoubleSpinBox;
    tempDoubleSpinBox->setMinimum(0.0);
    tempDoubleSpinBox->setMaximum(1.0);
    tempDoubleSpinBox->setValue(0.20);
    tempDoubleSpinBox->setSingleStep(0.10);
    tempLabel->setBuddy(tempDoubleSpinBox);
    registerField("weightModifier", tempDoubleSpinBox);

    tempHLayout->addWidget(tempLabel);
    tempHLayout->addWidget(tempDoubleSpinBox);
    tempVLayout->addLayout(tempHLayout);

    smoothingGroupBox->setLayout(tempVLayout);

    tempHLayout = new QHBoxLayout;
    tempLabel = new QLabel(tr("Refresh Rate:"));
    QComboBox *tempComboBox = new QComboBox;

    for (int i = 1; i <= JoyButton::MAXIMUMMOUSEREFRESHRATE; i++)
    {
        tempComboBox->addItem(QString("%1 ms").arg(i), i);
    }

    int refreshIndex = tempComboBox->findData(JoyButton::getMouseRefreshRate());
    if (refreshIndex >= 0)
    {
        tempComboBox->setCurrentIndex(refreshIndex);
    }

    tempComboBox->setToolTip(tr("The refresh rate is the amount of time that will elapse\n"
                                "in between mouse events. Please be cautious when\n"
                                "editing this setting as it will cause the program to use\n"
                                "more CPU power. Setting this value too low can cause\n"
                                "system instability. Please test the setting before using\n"
                                "it unattended."));
    tempLabel->setBuddy(tempComboBox);
    registerField("mouseRefreshRate", tempComboBox);

    tempHLayout->addWidget(tempLabel);
    tempHLayout->addWidget(tempComboBox);
    tempMainLayout->addSpacerItem(new QSpacerItem(10, 10));
    tempMainLayout->addLayout(tempHLayout);
}
Example #13
0
PreferencesDialog::PreferencesDialog( QWidget * parent )
  : QDialog( parent )
{
  Preferences *preferences = GetPreferences();
  m_restoreSearchPaths            = preferences->getSearchPaths();
  m_restoreEnvironmentEnabled     = preferences->getEnvironmentEnabled();
  m_restoreEnvironmentTextureName = preferences->getEnvironmentTextureName();
  m_restoreMaterialCatalogPath    = preferences->getMaterialCatalogPath();


  m_environmentMapLabel = new QLabel( m_restoreEnvironmentTextureName );
  m_environmentMapLabel->setFrameShadow( QFrame::Sunken );
  m_environmentMapLabel->setFrameShape( QFrame::StyledPanel );

  QPushButton * environmentMapButton = new QPushButton( "..." );
  connect( environmentMapButton, SIGNAL(clicked(bool)), this, SLOT(selectEnvironmentMap(bool)) );

  QHBoxLayout * environmentMapLayout = new QHBoxLayout();
  environmentMapLayout->addWidget( m_environmentMapLabel );
  environmentMapLayout->addWidget( environmentMapButton );

  QFormLayout * environmentLayout = new QFormLayout();
  environmentLayout->addRow( "Environment Map", environmentMapLayout );

  QGroupBox * environmentBox = new QGroupBox( "Environment" );
  environmentBox->setCheckable( true );
  environmentBox->setChecked( m_restoreEnvironmentEnabled );
  environmentBox->setLayout( environmentLayout );
  connect( environmentBox, SIGNAL(toggled(bool)), this, SLOT(toggledEnvironmentBox(bool)) );


  m_materialCatalogLabel = new QLabel( m_restoreMaterialCatalogPath );
  m_materialCatalogLabel->setFrameShadow( QFrame::Sunken );
  m_materialCatalogLabel->setFrameShape( QFrame::StyledPanel );

  QPushButton * materialCatalogButton = new QPushButton( "..." );
  connect( materialCatalogButton, SIGNAL(clicked(bool)), this, SLOT(selectMaterialCatalogPath(bool)) );

  QHBoxLayout * materialCatalogLayout = new QHBoxLayout();
  materialCatalogLayout->addWidget( m_materialCatalogLabel );
  materialCatalogLayout->addWidget( materialCatalogButton );

  QFormLayout * materialLayout = new QFormLayout();
  materialLayout->addRow( "Material Catalog", materialCatalogLayout );

  QGroupBox * materialBox = new QGroupBox( "Material" );
  materialBox->setLayout( materialLayout );


  m_searchPaths = new QListWidget();
  m_searchPaths->addItems( m_restoreSearchPaths );

  QPushButton * addPathButton = new QPushButton( "Add ..." );
  connect( addPathButton, SIGNAL(clicked(bool)), this, SLOT(addPath(bool)) );

  QPushButton * removePathButton = new QPushButton( "Remove" );
  connect( removePathButton, SIGNAL(clicked(bool)), this, SLOT(removePath(bool)) );

  QPushButton * moveUpPathButton = new QPushButton( "Move Up" );
  connect( moveUpPathButton, SIGNAL(clicked(bool)), this, SLOT(moveUpPath(bool)) );

  QPushButton * moveDownPathButton = new QPushButton( "Move Down" );
  connect( moveDownPathButton, SIGNAL(clicked(bool)), this, SLOT(moveDownPath(bool)) );

  QHBoxLayout * searchPathsButtons = new QHBoxLayout();
  searchPathsButtons->addWidget( addPathButton );
  searchPathsButtons->addWidget( removePathButton );
  searchPathsButtons->addWidget( moveUpPathButton );
  searchPathsButtons->addWidget( moveDownPathButton );

  QVBoxLayout * verticalLayout = new QVBoxLayout();
  verticalLayout->addWidget( m_searchPaths );
  verticalLayout->addLayout( searchPathsButtons );

  QGroupBox * searchPathsBox = new QGroupBox( "Search Paths" );
  searchPathsBox->setLayout( verticalLayout );

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

  verticalLayout = new QVBoxLayout();
  verticalLayout->addWidget( environmentBox );
  verticalLayout->addWidget( materialBox );
  verticalLayout->addWidget( searchPathsBox );
  verticalLayout->addWidget( buttonBox );

  setWindowTitle( "Preferences" );
  setLayout( verticalLayout );
}