Exemplo n.º 1
0
QToolButton* AppearanceDialog::selectButton(int width, int height, QString toolTip) {
    QToolButton* button = new QToolButton(this);
    button->setToolTip(toolTip);
    button->setToolButtonStyle(Qt::ToolButtonTextOnly);
    button->setMenu(new QMenu(button));
    button->setMinimumWidth(width);
    button->setMinimumHeight(height);

    return button;
}
Exemplo n.º 2
0
QToolButton* MainWindow::createToolButton(QIcon buttonIcon, QString buttonName) //初始化顶部按钮
{
    QToolButton* toolButton;
    toolButton = new QToolButton(this);
    toolButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    toolButton->setIcon(buttonIcon);
    toolButton->setIconSize(QSize(50,50));
    toolButton->setText(buttonName);
    toolButton->setMinimumWidth(65);
    toolButton->setAutoRaise(true);
    return toolButton;
}
Exemplo n.º 3
0
	QWidget * createWidget (QWidget * pParent)
	{
		QToolButton * pToolButton = new QToolButton(pParent);
		pToolButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
		pToolButton->setPopupMode(QToolButton::InstantPopup);
		pToolButton->setMinimumHeight(TOOLBAR_MIN_HEIGHT);
		pToolButton->setMinimumWidth(100);

		QMenu * pMenu = new QMenu(pToolButton);
		pMenu->addMenu(tr("Textured"));
		pMenu->addMenu(tr("Wireframe"));
		pMenu->addMenu(tr("Tex-Wir"));

		pToolButton->setMenu(pMenu);
		return pToolButton;
	}
Exemplo n.º 4
0
	QWidget * createWidget (QWidget * pParent)
	{
		QToolButton * pToolButton = new QToolButton(pParent);
		pToolButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
		pToolButton->setPopupMode(QToolButton::InstantPopup);
		pToolButton->setMinimumHeight(TOOLBAR_MIN_HEIGHT);
		pToolButton->setMinimumWidth(80);

		QMenu * pMenu = new QMenu(pToolButton);
		pMenu->addMenu(tr("RGB"));
		pMenu->addMenu(tr("Alpha"));
		pMenu->addMenu(tr("Overdraw"));
		pMenu->addMenu(tr("Mipmaps"));

		pToolButton->setMenu(pMenu);
		return pToolButton;
	}
