当前位置: 首页>>代码示例>>C++>>正文


C++ QTimer::connect方法代码示例

本文整理汇总了C++中QTimer::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ QTimer::connect方法的具体用法?C++ QTimer::connect怎么用?C++ QTimer::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTimer的用法示例。


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

示例1: MainPage

/** Constructor */
IdDialog::IdDialog(QWidget *parent)
: MainPage(parent)
{
	ui.setupUi(this);

	mEditDialog = NULL;
	//mPulseSelected = NULL;

	ui.radioButton_ListAll->setChecked(true);
	connect( ui.pushButton_NewId, SIGNAL(clicked()), this, SLOT(OpenOrShowAddDialog()));
	connect( ui.pushButton_EditId, SIGNAL(clicked()), this, SLOT(OpenOrShowEditDialog()));
	connect( ui.treeWidget_IdList, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelection()));

	connect( ui.radioButton_ListYourself, SIGNAL(toggled( bool ) ), this, SLOT(ListTypeToggled( bool ) ) );
	connect( ui.radioButton_ListFriends, SIGNAL(toggled( bool ) ), this, SLOT(ListTypeToggled( bool ) ) );
	connect( ui.radioButton_ListOthers, SIGNAL(toggled( bool ) ), this, SLOT(ListTypeToggled( bool ) ) );
	connect( ui.radioButton_ListPseudo, SIGNAL(toggled( bool ) ), this, SLOT(ListTypeToggled( bool ) ) );
	connect( ui.radioButton_ListAll, SIGNAL(toggled( bool ) ), this, SLOT(ListTypeToggled( bool ) ) );

	QTimer *timer = new QTimer(this);
	timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
	timer->start(1000);

	rsIdentity->generateDummyData();

	mIdQueue = new TokenQueue(rsIdentity, this);

}
开发者ID:coyotama,项目名称:retroshare,代码行数:29,代码来源:IdDialog.cpp

示例2: QBaseMeter

EngineMeter::EngineMeter(QString name, QString title, QMeter::Type type,QWidget *parent)
	: QBaseMeter(name,title,type,parent)
{
	m_runtime = 0;
	
    m_minValue = 0;
    m_maxValue = 40; 
	m_value = m_minValue;
	m_laValue = 25;
	m_haValue = 40;
	m_lwValue = 15;
	m_hwValue = 25;

	m_startAngle =60;
	m_endAngle =60;

	m_scaleMajor = 10;
	m_scaleMiddle = 2;
    m_scaleMinor = 4;

	m_units = QStringLiteral("RPM"); 
	//m_title = QStringLiteral("תËÙ±í");
	m_compoment =0x0C0E;
	m_precision = 2;
	QTimer *timer = new QTimer(this);
	//timer->connect(timer,SIGNAL(timeout()),this,SLOT(changeValue()));
	timer->connect(timer,SIGNAL(timeout()),this,SLOT(setRuntime()));
	timer->start(1000);
}
开发者ID:tenddy,项目名称:Scada,代码行数:29,代码来源:enginemeter.cpp

示例3: ConfigPage

/** Constructor */
ServerDialog::ServerDialog(QWidget *parent)
: ConfigPage(parent)
{
  /* Invoke the Qt Designer generated object setup routine */
  ui.setupUi(this);

  /* Create RshareSettings object */
  _settings = new RshareSettings();

  connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
  connect( ui.allowIpDeterminationCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleIpDetermination(bool) ) );

   QTimer *timer = new QTimer(this);
   timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
   timer->start(1000);

	load();
	updateStatus();

	bool b = rsPeers->getAllowServerIPDetermination() ;
	ui.allowIpDeterminationCB->setChecked(b) ;
	ui.IPServersLV->setEnabled(b) ;

	std::list<std::string> ip_servers ;
	rsPeers->getIPServersList(ip_servers) ;

	for(std::list<std::string>::const_iterator it(ip_servers.begin());it!=ip_servers.end();++it)
		ui.IPServersLV->addItem(QString::fromStdString(*it)) ;

  /* Hide platform specific features */
#ifdef Q_WS_WIN

#endif
}
开发者ID:autoscatto,项目名称:retroshare,代码行数:35,代码来源:ServerDialog.cpp

示例4: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Object object;
    QTimer timer;
    timer.setSingleShot(true);
    timer.connect(&timer, SIGNAL(timeout()), &object, SLOT(print()));
    timer.start(0);
    return app.exec();
}
开发者ID:bogdan-voevoda,项目名称:qt4,代码行数:10,代码来源:main.cpp

