本文整理汇总了C++中setParent函数的典型用法代码示例。如果您正苦于以下问题:C++ setParent函数的具体用法?C++ setParent怎么用?C++ setParent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setParent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: mxWidget
mxListView::mxListView (mxWindow *parent, int x, int y, int w, int h, int id)
: mxWidget (parent, x, y, w, h)
{
if (!parent)
return;
d_this = new mxListView_i;
DWORD dwStyle = LVS_NOSORTHEADER | LVS_REPORT | LVS_SHOWSELALWAYS | WS_VISIBLE | WS_CHILD;
HWND hwndParent = (HWND) ((mxWidget *) parent)->getHandle ();
d_this->d_hwnd = CreateWindowEx (WS_EX_CLIENTEDGE, WC_LISTVIEW, "", dwStyle,
x, y, w, h, hwndParent,
(HMENU) id, (HINSTANCE) GetModuleHandle (NULL), NULL);
SendMessage (d_this->d_hwnd, WM_SETFONT, (WPARAM) (HFONT) GetStockObject (ANSI_VAR_FONT), MAKELPARAM (TRUE, 0));
SetWindowLong (d_this->d_hwnd, GWL_USERDATA, (LONG) this);
setHandle ((void *) d_this->d_hwnd);
setType (MX_LISTVIEW);
setParent (parent);
setId (id);
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:23,代码来源:mxlistview.cpp
示例2: twReleaseCapture
void twDialog::showWithCompletionHandler(twInvocation *handler){
twReleaseCapture();
m_handler=handler;
m_mode=twDM_handler;
if(m_needsDimming){
m_dimmer=twDimmer::openDimmer(m_dimmerStyle, new twNoArgumentMemberFunctionInvocation<twDialog>(this, &twDialog::backgroundTouched));
m_oldDesktop=getParent();
setParent(m_dimmer);
m_dimmer->setHidingWindow(this);
}
m_res=twDR_invalid;
if(twWnd *w=twGetDesktop()){
twRect r1=w->getRect();
twRect r2=getRect();
setRect(twRect( (r1.w-r2.w)/2, (r1.h-r2.h)/2, r2.w, r2.h ));
}
show();
focus();
}
开发者ID:yvt,项目名称:Agiletimbres,代码行数:23,代码来源:twDialog.cpp
示例3: updateSettings
void Sound::create (Movable *parent)
{
Ogre::SceneManager *mSceneMgr = RadXML::getSingletonPtr ()->getSceneManager ();
if (load == true)
{
sSound = new RadXmlCommon::s13Sound ();
sSound->strPath = file;
sSound->bStreaming = streaming;
sSound->dGain = gain;
sSound->LoadPath ();
if (sSound->IsLoaded () == false)
RadXmlCommon::s13LogMessage ("Unable to load audio file: " + file);
if (bPlay == true)
sSound->Play ();
}
/// @note Create the SceneNode here and keep it updated.
updateSettings ();
setParent (parent);
}
开发者ID:qeensh,项目名称:RadXML,代码行数:23,代码来源:RadXmlSound.cpp
示例4: setParent
void WLayout::setParentWidget(WWidget *parent)
{
if (!this->parent())
setParent(parent);
assert(!impl_);
int c = count();
for (int i = 0; i < c; ++i) {
WLayoutItem *item = itemAt(i);
if (item)
item->setParentWidget(parent);
}
impl_ = parent->createLayoutItemImpl(this);
if (hints_) {
for (unsigned i = 0; i < hints_->size(); ++i)
impl_->setHint((*hints_)[i].name, (*hints_)[i].value);
delete hints_;
hints_ = 0;
}
}
开发者ID:913862627,项目名称:wt,代码行数:23,代码来源:WLayout.C
示例5: QObject
SpectrumAnalyserThread::SpectrumAnalyserThread(QObject *parent)
: QObject(parent)
#ifndef DISABLE_FFT
, m_fft(new FFTRealWrapper)
#endif
, m_numSamples(SpectrumLengthSamples)
, m_windowFunction(DefaultWindowFunction)
, m_window(SpectrumLengthSamples, 0.0)
, m_input(SpectrumLengthSamples, 0.0)
, m_output(SpectrumLengthSamples, 0.0)
, m_spectrum(SpectrumLengthSamples)
#ifdef SPECTRUM_ANALYSER_SEPARATE_THREAD
, m_thread(new QThread(this))
#endif
{
#ifdef SPECTRUM_ANALYSER_SEPARATE_THREAD
// moveToThread() cannot be called on a QObject with a parent
setParent(0);
moveToThread(m_thread);
m_thread->start();
#endif
calculateWindow();
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:23,代码来源:spectrumanalyser.cpp
示例6: setParent
void Completer::invokeCompletion( QPlainTextEdit* editor )
{
if ( !isVisible() )
{
mEditor = editor;
setParent( mEditor, windowFlags() );
QPoint position = mEditor->mapToGlobal( mEditor->cursorRect().topLeft() );
int h = mEditor->cursorRect().height();
QDesktopWidget *dw = QApplication::desktop();
if(position.ry() < (dw->screen()->height()-height()))
position.ry() += h;
else
position.ry() -= (h+height());
move( position );
if ( prepareCompletion() )
{
show();
lwItems->setFocus();
}
}
}
开发者ID:dgu123,项目名称:qshaderedit,代码行数:23,代码来源:completer.cpp
示例7: printv_func
void THIS::init(parent_t * const & p)
{
printv_func(DEBUG);
setParent(p);
auto self = std::dynamic_pointer_cast<neb::gfx::environ::three>(shared_from_this());
neb::gfx::environ::single<neb::gfx::camera::view::Base>::init(p);
neb::gfx::environ::three::init(p);
//programs_.reset(new neb::gfx::glsl::program::threed("3d"));
//programs_->init();
// camera
/*
if(!getParent()->view_) {
getParent()->view_.reset(new neb::gfx::camera::view::Free(self));
}
*/
}
开发者ID:nebula-engine,项目名称:Nebula-Graphics,代码行数:23,代码来源:SceneDefault.cpp
示例8: setParent
DelDialog::DelDialog(QString name, QString text, QWidget* parent)
{
setParent(parent);
setWindowFlags(Qt::Dialog);
setWindowTitle(name);
setModal(1);
layout = new QGridLayout;
label = new QLabel (text, this);
acceptButton = new QPushButton (tr("&yes"), this);
rejectButton = new QPushButton (tr("&no"), this);
rejectButton->setFocus();
connect(acceptButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(rejectButton, SIGNAL(clicked()), this, SLOT(reject()));
layout->addWidget(label, 0, 0, 1, 0);
layout->addWidget(acceptButton, 1, 0);
layout->addWidget(rejectButton, 1, 1);
setLayout(layout);
}
开发者ID:ThePsyjo,项目名称:Prodcalc,代码行数:23,代码来源:bpDelDialog.cpp
示例9: while
Magic3D::Object::~Object()
{
std::vector<Object*>::const_iterator it_o = children.begin();
while (it_o != children.end())
{
(*it_o++)->setParent(NULL, false);
}
children.clear();
std::vector<ObjectInstance*>::const_iterator it_i = instances.begin();
while (it_i != instances.end())
{
(*it_i++)->setInstance(NULL, false);
}
instances.clear();
if (getParent())
{
setParent(NULL);
}
if (Script::getInstance())
{
if (isScripted())
{
setScripted(false);
}
}
if (AI)
{
delete AI;
AI = NULL;
}
clearMeshes();
}
开发者ID:whztt07,项目名称:Magic3D-2,代码行数:37,代码来源:object.cpp
示例10: bindServer
void bindServer(const char *port, EventHandler *pProcessor) {
sockaddr_in sin = { 0 };
sin.sin_family = AF_INET;
sin.sin_port = htons(atoi(port));
int listenerfd = socket(AF_INET, SOCK_STREAM, 0);
if (listenerfd == -1) {
ERRNO_OUT("Error creating listening socket");
exit(1);
}
int reuse = 1;
if (setsockopt(listenerfd, SOL_SOCKET, SO_REUSEADDR, &reuse,
sizeof(reuse))) {
ERRNO_OUT("Error enabling socket reuse");
exit(1);
}
evutil_make_socket_nonblocking(listenerfd);
if (bind(listenerfd, (sockaddr*) &sin, sizeof(sin)) < 0) {
perror("bind");
}
if (listen(listenerfd, 16) < 0) {
perror("listen");
return;
}
setParent(pProcessor);
event *e = event_new(m_ebase, listenerfd, EV_READ | EV_PERSIST,
acceptfn, (void*) pProcessor);
event_add(e, NULL);
INFO_OUT("Bound to port:%s\n", port);
}
开发者ID:ahsank,项目名称:EvaluateIPC,代码行数:37,代码来源:eventserver.cpp
示例11: setParent
UniversalMusicScraper::UniversalMusicScraper(QObject *parent)
{
setParent(parent);
m_tadbApiKey = "7490823590829082posuda";
m_language = "en";
m_prefer = "theaudiodb";
m_widget = new QWidget(MainWindow::instance());
m_box = new QComboBox(m_widget);
m_box->addItem(tr("Chinese"), "cn");
m_box->addItem(tr("Dutch"), "nl");
m_box->addItem(tr("English"), "en");
m_box->addItem(tr("French"), "fr");
m_box->addItem(tr("German"), "de");
m_box->addItem(tr("Hebrew"), "il");
m_box->addItem(tr("Hungarian"), "hu");
m_box->addItem(tr("Italian"), "it");
m_box->addItem(tr("Japanese"), "jp");
m_box->addItem(tr("Norwegian"), "no");
m_box->addItem(tr("Polish"), "pl");
m_box->addItem(tr("Portuguese"), "pt");
m_box->addItem(tr("Russian"), "ru");
m_box->addItem(tr("Spanish"), "es");
m_box->addItem(tr("Swedish"), "se");
m_preferBox = new QComboBox(m_widget);
m_preferBox->addItem(tr("The Audio DB"), "theaudiodb");
m_preferBox->addItem(tr("AllMusic"), "allmusic");
m_preferBox->addItem(tr("Discogs"), "discogs");
QGridLayout *layout = new QGridLayout(m_widget);
layout->addWidget(new QLabel(tr("Language")), 0, 0);
layout->addWidget(m_box, 0, 1);
layout->addWidget(new QLabel(tr("Prefer")), 1, 0);
layout->addWidget(m_preferBox, 1, 1);
layout->setColumnStretch(2, 1);
layout->setContentsMargins(12, 0, 12, 12);
m_widget->setLayout(layout);
}
开发者ID:Komet,项目名称:MediaElch,代码行数:37,代码来源:UniversalMusicScraper.cpp
示例12: changePath
RDirNode::RDirNode(RDirNode* parent, const std::string & abspath) {
changePath(abspath);
parent = 0;
setParent(parent);
accel = spos = prev_accel = vel = vec2(0.0f);
//NOTE: parent is always being set to 0 so this never gets called ...
//figure out starting position
if(parent !=0) {
vec2 parentPos = parent->getPos();
vec2 offset;
pos = parentPos;
} else {
pos = vec2(0.0f, 0.0f);
}
float padded_file_radius = gGourceFileDiameter * 0.5;
file_area = padded_file_radius * padded_file_radius * PI;
visible_count = 0;
visible = false;
position_initialized = false;
since_node_visible = 0.0;
since_last_file_change = 0.0;
since_last_node_change = 0.0;
calcRadius();
calcColour();
}
开发者ID:EthiopionZA,项目名称:Gource,代码行数:37,代码来源:dirnode.cpp
示例13: Adaptor
InstanceAdaptor::InstanceAdaptor(AbstractPlugin *p_plgn) : Adaptor(Core::instance ()) {
if (p_plgn == NULL){
emit pluginCantLoad (Core::arguments ()->value ("plugin").toString ());
QApplication::quit ();
} else {
connect(QApplication::instance (),SIGNAL(aboutToQuit()),this,SIGNAL(aboutToQuit()));
QDBusConnection::sessionBus ().connect ("org.thesii.Wintermute","/Factory",
"org.thesii.Wintermute.Factory","pluginCantLoad",
this,SIGNAL(pluginCantLoad(QString)));
QDBusConnection::sessionBus ().connect ("org.thesii.Wintermute","/Factory",
"org.thesii.Wintermute.Factory","pluginLoaded",
this,SIGNAL(pluginLoaded(QString)));
QDBusConnection::sessionBus ().connect ("org.thesii.Wintermute","/Factory",
"org.thesii.Wintermute.Factory","pluginUnloaded",
this,SIGNAL(pluginUnloaded(QString)));
QDBusConnection::sessionBus ().connect ("org.thesii.Wintermute","/Factory",
"org.thesii.Wintermute.Factory","aboutToQuit",
this,SLOT(aboutToQuit()));
setParent(p_plgn);
//setAutoRelaySignals (true);
}
}
开发者ID:oligagne,项目名称:core,代码行数:24,代码来源:adaptors.cpp
示例14: bindServer
void bindServer(const char *port, EventHandler *pProcessor) {
struct sockaddr_in sin = { 0 };
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = 0;
sin.sin_port = htons(atoi(port));
listener = socket(AF_INET, SOCK_STREAM, 0);
this->server = pProcessor;
setParent(pProcessor);
fcntl(listener, F_SETFL, O_NONBLOCK);
int oneval = 1;
setsockopt(listener, SOL_SOCKET, SO_REUSEADDR, &oneval, sizeof(oneval));
if (bind(listener, (struct sockaddr*) &sin, sizeof(sin)) < 0) {
perror("bind");
return;
}
INFO_OUT("Bound to port %s", port);
if (listen(listener, 16) < 0) {
perror("listen");
return;
}
INFO_OUT("Listenning to port %s", port);
}
开发者ID:ahsank,项目名称:EvaluateIPC,代码行数:24,代码来源:epollserver.cpp
示例15: createEditor
QWidget* MailTreeDelegate::createEditor (QWidget *parent,
const QStyleOptionViewItem& option, const QModelIndex& index) const
{
const auto& actionsVar = index.data (MailModel::MailRole::MessageActions);
if (actionsVar.isNull ())
return nullptr;
const auto& actionInfos = actionsVar.value<QList<MessageListActionInfo>> ();
if (actionInfos.isEmpty ())
return nullptr;
const auto& id = index.data (MailModel::MailRole::ID).toByteArray ();
const auto container = new QToolBar { parent };
auto style = new NullMarginsStyle;
style->setParent (container);
container->setStyle (style);
for (const auto& actInfo : actionInfos)
BuildAction (std::bind (Loader_, id), container, actInfo);
Util::ExecuteLater ([=] { updateEditorGeometry (container, option, index); });
return container;
}
开发者ID:ForNeVeR,项目名称:leechcraft,代码行数:24,代码来源:mailtreedelegate.cpp
示例16: setParent
BattleScripting::BattleScripting(QScriptEngine *engine, BaseBattleWindowInterface *_interface)
{
myinterface = _interface;
myengine = engine;
myengine->setParent(this);
setParent(_interface);
registerObject(ProxyDataContainer);
registerObject(TeamProxy);
registerObject(PokeProxy);
registerObject(MoveProxy);
registerObject(AuxPokeDataProxy);
registerObject(FieldProxy);
qScriptRegisterMetaType<BattleChoice>(engine, &toBattleChoice, &fromBattleChoice);
advbattledata_proxy *data = _interface->getBattleData();
ProxyDataContainer *pdata = data->exposedData();
int me = data->isPlayer(1) ? 1 : 0;
int opp = !me;
QScriptValue battle = myengine->newQObject(_interface);
myengine->globalObject().setProperty("battle", battle);
battle.setProperty("data", myengine->newQObject(dynamic_cast<QObject*>(pdata)));
battle.setProperty("me", QScriptValue(me));
battle.setProperty("opp", QScriptValue(opp));
battle.setProperty("id", _interface->battleId());
/* Removes clientscripting' print function and add ours. Client scripting's print function
can still be accessed with sys.print() */
QScriptValue printfun = myengine->newFunction(nativePrint);
printfun.setData(myengine->newQObject(this));
myengine->globalObject().setProperty("print", myengine->nullValue());
myengine->globalObject().setProperty("print", printfun);
_interface->addOutput(this);
}
开发者ID:Angryn00b,项目名称:pokemon-online,代码行数:36,代码来源:battlescripting.cpp
示例17: setParent
void GuideManager::handleEvent(cocos2d::EventCustom* event)
{
void* userdata = event->getUserData();
if (userdata)
{
setParent((Node*)userdata);
}
if (event->getEventName() == GUIDE_EVENT_TOUCH_IN_RECT)
{
nextStep(getNextStepId());
}
else if (event->getEventName() == GUIDE_EVENT_BEGIN_GUIDE)
{
nextStep(0); // test here
}
else if (event->getEventName() == GUIDE_EVENT_CONTENUE)
{
setWait(false);
nextStep(getNextStepId());
}
else
{}
}
开发者ID:xyhak47,项目名称:learn_cocos2dx,代码行数:24,代码来源:GuideManager.cpp
示例18: setParent
TileSelectionWidget::TileSelectionWidget(QWidget *parent_)
{
setParent(parent_);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setAutoFillBackground(true);
QPalette pal(palette());
pal.setColor(QPalette::Background, QColor(157, 150, 150));
setPalette(pal);
container = new QWidget(this);
container->setStyleSheet("background:transparent;");
tileSetPixmap.load("res/img/tileset.png");
tileSetLabel = new QLabel(container);
tileSetLabel->setPixmap(tileSetPixmap);
tileSetLabel->resize(tileSetPixmap.size());
cursor = new QLabel(container);
cursor->setPixmap(QPixmap("res/img/GUI/tileSelector.png"));
container->resize(tileSetLabel->size() + QSize(80, 80));
tileSetLabel->move(40, 40);
cursor->move(40, 40);
setWidget(container);
select(0, 0);
leftButtonDown = false;
}
开发者ID:espacee,项目名称:BossBrawl,代码行数:24,代码来源:TileSelectionWidget.cpp
示例19: createAgentIcon
sp<Control> ControlGenerator::createAgentAssignmentControl(GameState &state, sp<Agent> agent)
{
const int controlLength = 200, controlHeight = 24, iconLenght = 36;
if (!singleton.initialised)
{
singleton.init(state);
}
auto control = mksp<Control>();
control->setData(agent);
control->Size = control->SelectionSize = {controlLength, controlHeight};
control->Name = "AGENT_PORTRAIT";
auto icon = createAgentIcon(state, agent, UnitSelectionState::Unselected, false);
icon->Size = {iconLenght, controlHeight};
icon->setParent(control);
auto nameLabel = control->createChild<Label>(agent->name, singleton.labelFont);
nameLabel->Size = {controlLength - iconLenght, singleton.labelFont->getFontHeight()};
nameLabel->Location = {iconLenght, (control->Size.y - nameLabel->Size.y) / 2};
return control;
}
开发者ID:jgatkinsn,项目名称:OpenApoc,代码行数:24,代码来源:controlgenerator.cpp
示例20: QToolButton
SplitterCollapser::SplitterCollapser(QSplitter *splitter, QWidget *widget)
: QToolButton(),
d(new SplitterCollapserPrivate)
{
d->q = this;
// We do not want our collapser to be added as a regular widget in the
// splitter!
setAttribute(Qt::WA_NoChildEventsForParent);
d->mOpacityTimeLine = new QTimeLine(TIMELINE_DURATION, this);
d->mOpacityTimeLine->setFrameRange(int(MINIMUM_OPACITY * 1000), 1000);
connect(d->mOpacityTimeLine, SIGNAL(valueChanged(qreal)), SLOT(update()));
d->mWidget = widget;
d->mWidget->installEventFilter(this);
qApp->installEventFilter(this);
d->mSplitter = splitter;
setParent(d->mSplitter);
if (splitter->indexOf(widget) < splitter->count() / 2) {
d->mDirection = LTR;
} else {
d->mDirection = RTL;
}
if (splitter->orientation() == Qt::Vertical) {
// FIXME: Ugly!
d->mDirection = static_cast<Direction>(int(d->mDirection) + int(TTB));
}
connect(this, SIGNAL(clicked()), SLOT(slotClicked()));
show();
}
开发者ID:KDE,项目名称:libksane,代码行数:36,代码来源:splittercollapser.cpp
注:本文中的setParent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论