Exemplo n.º 5
0
void DistroMesas::on_mui_nuevapantalla_clicked() {
            bool ok;
        QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
                                             tr("Nombre Pantalla:"), QLineEdit::Normal,
                                             "", &ok);
        if (ok && !text.isEmpty())
            	m_listapantallas.append(text);
	
	QToolButton *but = new QToolButton(this);
	but->setObjectName("p_" + text);
	but->setText(text);
	but->setCheckable(TRUE);
	but->setMinimumHeight(42);
	but->setMinimumWidth(42);
	mui_espaciopantallas->addWidget(but);
	connect(but, SIGNAL(clicked()), this, SLOT(cambiarPantalla()));
    repaint();
}
PFSViewMainWin::PFSViewMainWin(  float window_min, float window_max ):
  QMainWindow( 0 )
{
  currentFrame = frameList.end();
  
  QScrollArea *pfsViewArea = new PFSViewWidgetArea( this );
  
  pfsView = (PFSViewWidget*)pfsViewArea->widget();
  
  setCentralWidget( pfsViewArea );

  setWindowIcon( QIcon( ":icons/appicon.png" ) );

  QAction *nextFrameAct = new QAction( tr( "&Next frame" ), this );
  nextFrameAct->setStatusTip( tr( "Load next frame" ) );
  nextFrameAct->setShortcut( Qt::Key_PageDown );
  connect( nextFrameAct, SIGNAL(triggered()), this, SLOT(gotoNextFrame()) );

  QAction *previousFrameAct = new QAction( tr( "&Previous frame" ), this );
  previousFrameAct->setStatusTip( tr( "Load previous frame" ) );
  previousFrameAct->setShortcut( Qt::Key_PageUp );
  connect( previousFrameAct, SIGNAL(triggered()), this, SLOT(gotoPreviousFrame()) );
  
  QToolBar *toolBar = addToolBar( tr( "Navigation" ) );
//  toolBar->setHorizontalStretchable( true );

  QToolButton *previousFrameBt = new QToolButton( toolBar );
  previousFrameBt->setArrowType( Qt::LeftArrow );
  previousFrameBt->setMinimumWidth( 15 );
  connect( previousFrameBt, SIGNAL(clicked()), this, SLOT(gotoPreviousFrame()) );
  previousFrameBt->setToolTip( "Goto previous frame" );
  toolBar->addWidget( previousFrameBt );
  
  QToolButton *nextFrameBt = new QToolButton( toolBar );
  nextFrameBt->setArrowType( Qt::RightArrow );
  nextFrameBt->setMinimumWidth( 15 );
  connect( nextFrameBt, SIGNAL(clicked()), this, SLOT(gotoNextFrame()) );
  nextFrameBt->setToolTip( "Goto next frame" );
  toolBar->addWidget( nextFrameBt );

  QLabel *channelSelLabel = new QLabel( "&Channel", toolBar );
  channelSelection = new QComboBox( toolBar );
  channelSelLabel->setBuddy( channelSelection );
  connect( channelSelection, SIGNAL( activated( int ) ),
    this, SLOT( setChannelSelection(int) ) );
  toolBar->addWidget( channelSelLabel );
  toolBar->addWidget( channelSelection );
  
  toolBar->addSeparator();

  QLabel *mappingMethodLabel = new QLabel( "&Mapping", toolBar );
  mappingMethodLabel->setAlignment(  Qt::AlignRight | Qt::AlignVCenter ); // | 
//				    Qt::TextExpandTabs | Qt::TextShowMnemonic );
  mappingMethodCB = new QComboBox( toolBar );
  mappingMethodLabel->setBuddy( mappingMethodCB );
  mappingMethodCB->addItem( "Linear" );
  mappingMethodCB->addItem( "Gamma 1.4" );
  mappingMethodCB->addItem( "Gamma 1.8" );
  mappingMethodCB->addItem( "Gamma 2.2" );
  mappingMethodCB->addItem( "Gamma 2.6" );
  mappingMethodCB->addItem( "Logarithmic" );
  mappingMethodCB->setCurrentIndex( 3 );
  connect( mappingMethodCB, SIGNAL( activated( int ) ),
    this, SLOT( setLumMappingMethod(int) ) );
  toolBar->addWidget( mappingMethodLabel );
  toolBar->addWidget( mappingMethodCB );
  
//  addToolBar( Qt::BottomToolBarArea, toolBar );  
  
  QToolBar *toolBarLR = addToolBar( tr( "Histogram" ) );
  lumRange = new LuminanceRangeWidget( toolBarLR );
  connect( lumRange, SIGNAL( updateRangeWindow() ), this,
    SLOT( updateRangeWindow() ) );
  toolBarLR->addWidget( lumRange );
//  addToolBar( toolBar );

  
  pointerPosAndVal = new QLabel( statusBar() );
  statusBar()->addWidget( pointerPosAndVal );
//  QFont fixedFont = QFont::defaultFont();
//  fixedFont.setFixedPitch( true );
//  pointerPosAndVal->setFont( fixedFont );
  zoomValue = new QLabel( statusBar() );
  statusBar()->addWidget( zoomValue );
  exposureValue = new QLabel( statusBar() );
  statusBar()->addWidget( exposureValue );

  connect( pfsView, SIGNAL(updatePointerValue()),
             this, SLOT(updatePointerValue()) );



  QMenu *frameMenu = menuBar()->addMenu( tr( "&Frame" ) );
  frameMenu->addAction( nextFrameAct );
  frameMenu->addAction( previousFrameAct );
  frameMenu->addSeparator();
  frameMenu->addAction( "&Save image...", this, SLOT(saveImage()), QKeySequence::Save ); 
  frameMenu->addAction( "&Copy image to clipboard", this, SLOT(copyImage()), QKeySequence::Copy ); 
  frameMenu->addSeparator();
  frameMenu->addAction( "&Quit", qApp, SLOT(quit()), Qt::Key_Q ); //QKeySequence::Quit
  QShortcut *shortcut = new QShortcut( QKeySequence::Close, this );
  connect( shortcut, SIGNAL(activated()), qApp, SLOT(quit()) );
  
  
  QAction *act;
  QMenu *viewMenu = menuBar()->addMenu( tr( "&View" ) );

  act = viewMenu->addAction( "&Zoom in", pfsView, SLOT(zoomIn()), Qt::Key_Period ); // QKeySequence::ZoomIn -- not doing it -- silly binding under Linux
  connect( act, SIGNAL(triggered()), this, SLOT(updateZoomValue()) );
  act = viewMenu->addAction( "Zoom &out", pfsView, SLOT(zoomOut()), Qt::Key_Comma ); 
  connect( act, SIGNAL(triggered()), this, SLOT(updateZoomValue()) );
  act = viewMenu->addAction( "Zoom &1:1", pfsView, SLOT(zoomOriginal()), Qt::Key_N ); 
  connect( act, SIGNAL(triggered()), this, SLOT(updateZoomValue()) );
  viewMenu->addAction( "&Fit window to content", this, SLOT(updateViewSize()), Qt::Key_C ); 

  viewMenu->addSeparator();  

  QMenu *infnanMenu = viewMenu->addMenu( "NaN and &Inf values" );
  QActionGroup *infnanActGrp = new QActionGroup( this );
  infnanActGrp->setExclusive( true );
  QAction *infnanHideAct = new QAction( tr( "&Hide" ), this );
  infnanHideAct->setCheckable(true);
  infnanHideAct->setData(0);
  infnanActGrp->addAction( infnanHideAct );
  infnanMenu->addAction( infnanHideAct );
  QAction *infnanMarkAct = new QAction( tr( "Mark with &red color" ), this );
  infnanMarkAct->setCheckable(true);
  infnanMarkAct->setData(1);
  infnanActGrp->addAction( infnanMarkAct );
  infnanMenu->addAction( infnanMarkAct );
  infnanMarkAct->setChecked( true );
  connect( infnanActGrp, SIGNAL(triggered(QAction*)), pfsView, SLOT(setInfNaNTreatment(QAction*)) );

  QMenu *colorClipMenu = viewMenu->addMenu( "&Color clipping" );
  QActionGroup *colorClipActGrp = new QActionGroup( this );
  colorClipActGrp->setExclusive( true );
  QAction *colorClipSimpleAct = new QAction( tr( "&Simple clipping" ), this );
  colorClipSimpleAct->setCheckable(true);
  colorClipSimpleAct->setData(CLIP_SIMPLE);
  colorClipSimpleAct->setShortcut( Qt::CTRL + Qt::Key_H );
  colorClipActGrp->addAction( colorClipSimpleAct );
  colorClipMenu->addAction( colorClipSimpleAct );
  QAction *colorClipCodedAct = new QAction( tr( "&Color-coded clipping" ), this );
  colorClipCodedAct->setCheckable(true);
  colorClipCodedAct->setShortcut( Qt::CTRL + Qt::Key_J );
  colorClipCodedAct->setData(CLIP_COLORCODED);
  colorClipActGrp->addAction( colorClipCodedAct );
  colorClipMenu->addAction( colorClipCodedAct );
  QAction *colorClipBriHueAct = new QAction( tr( "&Keep brightness and hue" ), this );
  colorClipBriHueAct->setCheckable(true);
  colorClipBriHueAct->setShortcut( Qt::CTRL + Qt::Key_K );
  colorClipBriHueAct->setData(CLIP_KEEP_BRI_HUE);
  colorClipActGrp->addAction( colorClipBriHueAct );
  colorClipMenu->addAction( colorClipBriHueAct );
  colorClipSimpleAct->setChecked( true );
  connect( colorClipActGrp, SIGNAL(triggered(QAction*)), pfsView, SLOT(setRGBClippingMethod(QAction*)) );

  QMenu *negativeMenu = viewMenu->addMenu( "&Negative values" );
  QActionGroup *negativeActGrp = new QActionGroup( this );
  negativeActGrp->setExclusive( true );
  act = new QAction( tr( "&Black" ), this );
  act->setCheckable(true);
  act->setData(NEGATIVE_BLACK);
  act->setShortcut( Qt::ALT + Qt::Key_B );
  negativeActGrp->addAction( act );
  negativeMenu->addAction( act );
  act->setChecked( true );
  act = new QAction( tr( "Mark with &red color" ), this );
  act->setCheckable(true);
  act->setData(NEGATIVE_MARK_AS_RED);
  act->setShortcut( Qt::ALT + Qt::Key_R );
  negativeActGrp->addAction( act );
  negativeMenu->addAction( act );
  act = new QAction( tr( "Use &green color scale" ), this );
  act->setCheckable(true);
  act->setData(NEGATIVE_GREEN_SCALE);
  act->setShortcut( Qt::ALT + Qt::Key_G );
  negativeActGrp->addAction( act );
  negativeMenu->addAction( act );
  act = new QAction( tr( "Use &absolute values" ), this );
  act->setCheckable(true);
  act->setData(NEGATIVE_ABSOLUTE);
  act->setShortcut( Qt::ALT + Qt::Key_A );
  negativeActGrp->addAction( act );
  negativeMenu->addAction( act );
  connect( negativeActGrp, SIGNAL(triggered(QAction*)), pfsView, SLOT(setNegativeTreatment(QAction*)) );
  
  viewMenu->addSeparator();
  
  QMenu *colorCoordMenu = viewMenu->addMenu( "Color coo&rdinates" );
  QActionGroup *colorCoordActGrp = new QActionGroup( this );
  colorCoordActGrp->setExclusive( true );
  act = new QAction( tr( "&RGB" ), this );
  act->setCheckable(true);
  act->setData(CC_RGB);
  act->setShortcut( Qt::SHIFT + Qt::ALT + Qt::Key_R );
  colorCoordActGrp->addAction( act );
  colorCoordMenu->addAction( act );
  act->setChecked( true );
  act = new QAction( tr( "&XYZ" ), this );
  act->setCheckable(true);
  act->setData(CC_XYZ);
  act->setShortcut( Qt::SHIFT + Qt::ALT + Qt::Key_X );
  colorCoordActGrp->addAction( act );
  colorCoordMenu->addAction( act );
  act = new QAction( tr( "Y&u'v'" ), this );
  act->setCheckable(true);
  act->setData(CC_Yupvp);
  act->setShortcut( Qt::SHIFT + Qt::ALT + Qt::Key_U );
  colorCoordActGrp->addAction( act );
  colorCoordMenu->addAction( act );
  act = new QAction( tr( "Yx&y" ), this );
  act->setCheckable(true);
  act->setData(CC_Yxy);
  act->setShortcut( Qt::SHIFT + Qt::ALT + Qt::Key_Y );
  colorCoordActGrp->addAction( act );
  colorCoordMenu->addAction( act );
  connect( colorCoordActGrp, SIGNAL(triggered(QAction*)), this, SLOT(setColorCoord(QAction*)) );
  

  QMenu *mappingMenu = menuBar()->addMenu( tr( "&Tone mapping" ) );
  
  
  mappingMenu->addAction( "Increase exposure", lumRange, 
			SLOT(increaseExposure()), Qt::Key_Minus ); 
  mappingMenu->addAction( "Decrease exposure", lumRange, 
			SLOT(decreaseExposure()), Qt::Key_Equal );
  mappingMenu->addAction( "Extend dynamic range", lumRange, 
			SLOT(extendRange()), Qt::Key_BracketRight ); 
  mappingMenu->addAction( "Shrink dynamic range", lumRange, 
			SLOT(shrinkRange()), Qt::Key_BracketLeft );
  mappingMenu->addAction( "Fit to dynamic range", lumRange, 
			SLOT(fitToDynamicRange()), Qt::Key_Backslash );
  mappingMenu->addAction( "Low dynamic range", lumRange, 
			SLOT(lowDynamicRange()), Qt::ALT + Qt::Key_L );


  QMenu *mapfuncMenu = mappingMenu->addMenu( "&Mapping function" );
  QActionGroup *mapfuncActGrp = new QActionGroup( this );
  mapfuncActGrp->setExclusive( true );
  mappingAct[0] = act = new QAction( tr( "&Linear" ), this );
  act->setCheckable(true);
  act->setData(0);
  act->setShortcut( Qt::Key_L );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  mappingAct[1] = act = new QAction( tr( "Gamma 1.&4" ), this );
  act->setCheckable(true);
  act->setData(1);
  act->setShortcut( Qt::Key_1 );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  mappingAct[2] = act = new QAction( tr( "Gamma 1.&8" ), this );
  act->setCheckable(true);
  act->setData(2);
  act->setShortcut( Qt::Key_2 );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  mappingAct[3] = act = new QAction( tr( "Gamma 2.&2" ), this );
  act->setCheckable(true);
  act->setData(3);
  act->setChecked( true );
  act->setShortcut( Qt::Key_3 );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  mappingAct[4] = act = new QAction( tr( "Gamma 2.&6" ), this );
  act->setCheckable(true);
  act->setData(4);
  act->setShortcut( Qt::Key_4 );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  mappingAct[5] = act = new QAction( tr( "L&ogarithmic" ), this );
  act->setCheckable(true);
  act->setData(5);
  act->setShortcut( Qt::Key_O );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  connect( mapfuncActGrp, SIGNAL(triggered(QAction*)), this, SLOT(setLumMappingMethod(QAction*)) );

  
  QMenu *helpMenu = menuBar()->addMenu( tr( "&Help" ) );
  helpMenu->addAction( "&About", this, SLOT(showAboutdialog()) );
  
  colorCoord = CC_RGB;
  
  //Window should not be larger than desktop
  // TODO: how to find desktop size - gnome taksbars
//  setMaximumSize( QApplication::desktop()->width(), QApplication::desktop()->height() );

  try {
    
    if( !readNextFrame() ) 
      throw PFSViewException();
    
    if( window_min < window_max )
      lumRange->setRangeWindowMinMax( window_min, window_max );  
    
  } catch( pfs::Exception ex ) {
    QMessageBox::critical( this, "pfsview error", ex.getMessage() );
    throw PFSViewException();
  }

}
Exemplo n.º 7
0
//  FolderPage
FolderPage::FolderPage(QWidget * parent)
: QWizardPage(parent)
{
   setTitle(tr("Alias Selection"));
   QGridLayout *grLayout = new QGridLayout();

   QLabel * lblAlias = new QLabel(tr("You should specify an alias for Maverick Poker Bot in this step. Memorize the selected alias, you will need it while using Maverick Poker Bot. You can specify the alias yourself or you can use the \"Random\" button for the installation wizard to offer you some random value."), this);
   lblAlias->setWordWrap(true);

   edtAlias_ = new QLineEdit(this);
   edtAlias_->setValidator(new QRegExpValidator(QRegExp("[a-zA-Z0-9 ]+"), this));
   edtAlias_->setAlignment(Qt::AlignCenter);
   QFont fn = edtAlias_->font();
   fn.setBold(true);
   fn.setPointSize(24);
   edtAlias_->setFont(fn);
   edtAlias_->setMaxLength(120);
   connect(edtAlias_, SIGNAL(textChanged(const QString &)), 
      this, SLOT(aliased(const QString &)));
   
   //QLabel * lbl = new QLabel(tr("Select the folder where you would like Holdem Folder to be installed, then click Next.<p>The program requires at least 10 MB of disk space."), this);
   //lbl->setWordWrap(true);

   QLabel * lblPath = new QLabel(tr("&Path to Maverick Poker Bot:"), this);
   
   lePath_ = new QLineEdit(this);
   lePath_->setText("C:\\Program Files\\");
   lePath_->setEnabled(false);
   lblPath->setBuddy(lePath_);
   folderPrefix_ = "C:\\Program Files\\";

   QToolButton * btnRandom = new QToolButton(this);
   btnRandom->setIcon(QIcon(":/images/dice.png")); 
   btnRandom->setText(tr("&Random")); 
   btnRandom->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
   QPushButton * btnBrowse = new QPushButton(tr("&Browse..."), this);
   //btnBrowse->setFixedSize(20, 20);
   connect(btnBrowse, SIGNAL(clicked()), this, SLOT(browseDir()));
   connect(btnRandom, SIGNAL(clicked()), this, SLOT(random()));
   btnRandom->setMinimumHeight(edtAlias_->sizeHint().height());
   btnRandom->setMinimumWidth(btnBrowse->sizeHint().width());
   btnRandom->setIconSize(QSize(32, 32));
   
   int row = 0;
   //grLayout->addWidget(lbl,    row++, 0, 1, 2);

   //grLayout->addItem(new QSpacerItem(1, 20,
   //   QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 0, 1, 2);
   grLayout->addWidget(lblAlias,  row++, 0, 1, 1);
   grLayout->addWidget(edtAlias_,  row, 0, 1, 1);
   grLayout->addWidget(btnRandom, row++, 1, 1, 1, Qt::AlignCenter);

   grLayout->addItem(new QSpacerItem(1, 20,
      QSizePolicy::Fixed, QSizePolicy::Fixed), row++, 0, 1, 2);

   grLayout->addWidget(lblPath,   row++, 0, 1, 2);
   grLayout->addWidget(lePath_,    row,   0, 1, 1);
   grLayout->addWidget(btnBrowse, row++, 1, 1, 1, Qt::AlignRight);

   setLayout(grLayout);
}
Exemplo n.º 8
0
void ParameterWidget::addParam()
{
  XComboBox *xcomboBox = new XComboBox(_filterGroup);
  QToolButton *toolButton = new QToolButton(_filterGroup);
  QLineEdit *lineEdit = new QLineEdit(_filterGroup);
  QGridLayout *gridLayout = new QGridLayout();
  QVBoxLayout *xcomboLayout = new QVBoxLayout();
  QHBoxLayout *widgetLayout1 = new QHBoxLayout();
  QVBoxLayout *widgetLayout2 = new QVBoxLayout();
  QVBoxLayout *buttonLayout = new QVBoxLayout();

  int nextRow = _filtersLayout->rowCount();
  QString currRow = QString().setNum(nextRow);

  // Set up objects
  gridLayout->setObjectName("topLayout" + currRow);

  xcomboLayout->setObjectName("xcomboLayout" + currRow);
  xcomboLayout->setContentsMargins(0, 0, 0, 0);

  xcomboBox->setObjectName("xcomboBox" + currRow);
  xcomboBox->addItem("", currRow + ":" + "2");

  widgetLayout1->setObjectName("widgetLayout1" + currRow);

  widgetLayout2->setObjectName("widgetLayout2" + currRow);
  widgetLayout2->setContentsMargins(0, 0, 0, 0);

  lineEdit->setObjectName("widget" + currRow);
  lineEdit->setDisabled(true);

  buttonLayout->setObjectName("buttonLayout" + currRow);
  buttonLayout->setContentsMargins(0, 0, 0, 0);

  toolButton->setObjectName("button" + currRow);
  toolButton->setText(tr("-"));
 #ifdef Q_WS_MAC
  toolButton->setMinimumWidth(25);
 #else
  toolButton->setMinimumWidth(21);
 #endif

  //grab the items provided by other widgets to populate xcombobox with
  QMapIterator<QString, QPair<QString, ParameterWidgetTypes> > i(_types);
  while (i.hasNext())
  {
    i.next();
    QPair<QString, ParameterWidgetTypes> tempPair = i.value();
    QString value = QString().setNum(nextRow) + ":" + QString().setNum(tempPair.second);
    if ( _usedTypes.isEmpty() || !containsUsedType(i.key()) )
      xcomboBox->addItem(i.key(), value );
  }

  xcomboLayout->addWidget(xcomboBox);
  xcomboLayout->addItem(new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Expanding));

  // Place the default line edit/button combo
  widgetLayout1->addWidget(lineEdit);
  widgetLayout1->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Fixed));

  widgetLayout2->addLayout(widgetLayout1);
  widgetLayout2->addItem(new QSpacerItem(20, 0, QSizePolicy::Fixed, QSizePolicy::Expanding));

  gridLayout->addLayout(widgetLayout2, 0, 0, 1, 1);

  // Place Button
  buttonLayout->addWidget(toolButton);
  buttonLayout->addItem(new QSpacerItem(10, 0, QSizePolicy::Fixed, QSizePolicy::Expanding));

  gridLayout->addLayout(buttonLayout, 0, 1, 1, 1);

  _filtersLayout->addLayout(gridLayout, nextRow, 1, 1, 1);
  _filtersLayout->addLayout(xcomboLayout, nextRow, 0, 1, 1);


  // Hook up connections
  connect(toolButton, SIGNAL(clicked()), _filterSignalMapper, SLOT(map()));
  connect(toolButton, SIGNAL(clicked()), gridLayout, SLOT( deleteLater() ) );
  connect(toolButton, SIGNAL(clicked()), xcomboBox, SLOT( deleteLater() ) );
  connect(toolButton, SIGNAL(clicked()), lineEdit, SLOT( deleteLater() ) );
  connect(toolButton, SIGNAL(clicked()), toolButton, SLOT( deleteLater() ) );
  connect(xcomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT( addUsedType() ) );
  connect(xcomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT( changeFilterObject(int)) );
	connect(xcomboBox, SIGNAL(currentIndexChanged(int)), this, SLOT( repopulateComboboxes() ) );
  connect(lineEdit, SIGNAL(editingFinished()), this, SLOT( storeFilterValue() ) );

  _filterSignalMapper->setMapping(toolButton, nextRow);

  _addFilterRow->setDisabled(true);

}
Exemplo n.º 9
0
void DistroMesas::importXML(const QString val) {
  QFile file ( g_confpr->value( CONF_DIR_USER ) + "distromesas_" + mainCompany()->dbName() + ".cfn" );

    if (file.exists()) {
        if ( !file.open ( QIODevice::ReadOnly ) ) {
            
            return;
        } // end if
        QString result (file.readAll());
        file.close(); 


    QDomDocument doc ( "mydocument" );

    if ( !doc.setContent ( result ) ) {
	
        return;
    } // end if

    QDomElement docElem = doc.documentElement();
    QDomElement principal = docElem.firstChildElement ( "BACKGROUND" );
    m_background = principal.text();

    principal = docElem.firstChildElement ( "ESCALA" );
    g_escala = principal.text().toInt();


    QDomNodeList nodos = docElem.elementsByTagName ( "MESA" );
    int i = 0;
    while (i < nodos.count() ) {
        QDomNode ventana = nodos.item ( i++ );
        QDomElement e1 = ventana.toElement(); /// try to convert the node to an element.
        if ( !e1.isNull() ) { /// the node was really an element.
            QString nodoText = e1.text();
            /// Pasamos el XML a texto para poder procesarlo como tal.
            QString result;
            QTextStream stream ( &result );
            ventana.save(stream,5);

            Mesa *mesa = new Mesa((BtCompany *) mainCompany(), mui_widget);
            mesa->importXML(result);
	    
	    if (! m_listapantallas.contains(mesa->m_pantalla)) {
	        if (m_pantallaactual == "") {
		    m_pantallaactual = mesa->m_pantalla;
		} // end if
		m_listapantallas.append(mesa->m_pantalla);
		QToolButton *but = new QToolButton(this);
		but->setObjectName("p_"+mesa->m_pantalla);
		but->setText(mesa->m_pantalla);
		but->setMinimumHeight(42);
		but->setMinimumWidth(42);
		but->setCheckable(TRUE);
		mui_espaciopantallas->addWidget(but);
		connect(but, SIGNAL(clicked()), this, SLOT(cambiarPantalla()));
	    } // end if
	    if (mesa->m_pantalla == m_pantallaactual) 
		mesa->show();

        } // end if
    } // end while

} // end if

}