示例5: ConfigPage

ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
    : ConfigPage(parent, flags)
{
  /* Invoke the Qt Designer generated object setup routine */
  ui.setupUi(this);

  connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
  connect( ui.allowIpDeterminationCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleIpDetermination(bool) ) );
  connect( ui.allowTunnelConnectionCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleTunnelConnection(bool) ) );
  connect( ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) );
  connect( ui._turtle_enabled_CB, SIGNAL( toggled( bool ) ), this, SLOT( toggleTurtleRouting(bool) ) );
  connect( ui._routing_info_PB, SIGNAL( clicked() ), this, SLOT( showRoutingInfo() ) );

   QTimer *timer = new QTimer(this);
   timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
   timer->start(1000);

	_routing_info_page = NULL ;

	//load();
	updateStatus();

	bool b = rsPeers->getAllowServerIPDetermination() ;
	ui.allowIpDeterminationCB->setChecked(b) ;
	ui.IPServersLV->setEnabled(b) ;

#ifdef RS_RELEASE_VERSION
    ui.allowTunnelConnectionCB->hide();
    this->toggleTunnelConnection(false);
#else
    b = rsPeers->getAllowTunnelConnection() ;
    ui.allowTunnelConnectionCB->setChecked(b) ;
#endif

	std::list<std::string> ip_servers ;
	rsPeers->getIPServersList(ip_servers) ;

	for(std::list<std::string>::const_iterator it(ip_servers.begin());it!=ip_servers.end();++it)
		ui.IPServersLV->addItem(QString::fromStdString(*it)) ;

	TurtleRouterStatistics *trs = new TurtleRouterStatistics ;
	trs->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding)) ;
	ui.tabWidget->widget(2)->layout()->addWidget(trs) ;
	ui.tabWidget->widget(2)->layout()->setContentsMargins(0,5,0,0) ;

	QSpacerItem *verticalSpacer = new QSpacerItem(0,0,QSizePolicy::Expanding, QSizePolicy::Minimum);

	ui.tabWidget->widget(2)->layout()->addItem(verticalSpacer) ;
	ui.tabWidget->widget(2)->layout()->update() ;

  /* Hide platform specific features */
#ifdef Q_WS_WIN

#endif
}
开发者ID:boukeversteegh,项目名称:retroshare,代码行数:55,代码来源:ServerPage.cpp

示例6: scriptLoad

void BluemonkeyAgent::scriptLoad(qint64 id, const QString &program, const QString &fileName, int baseLineNumber)
{
	DebugOut()<<"executing script"<<endl;

	QTimer *timer = new QTimer();
	timer->setSingleShot(true);
	timer->connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
	timer->start(5000);

	timerIdMap[timer] = id;
}
开发者ID:asokang,项目名称:automotive-message-broker,代码行数:11,代码来源:agent.cpp

示例7: prepareStages

void CSMDoc::Operation::run()
{
    prepareStages();

    QTimer timer;

    timer.connect (&timer, SIGNAL (timeout()), this, SLOT (executeStage()));

    timer.start (0);

    exec();
}
开发者ID:Digmaster,项目名称:openmw,代码行数:12,代码来源:operation.cpp

示例8: QWidget

