本文整理汇总了C++中QSpinBox::setMaximumWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setMaximumWidth方法的具体用法?C++ QSpinBox::setMaximumWidth怎么用?C++ QSpinBox::setMaximumWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::setMaximumWidth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QGroupBox
QWidget * PrefsDialog::createAutosaveForm() {
QGroupBox * autosave = new QGroupBox(tr("Autosave"), this );
QHBoxLayout * zhlayout = new QHBoxLayout();
zhlayout->setSpacing(SPACING);
QCheckBox * box = new QCheckBox(tr("Autosave every:"));
box->setChecked(MainWindow::AutosaveEnabled);
zhlayout->addWidget(box);
zhlayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding));
QSpinBox * spinBox = new QSpinBox;
spinBox->setMinimum(1);
spinBox->setMaximum(60);
spinBox->setValue(MainWindow::AutosaveTimeoutMinutes);
spinBox->setMaximumWidth(80);
zhlayout->addWidget(spinBox);
QLabel * label = new QLabel(tr("minutes"));
zhlayout->addWidget(label);
autosave->setLayout(zhlayout);
connect(box, SIGNAL(clicked(bool)), this, SLOT(toggleAutosave(bool)));
connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(changeAutosavePeriod(int)));
return autosave;
}
示例2: createLayout
void DkFilePreference::createLayout() {
// temp folder
DkDirectoryChooser* dirChooser = new DkDirectoryChooser(Settings::param().global().tmpPath, this);
dirChooser->setObjectName("dirChooser");
QLabel* tLabel = new QLabel(tr("Screenshots are automatically saved to this folder"), this);
DkGroupWidget* tempFolderGroup = new DkGroupWidget(tr("Use Temporary Folder"), this);
tempFolderGroup->addWidget(dirChooser);
tempFolderGroup->addWidget(tLabel);
// cache size
int maxCache = qMax(qRound(DkMemory::getTotalMemory()*0.1), 512);
qDebug() << "max cache" << maxCache;
QSpinBox* cacheBox = new QSpinBox(this);
cacheBox->setObjectName("cacheBox");
cacheBox->setMinimum(0);
cacheBox->setMaximum(maxCache);
cacheBox->setSuffix(" MB");
cacheBox->setMaximumWidth(200);
cacheBox->setValue(qRound(Settings::param().resources().cacheMemory));
QLabel* cLabel = new QLabel(tr("We recommend to set a moderate cache value arround 100 MB"), this);
DkGroupWidget* cacheGroup = new DkGroupWidget(tr("Maximal Cache Size"), this);
cacheGroup->addWidget(cacheBox);
cacheGroup->addWidget(cLabel);
// history size
// cache size
QSpinBox* historyBox = new QSpinBox(this);
historyBox->setObjectName("historyBox");
historyBox->setMinimum(0);
historyBox->setMaximum(1024);
historyBox->setSuffix(" MB");
historyBox->setMaximumWidth(200);
historyBox->setValue(qRound(Settings::param().resources().historyMemory));
QLabel* hLabel = new QLabel(tr("We recommend to set a moderate edit history value arround 100 MB"), this);
DkGroupWidget* historyGroup = new DkGroupWidget(tr("History Size"), this);
historyGroup->addWidget(historyBox);
historyGroup->addWidget(hLabel);
// loading policy
QVector<QRadioButton*> loadButtons;
loadButtons.append(new QRadioButton(tr("Skip Images"), this));
loadButtons[0]->setToolTip(tr("Images are skipped until the Next key is released"));
loadButtons.append(new QRadioButton(tr("Wait for Images to be Loaded"), this));
loadButtons[1]->setToolTip(tr("The next image is loaded after the current image is shown."));
// check wrt the current settings
loadButtons[0]->setChecked(!Settings::param().resources().waitForLastImg);
loadButtons[1]->setChecked(Settings::param().resources().waitForLastImg);
QButtonGroup* loadButtonGroup = new QButtonGroup(this);
loadButtonGroup->setObjectName("loadGroup");
loadButtonGroup->addButton(loadButtons[0], 0);
loadButtonGroup->addButton(loadButtons[1], 1);
DkGroupWidget* loadGroup = new DkGroupWidget(tr("Image Loading Policy"), this);
loadGroup->addWidget(loadButtons[0]);
loadGroup->addWidget(loadButtons[1]);
// skip images
QSpinBox* skipBox = new QSpinBox(this);
skipBox->setObjectName("skipBox");
skipBox->setMinimum(2);
skipBox->setMaximum(1000);
skipBox->setValue(Settings::param().global().skipImgs);
skipBox->setMaximumWidth(200);
DkGroupWidget* skipGroup = new DkGroupWidget(tr("Number of Skipped Images on PgUp/PgDown"), this);
skipGroup->addWidget(skipBox);
// left column
QWidget* leftWidget = new QWidget(this);
QVBoxLayout* leftLayout = new QVBoxLayout(leftWidget);
leftLayout->addWidget(tempFolderGroup);
leftLayout->addWidget(cacheGroup);
leftLayout->addWidget(historyGroup);
leftLayout->addWidget(loadGroup);
leftLayout->addWidget(skipGroup);
QHBoxLayout* layout = new QHBoxLayout(this);
layout->setAlignment(Qt::AlignLeft);
layout->addWidget(leftWidget);
}
示例3: QWidget
ServerTab::ServerTab(QWidget *parent)
: QWidget(parent)
{
const short int labelWidth = 80;
QComboBox* enginesCombo = new QComboBox;
enginesCombo->setEditable(false);
enginesCombo->setInsertPolicy(QComboBox::InsertAlphabetically);
enginesCombo->addItem("Rapidshare");
QLabel* downloadsLabel = new QLabel(tr("Simultanious downloads:"));
downloadsLabel->setMinimumWidth(labelWidth);
QSpinBox* downloadsSpin = new QSpinBox;
downloadsSpin->setRange(1,999);
downloadsSpin->setValue(2);
downloadsSpin->setMaximumWidth(45);
QHBoxLayout* downloadsLayout = new QHBoxLayout;
downloadsLayout->addWidget(downloadsLabel);
downloadsLayout->addWidget(downloadsSpin);
downloadsLayout->addStretch(1);
QCheckBox* credentialsCheck = new QCheckBox(tr("Use credentials"));
connect(credentialsCheck,SIGNAL( stateChanged ( int ) ), this, SLOT( useCredentialChecked( int ) ) );
QLabel* userLabel = new QLabel(tr("User:"));
userLabel->setMinimumWidth(labelWidth);
m_UserEdit = new QLineEdit;
QHBoxLayout* userLayout = new QHBoxLayout;
userLayout->addWidget(userLabel);
userLayout->addWidget(m_UserEdit);
userLayout->addStretch(1);
QLabel* passwordLabel = new QLabel(tr("Password:"));
passwordLabel->setMinimumWidth(labelWidth);
m_PasswordEdit = new QLineEdit;
//m_PasswordEdit->setDisabled(true);
m_PasswordEdit->setEchoMode(QLineEdit::Password);
QHBoxLayout* passwordLayout = new QHBoxLayout;
passwordLayout->addWidget(passwordLabel);
passwordLayout->addWidget(m_PasswordEdit);
passwordLayout->addStretch(1);
QVBoxLayout* layout = new QVBoxLayout;
layout->addSpacing(settings_ui::SpaceBeforeFirstWidget);
layout->addWidget(enginesCombo);
layout->addSpacing(settings_ui::SpaceBeforeFirstWidget);
layout->addLayout(downloadsLayout);
layout->addSpacing(settings_ui::SpaceBeetwenWidgets);
layout->addWidget(credentialsCheck);
layout->addSpacing(settings_ui::SpaceBeetwenWidgets/2);
layout->addLayout(userLayout);
layout->addSpacing(settings_ui::SpaceBeetwenWidgets/2);
layout->addLayout(passwordLayout);
layout->addStretch(1);
setLayout(layout);
QString userName = Proxy::settings()->value(SettingsValNames::scPluginUsername,Settings::PLUGINS,QString("rapidshare")).toString();
QString userPass = Proxy::settings()->value(SettingsValNames::scPluginPassword,Settings::PLUGINS,QString("rapidshare")).toString();
bool useCredentials = Proxy::settings()->value(SettingsValNames::scUseCredentials,Settings::PLUGINS,QString("rapidshare")).toBool();
if (!userPass.isEmpty())
userPass = Proxy::decrypt(userPass);
//LOG(QString("User Name and pass from QSettings are : %1 - %2 ").arg( userName ).arg( userPass ));
credentialsCheck->setChecked(useCredentials);
m_UserEdit->setText(userName);
m_PasswordEdit->setText(userPass);
useCredentialChecked(credentialsCheck->checkState());
}