本文整理汇总了C++中setParent函数的典型用法代码示例。如果您正苦于以下问题:C++ setParent函数的具体用法?C++ setParent怎么用?C++ setParent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setParent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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();
}
示例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);
}
示例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;
}
}
示例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();
}
示例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();
}
}
}
示例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));
}
*/
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
}
示例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);
}
示例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;
}