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

C++ setInstance函数代码示例

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

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



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

示例1: main

int main() {
    auto foo = Foo{};
    foo.setInstance(std::make_unique<Bar>());
    
    
    auto bar = std::make_unique<Bar>();
    foo.setInstance(std::move(bar));
    
    foo.bar_->hello();
}
开发者ID:CCJY,项目名称:coliru,代码行数:10,代码来源:main.cpp


示例2: KYSession

void KYSession::createInstance()
{
    if (!me) {
        me = new KYSession();
        setInstance(me);
    }
}
开发者ID:Gerardwx,项目名称:Yzis,代码行数:7,代码来源:kysession.cpp


示例3: setInstance

void RenderScene::initialize(int argc, char**argv){
    //set global RenderScene variable to this instance
    setInstance();
    
    
    
    //setup glut environment
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
    glutInitWindowPosition(100, 100);
    glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    glutCreateWindow(windowTitle.c_str());
    
    
    glutDisplayFunc(displayWrapper);
    
    glClearColor(1.0, 0.0, 0.0, 1.0);
    
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glEnable(GL_LIGHT1);
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);
    
    
    
    glutIdleFunc(runWrapper);
    
    glutPassiveMotionFunc(mouseCallback);
    
    glutMainLoop();
}
开发者ID:chiltonotlihc,项目名称:KinectViewport,代码行数:32,代码来源:RenderScene.cpp


示例4: KDevPlugin

