• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ qsrand函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中qsrand函数的典型用法代码示例。如果您正苦于以下问题:C++ qsrand函数的具体用法?C++ qsrand怎么用?C++ qsrand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了qsrand函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: QObject

Doc::Doc(QObject* parent, int universes)
    : QObject(parent)
    , m_wsPath("")
    , m_fixtureDefCache(new QLCFixtureDefCache)
    , m_modifiersCache(new QLCModifiersCache)
    , m_ioPluginCache(new IOPluginCache(this))
    , m_ioMap(new InputOutputMap(this, universes))
    , m_masterTimer(new MasterTimer(this))
    , m_inputCapture(NULL)
    , m_monitorProps(NULL)
    , m_mode(Design)
    , m_kiosk(false)
    , m_clipboard(new QLCClipboard(this))
    , m_latestFixtureId(0)
    , m_latestFixtureGroupId(0)
    , m_latestChannelsGroupId(0)
    , m_latestFunctionId(0)
    , m_startupFunctionId(Function::invalidId())
{
    Bus::init(this);
    resetModified();
    qsrand(QTime::currentTime().msec());
}
开发者ID:Kokichiro,项目名称:qlcplus,代码行数:23,代码来源:doc.cpp


示例2: QWidget

RenderArea::RenderArea(const QString &name, FFunctions *fA, FFunctions *fB, QList< columnPoints* > *ip, QList< columnPoints* > *op, QWidget *parent) :
    QWidget(parent)
{
    QTime time = QTime::currentTime();
    qsrand((uint)time.msec());

    randomNoiseValue = 3000;

    originalImage = new QImage(name);
    imageInput = new QImage(name);
    imageOutput = new QImage(imageInput->width(), imageInput->height(), QImage::Format_ARGB32);

    functionsA = fA;
    functionsB = fB;

    functionsA->radius = 0;
    functionsA->center.clear();

    inputPoints = ip;
    outputPoints = op;

    imageMask = 0;
    centerX = 0;
    centerY = 0;

    output = true;

    m_points_count = imageInput->width();

    hideImage = false;
    hideMask = false;

    setMinimumHeight(imageInput->height());
    setMinimumWidth(imageInput->width() * 2 + SPACE);

    updateInputPoints();
}
开发者ID:tucna,项目名称:image_reconstruction,代码行数:37,代码来源:renderarea.cpp


示例3: emscriptenQtSDLMain

int emscriptenQtSDLMain(int argc, char *argv[])
#endif
{
    QApplication *app = new QApplication(argc, argv);

    qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
//! [0]
//! [1]
    QGraphicsScene *scene = new QGraphicsScene(-200, -200, 400, 400);

    for (int i = 0; i < 10; ++i) {
        ColorItem *item = new ColorItem;
        item->setPos(::sin((i * 6.28) / 10.0) * 150,
                     ::cos((i * 6.28) / 10.0) * 150);

        scene->addItem(item);
    }

    Robot *robot = new Robot;
    robot->scale(1.2, 1.2);
    robot->setPos(0, -20);
    scene->addItem(robot);
//! [1]
//! [2]
    GraphicsView *view = new GraphicsView(scene);
    view->setRenderHint(QPainter::Antialiasing);
    view->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    view->setBackgroundBrush(QColor(230, 200, 167));
    view->setWindowTitle("Drag and Drop Robot");
#if defined(Q_OS_SYMBIAN)
    view->showMaximized();
#else
    view->show();
#endif

    return app->exec();
}
开发者ID:tsuibin,项目名称:emscripten-qt,代码行数:37,代码来源:main.cpp


示例4: qsrand

