コード例 #1
0
ファイル: xadview.cpp プロジェクト: kaarthiks/xad-qt
XADDoc *XADView::getDocument() const
{
    XADApp *theApp=(XADApp *) parentWidget();

    return theApp->getDocument();
}
コード例 #2
0
/** 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 ;
  }

  matrix_start_x = 5 + MATRIX_START_X + peer_name_size ;

  // now draw the service names

  i=0 ;
  std::vector<int> last_width(10,0) ;

  for(std::map<uint32_t, RsServiceInfo>::const_iterator it(ownServices.mServiceList.begin());it!=ownServices.mServiceList.end();++it,++i)
  {
      QString name = QString::fromUtf8(it->second.mServiceName.c_str()) ;
      int text_width = fm.width(name) ;

      int X = matrix_start_x + COL_SIZE/2 - 2 + i*COL_SIZE - text_width/2;

      int height_index = 0 ;
      while(last_width[height_index] > X-5 && height_index < last_width.size()-1)
          ++height_index ;

      int Y = MATRIX_START_Y - ICON_SIZE_Y - 2 - line_height * height_index;

      last_width[height_index] = X + text_width ;
       // draw a half-transparent rectangle

      QBrush brush ;
      brush.setColor(QColor::fromHsvF(0.0f,0.0f,1.0f,0.8f));
      brush.setStyle(Qt::SolidPattern) ;

      QPen pen ;
      pen.setWidth(2) ;

      if(_current_service_id == it->second.mServiceType)
          pen.setBrush(Qt::black) ;
      else
          pen.setBrush(Qt::gray) ;

      _painter->setPen(pen) ;

      QRect info_pos( X-5,Y-line_height-2, text_width + 10, line_height + 5) ;

      //_painter->fillRect(info_pos,brush) ;
      //_painter->drawRect(info_pos) ;

      _painter->drawLine(QPointF(X,Y+3),QPointF(X+text_width,Y+3)) ;
      _painter->drawLine(QPointF(X+text_width/2, Y+3), QPointF(X+text_width/2,MATRIX_START_Y+peer_ids.size()*ROW_SIZE - ROW_SIZE+5)) ;

      pen.setBrush(Qt::black) ;
      _painter->setPen(pen) ;

      _painter->drawText(QPointF(X,Y),name);
  }

  // Now draw the global switches.

  peer_ids.clear() ;
  for(std::list<RsPeerId>::const_iterator it(ssllist.begin());it!=ssllist.end();++it)
      peer_ids.push_back(*it) ;
  service_ids.clear() ;
  for(std::map<uint32_t, RsServiceInfo>::const_iterator sit(ownServices.mServiceList.begin());sit!=ownServices.mServiceList.end();++sit)
      service_ids.push_back(sit->first) ;

  static const std::string global_switch[2] = { ":/images/global_switch_off.png",
                                                ":/images/global_switch_on.png" } ;

  for(int i=0;i<service_ids.size();++i)
  {
      RsServicePermissions serv_perm ;
      rsServiceControl->getServicePermissions(service_ids[i],serv_perm) ;

      QPixmap pix(global_switch[serv_perm.mDefaultAllowed].c_str()) ;
      QRect position = computeNodePosition(0,i,false) ;

      position.setY(position.y() - ICON_SIZE_Y + 8) ;
      position.setX(position.x() + 3) ;
      position.setHeight(30) ;
      position.setWidth(30) ;

      _painter->drawPixmap(position,pix,QRect(0,0,30,30)) ;
  }

  // We draw for each service.

  static const std::string pixmap_names[4] = { ":/images/switch00.png",
                                               ":/images/switch01.png",
                                               ":/images/switch10.png",
                                               ":/images/switch11.png" } ;

  int n_col = 0 ;
  int n_col_selected = -1 ;
  int n_row_selected = -1 ;

  for(std::map<uint32_t, RsServiceInfo>::const_iterator sit(ownServices.mServiceList.begin());sit!=ownServices.mServiceList.end();++sit,++n_col)
  {
      RsServicePermissions service_perms ;

      rsServiceControl->getServicePermissions(sit->first,service_perms) ;

      // draw the default switch.


      // draw one switch per friend.

      int n_row = 0 ;

      for(std::list<RsPeerId>::const_iterator it(ssllist.begin());it!=ssllist.end();++it,++n_row)
      {
          RsPeerServiceInfo local_service_perms ;
          RsPeerServiceInfo remote_service_perms ;

          rsServiceControl->getServicesAllowed (*it, local_service_perms) ;
          rsServiceControl->getServicesProvided(*it,remote_service_perms) ;

          bool  local_allowed =  local_service_perms.mServiceList.find(sit->first) !=  local_service_perms.mServiceList.end() ;
          bool remote_allowed = remote_service_perms.mServiceList.find(sit->first) != remote_service_perms.mServiceList.end() ;

      QPixmap pix(pixmap_names[(local_allowed << 1) + remote_allowed].c_str()) ;

      bool selected = (sit->first == _current_service_id && *it == _current_peer_id) ;
      QRect position = computeNodePosition(n_row,n_col,selected) ;

      if(selected)
      {
          n_row_selected = n_row ;
          n_col_selected = n_col ;
      }
          _painter->drawPixmap(position,pix,QRect(0,0,ICON_SIZE_X,ICON_SIZE_Y)) ;
      }
  }

  // now display some info about current node.

  if(n_row_selected < peer_ids.size() && n_col_selected < service_ids.size())
  {
      QRect position = computeNodePosition(n_row_selected,n_col_selected,false) ;

      // draw text info

      RsServicePermissions service_perms ;

      rsServiceControl->getServicePermissions(service_ids[n_col_selected],service_perms) ;

      QString service_name    = tr("Service name:")+" "+QString::fromUtf8(service_perms.mServiceName.c_str()) ;
      QString service_default = service_perms.mDefaultAllowed?tr("Allowed by default"):tr("Denied by default");
      QString peer_name = tr("Peer name:")+" " + names[n_row_selected] ;
      QString peer_id = tr("Peer Id:")+" "+QString::fromStdString(_current_peer_id.toStdString()) ;

      RsPeerServiceInfo pserv_info ;
      rsServiceControl->getServicesAllowed(_current_peer_id,pserv_info) ;

      bool locally_allowed = pserv_info.mServiceList.find(_current_service_id) != pserv_info.mServiceList.end();
      bool remotely_allowed = false ; // default, if the peer is offline

      if(rsServiceControl->getServicesProvided(_current_peer_id,pserv_info))
          remotely_allowed = pserv_info.mServiceList.find(_current_service_id) != pserv_info.mServiceList.end();

      QString local_status  = locally_allowed ?tr("Enabled for this peer") :tr("Disabled for this peer") ;
      QString remote_status = remotely_allowed?tr("Enabled by remote peer"):tr("Disabled by remote peer") ;

      if(!service_perms.mDefaultAllowed)
          local_status = tr("Switched Off") ;

      const QFont& font(_painter->font()) ;
      QFontMetrics fm(font);

      int text_size_x = 0 ;
      text_size_x = std::max(text_size_x,fm.width(service_name));
      text_size_x = std::max(text_size_x,fm.width(peer_name));
      text_size_x = std::max(text_size_x,fm.width(peer_id));
      text_size_x = std::max(text_size_x,fm.width(local_status));
      text_size_x = std::max(text_size_x,fm.width(remote_status));

       // draw a half-transparent rectangle

      QBrush brush ;
      brush.setColor(QColor::fromHsvF(0.0f,0.0f,1.0f,0.8f));
      brush.setStyle(Qt::SolidPattern) ;

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

      _painter->setPen(pen) ;

      QRect info_pos( position.x() + 50, position.y() - 10, text_size_x + 10, line_height * 5 + 5) ;

      _painter->fillRect(info_pos,brush) ;
      _painter->drawRect(info_pos) ;

      // draw the text

      float x = info_pos.x() + 5 ;
      float y = info_pos.y() + line_height + 1 ;

      _painter->drawText(QPointF(x,y), service_name)  ; y += line_height ;
      _painter->drawText(QPointF(x,y), peer_name)     ; y += line_height ;
      _painter->drawText(QPointF(x,y), peer_id)       ; y += line_height ;
      _painter->drawText(QPointF(x,y), remote_status) ; y += line_height ;
      _painter->drawText(QPointF(x,y), local_status)  ; y += line_height ;
  }

  _max_height = MATRIX_START_Y + (peer_ids.size()+3) * ROW_SIZE ;
  _max_width  = matrix_start_x + (service_ids.size()+3) * COL_SIZE ;

  /* Stop the painter */
  _painter->end();
}
コード例 #3
0
ファイル: MiniMap.cpp プロジェクト: JurajKubelka/Envision
void MiniMap::updatePosition()
{
	QGraphicsView* parent = static_cast<QGraphicsView*> (parentWidget());

	move(0,parent->viewport()->height() - height() + 2*frameWidth());
}
コード例 #4
0
void KoDockWidgetTitleBar::setCollapsed(bool collapsed)
{
    QDockWidget *q = qobject_cast<QDockWidget*>(parentWidget());
    if (q && q->widget() && q->widget()->isHidden() != collapsed)
        d->toggleCollapsed();
}
コード例 #5
0
ファイル: scrollarea.cpp プロジェクト: 4ker/tdesktop
ScrollArea *ScrollBar::area() {
	return static_cast<ScrollArea*>(parentWidget());
}
コード例 #6
0
/* Mini-toolbar constructor */
VBoxMiniToolBar::VBoxMiniToolBar(QWidget *pParent, Alignment alignment, bool fActive, bool fAutoHide)
    : UIToolBar(pParent)
    , m_pAutoHideAction(0)
    , m_pDisplayLabel(0)
    , m_pMinimizeAction(0)
    , m_pRestoreAction(0)
    , m_pCloseAction(0)
    , m_fActive(fActive)
    , m_fPolished(false)
    , m_fSeamless(false)
    , m_fAutoHide(fAutoHide)
    , m_fSlideToScreen(true)
    , m_fHideAfterSlide(false)
    , m_iAutoHideCounter(0)
    , m_iPositionX(0)
    , m_iPositionY(0)
    , m_pInsertPosition(0)
    , m_alignment(alignment)
    , m_fAnimated(true)
    , m_iScrollDelay(10)
    , m_iAutoScrollDelay(100)
    , m_iAutoHideTotalCounter(10)
{
    /* Check parent widget presence: */
    AssertMsg(parentWidget(), ("Parent widget must be set!\n"));

    /* Toolbar options: */
    setIconSize(QSize(16, 16));
    setVisible(false);

    /* Add pushpin: */
    m_pAutoHideAction = new QAction(this);
    m_pAutoHideAction->setIcon(UIIconPool::iconSet(":/pin_16px.png"));
    m_pAutoHideAction->setToolTip(tr("Always show the toolbar"));
    m_pAutoHideAction->setCheckable(true);
    m_pAutoHideAction->setChecked(!m_fAutoHide);
    connect(m_pAutoHideAction, SIGNAL(toggled(bool)), this, SLOT(togglePushpin(bool)));
    addAction(m_pAutoHideAction);

    /* Left menu margin: */
    m_Spacings << widgetForAction(addWidget(new QWidget(this)));

    /* Right menu margin: */
    m_pInsertPosition = addWidget(new QWidget(this));
    m_Spacings << widgetForAction(m_pInsertPosition);

    /* Left label margin: */
    m_LabelMargins << widgetForAction(addWidget(new QWidget(this)));

    /* Insert a label for VM Name: */
    m_pDisplayLabel = new QLabel(this);
    m_pDisplayLabel->setAlignment(Qt::AlignCenter);
    addWidget(m_pDisplayLabel);

    /* Right label margin: */
    m_LabelMargins << widgetForAction(addWidget(new QWidget(this)));

    /* Minimize action: */
    m_pMinimizeAction = new QAction(this);
    m_pMinimizeAction->setIcon(UIIconPool::iconSet(":/minimize_16px.png"));
    m_pMinimizeAction->setToolTip(tr("Minimize Window"));
    connect(m_pMinimizeAction, SIGNAL(triggered()), this, SIGNAL(minimizeAction()));
    addAction(m_pMinimizeAction);

    /* Exit action: */
    m_pRestoreAction = new QAction(this);
    m_pRestoreAction->setIcon(UIIconPool::iconSet(":/restore_16px.png"));
    m_pRestoreAction->setToolTip(tr("Exit Full Screen or Seamless Mode"));
    connect(m_pRestoreAction, SIGNAL(triggered()), this, SIGNAL(exitAction()));
    addAction(m_pRestoreAction);

    /* Close action: */
    m_pCloseAction = new QAction(this);
    m_pCloseAction->setIcon(UIIconPool::iconSet(":/close_16px.png"));
    m_pCloseAction->setToolTip(tr("Close VM"));
    connect(m_pCloseAction, SIGNAL(triggered()), this, SIGNAL(closeAction()));
    addAction(m_pCloseAction);

    /* Event-filter for parent widget to control resize: */
    pParent->installEventFilter(this);

    /* Enable mouse-tracking for this & children allowing to get mouse-move events: */
    setMouseTrackingEnabled(m_fAutoHide);
}
コード例 #7
0
void ShutterFunctionDialog::closeEvent(QCloseEvent *e)
{
    m_project->nodes()->segments()->unselectAll();
    parentWidget()->repaint();
    QDialog::closeEvent(e);
}
コード例 #8
0
bool QDockWidgetLayout::nativeWindowDeco() const
{
    return nativeWindowDeco(parentWidget()->isWindow());
}
コード例 #9
0
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);
}
コード例 #10
0
ファイル: q19writer.cpp プロジェクト: trifolio6/Bulmages
/**
\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
						{
							QString nomNou = fileName;
							QRegExp ext ( "(\\..*)$" );
							QString extensio ( "" );
							if ( ext.indexIn ( nomNou ) >=0 )
							{
								extensio = ext.cap ( 1 );
							}
							nomNou.replace ( ext,"" );
							nomNou+="_"+curbanc->value( "nombanco" ).replace ( QRegExp ( "[^a-zA-Z0-9_]" ),"-" )
							        +extensio;
							file.setFileName ( nomNou );
							BlDebug::blDebug ( "creare' el nom que m'he muntat: ",0,fileName );
						}
						if ( !file.open ( QIODevice::WriteOnly | QIODevice::Text ) )
							return;
						cabeceraPresentador ( out, sufijo , curbanc );
						cobramentsPresentador=0;
						registrosPresentador=1;
						impPresentador=0;
						ordenants=0;
						fechaCargo=QDate::fromString ( curcobro->value( "fechavenccobro" ),"dd/MM/yyyy" ) ;
					}
					if ( ( QDate::fromString ( curcobro->value( "fechavenccobro" ),"dd/MM/yyyy" ) != fechaCargo ) || ( registrosPresentador==1 ) )
					{
						fechaCargo = QDate::fromString ( curcobro->value( "fechavenccobro" ),"dd/MM/yyyy" );
						registrosPresentador++;
						cabeceraOrdenante ( out, sufijo , curbanc, fechaCargo );
						cobramentsOrdenante=0;
						registrosOrdenante=1;
						impOrdenante=0;
					}

					refActual=curcobro->value( "refcobro" );
					int registres = cobroQ19 ( out, sufijo, curcobro );
                                        if (idsGenerats) 
                                        { 
                                           idsGenerats->append(curcobro->value("idcobro"));
                                        }
					registrosOrdenante+=registres;
					registrosPresentador+=registres;
					cobramentsOrdenante++;
					cobramentsPresentador++;
					impOrdenante=impOrdenante+BlFixed ( curcobro->value( "cantcobro" ) );
					impPresentador=impPresentador+BlFixed ( curcobro->value( "cantcobro" ) );
				}
				else
				{
					sensebanc++;
				}
			}
			else
			{
				sensevenc++;
			}
			curcobro->nextRecord();
		}
		if ( file.handle() !=-1 )
		{
			registrosPresentador++;
			registrosOrdenante++;
			totalOrdenante ( out, sufijo , curbanc, impOrdenante, cobramentsOrdenante, registrosOrdenante );
			ordenants++;
						
			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;

		}
		if ( ( sensevenc>0 ) || ( sensebanc>0 ) )
		{
			QMessageBox::warning ( parentWidget(),_ ( "Remesa parcialmente generada" ),
			                       _ ( "Excluidos %3 de %2 recibos por falta de fecha de vencimiento y otros %1 por falta de banco" ).arg ( sensebanc ).arg ( cobraments ).arg ( sensevenc ) );
		}
		QMessageBox::information ( parentWidget(),_ ( "Fichero(s) generado(s)" ),_ ( "Tiene los siguientes ficheros de recibos para los bancos:\n%1" ).arg ( resultats ) );
	}
	catch ( QString e )
	{
		BlDebug::blDebug ( "Error ",0,refActual+":"+e );
		QMessageBox::critical ( parentWidget(),_ ( "Remesa mal generada" ),_( "%2\n.El fichero de remesa bancaria generado no es aprovechable. Ha fallado la generacion en el recibo con referencia %1" ).arg ( refActual ).arg ( e ) );
                if (idsGenerats) 
                {
                     idsGenerats->clear();
                }
	}
      }
	
}
コード例 #11
0
/*! \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);
}
コード例 #12
0
void Adding::OnCancel()
{
    this->close();
    parentWidget()->close();
}
コード例 #13
0
ファイル: StatusBar.cpp プロジェクト: johnbolia/schat
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
}
コード例 #14
0
ファイル: overlay.cpp プロジェクト: EldFitheach/Mudlet
void Overlay::relayout()
{
    resize(parentWidget()->size());
    if (d.button)
        d.button->move(rect().center() - d.button->rect().center());
}
コード例 #15
0
QWidget* GroupIndicatorOverlay::createWidget()
{
    QAbstractButton* const button = new GroupIndicatorOverlayWidget(parentWidget());
    button->setCursor(Qt::PointingHandCursor);
    return button;
}
コード例 #16
0
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);
        }
    }
}
コード例 #17
0
/* Timer event processor
 * Handles auto hide feature of the toolbar */
