void PreviewToolBar::setPreviewModeMask(int mask) { if (mask == NoPreviewMode) { setDisabled(true); if (d->actionsMenu) d->actionsMenu->setDisabled(true); return; } setDisabled(false); if (d->actionsMenu) d->actionsMenu->setDisabled(false); d->previewOriginalButton->setEnabled(mask & PreviewOriginalImage); d->previewBothButtonVert->setEnabled(mask & PreviewBothImagesHorz); d->previewBothButtonHorz->setEnabled(mask & PreviewBothImagesVert); d->previewDuplicateBothButtonVert->setEnabled(mask & PreviewBothImagesHorzCont); d->previewDupplicateBothButtonHorz->setEnabled(mask & PreviewBothImagesVertCont); d->previewtargetButton->setEnabled(mask & PreviewTargetImage); d->previewToggleMouseOverButton->setEnabled(mask & PreviewToggleOnMouseOver); if (d->actionsGroup) { foreach (QAction* const ac, d->actionsGroup->actions()) { ac->setEnabled(mask & ac->data().toInt()); } }
void MemoryCache::evictResources() { if (disabled()) return; setDisabled(true); setDisabled(false); }
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); }
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); }
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; }
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); } }
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); }
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); } }
DbHeaderListItem::DbHeaderListItem(QTreeWidget* parent, const QString& key) : QObject(parent), QTreeWidgetItem(parent) { // Reset all item flags: item is not selectable. setFlags(Qt::ItemIsEnabled); setDisabled(false); setExpanded(true); setFirstColumnSpanned(true); setTextAlignment(0, Qt::AlignCenter); QFont fn0(font(0)); fn0.setBold(true); fn0.setItalic(false); setFont(0, fn0); QFont fn1(font(1)); fn1.setBold(true); fn1.setItalic(false); setFont(1, fn1); setText(0, key); slotThemeChanged(); connect(ThemeManager::instance(), SIGNAL(signalThemeChanged()), this, SLOT(slotThemeChanged())); }
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); } }
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); } }
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())); }
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(); }
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); }
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())); }
bool CLineEdit::setEditMode(bool p) { if (p == _editMode) return p; if (!_canEdit) return false; _editMode=p; _modeAct->setChecked(p); if (_x_metrics) { if (_editMode) _menuLabel->setPixmap(QPixmap(":/widgets/images/edit.png")); else _menuLabel->setPixmap(QPixmap(":/widgets/images/magnifier.png")); if (!_x_metrics->boolean("DisableAutoComplete") && _editMode) disconnect(this, SIGNAL(textEdited(QString)), this, SLOT(sHandleCompleter())); else if (!_x_metrics->boolean("DisableAutoComplete")) connect(this, SIGNAL(textEdited(QString)), this, SLOT(sHandleCompleter())); } setDisabled(_editMode && _x_metrics->value("CRMAccountNumberGeneration") == "A"); if (!_editMode) selectAll(); emit editable(p); return p; }
void NifBlockEditor::nifDestroyed() { nif = 0; setDisabled( true ); if ( testAttribute( Qt::WA_DeleteOnClose ) ) close(); }
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()); } } } }
MainWindow::MainWindow() { resize(640, 640); scroll = new QScrollArea(); scroll->setWidgetResizable(true); setCentralWidget(scroll); editor = new EditorWidget(); scroll->setWidget(editor); statusBar()->showMessage(tr("%1 - by Overkill.").arg(AppName), 2000); statusBar()->setStyleSheet( "QStatusBar {" " border-top: 1px solid #CCCCCC;" " background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DADBDE, stop: 1 #F6F7FA);" " padding: 4px;" " color: #777777;" "}" ); #ifdef Q_WS_WIN QKeySequence quitSequence(Qt::ALT + Qt::Key_F4); #else QKeySequence quitSequence(QKeySequence::Quit); #endif fileMenu = menuBar()->addMenu(tr("&File")); newAction = createAction(fileMenu, tr("&New"), tr("Create a new CHR."), QKeySequence::New); openAction = createAction(fileMenu, tr("&Open..."), tr("Open an existing CHR."), QKeySequence::Open); createSeparator(fileMenu); saveAction = createAction(fileMenu, tr("&Save..."), tr("Save the current CHR."), QKeySequence::Save); saveAsAction = createAction(fileMenu, tr("Save &As..."), tr("Save a copy of the current CHR."), QKeySequence::SaveAs); createSeparator(fileMenu); for(int i = 0; i < MaxRecentCount; ++i) { auto action = createAction(fileMenu, QKeySequence(Qt::ALT + Qt::Key_1 + i)); action->setDisabled(true); recentFileActions[i] = action; connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile())); } clearRecentAction = createAction(fileMenu, tr("Clear &Recent Files"), tr("Clear all recently opened files."), QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Delete)); updateRecentFiles(); createSeparator(fileMenu); exitAction = createAction(fileMenu, tr("E&xit"), tr("Exit the program."), quitSequence); helpMenu = menuBar()->addMenu(tr("&Help")); aboutAction = createAction(helpMenu, tr("&About..."), tr("About %1.").arg(AppName), QKeySequence::HelpContents); connect(newAction, SIGNAL(triggered()), this, SLOT(newFile())); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile())); connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs())); connect(clearRecentAction, SIGNAL(triggered()), this, SLOT(clearRecentFiles())); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); QTimer::singleShot(0, this, SLOT(newFile())); }
KatePluginListItem::KatePluginListItem(bool checked, KatePluginInfo *info) : QTreeWidgetItem() , mInfo(info) { setCheckState(0, checked ? Qt::Checked : Qt::Unchecked); // skip plugins that will be loaded always! setDisabled (info->alwaysLoad); }
void ShopViewer::updateShopListItem(const Shop* shop) { auto item = _shopListItems.value(shop); Q_ASSERT(item); auto widget = ui->listWidget->itemWidget(item); widget->setDisabled(shop->isDisabled()); ui->listWidget->repaint(); }
void NewsItem::deleteNews() { QFont font = textLabel_->font(); font.setBold(false); textLabel_->setFont(font); setDisabled(true); emit signalDeleteNews(feedId_, newsId_); }
void VlcWidgetVolumeSlider::setMute(const bool &enabled) { if (!(_vlcMediaPlayer->state() == Vlc::Buffering || _vlcMediaPlayer->state() == Vlc::Playing || _vlcMediaPlayer->state() == Vlc::Paused)) return; if (!enabled) { _timer->start(100); setDisabled(false); } else { _timer->stop(); setDisabled(true); } _vlcAudio->toggleMute(); }
void QmlKeyframesMetadata::checkVersion(const QString& version) { if (!m_minimumVersion.isEmpty()) { LOG_DEBUG() << "MLT version:" << version << "Shotcut minimumVersion:" << m_minimumVersion; if (QVersionNumber::fromString(version) < QVersionNumber::fromString(m_minimumVersion)) setDisabled(); } }
TableauChiffres::TableauChiffres(QVector<int> const& chiffres , QWidget *parent) : QLineEdit(parent) , m_chiffres (chiffres) , m_taille (chiffres.size()) , m_texte ("") , m_affichage (Tout) { setDisabled(true); }
TableauChiffres::TableauChiffres(int taille , QWidget *parent) : QLineEdit (parent) , m_chiffres(taille), m_taille (taille), m_texte ("") , m_affichage (Tout) { setDisabled(true); }
FrameInfoWidget::FrameInfoWidget(FrameStorageStruct* pFS, QWidget *parent) : FSUtil(pFS), QWidget(parent), m_posModelX(this), m_posModelY(this), m_alphaModel(this), m_scaleModel(this), m_dataMapper(this) { FS()->m_pFrameInfo = this; ui.setupUi(this); connect(ui.btnImage, SIGNAL(clicked()), this, SLOT(onLoadImage())); ui.btnImage->setPixmap(QPixmap(":/AnimationEditor/Resources/obj.png")); m_dataMapper.setModel(AnimantionMgr::instance()); setDisabled(true); struct { AnimationEditWidget eType; QWidget* pWidget; } widget[] = { { AniEditWidget_Name, ui.name }, { AniEditWidget_TimeFrom, ui.spinBoxTimeFrom }, { AniEditWidget_Duration, ui.spinBoxTimeDuration }, { AniEditWidget_PosFromX, ui.editFromX }, { AniEditWidget_PosToX, ui.editToX }, { AniEditWidget_CurvePosX, ui.comboBoxPosX }, { AniEditWidget_PosFromY, ui.editFromY }, { AniEditWidget_PosToY, ui.editToY }, { AniEditWidget_CurvePosY, ui.comboBoxPosY }, { AniEditWidget_AlphaFrom, ui.editAlphaFrom }, { AniEditWidget_AlphaTo, ui.editAlphaTo }, { AniEditWidget_CurveAlpha, ui.comboBoxAlpha }, { AniEditWidget_ScaleFrom, ui.spinBoxScaleFrom }, { AniEditWidget_ScaleTo, ui.spinBoxScaleTo }, { AniEditWidget_CurveScale, ui.comboBoxScale }, }; for (int i = 0; i < _countof(widget); i++) { m_dataMapper.addMapping(widget[i].pWidget, (int)widget[i].eType); } m_dataMapper.setItemDelegate(new AnimationDelegate(&m_dataMapper)); m_dataMapper.setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ui.comboBoxPosX->setModel(&m_posModelX); ui.comboBoxPosY->setModel(&m_posModelY); ui.comboBoxAlpha->setModel(&m_alphaModel); ui.comboBoxScale->setModel(&m_scaleModel); ui.comboBoxPosX->setIconSize(QSize(ICON_SIZE, ICON_SIZE)); ui.comboBoxPosY->setIconSize(QSize(ICON_SIZE, ICON_SIZE)); ui.comboBoxAlpha->setIconSize(QSize(ICON_SIZE, ICON_SIZE)); ui.comboBoxScale->setIconSize(QSize(ICON_SIZE, ICON_SIZE)); QSignalMapper* pMapper = new QSignalMapper(this); connect(ui.btnPreview, SIGNAL(clicked()), this, SLOT(onPreview())); connect(ui.btnGen, SIGNAL(clicked()), this, SLOT(onGenCode())); connect(ui.comboBoxAlpha, SIGNAL(currentIndexChanged(int)), this, SLOT(onEasingCurveChanged(int))); connect(ui.comboBoxScale, SIGNAL(currentIndexChanged(int)), this, SLOT(onEasingCurveChanged(int))); connect(ui.comboBoxPosX, SIGNAL(currentIndexChanged(int)), this, SLOT(onEasingCurveChanged(int))); connect(ui.comboBoxPosY, SIGNAL(currentIndexChanged(int)), this, SLOT(onEasingCurveChanged(int))); }
void SimulateTrafficDialog::lockControl() { startButton->setEnabled(false); stopButton->setEnabled(true); prevButton->setEnabled(true); nextButton->setEnabled(true); fecComboBox->setEnabled(false); view->setDisabled(true); setDisabled(false); }
void HTTPValuePanel::requestFinished(bool error) { if(!error) { if(mState == WaitingForAllValuesAvailable) { mValueEdit->clear(); fillValueList(""); } } mState = None; setDisabled(false); }
//open function window void kf::kopen(){ int li=ui->ggf->currentIndex().row(); QDialog *lf=0; if (li>=0) {lf=tf->r[ui->ggf->m->gri(li)].f;} if (lf) { lf->activateWindow(); } else { uint lf_i=tf->r[ui->ggf->m->gri(li)].f_i; setDisabled(true); //============== QWidget * lp = static_cast<QWidget *>(this->parent()); switch (lf_i) { //!!just comment line if you won't compile or use punkt menu case 0: lf=new ksetup(lp,lf_i);break; // case 1: lf=new kwaterplant(lp,lf_i);break; default: { setDisabled(false); activateWindow(); ui->etf->setFocus(); return; } } //=============== //ui->ggf->saveopen(lf); if (li>=0) {tf->r[ui->ggf->m->gri(li)].f=lf;} lf->setAttribute(Qt::WA_DeleteOnClose); lf->setWindowTitle( ui->ggf->model()->data( ui->ggf->model()->index(ui->ggf->selectionModel()->currentIndex().row(),0) ).toString() ); lf->setWindowFlags(lf->windowFlags()|Qt::WindowMinMaxButtonsHint); // connect(lf,SIGNAL(markzero(uint)),this,SLOT(markzero(uint))); connect(lf,SIGNAL(kfshow()),this,SLOT(kfshow())); //show centered and maximized lf->showMaximized(); setDisabled(false); } //sp(itos(ui->dgfmenu->selectionModel()->currentIndex().row())); }