void PasswordGenerationAlgorithm::preExecute(void)
{
    m_password = "";
    m_nbrOfCharactersGenerated = 0;

    qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime())); // should not be put in the constructor
    // see http://stackoverflow.com/questions/3138373/qrand-is-not-generating-a-random-number

    register_clarifier_new_section();
    {
        register_classifier_shadow_message_info("Génération Aléatoire de mots de passe");
        register_classifier_pause(1500);

        register_classifier_message("Mot de passe généré : "+m_password, 1);
        register_classifier_pause(1500);

        QString str = QString("caractère") + (nbrOfCharactersRemaining()>=2 ? "s" : "");
        register_classifier_message("Reste à générer : "+QString::number(nbrOfCharactersRemaining())+" "+str, 1);
        register_classifier_pause(1500);
    }

    register_classifier_pause(2000); // temps d'attente pour passer aux messages suivants -> à encapsuler dans une fonction peut-être
    register_clarifier_new_section();
    {
        register_classifier_shadow_message_info("Remarques");
        register_classifier_pause(1500);

        register_classifier_message("La génération du mot de passe utilise uniquement", 1);
        register_classifier_pause(1500);

        register_classifier_message("les lettres de l'alphabet français (a-z ou A-Z)", 1);
        register_classifier_pause(1500);

        register_classifier_message("ainsi que les chiffres (0-9).", 1);
        register_classifier_pause(1500);
    }
}
开发者ID:misterFad,项目名称:heftyAD,代码行数:37,代码来源:PasswordGenerationAlgorithm.cpp


示例5: QWidget

Plot::Plot(size_t numberOfSamples, qreal minY, qreal maxY, QWidget *parent) :
  QWidget(parent),
  ui(new Ui::Plot)
{
  ui->setupUi(this);

  circularBuffer = new CircularBuffer(numberOfSamples,
                                      ui->minYSpinBox->value(),
                                      ui->maxYSpinBox->value());

  ui->minYSpinBox->setValue(minY);
  ui->maxYSpinBox->setValue(maxY);

  curve = new QwtPlotCurve();
  curve->setData(circularBuffer);
  curve->attach(ui->plot);

  ui->colorComboBox->addItem("Black", Qt::black);
  ui->colorComboBox->addItem("Dark gray", Qt::darkGray);
  ui->colorComboBox->addItem("Gray", Qt::gray);
  ui->colorComboBox->addItem("Light gray", Qt::lightGray);
  ui->colorComboBox->addItem("Red", Qt::red);
  ui->colorComboBox->addItem("Green", Qt::green);
  ui->colorComboBox->addItem("Blue", Qt::blue);
  ui->colorComboBox->addItem("Cyan", Qt::cyan);
  ui->colorComboBox->addItem("Magenta", Qt::magenta);
  ui->colorComboBox->addItem("Yellow", Qt::yellow);
  ui->colorComboBox->addItem("Dark red", Qt::darkRed);
  ui->colorComboBox->addItem("Dark green", Qt::darkGreen);
  ui->colorComboBox->addItem("Dark blue", Qt::darkBlue);
  ui->colorComboBox->addItem("Dark cyan", Qt::darkCyan);
  ui->colorComboBox->addItem("Dark magenta", Qt::darkMagenta);
  ui->colorComboBox->addItem("Dark yellow", Qt::darkYellow);

  qsrand(QTime::currentTime().msec());
  ui->colorComboBox->setCurrentIndex(qrand() % ui->colorComboBox->count());
}
开发者ID:ErEXON,项目名称:qSerialTerm,代码行数:37,代码来源:plot.cpp


示例6: QMainWindow