TransfersDialog::TransfersDialog(QWidget *parent)
: QWidget(parent) {
    /* Invoke the Qt Designer generated object setup routine */
    ui.setupUi(this);

    connect(ui.downloadButton, SIGNAL(clicked()), this, SLOT(download()));
    connect(ui.downloadsList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(downloadsListContextMenu(QPoint)));
    connect(ui.uploadsList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(uploadsListContextMenu(QPoint)));

    //To popup a box informing that a friend is attempting to send a file.
    //QList<qlonglong> is not a default registerd type for QT's meta-object system, so we must first manually register it.
    qRegisterMetaType<QList<qlonglong> >("QList<qlonglong>");
    QObject::connect(guiNotify, SIGNAL(suggestionReceived(unsigned int, QString, QStringList, QStringList, QList<qlonglong>)),
                     this, SLOT(suggestionReceived(unsigned int, QString, QStringList, QStringList, QList<qlonglong>)), Qt::QueuedConnection);

    QHeaderView *header = ui.downloadsList->header() ;
    header->hideSection(DOWNLOAD_FRIEND_ID);
    header->hideSection(DOWNLOAD_ITEM_TYPE);
    header->hideSection(DOWNLOAD_ITEM_ID);
    header->hideSection(DOWNLOAD_FINAL_LOCATION);

    header = ui.uploadsList->header() ;
    header->hideSection(UPLOAD_LIBRARYMIXER_ID);
    header->hideSection(UPLOAD_ITEM_ID);
    header->hideSection(UPLOAD_ITEM_TYPE);

    //Without this preliminary resizing, empty columns will visibly resize after view already displayed
    ui.downloadsList->resizeColumnToContents(DOWNLOAD_NAME_COLUMN);
    ui.downloadsList->resizeColumnToContents(DOWNLOAD_FRIEND_COLUMN);
    ui.downloadsList->resizeColumnToContents(DOWNLOAD_SPEED_COLUMN);
    ui.downloadsList->resizeColumnToContents(DOWNLOAD_REMAINING_COLUMN);
    ui.downloadsList->resizeColumnToContents(DOWNLOAD_TOTAL_SIZE_COLUMN);
    ui.downloadsList->resizeColumnToContents(DOWNLOAD_PERCENT_COLUMN);
    ui.downloadsList->resizeColumnToContents(DOWNLOAD_STATUS_COLUMN);
    ui.uploadsList->resizeColumnToContents(UPLOAD_FILE_COLUMN);
    ui.uploadsList->resizeColumnToContents(UPLOAD_FRIEND_COLUMN);
    ui.uploadsList->resizeColumnToContents(UPLOAD_SPEED_COLUMN);
    ui.uploadsList->resizeColumnToContents(UPLOAD_TRANSFERRED_COLUMN);
    ui.uploadsList->resizeColumnToContents(UPLOAD_STATUS_COLUMN);

    ui.downloadsList->sortItems(0, Qt::AscendingOrder);
    ui.uploadsList->sortItems(0, Qt::AscendingOrder);

    connect(files, SIGNAL(responseLendOfferReceived(uint,uint,QString,QStringList,QStringList,QList<qlonglong>)),
            this, SLOT(responseLendOfferReceived(uint,uint,QString,QStringList,QStringList,QList<qlonglong>)), Qt::QueuedConnection);

    /* This needs to change in the future, but for now, we simply refresh the entire view (including total transfer rates in corner) once every second. */
    QTimer *timer = new QTimer(this);
    timer->connect(timer, SIGNAL(timeout()), this, SLOT(insertTransfers()));
    timer->start(1000);
}
开发者ID:maxdmyers,项目名称:The-Mixologist,代码行数:51,代码来源:TransfersDialog.cpp

示例9: run

void PhysicallyBased::run() {
	srand( time(NULL) );
	
	QTimer* timer = new QTimer(this);
	float timestepMS = theTime.timestep * 1000;
	timer->setInterval(timestepMS);
	timer->connect(timer, SIGNAL(timeout()), this, SLOT(simLoop()));
	timer->start();
	
	exec(); // start event loop
	
	//Application* mainApp = Application::getInstance();
	//QApplication::postEvent(mainApp, new QEvent(PhysBEvent::traceStart));
	//QApplication::postEvent(mainApp->SFMLView, new QEvent(PhysBEvent::tracePixelFilled));
	//QApplication::postEvent(eventManager, new QEvent(PhysBEvent::tracePixelFilled));
	//QApplication::postEvent(mainApp, new QEvent(PhysBEvent::traceEnd));
}
开发者ID:stevo2588,项目名称:Physics-Engine,代码行数:17,代码来源:PhysicallyBased.cpp

示例10: MainPage

