本文整理汇总了C++中canceled函数的典型用法代码示例。如果您正苦于以下问题:C++ canceled函数的具体用法?C++ canceled怎么用?C++ canceled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了canceled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QProgressDialog
FileDownloader::FileDownloader(QWidget *parent) : QProgressDialog(parent)
{
reply = 0;
manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(gotResponse(QNetworkReply*)));
setMinimumDuration(0);
setRange(0,0);
connect(this, SIGNAL(canceled()), this, SLOT(cancelDownload()));
/*
connect(this, SIGNAL(fileSaved(const QString &, const QString &)), this, SLOT(reportFileSaved(const QString &,const QString &)));
connect(this, SIGNAL(saveFailed(const QString &)), this, SLOT(reportSaveFailed(const QString &)));
connect(this, SIGNAL(errorOcurred(int,QString)), this, SLOT(reportError(int,QString)));
*/
setWindowTitle(tr("Downloading..."));
}
示例2: switch
void Frame::setState(int a)
{
m_state = a;
switch(m_state)
{
case Frame::Started:
emit started();
break;
case Frame::Canceled:
emit canceled(QString::null);
break;
case Frame::Idle:
case Frame::Completed:
default:
emit completed();
}
}
示例3: createCopylist
void TrackExportWorker::run() {
int i = 0;
QMap<QString, QFileInfo> copy_list = createCopylist(m_tracks);
for (auto it = copy_list.constBegin(); it != copy_list.constEnd(); ++it) {
// We emit progress twice per loop, which may seem excessive, but it
// guarantees that we emit a sane progress before we start and after
// we end. In between, each filename will get its own visible tick
// on the bar, which looks really nice.
emit(progress(it->fileName(), i, copy_list.size()));
copyFile(*it, it.key());
if (load_atomic(m_bStop)) {
emit(canceled());
return;
}
++i;
emit(progress(it->fileName(), i, copy_list.size()));
}
}
示例4: Q_D
void QQuickMouseArea::ungrabMouse()
{
Q_D(QQuickMouseArea);
if (d->pressed) {
// if our mouse grab has been removed (probably by Flickable), fix our
// state
d->pressed = 0;
d->stealMouse = false;
setKeepMouseGrab(false);
emit canceled();
emit pressedChanged();
emit pressedButtonsChanged();
if (d->hovered) {
d->hovered = false;
emit hoveredChanged();
}
}
}
示例5: uniform_corr_option
static int uniform_corr_option (const gchar *title, gretlopt *popt)
{
const char *opts[] = {
N_("Ensure uniform sample size"),
NULL
};
int uniform = 0;
int resp;
resp = checks_only_dialog(title, NULL, opts, 1,
&uniform, CORR, NULL);
if (!canceled(resp) && uniform) {
*popt = OPT_U;
}
return resp;
}
示例6: canceled
void K3b::DvdFormattingJob::slotProcessFinished( int exitCode, QProcess::ExitStatus exitStatus )
{
if( d->canceled ) {
emit canceled();
d->success = false;
}
else if( exitStatus == QProcess::NormalExit ) {
if( !d->error && (exitCode == 0) ) {
emit infoMessage( i18n("Formatting successfully completed"), Job::MessageSuccess );
if( d->lastProgressValue < 100 ) {
emit infoMessage( i18n("Do not be concerned with the progress stopping before 100%."), MessageInfo );
emit infoMessage( i18n("The formatting will continue in the background during writing."), MessageInfo );
}
d->success = true;
}
else {
emit infoMessage( i18n("%1 returned an unknown error (code %2).",d->dvdFormatBin->name(), exitCode),
Job::MessageError );
emit infoMessage( i18n("Please send me an email with the last output."), Job::MessageError );
d->success = false;
}
}
else {
emit infoMessage( i18n("%1 did not exit cleanly.",d->dvdFormatBin->name()),
MessageError );
d->success = false;
}
if( d->forceNoEject ||
!k3bcore->globalSettings()->ejectMedia() ) {
d->running = false;
jobFinished(d->success);
}
else {
emit infoMessage( i18n("Ejecting medium..."), MessageInfo );
connect( Device::eject( d->device ),
SIGNAL(finished(K3b::Device::DeviceHandler*)),
this,
SLOT(slotEjectingFinished(K3b::Device::DeviceHandler*)) );
}
}
示例7: KRPleaseWait
void KRPleaseWaitHandler::startWaiting(QString msg, int count , bool cancel)
{
if (dlg == 0) {
dlg = new KRPleaseWait(msg , _parentWindow, count, cancel);
connect(dlg, SIGNAL(canceled()), this, SLOT(killJob()));
}
incMutex = cycleMutex = _wasCancelled = false;
dlg->setValue(0);
dlg->setLabelText(msg);
if (count == 0) {
dlg->setMaximum(10);
cycle = true ;
cycleProgress();
} else {
dlg->setMaximum(count);
cycle = false;
}
}
示例8: QAbstractListModel
QDeclarativeBluetoothDiscoveryModel::QDeclarativeBluetoothDiscoveryModel(QObject *parent) :
QAbstractListModel(parent),
d(new QDeclarativeBluetoothDiscoveryModelPrivate)
{
QHash<int, QByteArray> roleNames;
roleNames = QAbstractItemModel::roleNames();
roleNames.insert(Qt::DisplayRole, "name");
roleNames.insert(Qt::DecorationRole, "icon");
roleNames.insert(ServiceRole, "service");
setRoleNames(roleNames);
d->m_agent = new QBluetoothServiceDiscoveryAgent(this);
connect(d->m_agent, SIGNAL(serviceDiscovered(const QBluetoothServiceInfo&)), this, SLOT(serviceDiscovered(const QBluetoothServiceInfo&)));
connect(d->m_agent, SIGNAL(finished()), this, SLOT(finishedDiscovery()));
connect(d->m_agent, SIGNAL(canceled()), this, SLOT(finishedDiscovery()));
connect(d->m_agent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error)), this, SLOT(errorDiscovery(QBluetoothServiceDiscoveryAgent::Error)));
}
示例9: QTimer
void Downloader::setAnimator(QProgressDialog *anAnimator, QLabel* anAnimatorLabel, QProgressBar* anAnimatorBar, bool anAnimate)
{
delete AnimationTimer;
AnimatorLabel = anAnimatorLabel;
AnimatorBar = anAnimatorBar;
if (AnimatorBar && anAnimate)
{
AnimationTimer = new QTimer(this);
connect(AnimationTimer,SIGNAL(timeout()),this,SLOT(animate()));
}
if (AnimatorBar)
{
AnimatorBar->setValue(0);
if (anAnimator)
connect(anAnimator,SIGNAL(canceled()),this,SLOT(on_Cancel_clicked()));
qApp->processEvents();
}
}
示例10: tr
void MainWindow::learning()
{
QString dir_weight = QFileDialog::getOpenFileName(this, tr("Open File"), "/home", tr("Text (*.txt)"));
dataset_ = new dataset_t(dir_weight.toStdString(), X_SIZE, Y_SIZE);
dataset_->split_train_test(0.7);
perceptron_ = new perceptron_t(dataset_->dim());
thread_ = new QThread;
connect(this, SIGNAL(finish_learn()), thread_, SLOT(quit()));
connect(this, SIGNAL(finish_learn()), thread_, SLOT(deleteLater()));
connect(thread_, SIGNAL(started()), this, SLOT(learn()));
thread_->start();
progress_ = new QProgressDialog("Learning...", "Cancel", 0, EPOCH_COUNT, this);
connect(progress_, SIGNAL(canceled()), progress_, SLOT(cancel()));
progress_->setWindowModality(Qt::WindowModal);
ui->load->setDisabled(false);
}
示例11: SetupMenu
void QuteMessenger::startDeviceDiscovery()
{
SetupMenu(true);
if (devDisc) {
ui.deviceListWidget->clear();
foundDevices.clear();
connect(devDisc, SIGNAL(newDeviceFound(QBtDevice)), this,
SLOT(populateDeviceList(QBtDevice)));
connect(devDisc, SIGNAL(discoveryStopped()), this, SLOT(deviceDiscoveryCompleteReport()));
devDisc->startDiscovery();
dialog = new QProgressDialog("Searching devices...", "Stop", 0, 0, this);
dialog->setWindowModality(Qt::WindowModal);
connect(dialog, SIGNAL(canceled()), this, SLOT(deviceDiscoveryCompleteReport()));
dialog->setBar(NULL);
dialog->show();
}
}
示例12: state
UpdateApplication::UpdateApplication()
// ----------------------------------------------------------------------------
// Constructor
// ----------------------------------------------------------------------------
: state(Idle), file(NULL), progress(NULL),
dialogTitle(QString(tr("Tao3D Update"))),
downloadIcon(loadIcon(":/images/download.png")),
checkmarkIcon(loadIcon(":images/checkmark.png")),
connectionErrorIcon(loadIcon(":/images/not_connected.png")),
reply(NULL), manager(NULL), code(-1)
{
// download.png from http://www.iconfinder.com/icondetails/2085/128
// Author: Alexandre Moore
// License: LGPL
//
// checkmark.png from http://www.iconfinder.com/icondetails/3207/128
// Author: Everaldo Coelho
// License: LGPL
// not_connected.png is a merge from:
//
// - Red cross from http://www.iconfinder.com/icondetails/3206/128
// Author: Everaldo Coelho
// License: LGPL
// - Earth from http://www.iconfinder.com/icondetails/17829/128
// Author: Everaldo Coelho
// License: LGPL
resetRequest();
progress = new QProgressDialog(TaoApp->windowWidget());
progress->setFixedSize(500, 100);
connect(progress, SIGNAL(canceled()),
this, SLOT(cancel()));
progress->setWindowTitle(dialogTitle);
IFTRACE(update)
debug() << "Current version: edition='" << +edition
<< "' version=" << version
<< " target='" << +target << "'"
<< " User-Agent='" << +userAgent() << "'\n";
}
示例13: nameFilters
void Widget::onSelectSong()
{
QString strPath = QDir::currentPath();
QStringList nameFilters("*.mp3");
nameFilters << "*.wma" << "*.ape" << "*.ogg"
<< "*.aac" << "*.wav" << "*.mid"
<< "*.amr" << "*.3gp" << "*.mp4";
m_fileSelector = new OpenFileWidget(strPath, nameFilters);
m_layout->addWidget(m_fileSelector);
m_layout->setCurrentWidget(m_fileSelector);
m_fileSelector->setAttribute(Qt::WA_DeleteOnClose);
connect(m_fileSelector, SIGNAL(selected(QString))
, this, SLOT(onFileSelected(QString)));
connect(m_fileSelector, SIGNAL(canceled())
, this, SLOT(onFileSelectCanceled()));
m_fileSelector->setStyleSheet("QListWidget{ background: #303030; border: 1px solid white}");
}
示例14: QProgressDialog
void Updater::downloadUpdate()
{
if(a_netManager->networkAccessible() != QNetworkAccessManager::NotAccessible)
{
a_progressDialog = new QProgressDialog(nullptr);
a_progressDialog->setWindowModality(Qt::ApplicationModal);
connect(a_progressDialog, SIGNAL(canceled()),this, SLOT(cancelDownload()));
a_progressDialog->setWindowTitle(tr("Veuillez patienter"));
a_progressDialog->setLabelText(tr("Téléchargement de la mise à jour de %1 en cours").arg(a_appName));
a_progressDialog->setValue(0);
a_progressDialog->show();
a_netRequest.setUrl(a_urlExe);
a_netReply = a_netManager->get(a_netRequest);
connect(a_netReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(errorHandling(QNetworkReply::NetworkError)));
connect(a_netReply, SIGNAL(finished()),this, SLOT(writeUpdate()));
connect(a_netReply, SIGNAL(downloadProgress(qint64, qint64)),this, SLOT(updateProgress(qint64, qint64)));
}
else
noNetworkError();
}
示例15: connect
void Command::execute()
{
d->m_lastExecSuccess = false;
d->m_lastExecExitCode = -1;
if (d->m_jobs.empty())
return;
// For some reason QtConcurrent::run() only works on this
QFuture<void> task = QtConcurrent::run(&Command::run, this);
d->m_watcher.setFuture(task);
connect(&d->m_watcher, SIGNAL(canceled()), this, SLOT(cancel()));
QString binary = QFileInfo(d->m_binaryPath).baseName();
if (!binary.isEmpty())
binary = binary.replace(0, 1, binary[0].toUpper()); // Upper the first letter
const QString taskName = binary + QLatin1Char(' ') + d->m_jobs.front().arguments.at(0);
Core::ProgressManager::addTask(task, taskName,
Core::Id::fromString(binary + QLatin1String(".action")));
}