本文整理汇总了C++中QTimer::singleShot方法的典型用法代码示例。如果您正苦于以下问题:C++ QTimer::singleShot方法的具体用法?C++ QTimer::singleShot怎么用?C++ QTimer::singleShot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTimer
的用法示例。
在下文中一共展示了QTimer::singleShot方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setearFiltro
void ECBProveedor::setearFiltro( const QString f ) {
this->filtro = f;
// Hago la carga diferida
QTimer timer;
timer.singleShot( 900, this, SLOT( inicializar() ) );
_inicializado = false;
}
示例2: QComboBox
ECBProveedor::ECBProveedor(QWidget *parent) :
QComboBox(parent), filtro()
{
this->setObjectName( "SelectorProveedor" );
// Seteo las propiedades del combobox
this->setInsertPolicy( QComboBox::NoInsert );
this->setSizeAdjustPolicy( QComboBox::AdjustToContentsOnFirstShow );
this->setEditable( true );
this->completer()->setCompletionMode( QCompleter::PopupCompletion );
this->setCurrentIndex( -1 );
this->setInsertPolicy( QComboBox::NoInsert );
this->connect( this->lineEdit(), SIGNAL( returnPressed() ), this, SLOT( verificarExiste() ) );
this->lineEdit()->setText( "Cargando datos..." );
this->setEnabled( false );
ids = new QList<int>();
QTimer timer;
timer.singleShot( 900, this, SLOT( inicializar() ) );
connect( this, SIGNAL( currentIndexChanged( int ) ), this, SLOT( cambioProveedor( int ) ) );
_inicializado = false;
_id = -1;
}
示例3: kiemTraNguoiDung
void MainWindow::kiemTraNguoiDung()
{
if(test==false)
{
QTimer *timer;
timer=new QTimer(this);
timer->setSingleShot(true);
//sau 6,5 giây tự động bắt chọn chương trình!
timer->singleShot(6500,this,SLOT(noticeBox()));
}
}
示例4: set_uri
void Pane::set_uri(QString new_directory) {
if (directory && new_directory == directory->get_uri()) {
directory->refresh();
return;
}
if (pending_directory) delete pending_directory;
pending_directory = new Directory(main_window, new_directory);
connect(pending_directory, SIGNAL(ready(File_info_list)),
this, SLOT(directory_ready(File_info_list)));
connect(pending_directory, SIGNAL(error(QString)),
this, SLOT(directory_error(QString)));
pending_directory->refresh();
//ui->address->setText(directory);
ready = false;
QTimer* timer = new QTimer();
timer->singleShot(300, this, SLOT(show_loading_indicator()));
}
示例5: QDialog
Bai2::Bai2(QWidget *parent) :
QDialog(parent),
ui(new Ui::Bai2)
{
ui->setupUi(this);
setWindowTitle(QString::fromUtf8("Bài 2: Thuật Toán Euclid"));
QTimer *time;
/*ui->pushButtonA->hide();
ui->pushButtonB->hide();
ui->pushButtonX->hide();
ui->label->hide();
ui->label_2->hide();
ui->label_3->hide();*/
time=new QTimer(this);
time->setSingleShot(true);
QMessageBox::about(this,QString::fromUtf8("Giới thiệu : Thuật toán Euclid")
,
QString::fromUtf8("<br>Trong lý thuyết số học , thuật toán Euclid là một thuật toán cổ để xác định ước số chung lớn nhất (ƯSCLNN-tắt tiếng Việt; hoặc tiếng Anh GCD – Greatest Common Divisor) của 2 phần tử thuộc vùng Euclid (ví dụ: các số nguyên). </br>"
"<center><b><br>Lịch sử của thuật toán</br></b></center>"
"<br>Thuật toán Euclid là một thuật toán cổ xuất hiện trong cuốn Euclid’s Elements khoảng năm 300 trước công nguyên. Euclid khởi đầu đã trình bày rõ ràng vấn đề về phương diện hình học, như vấn đề tìm ra một thước đo chung cho độ dài hai đường thẳng, và thuật toán của ông đã xử lý bằng cách lặp lại phép trừ đoạn dài hơn cho đoạn ngắn hơn. </br>"
"<br></br>"
"<br>Tuy thuật toán này được biết đến sóm hơn bởi Eudoxus of Cnidus (khoảng năm 375 trước công nguyên) và Aristotle (khoảng năm 330 trước công nguyên), nhưng Euclide vẫn là người có công lớn nhất nên thuật toán được mang tên ông.</br>"
"<br></br>"
"<center><br>...........</br></center>"
"<br></br>"
"<b>Đọc thêm tại:</b> <a href='https://vi.wikipedia.org/wiki/Giải_thuật_Euclid'>https://vi.wikipedia.org/wiki/Giải_thuật_Euclid</a>"
)
);
time->singleShot(1000,this,SLOT(dung()));
QMovie *movie = new QMovie("tuyetroi.gif");
ui->label_4->setMovie(movie);
movie->start();
}
示例6: main
//.........这里部分代码省略.........
windowWidth = argument.section ("=", 1, 1).toInt();
application.setProperty("windowWidth", windowWidth);
}
}
if (argument.contains("--heigth") or argument.contains ("-h")) {
if (argument.section ("=", 1, 1).toInt() > 200) {
windowHeigth = argument.section ("=", 1, 1).toInt();
application.setProperty("windowHeigth", windowHeigth);
}
}
if (argument.contains("--timeout") or argument.contains ("-t")) {
if (argument.section ("=", 1, 1).toInt() > 3) {
timeoutSeconds = argument.section ("=", 1, 1).toInt();
application.setProperty("timeoutSeconds", timeoutSeconds);
}
}
}
// Message box icon:
QString externalIconFilePath =
application.applicationDirPath() +
QDir::separator() + "htmlmsg.png";
QFile iconFile(externalIconFilePath);
QPixmap icon(32, 32);
if (iconFile.exists()) {
// Set the external icon:
icon.load(externalIconFilePath);
QApplication::setWindowIcon(icon);
} else {
// Set the embedded icon:
icon.load(":/htmlmsg.png");
QApplication::setWindowIcon(icon);
}
// HTML message template:
QString htmlFolder =
application.applicationDirPath() + QDir::separator() + "msgbox";
QString htmlFilePath =
htmlFolder + QDir::separator() + "htmlmsg.html";
QFile htmlFile(htmlFilePath);
QString htmlContent;
if (htmlFile.exists()) {
// Load the external HTML message template:
QFileReader *resourceReader =
new QFileReader(htmlFilePath);
htmlContent = resourceReader->fileContents;
htmlContent.replace("local://",
QString(
"file://" + htmlFolder + QDir::separator()));
} else {
// Load the embedded HTML message template:
QFileReader *resourceReader =
new QFileReader(QString(":/htmlmsg.html"));
htmlContent = resourceReader->fileContents;
}
// Initiate the message box and load the HTML message:
QView window;
window.mainPage->mainFrame()->setHtml(htmlContent);
// Read any initial STDIN data:
if (isatty(fileno(stdin))) {
window.qReadStdin();
}
// Set the message box dimensions and center it on screen:
window.setFixedSize (windowWidth, windowHeigth);
QRect screenRect = QDesktopWidget().screen()->rect();
window.move (QPoint(
screenRect.width()/2 - windowWidth/2,
screenRect.height()/2 - windowHeigth/2));
// Display the message box:
window.show();
// Set the message box timeout:
if (timeoutSeconds > 0) {
int timeoutMilliseconds = timeoutSeconds * 1000;
QTimer *timer = new QTimer();
timer->singleShot (timeoutMilliseconds,
&window, SLOT (qCloseApplicationSlot()));
}
// Set the STDIN watcher:
QSocketNotifier *stdinNotifier =
new QSocketNotifier(fileno(stdin), QSocketNotifier::Read);
QObject::connect(stdinNotifier, SIGNAL(activated(int)),
&window, SLOT(qReadStdin()));
if (isatty(fileno(stdin))) {
stdinNotifier->setEnabled(true);
}
application.exec();
}
示例7: ui
ServerChoice::ServerChoice(TeamHolder* team) :
ui(new Ui::ServerChoice), wasConnected(false), team(team)
{
ui->setupUi(this);
ui->announcement->hide();
ServerChoiceModel *model = new ServerChoiceModel();
model->setParent(ui->serverList);
filter = new QSortFilterProxyModel(ui->serverList);
filter->setSourceModel(model);
filter->setSortRole(ServerChoiceModel::SortRole);
ui->serverList->setModel(filter);
connect(ui->description, SIGNAL(anchorClicked(QUrl)), SLOT(anchorClicked(QUrl)));
QSettings settings;
registry_connection = new Analyzer(true);
connect(registry_connection, SIGNAL(connected()), SLOT(connected()));
registry_connection->connectTo(
settings.value("ServerChoice/RegistryServer", "registry.pokemon-online.eu").toString(),
settings.value("ServerChoice/RegistryPort", 5090).toUInt()
);
registry_connection->setParent(this);
ui->switchPort->setIcon(QApplication::style()->standardIcon(QStyle::SP_BrowserReload));
connect(registry_connection, SIGNAL(connectionError(int,QString)), SLOT(connectionError(int , QString)));
connect(registry_connection, SIGNAL(regAnnouncementReceived(QString)), ui->announcement, SLOT(setText(QString)));
connect(registry_connection, SIGNAL(regAnnouncementReceived(QString)), ui->announcement, SLOT(show()));
connect(registry_connection, SIGNAL(serverReceived(ServerInfo)), model, SLOT(addServer(ServerInfo)));
connect(this, SIGNAL(clearList()), model, SLOT(clear()));
connect(registry_connection, SIGNAL(serverReceived(ServerInfo)), SLOT(serverAdded()));
//TO-DO: Make the item 0 un-resizable and unselectable - Latios
ui->serverList->setColumnWidth(0, settings.value("ServerChoice/PasswordProtectedWidth", 26).toInt());
ui->serverList->setColumnWidth(1, settings.value("ServerChoice/ServerNameWidth", 152).toInt());
if (settings.contains("ServerChoice/PlayersInfoWidth")) {
ui->serverList->setColumnWidth(2, settings.value("ServerChoice/PlayersInfoWidth").toInt());
}
ui->serverList->horizontalHeader()->setStretchLastSection(true);
connect(ui->serverList, SIGNAL(activated(QModelIndex)), SLOT(regServerChosen(QModelIndex)));
connect(ui->serverList, SIGNAL(currentCellChanged(QModelIndex)), SLOT(showDetails(QModelIndex)));
ui->nameEdit->setText(team->name());
ui->advServerEdit->addItem(settings.value("ServerChoice/DefaultServer").toString());
connect(ui->nameEdit, SIGNAL(returnPressed()), SLOT(advServerChosen()));
connect(ui->advServerEdit->lineEdit(), SIGNAL(returnPressed()), SLOT(advServerChosen()));
QCompleter *completer = new QCompleter(ui->advServerEdit);
completer->setCaseSensitivity(Qt::CaseInsensitive);
QStringList res = settings.value("ServerChoice/SavedServers").toStringList();
foreach (QString r, res) {
if (r.contains("-")) {
savedServers.push_back(QStringList() << r.section("-", -1).trimmed() << r.section("-", 0, -2).trimmed());
} else {
savedServers.push_back(QStringList() << r << "");
}
}
QStringListModel *m = new QStringListModel(res, completer);
completer->setModel(m);
ui->advServerEdit->setCompleter(completer);
ui->advServerEdit->setModel(m);
connect(ui->teambuilder, SIGNAL(clicked()), SIGNAL(teambuilder()));
connect(ui->advancedConnection, SIGNAL(clicked()), SLOT(advServerChosen()));
QTimer *t = new QTimer(this);
t->singleShot(5000, this, SLOT(timeout()));
#if QT_VERSION >= QT_VERSION_CHECK(4,8,0)
ui->serverList->sortByColumn(ServerChoiceModel::Players, Qt::SortOrder(filter->headerData(ServerChoiceModel::Players, Qt::Horizontal, Qt::InitialSortOrderRole).toInt()));
#else
ui->serverList->sortByColumn(ServerChoiceModel::Players, Qt::DescendingOrder);
#endif
}