/** Constructor */
WikiDialog::WikiDialog(QWidget *parent)
: MainPage(parent)
{
	/* Invoke the Qt Designer generated object setup routine */
	ui.setupUi(this);

	mAddPageDialog = NULL;
	mAddGroupDialog = NULL;
	mEditDialog = NULL;

	connect( ui.toolButton_NewGroup, SIGNAL(clicked()), this, SLOT(OpenOrShowAddGroupDialog()));
	connect( ui.toolButton_NewPage, SIGNAL(clicked()), this, SLOT(OpenOrShowAddPageDialog()));
	connect( ui.toolButton_Edit, SIGNAL(clicked()), this, SLOT(OpenOrShowEditDialog()));
	connect( ui.toolButton_Republish, SIGNAL(clicked()), this, SLOT(OpenOrShowRepublishDialog()));

	// Usurped until Refresh works normally
	connect( ui.toolButton_Delete, SIGNAL(clicked()), this, SLOT(insertWikiGroups()));
	connect( ui.pushButton, SIGNAL(clicked()), this, SLOT(todo()));

	connect( ui.treeWidget_Pages, SIGNAL(itemSelectionChanged()), this, SLOT(groupTreeChanged()));


	// GroupTreeWidget.
	connect(ui.groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupListCustomPopupMenu(QPoint)));
	connect(ui.groupTreeWidget, SIGNAL(treeItemActivated(QString)), this, SLOT(wikiGroupChanged(QString)));


	QTimer *timer = new QTimer(this);
	timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
	timer->start(1000);

	/* setup TokenQueue */
	mWikiQueue = new TokenQueue(rsWiki->getTokenService(), this);


	/* Setup Group Tree */
	mYourGroups = ui.groupTreeWidget->addCategoryItem(tr("My Groups"), QIcon(IMAGE_FOLDER), true);
	mSubscribedGroups = ui.groupTreeWidget->addCategoryItem(tr("Subscribed Groups"), QIcon(IMAGE_FOLDERRED), true);
	mPopularGroups = ui.groupTreeWidget->addCategoryItem(tr("Popular Groups"), QIcon(IMAGE_FOLDERGREEN), false);
	mOtherGroups = ui.groupTreeWidget->addCategoryItem(tr("Other Groups"), QIcon(IMAGE_FOLDERYELLOW), false);

  //Auto refresh seems not to work, temporary solution at start
  insertWikiGroups();

}
开发者ID:chozabu,项目名称:OldMeshDemocRS,代码行数:46,代码来源:WikiDialog.cpp

示例11: ConfigPage

ServerPage::ServerPage(QWidget * parent, Qt::WFlags flags)
    : ConfigPage(parent, flags)
{
  /* Invoke the Qt Designer generated object setup routine */
  ui.setupUi(this);

  connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
  connect( ui.allowIpDeterminationCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleIpDetermination(bool) ) );
  connect( ui.allowTunnelConnectionCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleTunnelConnection(bool) ) );
  connect( ui._max_tr_up_per_sec_SB, SIGNAL( valueChanged( int ) ), this, SLOT( updateMaxTRUpRate(int) ) );

   QTimer *timer = new QTimer(this);
   timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus()));
   timer->start(1000);

	//load();
	updateStatus();

	bool b = rsPeers->getAllowServerIPDetermination() ;
	ui.allowIpDeterminationCB->setChecked(b) ;
	ui.IPServersLV->setEnabled(b) ;

#ifdef RS_RELEASE_VERSION
    ui.allowTunnelConnectionCB->hide();
    this->toggleTunnelConnection(false);
#else
    b = rsPeers->getAllowTunnelConnection() ;
    ui.allowTunnelConnectionCB->setChecked(b) ;
#endif

	std::list<std::string> ip_servers ;
	rsPeers->getIPServersList(ip_servers) ;

	for(std::list<std::string>::const_iterator it(ip_servers.begin());it!=ip_servers.end();++it)
		ui.IPServersLV->addItem(QString::fromStdString(*it)) ;

  /* Hide platform specific features */
#ifdef Q_WS_WIN

#endif
}
开发者ID:coyotama,项目名称:retroshare,代码行数:41,代码来源:ServerPage.cpp

示例12: QWidget

GPS::GPS(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::GPS)
{
    ui->setupUi(this);

    Avion=(QPixmap) *(ui->avion->pixmap());
    x=ui->mapa->pos().x();
    y=ui->mapa->pos().y();


    yaw=0;
    velocidad=0;
    pitch=0;
    lastYaw=0;


    QTimer *timer = new QTimer(this);
    timer->connect(timer, SIGNAL(timeout()),
                   this, SLOT(update()));
    timer->start(200);
}
开发者ID:FlyTheThings,项目名称:FlightSimQt5,代码行数:22,代码来源:gps.cpp

示例13: iconSize