Musec::Musec(QMainWindow* parent) : QMainWindow(parent)
{
    setupUi(this);
    setWindowFlags(Qt::FramelessWindowHint);
    setAttribute(Qt::WA_TranslucentBackground, true);
    fTranslator = new QTranslator(this);
    fScore = new Score();
    fNetMgr = new NetMgr(this);
    fPlayer = new QMediaPlayer(this, QMediaPlayer::LowLatency);
    fPlaylist = new QMediaPlaylist(this);
    fPlayer->setPlaylist(fPlaylist);
    fTimer = new QTimer(this);
    fTimer->setSingleShot(true);
    fTimer->setInterval(TIME_HARD * 1000);
    fStartTime = -1;
    fDiffLock = kHard;
    fIsActive = false;
    fDragging = false;

    loadLanguage(getConfig("lang", QLocale::system().name()));
    fExtensions << "*.mp3" << "*.m4a"; // These should contain meta data

    btnMenuMusic->setMenu(menuMusic);
    btnMenuInfo->setMenu(menuInfo);
    btnMenuLanguage->setMenu(menuLanguage);
    btnMenuHelp->setMenu(menuHelp);

    connect(fScore, &Score::multiplierChanged, this, &Musec::multiplierChanged);
    connect(fNetMgr, &NetMgr::done, this, &Musec::scoreSubmitted);
    connect(fTimer, &QTimer::timeout, fPlayer, &QMediaPlayer::stop);
    connect(fPlayer, &QMediaPlayer::mediaStatusChanged, this, &Musec::mediaStatusChanged);
    connect(fPlaylist, &QMediaPlaylist::loaded, this, &Musec::playlistLoaded);
    connect(fPlaylist, &QMediaPlaylist::loadFailed, this, &Musec::playlistLoadFailed);
    connect(slDifficulty, &QSlider::valueChanged, this, &Musec::difficultyChanged);

    qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
}
开发者ID:Mystler,项目名称:Musec,代码行数:37,代码来源:Musec.cpp


示例7: MythScreenType

/**
 *  \brief  Constructor
 *  \param  parent The screen parent
 *  \param  name The name of the screen
 */
GallerySlideView::GallerySlideView(MythScreenStack *parent, const char *name,
                                   bool editsAllowed)
    : MythScreenType(parent, name),
      m_uiImage(NULL),
      m_uiStatus(NULL),
      m_uiSlideCount(NULL), m_uiCaptionText(NULL), m_uiHideCaptions(NULL),
      m_mgr(ImageManagerFe::getInstance()),
      m_view(NULL),
      m_availableTransitions(GetMythPainter()->SupportsAnimation()),
      m_transition(m_availableTransitions.Select(
                       gCoreContext->GetNumSetting("GalleryTransitionType",
                                                   kBlendTransition))),
      m_updateTransition(),
      m_slides(),
      m_infoList(*this),
      m_slideShowTime(gCoreContext->GetNumSetting("GallerySlideShowTime", 3000)),
      m_playing(false),
      m_suspended(false),
      m_showCaptions(gCoreContext->GetNumSetting("GalleryShowSlideCaptions", true)),
      m_transitioning(false),
      m_editsAllowed(editsAllowed)
{
    // Detect when transitions finish. Queued signal to allow redraw/pulse to
    // complete before handling event.
    connect(&m_transition, SIGNAL(finished()),
            this, SLOT(TransitionComplete()), Qt::QueuedConnection);
    connect(&m_updateTransition, SIGNAL(finished()),
            this, SLOT(TransitionComplete()), Qt::QueuedConnection);

    // Seed random generator for random transitions
    qsrand(QTime::currentTime().msec());

    // Initialise slideshow timer
    m_timer.setSingleShot(true);
    m_timer.setInterval(m_slideShowTime);
    connect(&m_timer, SIGNAL(timeout()), this, SLOT(ShowNextSlide()));
}
开发者ID:dragonian,项目名称:mythtv,代码行数:42,代码来源:galleryslideview.cpp


示例8: qDebug

/**
 * @brief Initializes the Sampler with the limits of robot's workspace and a point to innermodel.
 * The method uses that pointer to create a copy of innermodel, so the Sampler can use to test valid 
 * robot configurations without interfering with the original one
 * 
 * @param inner pointer to innerModel object
 * @param outerRegion_ QRectF delimiting the robot's workspace
 * @param innerRegions_ List of QRectF polygons delimiting forbidden regions inside robot's workspace
 * @return void
 */