void VBoxMiniToolBar::timerEvent(QTimerEvent *pEvent)
{
    if (pEvent->timerId() == m_scrollTimer.timerId())
    {
        /* Due to X11 async nature, this timer-event could come before parent
         * VM window become visible, we should ignore those timer-events: */
        if (QApplication::desktop()->screenNumber(window()) == -1)
            return;

        /* Update tool-bar position: */
        QRect screen = m_fSeamless ? vboxGlobal().availableGeometry(QApplication::desktop()->screenNumber(window())) :
                                     QApplication::desktop()->screenGeometry(window());
        switch (m_alignment)
        {
            case AlignTop:
            {
                if (((m_iPositionY == screen.y()) && m_fSlideToScreen) ||
                    ((m_iPositionY == screen.y() - height() + 1) && !m_fSlideToScreen))
                {
                    m_scrollTimer.stop();
                    if (m_fHideAfterSlide)
                    {
                        m_fHideAfterSlide = false;
                        hide();
                    }
                    return;
                }
                m_fSlideToScreen ? ++m_iPositionY : --m_iPositionY;
                break;
            }
            case AlignBottom:
            {
                if (((m_iPositionY == screen.y() + screen.height() - height()) && m_fSlideToScreen) ||
                    ((m_iPositionY == screen.y() + screen.height() - 1) && !m_fSlideToScreen))
                {
                    m_scrollTimer.stop();
                    if (m_fHideAfterSlide)
                    {
                        m_fHideAfterSlide = false;
                        hide();
                    }
                    return;
                }
                m_fSlideToScreen ? --m_iPositionY : ++m_iPositionY;
                break;
            }
            default:
                break;
        }
        move(parentWidget()->mapFromGlobal(QPoint(m_iPositionX, m_iPositionY)));
        emit geometryUpdated();
    }
    else if (pEvent->timerId() == m_autoScrollTimer.timerId())
    {
        QRect rect = this->rect();
        QPoint p = mapFromGlobal(QCursor::pos());
        if (!rect.contains(p))
        {
            ++m_iAutoHideCounter;

            if (m_iAutoHideCounter == m_iAutoHideTotalCounter)
            {
                m_fSlideToScreen = false;
                m_scrollTimer.start(m_iScrollDelay, this);
            }
        }
        else
            m_iAutoHideCounter = 0;
    }
    else
        QWidget::timerEvent(pEvent);
}
コード例 #18
0
ファイル: qtoolbox.cpp プロジェクト: AliYousuf/abanq-port
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 );
}
コード例 #19
0
ファイル: kfwin.cpp プロジェクト: Fat-Zer/tdebase
void KfindWindow::saveResults()
{
  TQListViewItem *item;

  KFileDialog *dlg = new KFileDialog(TQString::null, TQString::null, this,
	"filedialog", true);
  dlg->setOperationMode (KFileDialog::Saving);

  dlg->setCaption(i18n("Save Results As"));

  TQStringList list;

  list << "text/plain" << "text/html";

  dlg->setOperationMode(KFileDialog::Saving);
  
  dlg->setMimeFilter(list, TQString("text/plain"));

  dlg->exec();

  KURL u = dlg->selectedURL();
  KMimeType::Ptr mimeType = dlg->currentFilterMimeType();
  delete dlg;

  if (!u.isValid() || !u.isLocalFile())
     return;

  TQString filename = u.path();

  TQFile file(filename);

  if ( !file.open(IO_WriteOnly) )
    KMessageBox::error(parentWidget(),
		       i18n("Unable to save results."));
  else {
    TQTextStream stream( &file );
    stream.setEncoding( TQTextStream::Locale );

    if ( mimeType->name() == "text/html") {
      stream << TQString::fromLatin1("<HTML><HEAD>\n"
				    "<!DOCTYPE %1>\n"
				    "<TITLE>%2</TITLE></HEAD>\n"
				    "<BODY><H1>%3</H1>"
				    "<DL><p>\n")
	.arg(i18n("KFind Results File"))
	.arg(i18n("KFind Results File"))
	.arg(i18n("KFind Results File"));

      item = firstChild();
      while(item != NULL)
	{
	  TQString path=((KfFileLVI*)item)->fileitem.url().url();
	  TQString pretty=((KfFileLVI*)item)->fileitem.url().htmlURL();
	  stream << TQString::fromLatin1("<DT><A HREF=\"") << path
		 << TQString::fromLatin1("\">") << pretty
		 << TQString::fromLatin1("</A>\n");

	  item = item->nextSibling();
	}
      stream << TQString::fromLatin1("</DL><P></BODY></HTML>\n");
    }
    else {
      item = firstChild();
      while(item != NULL)
      {
	TQString path=((KfFileLVI*)item)->fileitem.url().url();
	stream << path << endl;
	item = item->nextSibling();
      }
    }

    file.close();
    KMessageBox::information(parentWidget(),
			     i18n("Results were saved to file\n")+
			     filename);
  }
}
コード例 #20
0
ファイル: analyzerpanel.cpp プロジェクト: wyuka/rekonq
MainWindow* NetworkAnalyzerPanel::mainWindow()
{
    return qobject_cast<MainWindow *>(parentWidget());
}
コード例 #21
0
ファイル: tpg-tab.cpp プロジェクト: Distrotech/v4l-utils
void ApplicationWindow::addTpgTab(int m_winWidth)
{
	QWidget *t = new QWidget(m_tabs);
	QVBoxLayout *vbox = new QVBoxLayout(t);
	QWidget *w = new QWidget(t);
	QCheckBox *check;
	QComboBox *combo;
	QSpinBox *spin;

	m_col = m_row = 0;
	m_cols = 4;
	for (int j = 0; j < m_cols; j++) {
		m_maxw[j] = 0;
	}

	vbox->addWidget(w);

	QGridLayout *grid = new QGridLayout(w);
	QLabel *title_tab = new QLabel("Test Pattern Generator", parentWidget());
	QFont f = title_tab->font();
	f.setBold(true);
	title_tab->setFont(f);
	grid->addWidget(title_tab, m_row, m_col, 1, m_cols, Qt::AlignLeft);
	grid->setRowMinimumHeight(m_row, 25);
	m_row++;

	QFrame *m_line = new QFrame(grid->parentWidget());
	m_line->setFrameShape(QFrame::HLine);
	m_line->setFrameShadow(QFrame::Sunken);
	grid->addWidget(m_line, m_row, m_col, 1, m_cols, Qt::AlignVCenter);
	m_row++;

	m_tabs->addTab(t, "Test Pattern Generator");
	grid->addWidget(new QWidget(w), grid->rowCount(), 0, 1, m_cols);

	addLabel(grid, "Test Pattern");
	combo = new QComboBox(w);
	for (int i = 0; tpg_pattern_strings[i]; i++)
		combo->addItem(tpg_pattern_strings[i]);
	addWidget(grid, combo);
	connect(combo, SIGNAL(activated(int)), SLOT(testPatternChanged(int)));

	m_row++;
	m_col = 0;

	addLabel(grid, "Horizontal Movement");
	combo = new QComboBox(w);
	combo->addItem("Move Left Fast");
	combo->addItem("Move Left");
	combo->addItem("Move Left Slow");
	combo->addItem("No Movement");
	combo->addItem("Move Right Slow");
	combo->addItem("Move Right");
	combo->addItem("Move Right Fast");
	combo->setCurrentIndex(3);
	addWidget(grid, combo);
	connect(combo, SIGNAL(activated(int)), SLOT(horMovementChanged(int)));

	addLabel(grid, "Video Aspect Ratio");
	combo = new QComboBox(w);
	combo->addItem("Source Width x Height");
	combo->addItem("4x3");
	combo->addItem("14x9");
	combo->addItem("16x9");
	combo->addItem("16x9 Anamorphic");
	addWidget(grid, combo);
	connect(combo, SIGNAL(activated(int)), SLOT(videoAspectRatioChanged(int)));

	addLabel(grid, "Vertical Movement");
	combo = new QComboBox(w);
	combo->addItem("Move Up Fast");
	combo->addItem("Move Up");
	combo->addItem("Move Up Slow");
	combo->addItem("No Movement");
	combo->addItem("Move Down Slow");
	combo->addItem("Move Down");
	combo->addItem("Move Down Fast");
	combo->setCurrentIndex(3);
	addWidget(grid, combo);
	connect(combo, SIGNAL(activated(int)), SLOT(vertMovementChanged(int)));

	addLabel(grid, "Show Border");
	check = new QCheckBox(w);
	addWidget(grid, check);
	connect(check, SIGNAL(stateChanged(int)), SLOT(showBorderChanged(int)));

	addLabel(grid, "Insert SAV Code in Image");
	check = new QCheckBox(w);
	addWidget(grid, check);
	connect(check, SIGNAL(stateChanged(int)), SLOT(insSAVChanged(int)));

	addLabel(grid, "Show Square");
	check = new QCheckBox(w);
	addWidget(grid, check);
	connect(check, SIGNAL(stateChanged(int)), SLOT(showSquareChanged(int)));

	addLabel(grid, "Insert EAV Code in Image");
	check = new QCheckBox(w);
	addWidget(grid, check);
	connect(check, SIGNAL(stateChanged(int)), SLOT(insEAVChanged(int)));

	addLabel(grid, "Fill Percentage of Frame");
	spin = new QSpinBox(w);
	spin->setRange(0, 100);
	spin->setValue(100);
	addWidget(grid, spin);
	connect(spin, SIGNAL(valueChanged(int)), SLOT(fillPercentageChanged(int)));

	addLabel(grid, "Colorspace");
	m_tpgColorspace = new QComboBox(w);
	m_tpgColorspace->addItem("Use Format", QVariant(0));
	m_tpgColorspace->addItem("SMPTE 170M", QVariant(V4L2_COLORSPACE_SMPTE170M));
	m_tpgColorspace->addItem("Rec. 709", QVariant(V4L2_COLORSPACE_REC709));
	m_tpgColorspace->addItem("sRGB", QVariant(V4L2_COLORSPACE_SRGB));
	m_tpgColorspace->addItem("Adobe RGB", QVariant(V4L2_COLORSPACE_ADOBERGB));
	m_tpgColorspace->addItem("BT.2020", QVariant(V4L2_COLORSPACE_BT2020));
	m_tpgColorspace->addItem("DCI-P3", QVariant(V4L2_COLORSPACE_DCI_P3));
	m_tpgColorspace->addItem("SMPTE 240M", QVariant(V4L2_COLORSPACE_SMPTE240M));
	m_tpgColorspace->addItem("470 System M", QVariant(V4L2_COLORSPACE_470_SYSTEM_M));
	m_tpgColorspace->addItem("470 System BG", QVariant(V4L2_COLORSPACE_470_SYSTEM_BG));
	addWidget(grid, m_tpgColorspace);
	connect(m_tpgColorspace, SIGNAL(activated(int)), SLOT(tpgColorspaceChanged()));

	addLabel(grid, "Transfer Function");
	m_tpgXferFunc = new QComboBox(w);
	m_tpgXferFunc->addItem("Use Format", QVariant(V4L2_XFER_FUNC_DEFAULT));
	m_tpgXferFunc->addItem("Rec. 709", QVariant(V4L2_XFER_FUNC_709));
	m_tpgXferFunc->addItem("sRGB", QVariant(V4L2_XFER_FUNC_SRGB));
	m_tpgXferFunc->addItem("Adobe RGB", QVariant(V4L2_XFER_FUNC_ADOBERGB));
	m_tpgXferFunc->addItem("DCI-P3", QVariant(V4L2_XFER_FUNC_DCI_P3));
	m_tpgXferFunc->addItem("SMPTE 2084", QVariant(V4L2_XFER_FUNC_SMPTE2084));
	m_tpgXferFunc->addItem("SMPTE 240M", QVariant(V4L2_XFER_FUNC_SMPTE240M));
	m_tpgXferFunc->addItem("None", QVariant(V4L2_XFER_FUNC_NONE));
	addWidget(grid, m_tpgXferFunc);
	connect(m_tpgXferFunc, SIGNAL(activated(int)), SLOT(tpgXferFuncChanged()));

	addLabel(grid, "Y'CbCr Encoding");
	m_tpgYCbCrEnc = new QComboBox(w);
	m_tpgYCbCrEnc->addItem("Use Format", QVariant(V4L2_YCBCR_ENC_DEFAULT));
	m_tpgYCbCrEnc->addItem("ITU-R 601", QVariant(V4L2_YCBCR_ENC_601));
	m_tpgYCbCrEnc->addItem("Rec. 709", QVariant(V4L2_YCBCR_ENC_709));
	m_tpgYCbCrEnc->addItem("xvYCC 601", QVariant(V4L2_YCBCR_ENC_XV601));
	m_tpgYCbCrEnc->addItem("xvYCC 709", QVariant(V4L2_YCBCR_ENC_XV709));
	m_tpgYCbCrEnc->addItem("sYCC", QVariant(V4L2_YCBCR_ENC_SYCC));
	m_tpgYCbCrEnc->addItem("BT.2020", QVariant(V4L2_YCBCR_ENC_BT2020));
	m_tpgYCbCrEnc->addItem("BT.2020 Constant Luminance", QVariant(V4L2_YCBCR_ENC_BT2020_CONST_LUM));
	m_tpgYCbCrEnc->addItem("SMPTE 240M", QVariant(V4L2_YCBCR_ENC_SMPTE240M));
	addWidget(grid, m_tpgYCbCrEnc);
	connect(m_tpgYCbCrEnc, SIGNAL(activated(int)), SLOT(tpgColorspaceChanged()));

	addLabel(grid, "Quantization");
	m_tpgQuantRange = new QComboBox(w);
	m_tpgQuantRange->addItem("Use Format", QVariant(V4L2_QUANTIZATION_DEFAULT));
	m_tpgQuantRange->addItem("Full Range", QVariant(V4L2_QUANTIZATION_FULL_RANGE));
	m_tpgQuantRange->addItem("Limited Range", QVariant(V4L2_QUANTIZATION_LIM_RANGE));
	addWidget(grid, m_tpgQuantRange);
	connect(m_tpgQuantRange, SIGNAL(activated(int)), SLOT(tpgColorspaceChanged()));

	addLabel(grid, "Limited RGB Range (16-235)");
	m_tpgLimRGBRange = new QCheckBox(w);
	addWidget(grid, m_tpgLimRGBRange);
	connect(m_tpgLimRGBRange, SIGNAL(stateChanged(int)), SLOT(limRGBRangeChanged(int)));

	addLabel(grid, "Alpha Component");
	spin = new QSpinBox(w);
	spin->setRange(0, 255);
	spin->setValue(0);
	addWidget(grid, spin);
	connect(spin, SIGNAL(valueChanged(int)), SLOT(alphaComponentChanged(int)));

	addLabel(grid, "Apply Alpha To Red Only");
	check = new QCheckBox(w);
	addWidget(grid, check);
	connect(check, SIGNAL(stateChanged(int)), SLOT(applyToRedChanged(int)));

	m_row++;
	m_col = 0;
	addWidget(grid, new QWidget(w));
	grid->setRowStretch(grid->rowCount() - 1, 1);
	w = new QWidget(t);
	vbox->addWidget(w);
	fixWidth(grid);

	int totalw = 0;
	int diff = 0;
	for (int i = 0; i < m_cols; i++) {
		totalw += m_maxw[i] + m_pxw;
	}
	if (totalw > m_winWidth)
		m_winWidth = totalw;
	else {
		diff = m_winWidth - totalw;
		grid->setHorizontalSpacing(diff/5);
	}
}
コード例 #22
0
ファイル: titlebar.cpp プロジェクト: evgeny/psi
void TitleBar::showSmall()
{
    parentWidget()->parentWidget()->showMinimized();
}
コード例 #23
0
ファイル: QIMainDialog.cpp プロジェクト: miguelinux/vbox
void QIMainDialog::polishEvent(QShowEvent*)
{
    /* Explicit centering according to our parent: */
    if (m_fIsAutoCentering)
        VBoxGlobal::centerWidget(this, parentWidget(), false);
}
コード例 #24
0
ファイル: titlebar.cpp プロジェクト: evgeny/psi
void TitleBar::mouseMoveEvent(QMouseEvent *me)
{
    if (maxNormal)
        return;
    parentWidget()->parentWidget()->move(me->globalPos() - clickPos);
}
コード例 #25
0
ファイル: title.cpp プロジェクト: NXij/tdesktop-dark
void TitleHider::mousePressEvent(QMouseEvent *e) {
	if (e->button() == Qt::LeftButton) {
		emit static_cast<TitleWidget*>(parentWidget())->hiderClicked();
	}
}
コード例 #26
0
ThumbnailsPanel::ThumbnailsPanel(QWidget* parent) : QWidget(parent)
{
    m_thumbnailsList.clear();
    m_scrollArea = dynamic_cast<QScrollArea*>(parentWidget());
    m_attachedCB = 0;
}
コード例 #27
0
ファイル: q3titlebar.cpp プロジェクト: stephaneAG/PengPod700
void Q3TitleBar::mouseMoveEvent(QMouseEvent *e)
{
    Q_D(Q3TitleBar);
    e->accept();
    switch (d->buttonDown) {
    case QStyle::SC_None:
        if(autoRaise())
            repaint();
        break;
    case QStyle::SC_TitleBarSysMenu:
        break;
    case QStyle::SC_TitleBarShadeButton:
    case QStyle::SC_TitleBarUnshadeButton:
    case QStyle::SC_TitleBarNormalButton:
    case QStyle::SC_TitleBarMinButton:
    case QStyle::SC_TitleBarMaxButton:
    case QStyle::SC_TitleBarCloseButton:
        {
            QStyle::SubControl last_ctrl = d->buttonDown;
            QStyleOptionTitleBar opt = d->getStyleOption();
            d->buttonDown = style()->hitTestComplexControl(QStyle::CC_TitleBar, &opt, e->pos(), this);
            if (d->buttonDown != last_ctrl)
                d->buttonDown = QStyle::SC_None;
            repaint();
            d->buttonDown = last_ctrl;
        }
        break;

    case QStyle::SC_TitleBarLabel:
        if (d->buttonDown == QStyle::SC_TitleBarLabel && d->movable && d->pressed) {
            if ((d->moveOffset - mapToParent(e->pos())).manhattanLength() >= 4) {
                QPoint p = mapFromGlobal(e->globalPos());

                QWidget *parent = d->window ? d->window->parentWidget() : 0;
                if(parent && parent->inherits("Q3WorkspaceChild")) {
                    QWidget *workspace = parent->parentWidget();
                    p = workspace->mapFromGlobal(e->globalPos());
                    if (!workspace->rect().contains(p)) {
                        if (p.x() < 0)
                            p.rx() = 0;
                        if (p.y() < 0)
                            p.ry() = 0;
                        if (p.x() > workspace->width())
                            p.rx() = workspace->width();
                        if (p.y() > workspace->height())
                            p.ry() = workspace->height();
                    }
                }

                QPoint pp = p - d->moveOffset;
                if (!parentWidget()->isMaximized())
                    parentWidget()->move(pp);
            }
        } else {
            QStyle::SubControl last_ctrl = d->buttonDown;
            d->buttonDown = QStyle::SC_None;
            if(d->buttonDown != last_ctrl)
                repaint();
        }
        break;
    default:
        break;
    }
}
コード例 #28
0
/* public slots */
QDomDocument Spice_Graphics::getDataDocument() const
{
    QDomDocument doc;
    QDomElement _listen, _device, _devDesc;
    _device = doc.createElement("device");
    _devDesc = doc.createElement("graphics");
    _devDesc.setAttribute("type", "spice");
    if ( tlsPortLabel->isChecked() )
        _devDesc.setAttribute("tlsPort", tlsPort->text());
    _devDesc.setAttribute("defaultPolicy", defaultPolicy->currentText());
    if ( autoPort->isChecked() ) {
        _devDesc.setAttribute("autoport", "yes");
    } else {
        _devDesc.setAttribute("port", port->text());
    };
    if ( usePassw->isChecked() ) {
        _devDesc.setAttribute("passwd", passw->text());
        _devDesc.setAttribute("keymap", keymap->currentText());
    };
    if ( policyElements->isVisibleTo(parentWidget()) ) {
        if ( mainLabel->isChecked() ) {
            QDomElement _main = doc.createElement("channel");
            _main.setAttribute("name", "main");
            _main.setAttribute("mode", main->currentText());
            _devDesc.appendChild(_main);
        };
        if ( displayLabel->isChecked() ) {
            QDomElement _display = doc.createElement("channel");
            _display.setAttribute("name", "display");
            _display.setAttribute("mode", display->currentText());
            _devDesc.appendChild(_display);
        };
        if ( inputsLabel->isChecked() ) {
            QDomElement _inputs = doc.createElement("channel");
            _inputs.setAttribute("name", "inputs");
            _inputs.setAttribute("mode", inputs->currentText());
            _devDesc.appendChild(_inputs);
        };
        if ( cursorLabel->isChecked() ) {
            QDomElement _cursor = doc.createElement("channel");
            _cursor.setAttribute("name", "cursor");
            _cursor.setAttribute("mode", cursor->currentText());
            _devDesc.appendChild(_cursor);
        };
        if ( playbackLabel->isChecked() ) {
            QDomElement _playback = doc.createElement("channel");
            _playback.setAttribute("name", "playback");
            _playback.setAttribute("mode", playback->currentText());
            _devDesc.appendChild(_playback);
        };
        if ( recordLabel->isChecked() ) {
            QDomElement _record = doc.createElement("channel");
            _record.setAttribute("name", "record");
            _record.setAttribute("mode", record->currentText());
            _devDesc.appendChild(_record);
        };
        if ( smartcardLabel->isChecked() ) {
            QDomElement _smartcard = doc.createElement("channel");
            _smartcard.setAttribute("name", "smartcard");
            _smartcard.setAttribute("mode", smartcard->currentText());
            _devDesc.appendChild(_smartcard);
        };
        if ( usbredirLabel->isChecked() ) {
            QDomElement _usbredir = doc.createElement("channel");
            _usbredir.setAttribute("name", "usbredir");
            _usbredir.setAttribute("mode", usbredir->currentText());
            _devDesc.appendChild(_usbredir);
        };
    };
    QString _address = address->itemData(
                address->currentIndex(), Qt::UserRole).toString();
    if ( !_address.isEmpty() && _address!="network" ) {
        _listen = doc.createElement("listen");
        _listen.setAttribute("type", "address");
        if ( _address!="custom" ) {
            _listen.setAttribute("address", _address);
            _devDesc.setAttribute("listen", _address);
        } else {
            _listen.setAttribute(
                        "address",
                        address->currentText());
            _devDesc.setAttribute(
                        "listen",
                        address->currentText());
        };
        _devDesc.appendChild(_listen);
    } else if ( _address=="network" && networks->count()>0 ) {
            _listen = doc.createElement("listen");
            _listen.setAttribute("type", "network");
            _listen.setAttribute("network", networks->currentText());
            _devDesc.appendChild(_listen);
    };
    if ( compress->isChecked() ) {
        if ( compressImage->isChecked() ) {
            QDomElement _image = doc.createElement("image");
            _image.setAttribute("compression", imageElement->currentText());
            _devDesc.appendChild(_image);
        };
        if ( compressJpeg->isChecked() ) {
            QDomElement _jpeg = doc.createElement("jpeg");
            _jpeg.setAttribute("compression", jpegElement->currentText());
            _devDesc.appendChild(_jpeg);
        };
        if ( compressZlib->isChecked() ) {
            QDomElement _zlib = doc.createElement("zlib");
            _zlib.setAttribute("compression", zlibElement->currentText());
            _devDesc.appendChild(_zlib);
        };
        if ( compressPlayback->isChecked() ) {
            QDomElement _playback = doc.createElement("playback");
            _playback.setAttribute("compression", playbackElement->currentText());
            _devDesc.appendChild(_playback);
        };
    };
    if ( addition->isChecked() ) {
        if ( streaming->isChecked() ) {
            QDomElement _streaming = doc.createElement("streaming");
            _streaming.setAttribute("mode", streamingElement->currentText());
            _devDesc.appendChild(_streaming);
        };
        if ( clipboard->isChecked() ) {
            QDomElement _clipboard = doc.createElement("clipboard");
            _clipboard.setAttribute("copypaste", clipboardElement->currentText());
            _devDesc.appendChild(_clipboard);
        };
        if ( mouse->isChecked() ) {
            QDomElement _mouse = doc.createElement("mouse");
            _mouse.setAttribute("mode", mouseElement->currentText());
            _devDesc.appendChild(_mouse);
        };
        if ( filetransfer->isChecked() ) {
            QDomElement _filetransfer = doc.createElement("filetransfer");
            _filetransfer.setAttribute("enable", filetransferElement->currentText());
            _devDesc.appendChild(_filetransfer);
        };
    };
    _device.appendChild(_devDesc);
    doc.appendChild(_device);
    return doc;
}
コード例 #29
0
ファイル: popupwebview.cpp プロジェクト: ragingsage/qupzilla
void PopupWebView::closeView()
{
    parentWidget()->close();
}
コード例 #30
0
ファイル: UBRightPalette.cpp プロジェクト: KubaO/Sankore-3.1
/**
 * \brief Update the maximum width
 */
void UBRightPalette::updateMaxWidth()
{
    setMaximumWidth((int)(parentWidget()->width() * 0.45));
    setMaximumHeight(parentWidget()->height());
    setMinimumHeight(parentWidget()->height());
}