/** Constructor */
PhotoDialog::PhotoDialog(QWidget *parent)
: MainPage(parent)
{
  /* Invoke the Qt Designer generated object setup routine */
  ui.setupUi(this);

  connect( ui.peerTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( peerTreeWidgetCustomPopupMenu( QPoint ) ) );
  connect( ui.photoTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( photoTreeWidgetCustomPopupMenu( QPoint ) ) );

  connect( ui.peerTreeWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * ) ), this, SLOT( updatePhotoList( ) ) );

  connect( ui.photoTreeWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem * , int ) ), this, SLOT( showPhoto( QTreeWidgetItem *, int ) ) );
  connect( ui.addButton, SIGNAL( clicked( ) ), this, SLOT( addPhotos( ) ) );
  connect( ui.expandButton, SIGNAL(clicked()), this, SLOT(togglefileview()));

  /* hide the Tree +/- */
  ui.photoTreeWidget -> setRootIsDecorated( false );

  QSize iconSize(PHOTO_ICON_SIZE,PHOTO_ICON_SIZE);
  ui.photoTreeWidget->setIconSize(iconSize);
  
  /* Set header resize modes and initial section sizes */
  QHeaderView * ptw_header = ui.peerTreeWidget->header () ;
  ptw_header->setResizeMode (0, QHeaderView::Interactive);

  ptw_header->resizeSection ( 0, 175 );



	/* Set a GUI update timer - much cleaner than
	 * doing everything through the notify agent 
	 */

  QTimer *timer = new QTimer(this);
  timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
  timer->start(1000);
}
开发者ID:MrKID,项目名称:RetroShare,代码行数:38,代码来源:PhotoDialog.cpp

示例14: main

int main(int argc, char **argv)
{
    srand(time(NULL));
    QGuiApplication app(argc, argv);
    
    QSurfaceFormat format;
    format.setSamples(16);
    
    paramCamera* c=new paramCamera();
    
    QTimer* calendar = new QTimer;

    TriangleWindow* window[4];
    for(int i = 0; i < 4; i++)
    {
        if (i == 0)
            window[i] = new TriangleWindow();
        else
            window[i] = new TriangleWindow(20);
        window[i]->setSeason(i);
        window[i]->c = c;
        window[i]->setFormat(format);
        window[i]->resize(500,375);
        int x = i%2;
        int y = i>>1;
                
        window[i]->setPosition(x*500,y*450);
        window[i]->show();

        calendar->connect(calendar, SIGNAL(timeout()),window[i], SLOT(updateSeason()));
    }
    
    calendar->start(20);

    return app.exec();
}
开发者ID:Ooya,项目名称:TP4,代码行数:36,代码来源:main.cpp

示例15: main

int main(int argc, char **argv)
{
    //serializeUnserializeTest();
    srand(time(NULL));
    QGuiApplication app(argc, argv);
    
    QSurfaceFormat format;
    format.setSamples(16);
    
    paramCamera* c=new paramCamera();
    
    QTimer* calendar = new QTimer;

    //Add ressources
    PlyMeshReader plyReader;


    QString spring(":/springtree.ply");QString sp_name("SpringTree");
    QString summer(":/summertree.ply");QString su_name("SummerTree");
    QString autumn(":/autumntree.ply");QString au_name("AutumnTree");
    QString winter(":/wintertree.ply");QString wi_name("WinterTree");
    AssetManager::getInstance().loadMesh(sp_name,&plyReader,spring);
    AssetManager::getInstance().loadMesh(su_name,&plyReader,summer);
    AssetManager::getInstance().loadMesh(au_name,&plyReader,autumn);
    AssetManager::getInstance().loadMesh(wi_name,&plyReader,winter);

    QVector<GameWindow*> window;

    //if big file set content
    if(FileManager::getInstance().haveBigFile()) {
        qDebug() << "Saved GameWindow";
        window = FileManager::getInstance().load();
    }
    else {
        //Default four
        qDebug() << "Default GameWindow";
        for(int i = 0; i < 4; i++)
        {
            if (i == 0)
                window.append(new GameWindow());
            else
                window.append(new GameWindow(30));
            Terrain* terrain = new Terrain();
            terrain->loadHeightmap(":/heightmap-1.png");
            window.at(i)->setSeason(i);
            window.at(i)->setTerrain(terrain);
            window.at(i)->c = c;
        }

    }

    for(int i=0; i<window.size(); ++i) {
        qDebug() << "t-"<<i;
        FileManager::getInstance().link(window[i]);
        window[i]->setFormat(format);
        window[i]->resize(500,375);
        int x = i%2;
        int y = i>>1;

        window[i]->setPosition(x*500,y*450);
        window[i]->show();
        calendar->connect(calendar, SIGNAL(timeout()),window[i], SLOT(updateSeason()));
    }
    
    calendar->start(20);

    int appResult = app.exec();
    //AssetManager::getInstance().purge();
    return appResult;
}
开发者ID:TsubameDono,项目名称:TP4,代码行数:70,代码来源:main.cpp


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