本文整理汇总了C++中QWidget::isPopup方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidget::isPopup方法的具体用法?C++ QWidget::isPopup怎么用?C++ QWidget::isPopup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWidget
的用法示例。
在下文中一共展示了QWidget::isPopup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventFilter
bool AQEventFilter::eventFilter(QObject *obj, QEvent *ev)
#endif
{
if (AQWEBAPP->ignoreEvents_ || ev->aq_ignore || !obj->isWidgetType())
#ifdef AQ_USE_NOTIFY
return QApplication::notify(obj, ev);
#else
return false;
#endif
switch (ev->type()) {
case QEvent::Show: {
ev->aq_ignore = true;
QApplication::sendEvent(obj, ev);
ev->aq_ignore = false;
AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::Show)));
return true;
}
case QEvent::Hide: {
ev->aq_ignore = true;
QApplication::sendEvent(obj, ev);
ev->aq_ignore = false;
QWidget *w = AQ_WIDGET(obj);
if (w->isTopLevel()) {
//printf("hide %p %s\n", w, w->QObject::name());
//if (AQWEBAPP->lastDeactivate_)
// printf("hide lastDeactivate_ %p %s\n", AQWEBAPP->lastDeactivate_, AQWEBAPP->lastDeactivate_->QObject::name());
if (AQWEBAPP->lastDeactivate_ == w)
AQWEBAPP->lastDeactivate_ = 0;
AQWidgetInfo *wInfo = AQWEBAPP->createdWidgets_.find(w);
if (wInfo && wInfo->backActive_) {
//printf("hide backActive_ %p %s\n", wInfo->backActive_, wInfo->backActive_->QObject::name());
if (AQWEBAPP->createdWidgets_.find(wInfo->backActive_))
wInfo->backActive_->setActiveWindow();
wInfo->backActive_ = 0;
}
}
AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::Hide)));
//break;
return true;
}
case QEvent::Move: {
QMoveEvent *mv = static_cast<QMoveEvent *>(ev);
if (mv->pos() != mv->oldPos())
AQWEBAPP->postAQEvent(new AQEvent(obj, new QMoveEvent(mv->pos(), mv->oldPos())));
break;
}
case QEvent::Resize: {
QResizeEvent *rs = static_cast<QResizeEvent *>(ev);
if (rs->size() != rs->oldSize())
AQWEBAPP->postAQEvent(new AQEvent(obj, new QResizeEvent(rs->size(), rs->oldSize())));
break;
}
case QEvent::Reparent: {
AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::Reparent)));
break;
}
case QEvent::WindowActivate: {
QWidget *w = AQ_WIDGET(obj);
if (w->isTopLevel()) {
//printf("activate %p %s\n", w, w->QObject::name());
if (AQWEBAPP->lastDeactivate_ && AQWEBAPP->lastDeactivate_ != w) {
AQWidgetInfo *wInfo = AQWEBAPP->createdWidgets_.find(w);
if (wInfo) {
wInfo->backActive_ = AQWEBAPP->lastDeactivate_;
//printf("activate backActive_ %p %s\n", wInfo->backActive_, wInfo->backActive_->QObject::name());
}
}
AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::WindowActivate)));
}
break;
}
case QEvent::WindowDeactivate: {
QWidget *w = AQ_WIDGET(obj);
if (w->isTopLevel()) {
//printf("deactivate %p %s\n", w, w->QObject::name());
AQWEBAPP->lastDeactivate_ = w;
AQWEBAPP->postAQEvent(new AQEvent(obj, new QEvent(QEvent::WindowDeactivate)));
}
break;
}
case QEvent::CaptionChange: {
QWidget *w = AQ_WIDGET(obj);
if (w->isTopLevel() && !w->isPopup())
aq_notify_gui_args_event(w, "xgen",
QString::fromLatin1("caption:") +
w->caption());
break;
}
case QEvent::IconChange: {
QWidget *w = AQ_WIDGET(obj);
if (w->isTopLevel() && !w->isPopup())
//.........这里部分代码省略.........
示例2: reparent_good
// taken from qt/x11 (doing this sucks sucks sucks sucks sucks)
void reparent_good(QWidget *that, Qt::WindowFlags f, bool showIt)
{
extern void qPRCreate( const QWidget *, Window );
extern void qt_XDestroyWindow( const QWidget *destroyer, Display *display, Window window );
extern bool qt_dnd_enable( QWidget* w, bool on );
QWidget *parent = 0;
Display *dpy = that->x11Display();
QCursor oldcurs;
bool setcurs = that->windowState(Qt::WState_OwnCursor);
if ( setcurs ) {
oldcurs = that->cursor();
that->unsetCursor();
}
// dnd unregister (we will register again below)
bool accept_drops = that->acceptDrops();
that->setAcceptDrops( false );
// clear mouse tracking, re-enabled below
bool mouse_tracking = that->hasMouseTracking();
that->clearWState(Qt::WState_MouseTracking);
QWidget* oldtlw = that->window();
QWidget *oldparent = that->parentWidget();
WId old_winid = that->winid;
if ( that->windowFlags(Qt::WType_Desktop) )
old_winid = 0;
that->setWinId( 0 );
// hide and reparent our own window away. Otherwise we might get
// destroyed when emitting the child remove event below. See QWorkspace.
XUnmapWindow( that->x11Display(), old_winid );
XReparentWindow( that->x11Display(), old_winid,
RootWindow( that->x11Display(), that->x11Screen() ), 0, 0 );
if ( that->isTopLevel() ) {
// input contexts are associated with toplevel widgets, so we need
// destroy the context here. if we are reparenting back to toplevel,
// then we will have another context created, otherwise we will
// use our new toplevel's context
that->destroyInputContext();
}
if ( that->isTopLevel() || !parent ) // we are toplevel, or reparenting to toplevel
that->topData()->parentWinId = 0;
if ( parent != that->parentObj ) {
if ( that->parentObj ) // remove from parent
that->parentObj->removeChild( that );
if ( parent ) // insert into new parent
parent->insertChild( that );
}
bool enable = that->isEnabled(); // remember status
Qt::FocusPolicy fp = that->focusPolicy();
QSize s = that->size();
QPixmap *bgp = (QPixmap *)that->backgroundPixmap();
QColor bgc = that->bg_col; // save colors
QString capt= that->caption();
that->widget_flags = f;
that->clearWState( Qt::WState_Created | Qt::WState_Visible | Qt::WState_ForceHide );
that->create();
if ( that->isTopLevel() || (!parent || parent->isVisible() ) )
that->setWState( Qt::WState_ForceHide ); // new widgets do not show up in already visible parents
const QObjectList *chlist = that->children();
if ( chlist ) { // reparent children
QObjectListIt it( *chlist );
QObject *obj;
while ( (obj=it.current()) ) {
if ( obj->isWidgetType() ) {
QWidget *w = (QWidget *)obj;
if ( !w->isTopLevel() ) {
XReparentWindow( that->x11Display(), w->winId(), that->winId(),
w->geometry().x(), w->geometry().y() );
} else if ( w->isPopup()
|| w->windowFlags(Qt::WStyle_DialogBorder)
|| w->windowFlags(Qt::WType_Dialog)
|| w->windowFlags(Qt::WStyle_Tool) ) {
XSetTransientForHint( that->x11Display(), w->winId(), that->winId() );
}
}
++it;
}
}
qPRCreate( that, old_winid );
if ( bgp )
XSetWindowBackgroundPixmap( dpy, that->winid, bgp->handle() );
else
XSetWindowBackground( dpy, that->winid, bgc.pixel(that->x11Screen()) );
// all this just to do a stupid resize instead of setGeometry
//setGeometry( p.x(), p.y(), s.width(), s.height() );
that->resize(s.width(), s.height());
that->setEnabled( enable );
that->setFocusPolicy( fp );
if ( !capt.isNull() ) {
that->extra->topextra->caption = QString::null;
//.........这里部分代码省略.........