void Sampler::initialize(InnerModel *inner, const RoboCompCommonBehavior::ParameterList &params)
{
	qDebug() << __FUNCTION__ << "Sampler: Copying InnerModel...";
	innerModelSampler = inner->copy();
	
	try
	{
		outerRegion.setLeft(std::stof(params.at("OuterRegionLeft").value));
		outerRegion.setRight(std::stof(params.at("OuterRegionRight").value));
		outerRegion.setBottom(std::stof(params.at("OuterRegionBottom").value));
		outerRegion.setTop(std::stof(params.at("OuterRegionTop").value));
		qDebug() << __FUNCTION__ << "OuterRegion from config: " << outerRegion;
	}
	catch(...)
	{ qFatal("Sampler-Initialize. Aborting. OuterRegion parameters not found in config file");}    //CHANGE TO THROW
	
	//innerRegions = innerRegions_;
	// 	foreach(QRectF ir,  innerRegions_)
	// 		if( ir.isNull() == false)
	// 			qFatal("Sampler-Initialize. Aborting. An InnerRegion is not a valid rectangle");
	// 	

	if(outerRegion.isNull())  
		qFatal("Sampler-Initialize. Aborting. OuterRegion is not properly initialized");    //CHANGE TO THROW

	robotNodes.clear(); restNodes.clear(); 
	QStringList ls = QString::fromStdString(params.at("ExcludedObjectsInCollisionCheck").value).replace(" ", "" ).split(',');
	qDebug() << __FUNCTION__ << ls.size() << "objects read for exclusion list";
	foreach( QString s, ls)
		excludedNodes.insert(s);
	
	// Compute the list of meshes that correspond to robot, world and possibly some additionally excluded ones
	recursiveIncludeMeshes(innerModelSampler->getRoot(), "robot", false, robotNodes, restNodes, excludedNodes);
	
	//Init random sequence generator
	qsrand( QTime::currentTime().msec() );
}
开发者ID:robocomp,项目名称:robocomp-shelly,代码行数:47,代码来源:sampler.cpp


示例9: QWizard

Wizard::Wizard(QWidget * parent)
: QWizard(parent, Qt::Dialog | Qt::WindowSystemMenuHint)
{
   //Транслятор
   QTranslator * appTranslator = new QTranslator(this);
   appTranslator->load(QString(":/translations/HoldemInstall_%1")
      .arg(QLocale::system().name()));
   qApp->installTranslator(appTranslator);

   QTranslator * qtTranslator = new QTranslator(this);
   qtTranslator->load(QString(":/translations/qt_%1")
      .arg(QLocale::system().name()));
   qApp->installTranslator(qtTranslator);

   BOOL IsAdmin = FALSE;
   BOOL success = IsUserAdmin(&IsAdmin);
   if (success && !IsAdmin)
   {
      //не админские права
      QMessageBox::warning(this, tr("Maverick Setup"), 
         tr("You must have administrative privileges to install the program.\n"
         "Please run the installer with administrative privileges."));
      exit(0);
   }
   qsrand(QDateTime::currentDateTime().toTime_t());
   createIntroStep();
   createLicenseStep();
   createFolderStep();
   //createRoomStep();
   createProgressStep();
   createFinishStep();
   setWindowTitle(tr("Setup - Maverick Poker Bot"));
   setFixedWidth(550);
   setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/water.png"));
   setOption(QWizard::NoBackButtonOnLastPage, true);
   //setWizardStyle(QWizard::ClassicStyle);
}
开发者ID:lazyrun,项目名称:pokerbot,代码行数:37,代码来源:Wizard.cpp


示例10: openVoltCalibrationFile

void CalibrationWnd::slotEnable()
{
    bool en = ui.mode->isChecked();
    ui.panel->setEnabled( en );
    ui.clearFileBtn->setEnabled( !en );
    if ( en )
    {
        openVoltCalibrationFile();
        openCurrCalibrationFile();

        QTime t = QTime::currentTime();
        int seed = t.msec() + (t.second() + (t.minute() + t.hour() * 24) * 60) * 1000;
        qsrand( seed );

        setRandomVolt();
    }
    else
    {
        if ( volt.size() >= 3 )
        {
            calcDac2Volt();
            mainWnd->setCalibrationDac( aDacLow, aDacHigh, bDac );
        }
        if ( volt.size() >= 2 )
        {
            calcAdcAux2Volt();
            calcAdcRef2Volt();
            mainWnd->setCalibrationAdcVolt( aAdcAux, bAdcAux, aAdcRef, bAdcRef );
        }
        if ( curr.size() >= 2 )
        {
            calcAdcI2Curr();
            mainWnd->setCalibrationAdcCurr( aAdcI, bAdcI );
        }
        closeCalibrationFiles();
    }
}
开发者ID:z80,项目名称:voltamper,代码行数:37,代码来源:calibration_wnd.cpp


