本文整理汇总了C++中setDisabled函数的典型用法代码示例。如果您正苦于以下问题:C++ setDisabled函数的具体用法?C++ setDisabled怎么用?C++ setDisabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setDisabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDisabled
void MemoryCache::evictResources()
{
if (disabled())
return;
setDisabled(true);
setDisabled(false);
}
示例2: setDisabled
void TowerButton::disable(unsigned int money) {
// If the amount of money we have is greater than or equal to the cost of the upgrade
// the upgrade tower button is not disabled
if(money >= m_cost) {
setDisabled(false);
return;
}
// If the cost of the upgrade is greater than the amount of money we have the button
// is disabled
setDisabled(true);
}
示例3: setDisabled
void FLReportViewer::slotPrintReport()
{
if (slotsPrintDisabled_)
return;
setDisabled(true);
printing_ = true;
reportPrinted_ = rptViewer_->printReport();
if (reportPrinted_ && autoClose_)
QTimer::singleShot(0, this, SLOT(slotExit()));
printing_ = false;
setDisabled(false);
}
示例4: QMenu
QMenu* TreeWidget::createContextMenu(TreeItem* item)
{
QMenu* menu = new QMenu(this);
menu->addAction(item->text(0))->setEnabled(false);
menu->addSeparator();
connect(item, SIGNAL(destroyed(TreeItem*)), menu, SLOT(deleteLater()));
const bool child = item->parentItem();
const bool connected = item->connection()->isActive();
const bool waiting = item->connection()->status() == IrcConnection::Waiting;
const bool active = item->buffer()->isActive();
const bool channel = item->buffer()->isChannel();
if (!child) {
QAction* editAction = menu->addAction(tr("Edit"), this, SLOT(onEditTriggered()));
editAction->setData(QVariant::fromValue(item));
menu->addSeparator();
if (waiting) {
QAction* stopAction = menu->addAction(tr("Stop"));
connect(stopAction, SIGNAL(triggered()), item->connection(), SLOT(setDisabled()));
connect(stopAction, SIGNAL(triggered()), item->connection(), SLOT(close()));
} else if (connected) {
QAction* disconnectAction = menu->addAction(tr("Disconnect"));
connect(disconnectAction, SIGNAL(triggered()), item->connection(), SLOT(setDisabled()));
connect(disconnectAction, SIGNAL(triggered()), item->connection(), SLOT(quit()));
} else {
QAction* reconnectAction = menu->addAction(tr("Reconnect"));
connect(reconnectAction, SIGNAL(triggered()), item->connection(), SLOT(setEnabled()));
connect(reconnectAction, SIGNAL(triggered()), item->connection(), SLOT(open()));
}
}
if (connected && child) {
QAction* action = 0;
if (!channel)
action = menu->addAction(tr("Whois"), this, SLOT(onWhoisTriggered()));
else if (!active)
action = menu->addAction(tr("Join"), this, SLOT(onJoinTriggered()));
else
action = menu->addAction(tr("Part"), this, SLOT(onPartTriggered()));
action->setData(QVariant::fromValue(item));
}
QAction* closeAction = menu->addAction(tr("Close"), this, SLOT(onCloseTriggered()), QKeySequence::Close);
closeAction->setShortcutContext(Qt::WidgetShortcut);
closeAction->setData(QVariant::fromValue(item));
return menu;
}
示例5: setDisabled
void FrameInfoWidget::onCurrentAnimationChanged(int iIndex)
{
if (iIndex == -1)
{
setDisabled(true);
return;
}
else
{
m_dataMapper.setCurrentIndex(iIndex);
AniPreviewWnd* pWnd = FS()->m_pPreviewWnd;
connect(this, SIGNAL(previewAnimation(AnimationInfo*)), pWnd, SLOT(onActionChanged(AnimationInfo*)));
setDisabled(false);
}
}
示例6: QGraphicsView
myGraphicsView::myGraphicsView(QWidget *parent) : QGraphicsView(parent)
{
setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
this->installEventFilter(this);
this->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
this->setResizeAnchor( QGraphicsView::AnchorUnderMouse );
origin = QPoint(0,0);
mTL = new QLabel(this);
scene = new QGraphicsScene(this);
scene->addText("No Images Available. Please browse to a folder containing appropriate images.");
setScene(scene);
setCursor(Qt::CrossCursor);
setDisabled(true);
mBR = new QLabel(this);
mTL->setStyleSheet("QLabel { background-color : white; color : black;}");
mBR->setStyleSheet("QLabel { background-color : white; color : black;}");
mTL->hide();
mBR->hide();
rubberBandActive = false;
rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
QPalette palette;
QColor highlight(Qt::green);
highlight.setAlpha(100);
palette.setBrush(QPalette::Highlight, QBrush(highlight));
palette.setBrush(QPalette::Shadow, QColor(Qt::red));
rubberBand->setPalette(palette);
rubberBand->setGeometry(20, 20, 200, 100);
}
示例7: setDisabled
void ByteSourceGuiButton::refreshState()
{
gui = byteSource->getGui();
if (gui != nullptr) {
setDisabled(false);
setVisible(true);
connect(localAction, &QAction::toggled, this, &ByteSourceGuiButton::onToggle, Qt::UniqueConnection);
connect(this, &ByteSourceGuiButton::toggled, this, &ByteSourceGuiButton::onToggle, Qt::UniqueConnection);
} else {
qDebug() << tr("No gui available for this source %1").arg(byteSource->metaObject()->className());
setDisabled(true);
setVisible(false);
}
}
示例8: shopsPath
void AdamantShopPlugin::loadShops(const QStringList ¤tLeagues) {
_shops.clear();
QStringList leagues = currentLeagues;
// NOTE(rory): Load leagues
auto list = shopsPath().entryInfoList({"*.shop"});
for (QFileInfo info : list) {
if (leagues.contains(info.baseName())) continue;
leagues.append(info.baseName());
}
// NOTE(rory):
for (const QString& league : leagues) {
if (_shops.contains(league)) continue;
bool disabled = !currentLeagues.contains(league);
auto shop = loadShop(shopsPath().absoluteFilePath(QString("%1.shop").arg(league)));
if (!shop) {
shop = new Shop(league);
shop->setUnused();
}
shop->setDisabled(disabled);
_shops.insert(shop->league(), shop);
_viewer->addShop(shop);
}
}
示例9: QPushButton
ByteSourceGuiButton::ByteSourceGuiButton(ByteSourceAbstract *bytesource, GuiHelper *nguiHelper, QWidget *parent) :
QPushButton(parent)
{
byteSource = bytesource;
guiHelper = nguiHelper;
guidia = nullptr;
localAction = nullptr;
localAction = new(std::nothrow) QAction(tr(""), this);
if (localAction == nullptr) {
qFatal("Cannot allocate memory for QAction X{");
}
localAction->setCheckable(true);
setCheckable(true);
setToolTip(tr("Configuration panel"));
setIcon(QIcon(":/Images/icons/configure-5.png"));
setMaximumWidth(25);
//setDefaultAction(localAction);
setFlat(true);
gui = byteSource->getGui();
if (gui != nullptr) {
connect(localAction, &QAction::toggled, this, &ByteSourceGuiButton::onToggle,Qt::UniqueConnection);
connect(this, &ByteSourceGuiButton::toggled, this, &ByteSourceGuiButton::onToggle,Qt::UniqueConnection);
} else {
localAction->setToolTip(tr("No settings available for this source"));
setDisabled(true);
setVisible(false);
}
}
示例10: QTreeWidget
InterfaceTree::InterfaceTree(QWidget *parent) :
QTreeWidget(parent)
#ifdef HAVE_LIBPCAP
,stat_cache_(NULL)
,stat_timer_(NULL)
#endif // HAVE_LIBPCAP
{
QTreeWidgetItem *ti;
qRegisterMetaType< PointList >("PointList");
header()->setVisible(false);
setRootIsDecorated(false);
setUniformRowHeights(true);
/* Seems to have no effect, still the default value (2) is being used, as it
* was set in the .ui file. But better safe, then sorry. */
resetColumnCount();
setSelectionMode(QAbstractItemView::ExtendedSelection);
setAccessibleName(tr("Welcome screen list"));
setItemDelegateForColumn(IFTREE_COL_STATS, new SparkLineDelegate(this));
setDisabled(true);
ti = new QTreeWidgetItem();
ti->setText(IFTREE_COL_NAME, tr("Waiting for startup%1").arg(UTF8_HORIZONTAL_ELLIPSIS));
addTopLevelItem(ti);
resizeColumnToContents(IFTREE_COL_NAME);
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(getInterfaceList()));
connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(interfaceListChanged()));
connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelectedInterfaces()));
}
示例11: updateState
void Playback::updateState(const AudioPlaybackState &playbackState) {
qint64 position = 0, duration = playbackState.duration;
auto wasDisabled = _slider->isDisabled();
if (wasDisabled) setDisabled(false);
_playing = !(playbackState.state & AudioPlayerStoppedMask);
if (_playing || playbackState.state == AudioPlayerStopped) {
position = playbackState.position;
} else if (playbackState.state == AudioPlayerStoppedAtEnd) {
position = playbackState.duration;
} else {
position = 0;
}
float64 progress = 0.;
if (position > duration) {
progress = 1.;
} else if (duration) {
progress = duration ? snap(float64(position) / duration, 0., 1.) : 0.;
}
if (duration != _duration || position != _position || wasDisabled) {
auto animated = (duration && _duration && progress > _slider->value());
_slider->setValue(progress, animated);
_position = position;
_duration = duration;
}
_slider->update();
}
示例12: disconnect
void AMControlMoveButton::setControl(AMControl *control)
{
if(control == control_)
return;
// in the future: if we wanted to be slightly more efficient, could update the context menu to give it an editor for the new control instead of just deleting it and letting a new one be created.
if(contextMenu_) {
contextMenu_->deleteLater();
contextMenu_ = 0;
}
if(control_) {
disconnect(control_, 0, this, 0);
}
control_ = control;
if(control_) {
connect(control_, SIGNAL(destroyed()), this, SLOT(onControlDestroyed()));
connect(control_, SIGNAL(connected(bool)), this, SLOT(setEnabled(bool)));
}
setText(QString::number(currentStepSize()) % (control_ ? control_->units() : QString()));
if(control_ && toolTip().isEmpty())
setToolTip(control_->description().isEmpty() ? control_->name() : control_->description());
// enabled / disabled:
if(control_ && control->isConnected())
setEnabled(true);
else
setDisabled(true);
}
示例13: QTreeWidget
InterfaceTree::InterfaceTree(QWidget *parent) :
QTreeWidget(parent)
#ifdef HAVE_LIBPCAP
,stat_cache_(NULL)
,stat_timer_(NULL)
#endif // HAVE_LIBPCAP
{
QTreeWidgetItem *ti;
header()->setVisible(false);
setRootIsDecorated(false);
setUniformRowHeights(true);
setColumnCount(2);
setSelectionMode(QAbstractItemView::ExtendedSelection);
setAccessibleName(tr("Welcome screen list"));
setItemDelegateForColumn(1, new SparkLineDelegate());
setDisabled(true);
ti = new QTreeWidgetItem();
ti->setText(0, tr("Waiting for startup" UTF8_HORIZONTAL_ELLIPSIS));
addTopLevelItem(ti);
resizeColumnToContents(0);
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(getInterfaceList()));
connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelectedInterfaces()));
}
示例14: setDisabled
void NifBlockEditor::nifDestroyed()
{
nif = 0;
setDisabled( true );
if ( testAttribute( Qt::WA_DeleteOnClose ) )
close();
}
示例15: setDisabled
void LLPanelNearByMedia::onClickSelectedMediaPlay()
{
LLUUID selected_media_id = mMediaList->getValue().asUUID();
// First enable it
setDisabled(selected_media_id, false);
// Special code to make play "unpause" if time-based and playing
if (selected_media_id != PARCEL_AUDIO_LIST_ITEM_UUID)
{
LLViewerMediaImpl *impl = (selected_media_id == PARCEL_MEDIA_LIST_ITEM_UUID) ?
((LLViewerMediaImpl*)LLViewerParcelMedia::getParcelMedia()) : LLViewerMedia::getMediaImplFromTextureID(selected_media_id);
if (NULL != impl)
{
if (impl->isMediaTimeBased() && impl->isMediaPaused())
{
// Aha! It's really time-based media that's paused, so unpause
impl->play();
return;
}
else if (impl->isParcelMedia())
{
LLViewerParcelMedia::play(LLViewerParcelMgr::getInstance()->getAgentParcel());
}
}
}
}