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


C++ parentWidget函数代码示例

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


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

示例1: parentWidget

XADDoc *XADView::getDocument() const
{
    XADApp *theApp=(XADApp *) parentWidget();

    return theApp->getDocument();
}
开发者ID:kaarthiks,项目名称:xad-qt,代码行数:6,代码来源:xadview.cpp

示例2: QBrush

/** Overloads default QWidget::paintEvent. Draws the actual 
 * bandwidth graph. */
void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
{
    //std::cerr << "In paint event!" << std::endl;

  /* Set current graph dimensions */
  _rec = this->frameRect();
  
  /* Start the painter */
  _painter->begin(this);
  
  /* We want antialiased lines and text */
  _painter->setRenderHint(QPainter::Antialiasing);
  _painter->setRenderHint(QPainter::TextAntialiasing);
  
  /* Fill in the background */
  _painter->fillRect(_rec, QBrush(BACK_COLOR));
  _painter->drawRect(_rec);

  // draw one line per friend.
  std::list<RsPeerId> ssllist ;
  rsPeers->getFriendList(ssllist) ;

  // sort list
  {
      // RSPermissionMatrixWidgets parent is ServicePermissionsPage which holds the checkbox
      ServicePermissionsPage *spp = dynamic_cast<ServicePermissionsPage*>(parentWidget());
      if(spp != NULL) {
          // sort out offline peers
          if(spp->isHideOfflineChecked()) {
              RsPeerDetails peerDetails;
              for(std::list<RsPeerId>::iterator it = ssllist.begin(); it != ssllist.end();) {
                  rsPeers->getPeerDetails(*it, peerDetails);

                  switch (peerDetails.connectState) {
                  case RS_PEER_CONNECTSTATE_OFFLINE:
                  case RS_PEER_CONNECTSTATE_TRYING_TCP:
                  case RS_PEER_CONNECTSTATE_TRYING_UDP:
                      it = ssllist.erase(it);
                      break;
                  default:
                      it++;
                      break;
                  }
              }
          }
      }

      // sort by name
      ssllist.sort(sortRsPeerIdByNameLocation);
  }

  RsPeerServiceInfo ownServices;
  rsServiceControl->getOwnServices(ownServices);

  // Display friend names at the beginning of each column

  const QFont& font(_painter->font()) ;
  QFontMetrics fm(font);
  int peer_name_size = 0 ;
  float line_height = 2 + fm.height() ;

  std::vector<QString> names ;

  for(std::list<RsPeerId>::const_iterator it(ssllist.begin());it!=ssllist.end();++it)
  {
      RsPeerDetails details ;
      rsPeers->getPeerDetails(*it,details) ;

      QString name = QString::fromUtf8(details.name.c_str()) + " (" + QString::fromUtf8(details.location.c_str()) + ")";
      if(name.length() > 20)
          name = name.left(20)+"..." ;

      peer_name_size = std::max(peer_name_size, fm.width(name)) ;
      names.push_back(name) ;
  }

  QPen pen ;
  pen.setWidth(2) ;
  pen.setBrush(Qt::black) ;

  _painter->setPen(pen) ;
  int i=0;
  int x=5 ;
  int y=MATRIX_START_Y ;

  for(std::list<RsPeerId>::const_iterator it(ssllist.begin());it!=ssllist.end();++it,++i)
  {
      float X = MATRIX_START_X + peer_name_size - fm.width(names[i]) ;
      float Y = MATRIX_START_Y + (i+0.5)*ROW_SIZE + line_height/2.0f-2 ;

      _painter->drawText(QPointF(X,Y),names[i]) ;

      if(*it == _current_peer_id)
          _painter->drawLine(QPointF(X,Y+3),QPointF(X+fm.width(names[i]),Y+3)) ;

      y += line_height ;
  }

//.........这里部分代码省略.........
开发者ID:N00D13,项目名称:RetroShare,代码行数:101,代码来源:RSPermissionMatrixWidget.cpp

示例3: updatePosition

void MiniMap::updatePosition()
{
	QGraphicsView* parent = static_cast<QGraphicsView*> (parentWidget());

	move(0,parent->viewport()->height() - height() + 2*frameWidth());
}
开发者ID:JurajKubelka,项目名称:Envision,代码行数:6,代码来源:MiniMap.cpp

示例4:

ScrollArea *ScrollBar::area() {
	return static_cast<ScrollArea*>(parentWidget());
}
开发者ID:4ker,项目名称:tdesktop,代码行数:3,代码来源:scrollarea.cpp

示例5: parentWidget

void ShutterFunctionDialog::closeEvent(QCloseEvent *e)
{
    m_project->nodes()->segments()->unselectAll();
    parentWidget()->repaint();
    QDialog::closeEvent(e);
}
开发者ID:Tungee,项目名称:slowmoVideo,代码行数:6,代码来源:shutterFunctionDialog.cpp

示例6: nativeWindowDeco

bool QDockWidgetLayout::nativeWindowDeco() const
{
    return nativeWindowDeco(parentWidget()->isWindow());
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:4,代码来源:qdockwidget.cpp

示例7: minimumTitleWidth

QSize QDockWidgetLayout::sizeFromContent(const QSize &content, bool floating) const
{
    QSize result = content;

    if (verticalTitleBar) {
        result.setHeight(qMax(result.height(), minimumTitleWidth()));
        result.setWidth(qMax(content.width(), 0));
    } else {
        result.setHeight(qMax(result.height(), 0));
        result.setWidth(qMax(content.width(), minimumTitleWidth()));
    }

    QDockWidget *w = qobject_cast<QDockWidget*>(parentWidget());
    const bool nativeDeco = nativeWindowDeco(floating);

    int fw = floating && !nativeDeco
            ? w->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, w)
            : 0;

    const int th = titleHeight();
    if (!nativeDeco) {
        if (verticalTitleBar)
            result += QSize(th + 2*fw, 2*fw);
        else
            result += QSize(2*fw, th + 2*fw);
    }

    result.setHeight(qMin(result.height(), (int) QWIDGETSIZE_MAX));
    result.setWidth(qMin(result.width(), (int) QWIDGETSIZE_MAX));

    if (content.width() < 0)
        result.setWidth(-1);
    if (content.height() < 0)
        result.setHeight(-1);

    int left, top, right, bottom;
    w->getContentsMargins(&left, &top, &right, &bottom);
    //we need to substract the contents margin (it will be added by the caller)
    QSize min = w->minimumSize() - QSize(left + right, top + bottom);
    QSize max = w->maximumSize() - QSize(left + right, top + bottom);

    /* A floating dockwidget will automatically get its minimumSize set to the layout's
       minimum size + deco. We're *not* interested in this, we only take minimumSize()
       into account if the user set it herself. Otherwise we end up expanding the result
       of a calculation for a non-floating dock widget to a floating dock widget's
       minimum size + window decorations. */

    uint explicitMin = 0;
    uint explicitMax = 0;
    if (w->d_func()->extra != 0) {
        explicitMin = w->d_func()->extra->explicitMinSize;
        explicitMax = w->d_func()->extra->explicitMaxSize;
    }

    if (!(explicitMin & Qt::Horizontal) || min.width() == 0)
        min.setWidth(-1);
    if (!(explicitMin & Qt::Vertical) || min.height() == 0)
        min.setHeight(-1);

    if (!(explicitMax & Qt::Horizontal))
        max.setWidth(QWIDGETSIZE_MAX);
    if (!(explicitMax & Qt::Vertical))
        max.setHeight(QWIDGETSIZE_MAX);

    return result.boundedTo(max).expandedTo(min);
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:66,代码来源:qdockwidget.cpp

示例8: refActual

/**
\return
**/
void Q19Writer::genera ( BlDbRecordSet  *curcobro, QString fileName , QStringList *idsGenerats)
{
      BL_FUNC_DEBUG
      QString refActual ( "cap rebut" );
      if (fileName.length()==0) {
          fileName = QFileDialog::getSaveFileName ( parentWidget(), _ ( "Fichero de remesa bancaria (Cuaderno 19)" ),
                       "",
                       _ ( "*.q19;;*" ) );
      }

      BlDebug::blDebug ( Q_FUNC_INFO, 0, QString(_("Nombre del fichero: '%1'")).arg(fileName) );

      if (fileName.length()>0) { // else ha apretat cancel?lar
       
	try
	{
		int cobraments=curcobro->numregistros();
		BlDbRecordSet  *curbanc;
		/*
		http://www.cam.es/1/empresas/servicios/pdf/c19.pdf
		"    Dentro de cada Cliente Ordenante, todos los registros individuales debera'n
		figurar en el soporte clasificados ascendentemente por el nu'mero de Entidad-
		Oficina de adeudo, Referencia y Co'digo de dato, terminando con un registro de
		<<Total Ordenante>>. Al final llevara' un registro de <<Total General>>.
		"
		Per'o cada idbanco (de fet cada entitat, per'o no filem tan prim) requereix un
		fitxer, perqu'e no portar'as a un banc els rebuts que vols cobrar per un altre.
		I la data de c'arrec va a la capc,alera d'ordenant, per tant hem d'ordenar primer
		per banc i data i despre's pel que demana als rebuts d'un ordenant. Farem tantes capc,aleres
		d'ordenant com dates encara que sempre sigui el mateix ordenant.

		*/
		bool bancUnic = ( curcobro->value( "idbanco",0 ) == curcobro->value( "idbanco",curcobro->numregistros()-1 ) );
		BlDebug::blDebug ( "bancUnic=",0,bancUnic?"si":"no" );
		QString idbanc ( "" );
		QFile file;
		QTextStream out ( &file );
		/*
		   http://www.cam.es/1/empresas/servicios/pdf/c19.pdf
		   - Codigo ASCII ( en mayusculas) (caracter 165= enye).
		   - Registros de longitud fija (162 bytes).
		   - Formato MS-DOS secuencial tipo texto.
		   En canvi un fitxer de mostra generat amb un programa que do'na el banc
		   te' 162 car'acters + \x0a , que no e's un salt de li'nia MSDOS. Ni se' si
		   un fitxer de registres de longitud fixa necessita  salts de li'nia per a res.
		*/
		out.setCodec ( "Q19" );
		QString sufijo;
		QDate fechaCargo = ( curcobro->eof() ?
		                     QDate()
		                     : QDate::fromString ( curcobro->value( "fechavenccobro" ),"dd/MM/yyyy" ) ) ;
		BlFixed impOrdenante ( 0,2 );
		BlFixed impPresentador ( 0,2 );
		QString resultats ( "" );
		int registrosOrdenante=0;
		int registrosPresentador=0;
		int cobramentsOrdenante=0;
		int cobramentsPresentador=0;
		int ordenants=0;
		int sensebanc=0;
		int sensevenc=0;
		while ( !curcobro->eof() )
		{
			if ( QDate::fromString ( curcobro->value( "fechavenccobro" ),"dd/MM/yyyy" ).isValid() )
			{
				if ( ( !curcobro->value( "idbanco" ).isNull() ) && ( curcobro->value( "idbanco" ).length() >0 ) )
				{

					if ( QDate::fromString ( curcobro->value( "fechavenccobro" ),"dd/MM/yyyy" ) != fechaCargo )
					{
						registrosPresentador++;
						registrosOrdenante++;
						totalOrdenante ( out, sufijo , curbanc, impOrdenante,
						                 cobramentsOrdenante, registrosOrdenante );
						ordenants++;
					}
					if ( curcobro->value( "idbanco" ) != idbanc )
					{
						// canvi de banc on cobrem els rebuts, canvi de fitxer
						idbanc=curcobro->value( "idbanco" );
						if ( file.handle() !=-1 )
						{
							registrosPresentador++;
							totalPresentador ( out, sufijo, curbanc, impPresentador, cobramentsPresentador, registrosPresentador , ordenants );
							resultats += _ ( "\n%3 : %1 recibos, %2 EUR. " ).arg ( cobramentsPresentador ).arg ( impPresentador.toQString() ).arg ( file.fileName() );
							file.close();
							delete curbanc;

						}
						curbanc = m_empresa->loadQuery ( "SELECT * FROM banco WHERE idbanco = $1",1,&idbanc );
                                                sufijo = curbanc->value("sufijobanco");
						if ( bancUnic )
						{
							file.setFileName ( fileName );
							BlDebug::blDebug ( "creare' ",0,fileName );
						}
						else
//.........这里部分代码省略.........
开发者ID:trifolio6,项目名称:Bulmages,代码行数:101,代码来源:q19writer.cpp

示例9: Q_D

/*! \reimp */
bool QDockWidget::event(QEvent *event)
{
    Q_D(QDockWidget);

    QMainWindow *win = qobject_cast<QMainWindow*>(parentWidget());
    QMainWindowLayout *layout = 0;
    if (win != 0)
        layout = qobject_cast<QMainWindowLayout*>(win->layout());

    switch (event->type()) {
#ifndef QT_NO_ACTION
    case QEvent::Hide:
        if (layout != 0)
            layout->keepSize(this);
        d->toggleViewAction->setChecked(false);
        emit visibilityChanged(false);
        break;
    case QEvent::Show:
        d->toggleViewAction->setChecked(true);
        emit visibilityChanged(geometry().right() >= 0 && geometry().bottom() >= 0);
        break;
#endif
    case QEvent::ApplicationLayoutDirectionChange:
    case QEvent::LayoutDirectionChange:
    case QEvent::StyleChange:
    case QEvent::ParentChange:
        d->updateButtons();
        break;
    case QEvent::ZOrderChange: {
        bool onTop = false;
        if (win != 0) {
            const QObjectList &siblings = win->children();
            onTop = siblings.count() > 0 && siblings.last() == (QObject*)this;
        }
        if (!isFloating() && layout != 0 && onTop)
            layout->raise(this);
        break;
    }
    case QEvent::WindowActivate:
    case QEvent::WindowDeactivate:
        update(qobject_cast<QDockWidgetLayout *>(this->layout())->titleArea());
        break;
    case QEvent::ContextMenu:
        if (d->state) {
            event->accept();
            return true;
        }
        break;
        // return true after calling the handler since we don't want
        // them to be passed onto the default handlers
    case QEvent::MouseButtonPress:
        if (d->mousePressEvent(static_cast<QMouseEvent *>(event)))
            return true;
        break;
    case QEvent::MouseButtonDblClick:
        if (d->mouseDoubleClickEvent(static_cast<QMouseEvent *>(event)))
            return true;
        break;
    case QEvent::MouseMove:
        if (d->mouseMoveEvent(static_cast<QMouseEvent *>(event)))
            return true;
        break;
#ifdef Q_OS_WIN
    case QEvent::Leave:
        if (d->state != 0 && d->state->dragging && !d->state->nca) {
            // This is a workaround for loosing the mouse on Vista.
            QPoint pos = QCursor::pos();
            QMouseEvent fake(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton,
                             QApplication::mouseButtons(), QApplication::keyboardModifiers());
            d->mouseMoveEvent(&fake);
        }
        break;
#endif
    case QEvent::MouseButtonRelease:
        if (d->mouseReleaseEvent(static_cast<QMouseEvent *>(event)))
            return true;
        break;
    case QEvent::NonClientAreaMouseMove:
    case QEvent::NonClientAreaMouseButtonPress:
    case QEvent::NonClientAreaMouseButtonRelease:
    case QEvent::NonClientAreaMouseButtonDblClick:
        d->nonClientAreaMouseEvent(static_cast<QMouseEvent*>(event));
        return true;
    case QEvent::Move:
        d->moveEvent(static_cast<QMoveEvent*>(event));
        break;
    case QEvent::Resize:
        // if the mainwindow is plugging us, we don't want to update undocked geometry
        if (isFloating() && layout != 0 && layout->pluggingWidget != this)
            d->undockedGeometry = geometry();
        break;
    default:
        break;
    }
    return QWidget::event(event);
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:97,代码来源:qdockwidget.cpp

示例10: parentWidget

void Adding::OnCancel()
{
    this->close();
    parentWidget()->close();
}
开发者ID:amitbhorania,项目名称:ExpenseManager,代码行数:5,代码来源:adding.cpp

示例11: defined

void StatusBar::updateStyleSheet()
{
  #if defined(Q_OS_MAC)
  setStyleSheet(LS("QStatusBar { background: qlineargradient(x1: 1, y1: 0, x2: 1, y2: 1, stop: 0 #ededed, stop: 1 #c8c8c8); } QStatusBar::item { border-width: 0; }"));
  #else
    #if defined(Q_OS_WIN32)
    setStyleSheet(QString(LS("QStatusBar { background-color: %1; } QStatusBar::item { border-width: 0; }")).arg(parentWidget()->palette().color(QPalette::Window).name()));
    #else
    setStyleSheet(LS("QStatusBar::item { border-width: 0; }"));
    #endif
  #endif
}
开发者ID:johnbolia,项目名称:schat,代码行数:12,代码来源:StatusBar.cpp

示例12: resize

void Overlay::relayout()
{
    resize(parentWidget()->size());
    if (d.button)
        d.button->move(rect().center() - d.button->rect().center());
}
开发者ID:EldFitheach,项目名称:Mudlet,代码行数:6,代码来源:overlay.cpp

示例13: GroupIndicatorOverlayWidget

QWidget* GroupIndicatorOverlay::createWidget()
{
    QAbstractButton* const button = new GroupIndicatorOverlayWidget(parentWidget());
    button->setCursor(Qt::PointingHandCursor);
    return button;
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:6,代码来源:groupindicatoroverlay.cpp

示例14: setGeometry

void QDockWidgetLayout::setGeometry(const QRect &geometry)
{
    QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());

    bool nativeDeco = nativeWindowDeco();

    int fw = q->isFloating() && !nativeDeco
            ? q->style()->pixelMetric(QStyle::PM_DockWidgetFrameWidth, 0, q)
            : 0;

    if (nativeDeco) {
        if (QLayoutItem *item = item_list[Content])
            item->setGeometry(geometry);
    } else {
        int titleHeight = this->titleHeight();

        if (verticalTitleBar) {
            _titleArea = QRect(QPoint(fw, fw),
                                QSize(titleHeight, geometry.height() - (fw * 2)));
        } else {
            _titleArea = QRect(QPoint(fw, fw),
                                QSize(geometry.width() - (fw * 2), titleHeight));
        }

        if (QLayoutItem *item = item_list[TitleBar]) {
            item->setGeometry(_titleArea);
        } else {
            QStyleOptionDockWidgetV2 opt;
            q->initStyleOption(&opt);

            if (QLayoutItem *item = item_list[CloseButton]) {
                if (!item->isEmpty()) {
                    QRect r = q->style()
                        ->subElementRect(QStyle::SE_DockWidgetCloseButton,
                                            &opt, q);
                    if (!r.isNull())
                        item->setGeometry(r);
                }
            }

            if (QLayoutItem *item = item_list[FloatButton]) {
                if (!item->isEmpty()) {
                    QRect r = q->style()
                        ->subElementRect(QStyle::SE_DockWidgetFloatButton,
                                            &opt, q);
                    if (!r.isNull())
                        item->setGeometry(r);
                }
            }
        }

        if (QLayoutItem *item = item_list[Content]) {
            QRect r = geometry;
            if (verticalTitleBar) {
                r.setLeft(_titleArea.right() + 1);
                r.adjust(0, fw, -fw, -fw);
            } else {
                r.setTop(_titleArea.bottom() + 1);
                r.adjust(fw, 0, -fw, -fw);
            }
            item->setGeometry(r);
        }
    }
}
开发者ID:cdaffara,项目名称:symbiandump-mw3,代码行数:64,代码来源:qdockwidget.cpp

示例15: colorGroup

void QToolBoxButton::drawButton( QPainter *p )
{
    QStyle::SFlags flags = QStyle::Style_Default;
    const QColorGroup &cg = colorGroup();

    if ( isEnabled() )
	flags |= QStyle::Style_Enabled;
    if ( selected )
	flags |= QStyle::Style_Selected;
    if ( hasFocus() )
	flags |= QStyle::Style_HasFocus;
    if (isDown())
	flags |= QStyle::Style_Down;
    style().drawControl( QStyle::CE_ToolBoxTab, p, parentWidget(), rect(), cg, flags );

    QPixmap pm = icon.pixmap( QIconSet::Small, isEnabled() ? QIconSet::Normal : QIconSet::Disabled );

    QRect cr = style().subRect( QStyle::SR_ToolBoxTabContents, this );
    QRect tr, ir;
    int ih = 0;
    if ( pm.isNull() ) {
	tr = cr;
	tr.addCoords( 4, 0, -8, 0 );
    } else {
	int iw = pm.width() + 4;
	ih = pm.height();
	ir = QRect( cr.left() + 4, cr.top(), iw + 2, ih );
	tr = QRect( ir.right(), cr.top(), cr.width() - ir.right() - 4, cr.height() );
    }

    if ( selected && style().styleHint( QStyle::SH_ToolBox_SelectedPageTitleBold ) ) {
	QFont f( p->font() );
	f.setBold( TRUE );
	p->setFont( f );
    }

    QString txt;
    if ( p->fontMetrics().width(label) < tr.width() ) {
	txt = label;
    } else {
	txt = label.left( 1 );
	int ew = p->fontMetrics().width( "..." );
	int i = 1;
	while ( p->fontMetrics().width( txt ) + ew +
		p->fontMetrics().width( label[i] )  < tr.width() )
	    txt += label[i++];
	txt += "...";
    }

    if ( ih )
	p->drawPixmap( ir.left(), (height() - ih) / 2, pm );

    QToolBox *tb = (QToolBox*)parentWidget();

    const QColor* fill = 0;
    if ( selected &&
	 style().styleHint( QStyle::SH_ToolBox_SelectedPageTitleBold ) &&
	 tb->backgroundMode() != NoBackground )
	fill = &cg.color( QPalette::foregroundRoleFromMode( tb->backgroundMode() ) );

    int alignment = AlignLeft | AlignVCenter | ShowPrefix;
    if (!style().styleHint(QStyle::SH_UnderlineAccelerator, this))
	alignment |= NoAccel;
    style().drawItem( p, tr, alignment, cg,
		      isEnabled(), 0, txt, -1, fill );

    if ( !txt.isEmpty() && hasFocus() )
	style().drawPrimitive( QStyle::PE_FocusRect, p, tr, cg );
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:69,代码来源:qtoolbox.cpp


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