示例11: QObject

Folder::Folder(const QString &alias, const QString &path, const QString& secondPath, QObject *parent)
    : QObject(parent)
      , _path(path)
      , _secondPath(secondPath)
      , _alias(alias)
      , _enabled(true)
      , _thread(0)
      , _csync(0)
      , _csyncError(false)
      , _csyncUnavail(false)
      , _csync_ctx(0)
{
    qsrand(QTime::currentTime().msec());
    _timeSinceLastSync.start();

    _watcher = new FolderWatcher(path, this);

    MirallConfigFile cfg;
    _watcher->addIgnoreListFile( cfg.excludeFile(MirallConfigFile::SystemScope) );
    _watcher->addIgnoreListFile( cfg.excludeFile(MirallConfigFile::UserScope) );

    QObject::connect(_watcher, SIGNAL(folderChanged(const QStringList &)),
                     SLOT(slotChanged(const QStringList &)));

    _syncResult.setStatus( SyncResult::NotYetStarted );

    // check if the local path exists
    checkLocalPath();

    int polltime = cfg.remotePollInterval();
    qDebug() << "setting remote poll timer interval to" << polltime << "msec";
    _pollTimer.setInterval( polltime );
    QObject::connect(&_pollTimer, SIGNAL(timeout()), this, SLOT(slotPollTimerTimeout()));
    _pollTimer.start();

    _syncResult.setFolder(alias);
}
开发者ID:Silvernerd1,项目名称:mirall,代码行数:37,代码来源:folder.cpp


示例12: qsrand

