本文整理汇总了C++中QSlider::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QSlider::setEnabled方法的具体用法?C++ QSlider::setEnabled怎么用?C++ QSlider::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSlider
的用法示例。
在下文中一共展示了QSlider::setEnabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetSliders
// scale and adjust the upper slider group
void TriangleDensityWidget::resetSliders(double norm)
{
TriangleList triangles = triangleScene->triangles();
int n = 0;
foreach (Triangle* t, triangles)
{
QSlider* sl = sliders[n];
QLabel* la = slider_names[n];
sl->blockSignals(true);
sl->setSliderPosition((int)( t->xform()->density / norm * 1000. ));
sl->blockSignals(false);
sl->setVisible(true);
la->setVisible(true);
sl->setToolTip(triangleScene->getInfoLabel(t));
if (genome_ptr->final_xform_enable
&& genome_ptr->final_xform_index == n)
{
sl->setEnabled(false);
la->setEnabled(false);
}
else
{
sl->setEnabled(true);
la->setEnabled(true);
}
n++;
}
示例2: createWidgets
QWidget* createWidgets(BasePropertyWidget* parent)
{
m_slider = new QSlider(parent);
m_slider->setOrientation(Qt::Horizontal);
m_slider->setEnabled(!parent->readOnly());
QObject::connect(m_slider, &QSlider::valueChanged, parent, &BasePropertyWidget::setWidgetDirty);
auto rangeMeta = parent->property()->getMeta<meta::RangeWithStep<value_type>>();
float minVal = 0, maxVal = 100, step = 1;
if (rangeMeta)
{
minVal = rangeMeta->min;
maxVal = rangeMeta->max;
step = rangeMeta->step;
}
m_scale = 1 / step;
m_offset = -minVal * m_scale;
float range = maxVal - minVal;
int intRange = static_cast<int>(range * m_scale);
m_slider->setMinimum(0);
m_slider->setMaximum(intRange);
return m_slider;
}
示例3: startPlaying
void MediaView::startPlaying() {
// qDebug() << __PRETTY_FUNCTION__;
if (stopped) return;
if (!downloadItem) {
skip();
return;
}
if (downloadItem->offset() == 0) {
currentVideoSize = downloadItem->bytesTotal();
// qDebug() << "currentVideoSize" << currentVideoSize;
}
// go!
QString source = downloadItem->currentFilename();
qDebug() << "Playing" << source << QFile::exists(source);
#ifdef APP_PHONON
mediaObject->setCurrentSource(QUrl::fromLocalFile(source));
mediaObject->play();
#endif
#ifdef APP_PHONON_SEEK
MainWindow::instance()->getSeekSlider()->setEnabled(false);
#else
QSlider *slider = MainWindow::instance()->getSlider();
slider->setEnabled(true);
#endif
}
示例4: on_propertyCheckbox_changed
void AbstractCameraManager::on_propertyCheckbox_changed(int state) {
if( selectedItem == NULL ) return;
CameraProperty* prop = reinterpret_cast<CameraProperty*>( sender()->property("CameraProperty").value<quintptr>() );
qDebug() << sender() << prop->getName().c_str();
prop->setAuto(state == Qt::Checked);
cameraTree_recursiveSetProperty(selectedItem, prop);
//(de)activate slider
if( prop->getType() == CameraManager::AUTOTRIGGER ) return;
QSlider* slider = reinterpret_cast<QSlider*>( sender()->property("TreeWidgetSlider").value<quintptr>() );
qDebug() << "Qslider" << slider;
if(state != Qt::Checked) {
slider->setEnabled(true);
slider->setValue(prop->getValueToSlider());
} else {
slider->setEnabled(false);
}
}
示例5: stop
void MediaView::stop() {
stopped = true;
while (!history.isEmpty()) {
VideoSource *videoSource = history.takeFirst();
if (!videoSource->parent()) delete videoSource;
}
playlistModel->abortSearch();
videoAreaWidget->clear();
videoAreaWidget->update();
errorTimer->stop();
playlistView->selectionModel()->clearSelection();
if (downloadItem) {
downloadItem->stop();
delete downloadItem;
downloadItem = 0;
currentVideoSize = 0;
}
The::globalActions()->value("refine-search")->setChecked(false);
updateSubscriptionAction(0, false);
#ifdef APP_ACTIVATION
demoTimer->stop();
#endif
foreach (QAction *action, currentVideoActions)
action->setEnabled(false);
QAction *a = The::globalActions()->value("download");
a->setEnabled(false);
a->setVisible(false);
#ifdef APP_PHONON
mediaObject->stop();
#endif
currentVideoId.clear();
#ifndef APP_PHONON_SEEK
QSlider *slider = MainWindow::instance()->getSlider();
slider->setEnabled(false);
slider->setValue(0);
#else
Phonon::SeekSlider *slider = MainWindow::instance()->getSeekSlider();
#endif
if (snapshotSettings) {
delete snapshotSettings;
snapshotSettings = 0;
}
}
示例6: updateProperties
void AbstractCameraManager::updateProperties() {
AbstractCamera* selected = selectedCamera;
if( selected == NULL ) return ;
for( int i = propertiesList.topLevelItemCount()-1; i>=0; i--) {
QTreeWidgetItem* item = propertiesList.topLevelItem(i);
QCheckBox* checkBox = qobject_cast<QCheckBox*>( propertiesList.itemWidget(item, Ui::PropertyAuto) );
CameraManager::CameraProperty * prop = reinterpret_cast<CameraManager::CameraProperty*>( checkBox->property("CameraProperty").value<quintptr>() );
QSlider* slider = reinterpret_cast<QSlider*>( checkBox->property("TreeWidgetSlider").value<quintptr>() );
//qDebug() << "updating:" << prop->getName().c_str();
selected->updateProperty(prop);
item->setText(Ui::PropertyValue, prop->formatValue() );
checkBox->setChecked(prop->getAuto());
if( prop->getType() == CameraManager::AUTOTRIGGER ) continue;
slider->setValue(prop->getValueToSlider());
slider->setEnabled(!prop->getAuto());
}
}
示例7: main
int main(int argc, char **argv)
{
QApplication app(argc, argv);
Q3DSurface *graph = new Q3DSurface();
QWidget *container = QWidget::createWindowContainer(graph);
QSize screenSize = graph->screen()->size();
container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 1.6));
container->setMaximumSize(screenSize);
container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
container->setFocusPolicy(Qt::StrongFocus);
QWidget *widget = new QWidget;
QHBoxLayout *hLayout = new QHBoxLayout(widget);
QVBoxLayout *vLayout = new QVBoxLayout();
hLayout->addWidget(container, 1);
hLayout->addLayout(vLayout);
vLayout->setAlignment(Qt::AlignTop);
widget->setWindowTitle(QStringLiteral("Interpolation"));
QGroupBox *modelGroupBox = new QGroupBox(QStringLiteral("Mode"));
QRadioButton *InitPlotModelRB = new QRadioButton(widget);
InitPlotModelRB->setText(QStringLiteral("Initial plot"));
InitPlotModelRB->setChecked(false);
QRadioButton *InterpModelRB = new QRadioButton(widget);
InterpModelRB->setText(QStringLiteral("Interpolating plot"));
InterpModelRB->setChecked(false);
QRadioButton *InitInterpModelRB = new QRadioButton(widget);
InitInterpModelRB->setText(QStringLiteral("Initial and Interpolating plots"));
InitInterpModelRB->setChecked(false);
QRadioButton *ResidModelRB = new QRadioButton(widget);
ResidModelRB->setText(QStringLiteral("Residual norm plot"));
ResidModelRB->setChecked(false);
QVBoxLayout *modelVBox = new QVBoxLayout;
modelVBox->addWidget(InitPlotModelRB);
modelVBox->addWidget(InterpModelRB);
modelVBox->addWidget(InitInterpModelRB);
modelVBox->addWidget(ResidModelRB);
modelGroupBox->setLayout(modelVBox);
QSlider *axisMinSliderX = new QSlider(Qt::Horizontal, widget);
axisMinSliderX->setMinimum(0);
axisMinSliderX->setTickInterval(1);
axisMinSliderX->setEnabled(true);
QSlider *axisMaxSliderX = new QSlider(Qt::Horizontal, widget);
axisMaxSliderX->setMinimum(1);
axisMaxSliderX->setTickInterval(1);
axisMaxSliderX->setEnabled(true);
QSlider *axisMinSliderZ = new QSlider(Qt::Horizontal, widget);
axisMinSliderZ->setMinimum(0);
axisMinSliderZ->setTickInterval(1);
axisMinSliderZ->setEnabled(true);
QSlider *axisMaxSliderZ = new QSlider(Qt::Horizontal, widget);
axisMaxSliderZ->setMinimum(1);
axisMaxSliderZ->setTickInterval(1);
axisMaxSliderZ->setEnabled(true);
QLabel *countN = new QLabel(widget);
QLabel *countM = new QLabel(widget);
vLayout->addWidget(modelGroupBox);
vLayout->addWidget(new QLabel(QStringLiteral("Column range")));
vLayout->addWidget(axisMinSliderX);
vLayout->addWidget(axisMaxSliderX);
vLayout->addWidget(new QLabel(QStringLiteral("Row range")));
vLayout->addWidget(axisMinSliderZ);
vLayout->addWidget(axisMaxSliderZ);
vLayout->addWidget(new QLabel(QStringLiteral("Points at X axis")));
vLayout->addWidget(countN);
vLayout->addWidget(new QLabel(QStringLiteral("Points at Z axis")));
vLayout->addWidget(countM);
vLayout->addWidget(new QLabel(QStringLiteral("Press 1 to change the plot\n"
"Press 2 to increase number of points at X axis\n"
"Press 3 to decrease number of points at X axis\n"
"Press 4 to increase number of points at Z axis\n"
"Press 5 to decrease number of points at Z axis")));
widget->show();
SurfaceGraph *modifier = new SurfaceGraph(graph);
modifier->key1 = new QShortcut(widget);
modifier->key1->setKey(Qt::Key_1);
QObject::connect(modifier->key1, SIGNAL(activated()), modifier, SLOT(slotShortcut1()));
modifier->key2 = new QShortcut(widget);
modifier->key2->setKey(Qt::Key_2);
QObject::connect(modifier->key2, SIGNAL(activated()), modifier, SLOT(slotShortcut2()));
modifier->key3 = new QShortcut(widget);
modifier->key3->setKey(Qt::Key_3);
QObject::connect(modifier->key3, SIGNAL(activated()), modifier, SLOT(slotShortcut3()));
modifier->key4 = new QShortcut(widget);
//.........这里部分代码省略.........
示例8: displaySettings
//.........这里部分代码省略.........
}
delete layout;
}
for ( uint i = 0; i < m_namedGains.size(); i++ )
{
std::pair< QString, std::vector<double> > pair = m_namedGains[i];
QHBoxLayout *layout = new QHBoxLayout();
QLabel *gainName = new QLabel( pair.first + " Gain" );
QSlider *gainSlider = new QSlider(Qt::Horizontal);
QLabel *gainLabel = new QLabel("0");
gainLabel->setMinimumWidth(30);
gainLabel->setAlignment(Qt::AlignHCenter | Qt::AlignHCenter);
QPair< QSlider*, QLabel* > pair2( gainSlider, gainLabel );
m_gainControls.push_back( pair2 );
connect(gainSlider, SIGNAL(valueChanged(int)),
this, SLOT(on_sldGain_valueChanged(int)));
layout->addWidget(gainName);
layout->addWidget(gainSlider);
layout->addWidget(gainLabel);
layoutGains->addLayout(layout);
std::vector<double> gain_values = pair.second;
if ( gain_values.size() ) {
gainSlider->setRange(0, gain_values.size() - 1);
gainSlider->setValue(gain_values.size() / 4);
gainSlider->setEnabled(true);
} else {
gainSlider->setEnabled(false);
}
}
oldIndex = ui->cboSampleRate->currentIndex();
ui->cboSampleRate->clear();
for ( uint i = 0; i < m_sampRates.size(); i++ )
ui->cboSampleRate->addItem( QString::number(m_sampRates[i] / 1e6) );
if ( oldIndex > ui->cboSampleRate->count() - 1 )
oldIndex = 0;
if ( ui->cboSampleRate->count() && oldIndex >= 0 )
ui->cboSampleRate->setCurrentIndex(oldIndex);
if ( ui->cboSampleRate->count() ) {
ui->cboSampleRate->setEnabled(true);
} else {
ui->cboSampleRate->setEnabled(false);
}
oldIndex = ui->cboAntennas->currentIndex();
ui->cboAntennas->clear();
if ( m_antennas.size() ) {
for ( uint i = 0; i < m_antennas.size(); i++ )
ui->cboAntennas->addItem( m_antennas[i] );
if ( oldIndex > ui->cboAntennas->count() - 1 )
oldIndex = 0;
示例9: grBtoY
//.........这里部分代码省略.........
QRadioButton *modeNoneRB = new QRadioButton(widget);
modeNoneRB->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
modeNoneRB->setText(QStringLiteral("No selection"));
modeNoneRB->setChecked(false);
QRadioButton *modeItemRB = new QRadioButton(widget);
modeItemRB->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
modeItemRB->setText(QStringLiteral("Item"));
modeItemRB->setChecked(false);
QRadioButton *modeSliceRowRB = new QRadioButton(widget);
modeSliceRowRB->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
modeSliceRowRB->setText(QStringLiteral("Row Slice"));
modeSliceRowRB->setChecked(false);
QRadioButton *modeSliceColumnRB = new QRadioButton(widget);
modeSliceColumnRB->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
modeSliceColumnRB->setText(QStringLiteral("Column Slice"));
modeSliceColumnRB->setChecked(false);
QVBoxLayout *selectionVBox = new QVBoxLayout;
selectionVBox->addWidget(modeNoneRB);
selectionVBox->addWidget(modeItemRB);
selectionVBox->addWidget(modeSliceRowRB);
selectionVBox->addWidget(modeSliceColumnRB);
selectionGroupBox->setLayout(selectionVBox);
QSlider *axisCameraSliderZ = new QSlider(Qt::Horizontal, widget);
axisCameraSliderZ->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
axisCameraSliderZ->setMinimum(0);
axisCameraSliderZ->setMaximum(179);
axisCameraSliderZ->setTickInterval(1);
axisCameraSliderZ->setEnabled(true);
QSlider *axisCameraSliderY = new QSlider(Qt::Horizontal, widget);
axisCameraSliderY->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
axisCameraSliderY->setMinimum(0);
axisCameraSliderY->setMaximum(180);
axisCameraSliderY->setTickInterval(0);
axisCameraSliderY->setEnabled(true);
QComboBox *themeList = new QComboBox(widget);
themeList->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
themeList->addItem(QStringLiteral("Qt"));
themeList->addItem(QStringLiteral("Primary Colors"));
themeList->addItem(QStringLiteral("Digia"));
themeList->addItem(QStringLiteral("Stone Moss"));
themeList->addItem(QStringLiteral("Army Blue"));
themeList->addItem(QStringLiteral("Retro"));
themeList->addItem(QStringLiteral("Ebony"));
themeList->addItem(QStringLiteral("Isabelle"));
QGroupBox *colorGroupBox = new QGroupBox(QStringLiteral("Custom gradient"));
QLinearGradient grBtoY(0, 0, 1, 100);
grBtoY.setColorAt(1.0, Qt::black);
grBtoY.setColorAt(0.67, Qt::blue);
grBtoY.setColorAt(0.33, Qt::red);
grBtoY.setColorAt(0.0, Qt::yellow);
QPixmap pm(24, 100);
QPainter pmp(&pm);
pmp.setBrush(QBrush(grBtoY));
示例10: activeRowChanged
void MediaView::activeRowChanged(int row) {
if (stopped) return;
errorTimer->stop();
#ifdef APP_PHONON
mediaObject->stop();
#endif
if (downloadItem) {
downloadItem->stop();
delete downloadItem;
downloadItem = 0;
currentVideoSize = 0;
}
Video *video = playlistModel->videoAt(row);
if (!video) return;
videoAreaWidget->showLoading(video);
connect(video, SIGNAL(gotStreamUrl(QUrl)),
SLOT(gotStreamUrl(QUrl)), Qt::UniqueConnection);
connect(video, SIGNAL(errorStreamUrl(QString)),
SLOT(skip()), Qt::UniqueConnection);
video->loadStreamUrl();
// video title in titlebar
MainWindow::instance()->setWindowTitle(video->title() + " - " + Constants::NAME);
// ensure active item is visible
if (row != -1) {
QModelIndex index = playlistModel->index(row, 0, QModelIndex());
playlistView->scrollTo(index, QAbstractItemView::EnsureVisible);
}
// enable/disable actions
The::globalActions()->value("download")->setEnabled(
DownloadManager::instance()->itemForVideo(video) == 0);
The::globalActions()->value("previous")->setEnabled(row > 0);
The::globalActions()->value("stopafterthis")->setEnabled(true);
The::globalActions()->value("related-videos")->setEnabled(true);
bool enableDownload = video->license() == Video::LicenseCC;
#ifdef APP_ACTIVATION
enableDownload = enableDownload || Activation::instance().isLegacy();
#endif
#ifdef APP_DOWNLOADS
enableDownload = true;
#endif
QAction *a = The::globalActions()->value("download");
a->setEnabled(enableDownload);
a->setVisible(enableDownload);
updateSubscriptionAction(video, YTChannel::isSubscribed(video->channelId()));
foreach (QAction *action, currentVideoActions)
action->setEnabled(true);
#ifndef APP_PHONON_SEEK
QSlider *slider = MainWindow::instance()->getSlider();
slider->setEnabled(false);
slider->setValue(0);
#endif
if (snapshotSettings) {
delete snapshotSettings;
snapshotSettings = 0;
MainWindow::instance()->adjustStatusBarVisibility();
}
// see you in gotStreamUrl...
}