EditorChooserPart::EditorChooserPart(QObject *parent, const char *name, const QStringList &)
  : KDevPlugin(&data, parent, name ? name : "EditorChooserPart")
{
  setInstance(EditorChooserFactory::instance());

  connect(core(), SIGNAL(configWidget(KDialogBase*)), this, SLOT(configWidget(KDialogBase*)));
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:7,代码来源:editorchooser_part.cpp


示例5: deleteDemandDrivenData

// Sync mesh update with changes on other processors
void Foam::polyMesh::syncUpdateMesh()
{
    // Update zones.  Since boundary depends on zones, they need to be
    // updated first.  HJ, 20/May/2014
    pointZones_.updateMesh();
    faceZones_.updateMesh();
    cellZones_.updateMesh();

    // Update boundaryMesh (note that patches themselves already ok)
    boundary_.updateMesh();

    // Clear out parallel data.  HJ, 27/Nov/2009
    deleteDemandDrivenData(globalMeshDataPtr_);

    setInstance(time().timeName());

    // Reset valid directions (could change by faces put into empty patches)
    geometricD_ = Vector<label>::zero;
    solutionD_ = Vector<label>::zero;

    // Update all function objects
    // Moved from fvMesh.C in 1.6.x merge.  HJ, 29/Aug/2010

    // Instantiate a dummy mapPolyMesh
    autoPtr<mapPolyMesh> mapPtr(new mapPolyMesh(*this));

    meshObjectBase::allUpdateTopology<polyMesh>(*this, mapPtr());
}
开发者ID:TsukasaHori,项目名称:openfoam-extend-foam-extend-3.1,代码行数:29,代码来源:polyMeshUpdate.C


示例6: RK_TRACE

RKDummyPart::RKDummyPart (QObject *parent, QWidget *widget) : KParts::Part (parent) {
	RK_TRACE (MISC);
	setWidget (widget);

	KInstance* instance = new KInstance ("rkward");
	setInstance (instance);
}
开发者ID:svn2github,项目名称:rkward-svn-mirror,代码行数:7,代码来源:rkdummypart.cpp


示例7: _widget

PluginPart::PluginPart(QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const QStringList &args)
    : KParts::ReadOnlyPart(parent, name), _widget(0), _args(args), _destructed(0L)
{
    setInstance(PluginFactory::instance());
    kdDebug(1432) << "PluginPart::PluginPart" << endl;

    // we have to keep the class name of KParts::PluginBrowserExtension
    // to let khtml find it
    _extension = static_cast< PluginBrowserExtension * >(new KParts::BrowserExtension(this));
    _liveconnect = new PluginLiveConnectExtension(this);

    // Only create this if we have no parent since the parent part is
    // responsible for "Save As" then
    if(!parent || !parent->inherits("Part"))
    {
        new KAction(i18n("&Save As..."), CTRL + Key_S, this, SLOT(saveAs()), actionCollection(), "saveDocument");
        setXMLFile("nspluginpart.rc");
    }

    // create
    _loader = NSPluginLoader::instance();
    _callback = new NSPluginCallback(this);

    // create a canvas to insert our widget
    _canvas = new PluginCanvasWidget(parentWidget, widgetName);
    //_canvas->setFocusPolicy( QWidget::ClickFocus );
    _canvas->setFocusPolicy(QWidget::WheelFocus);
    _canvas->setBackgroundMode(QWidget::NoBackground);
    setWidget(_canvas);
    _canvas->show();
    QObject::connect(_canvas, SIGNAL(resized(int, int)), this, SLOT(pluginResized(int, int)));
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:32,代码来源:plugin_part.cpp


示例8: setInstance

void ViewCluster::setSolution(CCP::Solution * sol){

    if (sol == 0){
        setInstance(_instance);
        return;
    }

    CCP::Point * tmpCenter = 0;
    _sol = sol;

    scene()->clear();
    qreal ellipseSize = (qMin(_instanceSize.width(), _instanceSize.height())/(_instance->numPoints()*4));
    this->fitInView(scene()->sceneRect(), Qt::KeepAspectRatio);

    for (unsigned short i = 0; i < _instance->numCenters(); i++){
        tmpCenter = _sol->centerOfCluster(i);
        scene()->addEllipse(tmpCenter->position().x() - ellipseSize*0.5,
                                        tmpCenter->position().y() - ellipseSize*0.5,
                                        ellipseSize, ellipseSize, QPen(QBrush(Qt::blue), 2));
        for (unsigned short k = 0; k < _sol->cluster(i)->numPoints(); ++k){
            scene()->addEllipse(_sol->cluster(i)->getPoint(k)->position().x() - ellipseSize*0.35 ,
                                            _sol->cluster(i)->getPoint(k)->position().y() -  ellipseSize*0.35 ,
                                            ellipseSize*0.7, ellipseSize*0.7,
                                            QPen(QBrush(Qt::black), 0));
            scene()->addLine(tmpCenter->position().x() ,
                             tmpCenter->position().y() ,
                             _sol->cluster(i)->getPoint(k)->position().x() ,
                             _sol->cluster(i)->getPoint(k)->position().y()
                             );
	}
    }
}
开发者ID:irfankhan19,项目名称:CCP,代码行数:32,代码来源:viewcluster.cpp


示例9: m_capabilities

KopeteRichTextEditPart::KopeteRichTextEditPart( QWidget *parent, const char *name, int capabilities )
  : KParts::ReadOnlyPart( parent, name ? name : "rich_text_part" ),
	m_capabilities( capabilities ),
	m_richTextEnabled( true )
{
	// we need an instance
	setInstance( KopeteRichTextEditPartFactory::instance() );

	editor = new KopeteTextEdit( parent );
	editor->setReadOnly( false );

	setWidget( editor );

	m_richTextAvailable = (
		m_capabilities & Kopete::Protocol::RichFormatting ||
		m_capabilities & Kopete::Protocol::Alignment ||
		m_capabilities & Kopete::Protocol::RichFont ||
		m_capabilities & Kopete::Protocol::RichColor
	);

	createActions();

	setXMLFile( "kopeterichtexteditpartfull.rc" );
	enableRichText->setEnabled( m_richTextAvailable );
	enableRichText->setChecked( m_richTextAvailable );
	slotSetRichTextEnabled( m_richTextAvailable );

	//Set colors, font
	readConfig();
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:30,代码来源:krichtexteditpart.cpp


示例10: setInstance

	void GlutFramework::startFramework(
	        int argc, char *argv[], std::string title, int width, int height,
	        int posx, int posy, double fps) {

	    // Sets the instance to this, used in the callback wrapper functions
		setInstance();
		this->frameTime = 1.0 / fps * 1000.0;

		// Initialize GLUT
		glutInit(&argc, argv);
		glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
		glutInitWindowSize(width, height);
		glutInitWindowPosition(0, 100);
		this->window = glutCreateWindow(title.c_str());

        init();                     // Initialize

		// Function callbacks with wrapper functions
        glutDisplayFunc(displayWrapper);
		glutReshapeFunc(reshapeWrapper);
        glutIdleFunc(runWrapper);
		glutMouseFunc(mouseButtonPressWrapper);
		glutMotionFunc(mouseMoveWrapper);
		glutKeyboardFunc(keyboardDownWrapper);
		glutKeyboardUpFunc(keyboardUpWrapper);
		glutSpecialFunc(specialKeyboardDownWrapper);
		glutSpecialUpFunc(specialKeyboardUpWrapper);
		glutMainLoop();
	}
开发者ID:Lillan,项目名称:Visualiser,代码行数:29,代码来源:GlutFramework.cpp


示例11: engine

Kaboodle::Player::Player(QWidget *widgetParent, const char *widgetName,
                         QObject *parent, const char *name)
	: KMediaPlayer::Player(widgetParent, widgetName, parent, name)
	, engine(new Engine(this))
	, widget(new View(widgetParent, widgetName, this))
	, uncompleted(true)
	, embedded(false)
{
	setInstance(KaboodleFactory::instance());

	connect(&ticker, SIGNAL(timeout()), SLOT(tickerTimeout()));
	ticker.start(500);
	setState(Empty);

	playAction = new KAction(i18n("&Play"), 0, this, SLOT(play()), actionCollection(), "play");
	pauseAction = new KAction(i18n("&Pause"), 0, this, SLOT(pause()), actionCollection(), "pause");
	stopAction = new KAction(i18n("&Stop"), 0, this, SLOT(stop()), actionCollection(), "stop");
	loopAction = new KToggleAction(i18n("&Looping"), 0, this, SLOT(loop()), actionCollection(), "loop");
	stopAction->setEnabled(false);
	playAction->setEnabled(false);
	pauseAction->setEnabled(false);
	connect(this, SIGNAL(loopingChanged(bool)), loopAction, SLOT(setChecked(bool)));

	KParts::Part::setWidget(widget);
	setXMLFile("kaboodlepartui.rc");

	extension = new BrowserExtension(this);
	extension->setURLDropHandlingEnabled(true);
}
开发者ID:serghei,项目名称:kde3-kdemultimedia,代码行数:29,代码来源:player.cpp


示例12: KDevBuildTool

AntProjectPart::AntProjectPart(QObject *parent, const char *name, const QStringList &)
  : KDevBuildTool(&data, parent, name ? name : "AntProjectPart")
{
  setInstance(AntProjectFactory::instance());

  setXMLFile("kdevantproject.rc");

  m_buildProjectAction = new KAction(i18n("&Build Project"), "make_kdevelop", Key_F8,
		                     this, SLOT(slotBuild()),
				     actionCollection(), "build_build" );
  m_buildProjectAction->setToolTip(i18n("Build project"));
  m_buildProjectAction->setWhatsThis(i18n("<b>Build project</b><p>Executes <b>ant dist</b> command to build the project."));

  KActionMenu *menu = new KActionMenu(i18n("Build &Target"),
                                      actionCollection(), "build_target" );
  menu->setToolTip(i18n("Build target"));
  menu->setWhatsThis(i18n("<b>Build target</b><p>Executes <b>ant target_name</b> command to build the specified target."));

  m_targetMenu = menu->popupMenu();

  connect(m_targetMenu, SIGNAL(activated(int)), this, SLOT(slotTargetMenuActivated(int)));
  connect(core(), SIGNAL(projectConfigWidget(KDialogBase*)), this, SLOT(projectConfigWidget(KDialogBase*)));
  connect(core(), SIGNAL(contextMenu(QPopupMenu *, const Context *)), this, SLOT(contextMenu(QPopupMenu *, const Context *)));

  m_antOptionsWidget = 0;
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:26,代码来源:antprojectpart.cpp


示例13: KDevMakeFrontend

MakeViewPart::MakeViewPart(QObject *parent, const char *name, const QStringList &)
    : KDevMakeFrontend(&data, parent, name)
{
    setInstance(MakeViewFactory::instance());

    setXMLFile("kdevmakeview.rc");

    m_dcop = new KDevMakeFrontendIface(this);

    m_widget = new MakeWidget(this);
    m_widget->setIcon( SmallIcon("exec") );
    m_widget->setCaption(i18n("Messages Output"));
    QWhatsThis::add(m_widget, i18n("<b>Messages output</b><p>"
                                   "The messages window shows the output of the compiler and "
                                   "used build tools like make, ant, uic, dcopidl etc. "
                                   "For compiler error messages, click on the error message. "
                                   "This will automatically open the source file and set the "
                                   "cursor to the line that caused the compiler error/warning."));

    mainWindow()->embedOutputView(m_widget, i18n("Messages"), i18n("Compiler output messages"));

    KAction *action;
    action = new KAction( i18n("&Next Error"), Key_F4, m_widget, SLOT(nextError()),
                          actionCollection(), "view_next_error");
    action->setToolTip( i18n("Go to the next error") );
    action->setWhatsThis(i18n("<b>Next error</b><p>Switches to the file and line where the next error was reported from."));
    action = new KAction( i18n("&Previous Error"), SHIFT+Key_F4, m_widget, SLOT(prevError()),
                          actionCollection(), "view_previous_error");
    action->setToolTip( i18n("Go to the previous error") );
    action->setWhatsThis(i18n("<b>Previous error</b><p>Switches to the file and line where the previous error was reported from."));

    connect( core(), SIGNAL(stopButtonClicked(KDevPlugin*)),
             this, SLOT(slotStopButtonClicked(KDevPlugin*)) );
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:34,代码来源:makeviewpart.cpp


示例14: protocol

SocketListener::SocketListener( String p_name )
:	protocol( logger ) {
	name = p_name;
	lastConnectionId = 0;

	setInstance( p_name );
	attachLogger();
}
开发者ID:AbhishekGhosh,项目名称:Artificial-Human,代码行数:8,代码来源:socketlistener.cpp


示例15: setInstance

CEventQueue::~CEventQueue()
{
	delete m_buffer;
	ARCH->setSignalHandler(CArch::kINTERRUPT, NULL, NULL);
	ARCH->setSignalHandler(CArch::kTERMINATE, NULL, NULL);
	ARCH->closeMutex(m_mutex);
	setInstance(NULL);
}
开发者ID:iHateInventNames,项目名称:synergy-plus,代码行数:8,代码来源:CEventQueue.cpp


示例16: m_nextType

CEventQueue::CEventQueue() :
	m_nextType(CEvent::kLast)
{
	setInstance(this);
	m_mutex = ARCH->newMutex();
	ARCH->setSignalHandler(CArch::kINTERRUPT, &interrupt, NULL);
	ARCH->setSignalHandler(CArch::kTERMINATE, &interrupt, NULL);
	m_buffer = new CSimpleEventQueueBuffer;
}
开发者ID:iHateInventNames,项目名称:synergy-plus,代码行数:9,代码来源:CEventQueue.cpp


示例17: Java_org_tof_player_VorbisDecoder_nativeClose

extern "C" void
Java_org_tof_player_VorbisDecoder_nativeClose(JNIEnv * env,jobject thiz) {
	VorbisDecoder * decoder=getInstance(env,thiz);
	if (decoder) {
		decoder->Close();
		delete decoder;
		setInstance(env,thiz,0);
	}
}
开发者ID:OrangesCyf,项目名称:tapsoffire,代码行数:9,代码来源:VorbisDecoder.cpp


示例18: setInstance

TestPlugin::TestPlugin(Kontact::Core *_core, const char *name, const QStringList &)
    : Kontact::Plugin(_core, _core, name)
{
    setInstance(TestPluginFactory::instance());

    insertNewAction(new KAction("Test", 0, this, SLOT(slotTestMenu()), actionCollection(), "edit_test"));

    setXMLFile("kptestplugin.rc");
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:9,代码来源:test_plugin.cpp


示例19: QQmlAndroidContextWrapper

QT_BEGIN_NAMESPACE

QQmlAndroidActivity::QQmlAndroidActivity(QObject *parent) :
    QQmlAndroidContextWrapper(parent), m_window(new QQmlAndroidWindow(this)),
    m_contentView(0), m_optionsMenu(0), m_actionBar(0)
{
    // TODO: multiple activities?
    setInstance(QtAndroid::androidActivity());
}
开发者ID:butzist,项目名称:playground-qtqmlandroid,代码行数:9,代码来源:qqmlandroidactivity.cpp


示例20: QDialog

QgsCredentialDialog::QgsCredentialDialog( QWidget *parent, Qt::WFlags fl )
    : QDialog( parent, fl )
{
  setupUi( this );
  setInstance( this );
  connect( this, SIGNAL( credentialsRequested( QString, QString *, QString *, QString, bool * ) ),
           this, SLOT( requestCredentials( QString, QString *, QString *, QString, bool * ) ),
           Qt::BlockingQueuedConnection );
}
开发者ID:AnAvidDeveloper,项目名称:QGIS,代码行数:9,代码来源:qgscredentialdialog.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setInt函数代码示例发布时间:2022-05-30
下一篇:
C++ setInline函数代码示例发布时间: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