void CentreControl::startButtonClicked()
{
	//删除开始按钮
	scene->removeItem(startButton);
    delete startButton;
    //定义三人的牌和底牌,并排序
    QList<CardItem *> myCard;
    QList<CardItem *> leftCard;
    QList<CardItem *> rightCard;
    QList<CardItem *> bottomList;
    CardUtil::dealCard(myCard,leftCard,rightCard,bottomList);

    //选地主
    qsrand(QTime::currentTime().msec());
    master = qrand()%3+1;
    handerIndex = master;
    QString leftHeadImage = ":images/image/farmers_left.png";
    QString rightHeadImage = ":images/image/farmers_left.png";
    switch (master) {
    case 1:
        foreach(CardItem * item,bottomList){
            item->isFront = true;
			item->setSelected(true);
            myCard.append(item);
        }
        break;
    case 2:
        rightCard << bottomList.at(0)<<bottomList.at(1)<< bottomList.at(2);
        rightHeadImage = ":images/image/lord_left.png";
        break;
    case 3:
        leftCard << bottomList.at(0)<<bottomList.at(1)<< bottomList.at(2);
        leftHeadImage = ":images/image/lord_left.png";
        break;
    default:
        break;
    }
开发者ID:song316,项目名称:joker,代码行数:37,代码来源:centrecontrol.cpp


示例13: qsrand

void FindSpikes::GenerateSpikes()
{
    qsrand(QTime::currentTime().msec());
    QVector<double> *randomData=new QVector<double>;//durée spikes 6.5s=130points (/10 ici)
    //add spike to clusters
    int number=1;
    for(int spike=0;spike<number;spike++)
    {
        for(int channel=0;channel<nbChannels;channel++)
        {
            //generate spikes randomly
            randomData->clear();
            for(int i=0;i<13*nbChannels;i++)//generate random values of spike
            {
                int value=rand()%100;
                randomData->append(value);
                //teValues->append(QString::number(value));
            }
        }
        nbGenerated++;
        Spikes.append(randomData);
    }
    LabelNbSpikes->setText(QString::number(nbGenerated));
}
开发者ID:drevond,项目名称:spikeSorting,代码行数:24,代码来源:findspikes.cpp


示例14: qsrand

Enemy::Enemy()
{
    QTime t;
    qsrand(t.currentTime().msec());
    int s = qrand()%4;
    switch(s){
    case 0:
        this->x = qrand()%1000;
        this->y = -10;
        break;
    case 1:
        this->x = qrand()%1;
        this->y = -10;
        break;
    case 2:
        this->x = -10;
        this->y = qrand()%10;
        break;
    case 3:
        this->x = 1290;
        this->y = qrand()%10;
        break;
    }

    hp = 100 * (qrand()%5+1);

    this->dx = 1.0/sqrt(2.0);
    this->dy = 1.0/sqrt(2.0);
    this->speed = 1+qrand()%20/10.1;
    // get resource, (see Resource.h)
    Resource * resource = new Resource();
    pix.load(resource->picLocation + "enemy.png");
    // release resource, (see Resource.h)
    delete resource;
    mouseOver = false;
}
开发者ID:14USTC,项目名称:TEST,代码行数:36,代码来源:enemy.cpp


示例15: qsrand

Populacja::Populacja(int r)
{
    rozmiar=r;

    qsrand(time(NULL));

    populacja = new QVector<Osobnik*>;

    for(int i=0; i<rozmiar; ++i)
    {
        int g1=qrand()%8+1;
        int g2=qrand()%8+1;
        int g3=qrand()%8+1;
        int g4=qrand()%8+1;
        int g5=qrand()%8+1;
        int g6=qrand()%8+1;
        int g7=qrand()%8+1;
        int g8=qrand()%8+1;

        populacja->push_front(new Osobnik(g1,g2,g3,g4,g5,g6,g7,g8));
       // std::cout<<g1<<" "<<g2<<" "<<g3<<" "<<g4<<" "<<g5<<" "<<g6<<" "<<g7<<" "<<g8<<std::endl;
       // std::cout<<"size "<<populacja->size()<<std::endl;
    }
}
开发者ID:pierok,项目名称:mm,代码行数:24,代码来源:populacja.cpp


示例16: run

    void run() {
        qsrand(QTime::currentTime().msec());
        for(qint32 i = 0; i < NUM_CYCLES; i++) {
            qint32 type = i % 2;

            switch(type) {
            case 0:
                for(qint32 j = 0; j < NUM_OBJECTS; j++) {
                    m_pointer[j] = m_pool.pop();
                    Q_ASSERT(m_pointer[j]);
                    // check for sigsegv ;)
                    ((quint8*)m_pointer[j])[0] = i;
                }
                break;
            case 1:
                for(qint32 j = 0; j < NUM_OBJECTS; j++) {
                    // are we the only writers here?
                    Q_ASSERT(((quint8*)m_pointer[j])[0] == (i-1) % 256);
                    m_pool.push(m_pointer[j]);
                }
                break;
            }
        }
    }
开发者ID:IGLOU-EU,项目名称:krita,代码行数:24,代码来源:kis_memory_pool_test.cpp


示例17: qsrand

void RoomThread1v1::run(){
    // initialize the random seed for this thread
    qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));

    QSet<QString> banset = Config.value("1v1/Banlist").toStringList().toSet();
    general_names = Sanguosha->getRandomGenerals(10, banset);

    QStringList known_list = general_names.mid(0, 6);
    unknown_list = general_names.mid(6, 4);

    int i;
    for(i=0; i<4; i++){
        general_names[i + 6] = QString("x%1").arg(i);
    }

    QString unknown_str = "+x0+x1+x2+x3";

    room->broadcastInvoke("fillGenerals", known_list.join("+") + unknown_str);

    ServerPlayer *first = room->players.at(0), *next = room->players.at(1);
    askForTakeGeneral(first);

    while(general_names.length() > 1){
        qSwap(first, next);

        askForTakeGeneral(first);
        askForTakeGeneral(first);
    }

    askForTakeGeneral(next);

    startArrange(first);
    startArrange(next);

    room->sem->acquire(2);
}
开发者ID:ailue,项目名称:NiubiSlash,代码行数:36,代码来源:roomthread1v1.cpp


