本文整理汇总了C++中QSlider::setFixedWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ QSlider::setFixedWidth方法的具体用法?C++ QSlider::setFixedWidth怎么用?C++ QSlider::setFixedWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSlider
的用法示例。
在下文中一共展示了QSlider::setFixedWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initSaveLabel
void SubToolBar::initSaveLabel() {
//save to...
QList<ToolButton*> toolBtnList;
ToolButton* saveDesktopBtn = new ToolButton();
saveDesktopBtn->setFixedSize(SAVEBTN_SIZE);
saveDesktopBtn->setObjectName("SaveToDesktop");
saveDesktopBtn->setTips(tr("Save to desktop"));
toolBtnList.append(saveDesktopBtn);
ToolButton* savePicBtn = new ToolButton();
savePicBtn->setFixedSize(SAVEBTN_SIZE);
savePicBtn->setObjectName("SaveToPictureDir");
savePicBtn->setTips(tr("Autosave"));
toolBtnList.append(savePicBtn);
ToolButton* saveSpecificDirBtn = new ToolButton();
saveSpecificDirBtn->setFixedSize(SAVEBTN_SIZE);
saveSpecificDirBtn->setObjectName("SaveToSpecificDir");
saveSpecificDirBtn->setTips(tr("Save to specified folder"));
toolBtnList.append(saveSpecificDirBtn);
ToolButton* saveClipboardBtn = new ToolButton();
saveClipboardBtn->setFixedSize(SAVEBTN_SIZE);
saveClipboardBtn->setObjectName("SaveToClipboard");
saveClipboardBtn->setTips(tr("Copy to clipboard"));
toolBtnList.append(saveClipboardBtn);
ToolButton* saveAutoClipboardBtn = new ToolButton();
saveAutoClipboardBtn->setObjectName("SaveToAutoClipboard");
saveAutoClipboardBtn->setTips(tr("Autosave and copy to clipboard"));
toolBtnList.append(saveAutoClipboardBtn);
QLabel* lowQualityText = new QLabel();
lowQualityText->setObjectName("LowQualityLabel");
lowQualityText->setText(tr("Low"));
QSlider* saveQualitySlider = new QSlider(Qt::Horizontal);
saveQualitySlider->setFixedWidth(58);
saveQualitySlider->setMinimum(50);
saveQualitySlider->setMaximum(100);
saveQualitySlider->setPageStep(1);
saveQualitySlider->setSliderPosition(100);
setSaveQualityIndex(saveQualitySlider->value());
connect(saveQualitySlider, &QSlider::valueChanged,
this, &SubToolBar::setSaveQualityIndex);
QLabel* highQualityText = new QLabel();
highQualityText->setObjectName("HighQualityLabel");
highQualityText->setText(tr("High"));
m_saveLabel = new QLabel(this);
QHBoxLayout* saveLayout = new QHBoxLayout();
saveLayout->setMargin(0);
saveLayout->setSpacing(0);
saveLayout->addSpacing(1);
foreach (ToolButton* btn, toolBtnList) {
saveLayout->addWidget(btn);
// saveLayout->addSpacing(1);
connect(btn, &ToolButton::clicked, this, [=]{
qDebug() << "saveButtonList:" << toolBtnList.indexOf(btn);
setSaveOption(toolBtnList.indexOf(btn));
});
connect(btn, &ToolButton::onEnter, this, [=]{
emit showSaveTip(btn->getTips());
});
connect(btn, &ToolButton::onExist, this, [=]{
emit hideSaveTip();
});
}
示例2: createView
NLMGUI2D::NLMGUI2D() {
viewOrig = createView();
viewOrig->set2DMode();
//viewOrig->set3DMode();
// Create a 3D view
//View* view = createView();
view = createView();
//view->set3DMode();
view->set2DMode();
//enableFullscreen();
// Import image
ImageFileImporter::pointer importer = ImageFileImporter::New();
importer->setFilename(std::string(FAST_TEST_DATA_DIR) + "/US-2D.jpg");
//importer->setFilename(std::string(FAST_TEST_DATA_DIR) + "/US-1-2D.png");
// Smooth images
nlmSmoothing = NonLocalMeans::New();
nlmSmoothing->setInputConnection(importer->getOutputPort());
nlmSmoothing->setSigma(0.65f);
nlmSmoothing->setGroupSize(5);
nlmSmoothing->setWindowSize(11);
nlmSmoothing->setDenoiseStrength(0.300);
nlmSmoothing->setK(1);
nlmSmoothing->setEuclid(1);
nlmSmoothing->enableRuntimeMeasurements();
//mSmoothing = GaussianSmoothingFilter::New();
//mSmoothing->setInputConnection(importer->getOutputPort());
//mSmoothing->setStandardDeviation(1);
// Set up surface extraction
//mSurfaceExtraction = SurfaceExtraction::New();
//mSurfaceExtraction->setInputConnection(nlmSmoothing->getOutputPort());
//mSurfaceExtraction->setThreshold(100);
// Set up rendering
renderer = ImageRenderer::New();
//ImageRenderer::pointer renderer = ImageRenderer::New();
renderer->addInputConnection(nlmSmoothing->getOutputPort());
//MeshRenderer::pointer renderer = MeshRenderer::New();
//renderer->addInputConnection(mSurfaceExtraction->getOutputPort());
view->addRenderer(renderer);
rendererOrig = ImageRenderer::New();
rendererOrig->addInputConnection(importer->getOutputPort());
viewOrig->addRenderer(rendererOrig);
// Create and add GUI elements
// First create the menu layout
QVBoxLayout* menuLayout = new QVBoxLayout;
// Menu items should be aligned to the top
menuLayout->setAlignment(Qt::AlignTop);
// Title label
QLabel* title = new QLabel;
title->setText("Menu");
QFont font;
font.setPointSize(28);
title->setFont(font);
menuLayout->addWidget(title);
// Quit button
QPushButton* quitButton = new QPushButton;
quitButton->setText("Quit");
quitButton->setFixedWidth(200);
menuLayout->addWidget(quitButton);
// Connect the clicked signal of the quit button to the stop method for the window
QObject::connect(quitButton, &QPushButton::clicked, boost::bind(&Window::stop, this));
// Smoothing parameter label
//mSmoothingLabel = new QLabel;
//mSmoothingLabel->setText("DenoiseStrength: 300");
//menuLayout->addWidget(mSmoothingLabel);
nlmStrengthLabel = new QLabel;
std::string text1 = "Denoise Strength: " + boost::lexical_cast<std::string>(0.3) + " ";
nlmStrengthLabel->setText(text1.c_str());
menuLayout->addWidget(nlmStrengthLabel);
// Smoothing parameter slider
QSlider* slider = new QSlider(Qt::Horizontal);
slider->setMinimum(10);
slider->setMaximum(3000);
slider->setValue(300);
slider->setFixedWidth(300);
menuLayout->addWidget(slider);
// Connect the value changed signal of the slider to the updateSmoothingParameter method
QObject::connect(slider, &QSlider::valueChanged, boost::bind(&NLMGUI2D::updateDenoiseParameter, this, _1));
// Threshold label
//mThresholdLabel = new QLabel;
//mThresholdLabel->setText("Threshold: 100 HU");
//menuLayout->addWidget(mThresholdLabel);
nlmSigmaLabel = new QLabel;
std::string text2 = "Sigma: " + boost::lexical_cast<std::string>(0.65) + " ";
nlmSigmaLabel->setText(text2.c_str());
menuLayout->addWidget(nlmSigmaLabel);
//.........这里部分代码省略.........
示例3: initUI
void TimeLine::initUI()
{
Q_ASSERT(editor() != nullptr);
setWindowTitle(tr("Timeline"));
QWidget* timeLineContent = new QWidget(this);
mLayerList = new TimeLineCells(this, editor(), TIMELINE_CELL_TYPE::Layers);
mTracks = new TimeLineCells(this, editor(), TIMELINE_CELL_TYPE::Tracks);
mHScrollbar = new QScrollBar(Qt::Horizontal);
mVScrollbar = new QScrollBar(Qt::Vertical);
mVScrollbar->setMinimum(0);
mVScrollbar->setMaximum(1);
mVScrollbar->setPageStep(1);
QWidget* leftWidget = new QWidget();
leftWidget->setMinimumWidth(120);
QWidget* rightWidget = new QWidget();
QWidget* leftToolBar = new QWidget();
leftToolBar->setFixedHeight(30);
QWidget* rightToolBar = new QWidget();
rightToolBar->setFixedHeight(30);
// --- left widget ---
// --------- layer buttons ---------
QToolBar* layerButtons = new QToolBar(this);
QLabel* layerLabel = new QLabel(tr("Layers:"));
layerLabel->setIndent(5);
QToolButton* addLayerButton = new QToolButton(this);
addLayerButton->setIcon(QIcon(":icons/add.png"));
addLayerButton->setToolTip(tr("Add Layer"));
addLayerButton->setFixedSize(24, 24);
QToolButton* removeLayerButton = new QToolButton(this);
removeLayerButton->setIcon(QIcon(":icons/remove.png"));
removeLayerButton->setToolTip(tr("Remove Layer"));
removeLayerButton->setFixedSize(24, 24);
layerButtons->addWidget(layerLabel);
layerButtons->addWidget(addLayerButton);
layerButtons->addWidget(removeLayerButton);
layerButtons->setFixedHeight(30);
QHBoxLayout* leftToolBarLayout = new QHBoxLayout();
leftToolBarLayout->setMargin(0);
leftToolBarLayout->addWidget(layerButtons);
leftToolBar->setLayout(leftToolBarLayout);
QAction* newBitmapLayerAct = new QAction(QIcon(":icons/layer-bitmap.png"), tr("New Bitmap Layer"), this);
QAction* newVectorLayerAct = new QAction(QIcon(":icons/layer-vector.png"), tr("New Vector Layer"), this);
QAction* newSoundLayerAct = new QAction(QIcon(":icons/layer-sound.png"), tr("New Sound Layer"), this);
QAction* newCameraLayerAct = new QAction(QIcon(":icons/layer-camera.png"), tr("New Camera Layer"), this);
QMenu* layerMenu = new QMenu(tr("&Layer", "Timeline add-layer menu"), this);
layerMenu->addAction(newBitmapLayerAct);
layerMenu->addAction(newVectorLayerAct);
layerMenu->addAction(newSoundLayerAct);
layerMenu->addAction(newCameraLayerAct);
addLayerButton->setMenu(layerMenu);
addLayerButton->setPopupMode(QToolButton::InstantPopup);
QGridLayout* leftLayout = new QGridLayout();
leftLayout->addWidget(leftToolBar, 0, 0);
leftLayout->addWidget(mLayerList, 1, 0);
leftLayout->setMargin(0);
leftLayout->setSpacing(0);
leftWidget->setLayout(leftLayout);
// --- right widget ---
// --------- key buttons ---------
QToolBar* timelineButtons = new QToolBar(this);
QLabel* keyLabel = new QLabel(tr("Keys:"));
keyLabel->setIndent(5);
QToolButton* addKeyButton = new QToolButton(this);
addKeyButton->setIcon(QIcon(":icons/add.png"));
addKeyButton->setToolTip(tr("Add Frame"));
addKeyButton->setFixedSize(24, 24);
QToolButton* removeKeyButton = new QToolButton(this);
removeKeyButton->setIcon(QIcon(":icons/remove.png"));
removeKeyButton->setToolTip(tr("Remove Frame"));
removeKeyButton->setFixedSize(24, 24);
QToolButton* duplicateKeyButton = new QToolButton(this);
duplicateKeyButton->setIcon(QIcon(":icons/controls/duplicate.png"));
duplicateKeyButton->setToolTip(tr("Duplicate Frame"));
duplicateKeyButton->setFixedSize(24, 24);
QLabel* zoomLabel = new QLabel(tr("Zoom:"));
zoomLabel->setIndent(5);
QSlider* zoomSlider = new QSlider(this);
zoomSlider->setRange(4, 40);
zoomSlider->setFixedWidth(74);
zoomSlider->setValue(mTracks->getFrameSize());
//.........这里部分代码省略.........
示例4: initExtraControllers
void VPiano::initExtraControllers()
{
QWidget *w = NULL;
QCheckBox *chkbox = NULL;
Knob *knob = NULL;
QSpinBox *spin = NULL;
QSlider *slider = NULL;
QToolButton *button = NULL;
foreach(const QString& s, m_extraControls) {
QString lbl;
int control = 0;
int type = 0;
int minValue = 0;
int maxValue = 127;
int defValue = 0;
int value = 0;
int size = 100;
QString fileName;
ExtraControl::decodeString( s, lbl, control, type,
minValue, maxValue, defValue,
size, fileName );
if (m_ctlState[m_channel].contains(control))
value = m_ctlState[m_channel][control];
else
value = defValue;
switch(type) {
case 0:
chkbox = new QCheckBox(this);
if (dlgPreferences()->getStyledWidgets()) {
chkbox->setStyle(m_dialStyle);
}
chkbox->setProperty(MIDICTLONVALUE, maxValue);
chkbox->setProperty(MIDICTLOFFVALUE, minValue);
chkbox->setChecked(bool(value));
connect(chkbox, SIGNAL(clicked(bool)), SLOT(slotControlClicked(bool)));
w = chkbox;
break;
case 1:
knob = new Knob(this);
knob->setFixedSize(32, 32);
knob->setStyle(dlgPreferences()->getStyledWidgets()? m_dialStyle : NULL);
knob->setMinimum(minValue);
knob->setMaximum(maxValue);
knob->setValue(value);
knob->setToolTip(QString::number(value));
knob->setDefaultValue(defValue);
knob->setDialMode(Knob::LinearMode);
connect(knob, SIGNAL(sliderMoved(int)), SLOT(slotExtraController(int)));
w = knob;
break;
case 2:
spin = new QSpinBox(this);
spin->setMinimum(minValue);
spin->setMaximum(maxValue);
spin->setValue(value);
connect(spin, SIGNAL(valueChanged(int)), SLOT(slotExtraController(int)));
w = spin;
break;
case 3:
slider = new QSlider(this);
slider->setOrientation(Qt::Horizontal);
slider->setFixedWidth(size);
slider->setMinimum(minValue);
slider->setMaximum(maxValue);
slider->setToolTip(QString::number(value));
slider->setValue(value);
connect(slider, SIGNAL(sliderMoved(int)), SLOT(slotExtraController(int)));
w = slider;
break;
case 4:
button = new QToolButton(this);
button->setText(lbl);
button->setProperty(MIDICTLONVALUE, maxValue);
button->setProperty(MIDICTLOFFVALUE, minValue);
connect(button, SIGNAL(clicked(bool)), SLOT(slotControlClicked(bool)));
w = button;
break;
case 5:
control = 255;
button = new QToolButton(this);
button->setText(lbl);
button->setProperty(SYSEXFILENAME, fileName);
button->setProperty(SYSEXFILEDATA, readSysexDataFile(fileName));
connect(button, SIGNAL(clicked(bool)), SLOT(slotControlClicked(bool)));
w = button;
break;
default:
w = NULL;
}
if (w != NULL) {
if (!lbl.isEmpty() && type < 4) {
QLabel *qlbl = new QLabel(lbl, this);
qlbl->setMargin(TOOLBARLABELMARGIN);
ui.toolBarExtra->addWidget(qlbl);
//connect(qlbl, SIGNAL(destroyed(QObject*)), SLOT(slotDebugDestroyed(QObject*)));
}
w->setProperty(MIDICTLNUMBER, control);
w->setFocusPolicy(Qt::NoFocus);
ui.toolBarExtra->addWidget(w);
//connect(w, SIGNAL(destroyed(QObject*)), SLOT(slotDebugDestroyed(QObject*)));
//.........这里部分代码省略.........