示例18: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    tcpClient = new QTcpSocket(this);
    ui->pushSent->setEnabled(false);
    this->ui->timeBut->setEnabled(false);
    tcpClient->abort();
    connect(tcpClient,&QTcpSocket::readyRead,
            [&](){this->ui->textEdit->append(tr("%1 Server Say:%2").arg(QTime::currentTime().toString("hh:mm:ss.zzz")).arg(QString(this->tcpClient->readAll())));});
    connect(tcpClient,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(ReadError(QAbstractSocket::SocketError)));
    connect(&tm,&QTimer::timeout,[&](){
            int i = qrand() % 6;
            this->ui->textEdit->append(tr("%1 Timer Sent: %2").arg(QTime::currentTime().toString("hh:mm:ss.zzz")).arg(list.at(i)));
            tcpClient->write(list.at(i).toUtf8());
    });
    list << "我是谁?" << "渡世白玉" << "hello" << "哈哈哈哈哈" << "你是坏蛋!" <<  "测试一下下了" << "不知道写什么" ;
    QTime time;
    time= QTime::currentTime();
    qsrand(time.msec()+time.second()*1000);
    this->ui->txtIp->setText("127.0.0.1");
    this->ui->txtPort->setText("6666");
}
开发者ID:cloud602,项目名称:QtTcpThreadServer,代码行数:24,代码来源:mainwindow.cpp


示例19: main

int  main(int argc, char *argv[])
{
    QApplication::setGraphicsSystem("opengl");
    QApplication app(argc, argv);
    YagwScene scene;

    qsrand(0xDEADBEEF * QTime::currentTime().msec());
    app.setApplicationName("Yagw: Yet Another Graphic Woobling");
    SoundCenter::get_instance(); // init le son et lance la musique
    QGraphicsView view(&scene);
    GameProcessor game(scene);
    scene.connect(&scene, SIGNAL(quit()), &app, SLOT(quit()));
    view.showFullScreen();
    view.setRenderHint(QPainter::Antialiasing);
    view.setCacheMode(QGraphicsView::CacheBackground);
    view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
    view.show();
    view.setMouseTracking(false);
    view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    app.setOverrideCursor( QCursor( Qt::BlankCursor ) );
    app.exec();
    return (0);
}
开发者ID:chipot,项目名称:Yagw,代码行数:24,代码来源:main.cpp


示例20: close

void AddUserDlg::slotUserAdded(UserAccount* ua)
{
    if (!ua) {
        QMessageBox::warning(this, "warning",i18n("can not find user!") );
        close();
        return;
    }

    if (ua->userName() != ui.userNameEdit->text()) {
        close();
        return;
    }

    qsrand(time(NULL));
    int n = qrand();
    char salt[8] = "";
    snprintf(salt, sizeof(salt) - 1, "$6$%02d", n);
    char *crystr = crypt(qPrintable(ui.verifyPwdEdit->text()), salt);
    if (crystr == NULL) {
        QMessageBox::warning(this, "warning",
            i18n("fail to crypt password, please change password manually."));
        close();
        return;
    }
    ua->setPassword(crystr);
    ua->setAutomaticLogin( ui.autoLoginCheckBox->isChecked() ? true : false);
    ua->setLocked(ui.disLoginCheckBox->isChecked() ? true : false);
    if (!iconFilePath.isEmpty()) {
        ua->setIconFileName(iconFilePath);
        iconFilePath = "";
    }

    emit finished();

    close();
}
开发者ID:isoft-linux,项目名称:kuseraccount,代码行数:36,代码来源:adduserdlg.cpp



注:本文中的qsrand函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ qstr函数代码示例发布时间:2022-05-30
下一篇:
C++ qspRestoreCallState函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap