示例#1
0
void K3bDeviceTreeToolTip::maybeTip( const QPoint& pos )
{
  if( !parentWidget() || !m_view )
    return;

  K3bDeviceBranchViewItem* item = dynamic_cast<K3bDeviceBranchViewItem*>( m_view->itemAt( pos ) );
  if( !item )
    return;

  K3bDevice::Device* dev = static_cast<K3bDeviceBranch*>( item->branch() )->device();

  QFrame* tooltip = new QFrame( parentWidget() );
  tooltip->setFrameStyle( QFrame::Panel | QFrame::Raised );
  tooltip->setFrameShape( QFrame::StyledPanel );
  QGridLayout* lay = new QGridLayout( tooltip, 2, 2, tooltip->frameWidth()*2 /*margin*/, 6 /*spacing*/ );

  QString text = k3bappcore->mediaCache()->medium( dev ).longString();
  int detailsStart = text.find( "<p>", 3 );
  QString details = text.mid( detailsStart );
  text.truncate( detailsStart );

  QLabel* label = new QLabel( text, tooltip );
  label->setMargin( 9 );
  lay->addMultiCellWidget( label, 0, 0, 0, 1 );
  label = new QLabel( details, tooltip );
  label->setMargin( 9 );
  label->setAlignment( Qt::Vertical );
  lay->addMultiCellWidget( label, 1, 2, 0, 0 );
  label = new QLabel( tooltip );
  lay->addWidget( label, 2, 1 );
  lay->setColStretch( 0, 1 );

  if( K3bTheme* theme = k3bappcore->themeManager()->currentTheme() ) {
    tooltip->setPaletteBackgroundColor( theme->backgroundColor() );
    tooltip->setPaletteForegroundColor( theme->foregroundColor() );
    K3bTheme::PixmapType pm;
    int c = k3bappcore->mediaCache()->medium( dev ).content();
    if( c & (K3bMedium::CONTENT_VIDEO_CD|K3bMedium::CONTENT_VIDEO_DVD) )
      pm = K3bTheme::MEDIA_VIDEO;
    else if( c & K3bMedium::CONTENT_AUDIO &&
	      c & K3bMedium::CONTENT_DATA )
      pm = K3bTheme::MEDIA_MIXED;
    else if( c & K3bMedium::CONTENT_AUDIO )
      pm = K3bTheme::MEDIA_AUDIO;
    else if( c & K3bMedium::CONTENT_DATA )
      pm = K3bTheme::MEDIA_DATA;
    else {
      K3bDevice::DiskInfo di = k3bappcore->mediaCache()->diskInfo( dev );
      if( di.diskState() == K3bDevice::STATE_EMPTY )
	pm = K3bTheme::MEDIA_EMPTY;
      else
	pm = K3bTheme::MEDIA_NONE;
    }
    label->setPixmap( theme->pixmap( pm ) );
  }

  // the tooltip will take care of deleting the widget
  tip( m_view->itemRect( item ), tooltip );
}
示例#2
0
CorrelationView::CorrelationView(std::map<QString, Image*> imagesMap, QWidget *parent) :
    QWidget(parent)
{
    QGridLayout * Glayout = new QGridLayout();
    QVBoxLayout * Vlayout = new QVBoxLayout();
    QHBoxLayout * Hlayout = new QHBoxLayout();
    QPushButton * bouttonFermer = new QPushButton("Fermer");
    Hlayout->addWidget(bouttonFermer);
    Hlayout->setAlignment(bouttonFermer, Qt::AlignCenter);
    Vlayout->addLayout(Glayout);
    Vlayout->addLayout(Hlayout);

    std::map<QString, Image *>::iterator it;
    int i = 1;
    for(it = imagesMap.begin() ; it != imagesMap.end() ; ++it)
    {
        QString canal = it->first;

        QLabel * labelCanal = new QLabel(canal);
        labelCanal->setMargin(10);
        Glayout->addWidget(labelCanal, 0, i);
        i++;
    }

    i = 1;
    for(it = imagesMap.begin() ; it != imagesMap.end() ; ++it)
    {
        QString canal = it->first;
        Image * img = it->second;

        QLabel * labelCanal = new QLabel(canal);
        labelCanal->setMargin(10);
        Glayout->addWidget(labelCanal, i, 0);

        int j = 1;
        std::map<QString, Image *>::iterator it2;
        for(it2 = imagesMap.begin() ; it2 != imagesMap.end() ; ++it2)
        {
            Image * img2 = it2->second;

            double correlation = img->correlation(img2);
            QString stringCorr = (new QString())->number(correlation);

            QLabel * labelCorr = new QLabel(stringCorr);
            labelCorr->setMargin(10);
            Glayout->addWidget(labelCorr, i, j);

            j++;
        }
        i++;
    }

    this->setLayout(Vlayout);
    QObject::connect(bouttonFermer, SIGNAL(clicked()), this, SLOT(close()));
}
void NuevoCandidato::principal()
{
        QGridLayout *layoutCont = new QGridLayout;

        QLabel *nombreCandidato = new QLabel("Nombre de candidato:");
        nombreCandidato->setMargin ( 10 );

        QLabel *nombrePartido = new QLabel("Nombre de partido:");
        nombrePartido->setMargin ( 10 );

        QString img("imagen :");

        QFont serifFont("Times", 10, QFont::Bold);

        nombreImagen = new QLabel(img);
        nombreImagen->setMargin ( 10 );
        nombreImagen->setFont(serifFont);

        imgen = new QLabel("");
        imgen->setMargin ( 10 );
        imgen->setFixedSize(110,100);

        nombreCandidatoEdit= new QLineEdit();
        nombrePartidoEdit= new QLineEdit();

        QPushButton * terminar = new QPushButton(tr("Añadir Candidato"),this);
        QPushButton * cargarImagen = new QPushButton(tr("Cargar imagen"),this);
        QPushButton * atras = new QPushButton(tr("Atras"),this);

        connect(terminar, SIGNAL(clicked()),this, SLOT(terminarCreacion()));

        connect(cargarImagen, SIGNAL(clicked()),this, SLOT(cargarImagen()));
        connect(atras, SIGNAL(clicked()),this, SLOT(salir()));

        layoutCont->addWidget(nombreCandidato , 0 , 0);
        layoutCont->addWidget(nombreCandidatoEdit , 0 , 1);
        layoutCont->addWidget(nombrePartido ,1 , 0);
        layoutCont->addWidget(nombrePartidoEdit , 1 , 1);
        layoutCont->addWidget(nombreImagen , 2 , 0);
        layoutCont->addWidget(cargarImagen , 2 , 1);
        layoutCont->addWidget(imgen , 3 , 0);
        layoutCont->addWidget(terminar , 3 , 1);
        layoutCont->addWidget(atras , 4 , 1);

        setLayout(layoutCont);

        this->setWindowTitle(tr("Configuracion"));
        QPoint putno(20,20);
        this->move(putno);
        this->show();
}
示例#4
0
// Dialogs ****************************************************************************************
// ** Actions Dialog
void BaulkInterfaceDialog::actionsDialogLoader() {
	actionsDialog = new BaulkDialog( parentWidget );

	BaulkControl *control = (BaulkControl*)parentWidget;

	// Window Title
	actionsDialog->setWindowTitle( tr("Available Actions") );

	// Layout
	QVBoxLayout *layout = new QVBoxLayout;
	layout->setContentsMargins( 0,0,0,0 );
	actionsDialog->setLayout( layout );

	// Title
	QLabel *title = new QLabel( tr("<big><b>Select an action to use or edit:</b></big>") );
	title->setWordWrap( true );
	title->setMargin( 5 );
	layout->addWidget( title );

	// TableView
	QList<QAction*> list = control->globalQActions();
	actionsTableView = new QTableWidget( list.count() + 1, 3 );
	actionsTableView->setEditTriggers( QAbstractItemView::NoEditTriggers );
	for ( int row = 0; row < list.count(); ++row ) {
		// Hotkey Name
		actionsTableView->setItem( row, 0, new QTableWidgetItem( list[row]->text() ) );
		// Hotkey
		actionsTableView->setItem( row, 1, new QTableWidgetItem( list[row]->shortcut().toString() ) );
		// List Key, Hidden from view
		actionsTableView->setItem( row, 2, new QTableWidgetItem( QString("%1").arg( row ) ) );
	}
	actionsTableView->hideColumn( 2 ); 		// Hide Key Column
	actionsTableView->sortItems( 0 );		// Sort Items by the first Column

	// Add Close Item
	actionsTableView->setItem( list.count(), 0, new QTableWidgetItem( tr("Close Menu") ) );
	actionsTableView->setItem( list.count(), 1, new QTableWidgetItem( tr("N/A") ) );
	actionsTableView->setItem( list.count(), 2, new QTableWidgetItem( "Close" ) );

	actionsTableView->setShowGrid( false );		// Hide Grid
	actionsTableView->setWordWrap( true );		// Allow Word Wrap
	actionsTableView->verticalHeader()->hide();	// Hide Vertical Headers
	actionsTableView->horizontalHeader()->hide();	// Hide Horizontal Headers
	actionsTableView->resizeColumnToContents( 1 );	// Resize Hotkey Column to optimal size
	actionsTableView->setColumnWidth( 0,		// TODO Make resizing dynamic 
		220 - actionsTableView->columnWidth( 1 ) );
	actionsTableView->resizeRowsToContents();	// Resize Rows to allow for word wrap
	layout->addWidget( actionsTableView );

	// Connections
	connect( actionsTableView, SIGNAL( itemDoubleClicked( QTableWidgetItem* ) ), 
		this, SLOT( actionsDialogHotkeyEdit( QTableWidgetItem* ) ) );
	connect( actionsTableView, SIGNAL( cellActivated( int, int ) ), 
		this, SLOT( actionsDialogHotkeyAccepted( int, int ) ) );
	connect( actionsTableView, SIGNAL( cellChanged( int, int ) ),
		this, SLOT( actionsDialogHotkeyModified( int, int ) ) );

	// Show Dialog
	actionsDialog->show();
}
示例#5
0
void Widget::build3x3frame(QFrame *box3x3frame, int rowStart, int colStart, int QMap)
{
    box3x3frame->setFrameStyle(QFrame::Plain);
    box3x3frame->setFrameShape(QFrame::Box);
    QGridLayout* box3x3 = new QGridLayout(box3x3frame);
    box3x3->setSpacing(0);
    box3x3->setMargin(0);
    int x = rowStart%9;
    for (int i = 0; i < 3; ++i)
    {
        int y = colStart%9;
        for (int j = 0; j < 3; ++j)
        {
            QLabel* cell = new QLabel("");
            cell->setAlignment(Qt::AlignCenter);
            //cell->setAlignment(Qt::AlignVCenter);
            if(QMap) originPointToCellMap.insert(QPair<int,int>(x,y++),cell);
            else     resultPointToCellMap.insert(QPair<int,int>(x,y++),cell);
            cell->setFrameStyle(QFrame::Plain);
            cell->setFrameShape(QFrame::Box);
            cell->setMargin(5);
            box3x3->addWidget(cell,i,j,1,1);
        }
        x++;
    }
}
示例#6
0
// ** Configuration Dialog
void BaulkInterfaceDialog::configurationDialogLoader() {
	configurationDialog = new BaulkDialog( parentWidget );

	BaulkControl *control = (BaulkControl*)parentWidget;

	// Window Title
	configurationDialog->setWindowTitle( tr("Widget Configuration") );

	// Layout
	QVBoxLayout *vlayout = new QVBoxLayout;
	vlayout->setContentsMargins( 0,0,0,0 );

	QHBoxLayout *hlayout = new QHBoxLayout;
	hlayout->setContentsMargins( 0,0,0,0 );
	hlayout->addLayout( vlayout );
	configurationDialog->setLayout( hlayout );

	// Widget Tree
	configurationTree = new QTreeWidget;
	hlayout->insertWidget( 0, configurationTree );

	// Title
	QLabel *title = new QLabel( tr("<big><b>Configs:</b></big>") );
	title->setWordWrap( true );
	title->setMargin( 5 );
	vlayout->addWidget( title );

	// Show Dialog
	configurationDialog->show();
}
QLabel * TASARIM_DESIGN_WIDGET::CREATE_NEW_LABEL ( const QString &text, QWidget * parent )
{
    if ( parent EQ NULL ) {
        parent = this;
    }

    QLabel * label = new QLabel(text.toUtf8(),parent);
    label->setMargin(0);
    label->setIndent(0);
    QFont label_font = label->font();
    label_font.setFixedPitch    ( false );
    label_font.setKerning       ( false );
    label_font.setLetterSpacing ( QFont::AbsoluteSpacing, 0.01 );
    label_font.setWordSpacing   ( 0.01 );
    label->setScaledContents    ( true );
    label->setFont              ( label_font );
    label->setFocusPolicy       ( Qt::StrongFocus );

    int width = label->width();
    label->setMinimumWidth( width + 5 );

    label->installEventFilter( this );

    SET_LABEL_FONTS_UNSELECTED( label );

    return label;
}
示例#8
0
CloseMessageBox::CloseMessageBox(const QString& Caption, const QString& Text,
		       QWidget *parent, const char *name)
			: QDialog(parent, name)
			// must not be "WDestructiveClose" !!!!!
{
  setCaption(Caption);

  all = new Q3VBoxLayout(this);
  all->setSpacing(5);
  QLabel *l   = new QLabel(Text, this);
  l->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter);
  l->setMargin(5);
  all->addWidget(l);

  Q3HBox  *Butts = new Q3HBox(this);
//  Butts->setSpacing(5);
  all->addWidget(Butts);
  QPushButton *Save = new QPushButton(tr("Save"), Butts);
  connect(Save, SIGNAL(clicked()), SLOT(slotSave()));
  QPushButton *SaveAll = new QPushButton(tr("Save all"), Butts);
  connect(SaveAll, SIGNAL(clicked()), SLOT(slotSaveAll()));
  QPushButton *Discard = new QPushButton(tr("Discard"), Butts);
  connect(Discard, SIGNAL(clicked()), SLOT(slotDiscard()));
  QPushButton *DiscardAll = new QPushButton(tr("Discard all"), Butts);
  connect(DiscardAll, SIGNAL(clicked()), SLOT(slotDiscardAll()));
  QPushButton *Cancel = new QPushButton(tr("Cancel"), Butts);
  connect(Cancel, SIGNAL(clicked()), SLOT(slotCancel()));
}
/**Initializes the view of this widget*/
void BibleTime::initView() {
	KStartupLogo::setStatusMessage(i18n("Creating BibleTime's GUI") + QString("..."));

	m_mainSplitter = new QSplitter(this, "mainsplitter");
	m_mainSplitter->setChildrenCollapsible(false);
	setCentralWidget(m_mainSplitter);

	m_leftPaneSplitter = new QSplitter(Qt::Vertical, m_mainSplitter);
	m_leftPaneSplitter->setChildrenCollapsible(false);
	
	QVBox* vBox = new QVBox(m_leftPaneSplitter);
	vBox->setMinimumSize(100, 100);
	
	QLabel* bookshelfLabel = new QLabel( i18n("Bookshelf"), vBox );
	bookshelfLabel->setMargin(5);

	m_mainIndex = new CMainIndex(vBox);

	m_infoDisplay = new CInfoDisplay(m_leftPaneSplitter);
	CPointers::setInfoDisplay(m_infoDisplay);

	m_mdi = new CMDIArea(m_mainSplitter, "mdiarea" );
	m_mdi->setMinimumSize(100, 100);
	m_mdi->setFocusPolicy(ClickFocus);

	m_helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), true, actionCollection());
}
示例#10
0
StatusBar::StatusBar( QWidget* parent )
    : QStatusBar( parent )
{
    // create labels
    QLabel* label;
    
    label = ( mLabels[ltCursorPosition] = new QLabel( this ) );
    label->setToolTip( tr( "Cursor position" ) );
    
    label = ( mLabels[ltSaveState] = new QLabel( this ) );
    label->setToolTip( tr( "Modification state of file" ) );
    
    label = ( mLabels[ltEOLMode] = new QLabel( this ) );
    label->setToolTip( tr( "EOL mode" ) );
    
    label = ( mLabels[ltIndentMode] = new QLabel( this ) );
    label->setToolTip( tr( "Indentation mode" ) );
    
    // add labels
    for ( int i = ltCursorPosition; i < ltIndentMode +1; i++ )
    {
        label = mLabels[ i ];
        addPermanentWidget( label );
        label->setMargin( 2 );
        label->setFrameStyle( QFrame::NoFrame );
        label->setAttribute( Qt::WA_MacSmallSize );
    }
    
    // force remove statusbar label frame
    setStyleSheet( "QStatusBar::item { border: 0px; }" );
    
    // connections
    connect( this, SIGNAL( messageChanged( const QString& ) ), this, SLOT( setMessage( const QString& ) ) );
}
SectorExportOptionsDialog::SectorExportOptionsDialog(QWidget *parent) : QDialog(parent)
{
    QGridLayout *layout = new QGridLayout(this);
    layout->setMargin(12);
    QLabel *l = new QLabel("Export shortest paths only",this);
    l->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    QLabel *l1 = new QLabel("Consider paths with garden planets only",this);
    l1->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
    this->setWindowTitle("Export sector options");
    this->chkDirectRoutesOnly = new QCheckBox(this);
    this->chkGardenRoutesOnly = new QCheckBox(this);

    l->setMargin(6);
    l1->setMargin(6);
    this->chkDirectRoutesOnly->setChecked(true);
    this->chkGardenRoutesOnly->setChecked(false);

    layout->addWidget(l,0,0);
    layout->addWidget(this->chkDirectRoutesOnly,0,1);
    layout->addWidget(l1,1,0);
    layout->addWidget(this->chkGardenRoutesOnly,1,1);

    QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
    bb->setCenterButtons(true);
    connect(bb,&QDialogButtonBox::accepted,this, &QDialog::accept);
    connect(bb,&QDialogButtonBox::rejected,this, &QDialog::reject);
    layout->addWidget(bb,2,0,1,2);

}
示例#12
0
 foreach(QString label, labelList)
 {
     QLabel * qlabel = new QLabel(label);
     qlabel->setMargin(10);
     Glayout->addWidget(qlabel, 0, i);
     i++;
 }
示例#13
0
//! [3]
QLabel *Window::createLabel(const QString &text)
{
    QLabel *label = new QLabel(text);
    label->setAlignment(Qt::AlignCenter);
    label->setMargin(2);
    label->setFrameStyle(QFrame::Box | QFrame::Sunken);
    return label;
}
示例#14
0
void
MessageBar::show( const QString& message, const QString& id )
{    
    QLabel* label = findChild<QLabel*>( id );
    
    if (label && id.size()) {
        if (message.isEmpty())
        {
            QProgressBar* p = label->findChild<QProgressBar*>();
            if (p)
                p->setRange( 0, 1 ),
                p->setValue( 1 );
            QTimer::singleShot( 3000, label, SLOT(deleteLater()) );
        }
        else
            label->setText( message );
        return;
    }
    
    label = new QLabel( message, ui.papyrus );
    label->setBackgroundRole( QPalette::Base );
    label->setMargin( 8 );
    label->setIndent( 4 );
    label->setTextFormat( Qt::RichText );
    label->setOpenExternalLinks( true );
    label->setTextInteractionFlags( Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse );
    
    ImageButton* close = new ImageButton( ":/buckets/radio_clear_all_x.png" );
    QHBoxLayout* h = new QHBoxLayout( label );
    h->addStretch();
    
    if (id.size())
    {
        label->setObjectName( id );
        
        QProgressBar* p;
        h->addWidget( p = new QProgressBar );
        p->setRange( 0, 0 );
        p->setFixedWidth( 90 );
    }

    h->addWidget( close );
    h->setMargin( 4 );
    
    label->setFixedWidth( width() );
    label->adjustSize();
    label->show();
    
    ui.papyrus->move( 0, -label->height() );

    doLayout();
    
    connect( close, SIGNAL(clicked()), label, SLOT(deleteLater()) );    
    connect( label, SIGNAL(destroyed()), SLOT(onLabelDestroyed()), Qt::QueuedConnection );
        
    m_timeline->setFrameRange( height(), ui.papyrus->height() );
    m_timeline->start();
}
void TargetSettingsPanelWidget::setupUi()
{
    QVBoxLayout *viewLayout = new QVBoxLayout(this);
    viewLayout->setMargin(0);
    viewLayout->setSpacing(0);

    m_selector = new TargetSettingsWidget(this);
    viewLayout->addWidget(m_selector);

    // Setup our container for the contents:
    m_centralWidget = new QStackedWidget(this);
    m_selector->setCentralWidget(m_centralWidget);

    // no target label:
    m_noTargetLabel = new QWidget;
    QVBoxLayout *noTargetLayout = new QVBoxLayout(m_noTargetLabel);
    noTargetLayout->setMargin(0);
    QLabel *label = new QLabel(m_noTargetLabel);
    label->setText(tr("No kit defined in this project."));
    {
        QFont f = label->font();
        f.setPointSizeF(f.pointSizeF() * 1.4);
        f.setBold(true);
        label->setFont(f);
    }
    label->setMargin(10);
    label->setAlignment(Qt::AlignTop);
    noTargetLayout->addWidget(label);
    noTargetLayout->addStretch(10);
    m_centralWidget->addWidget(m_noTargetLabel);

    foreach (Target *t, m_project->targets())
        targetAdded(t);

    // Now set the correct target
    int index = m_targets.indexOf(m_project->activeTarget());
    m_selector->setCurrentIndex(index);
    m_selector->setCurrentSubIndex(0);

    currentTargetChanged(index, 0);

    connect(m_selector, SIGNAL(currentChanged(int,int)),
            this, SLOT(currentTargetChanged(int,int)));
    connect(m_selector, SIGNAL(removeButtonClicked(int)),
            this, SLOT(removeTarget(int)));
    connect(m_selector, SIGNAL(manageButtonClicked()),
            this, SLOT(openTargetPreferences()));
    connect(m_selector, SIGNAL(toolTipRequested(QPoint,int)),
            this, SLOT(showTargetToolTip(QPoint,int)));

    m_selector->setAddButtonMenu(m_addMenu);
    connect(m_addMenu, SIGNAL(triggered(QAction*)),
            this, SLOT(addTarget(QAction*)));

    updateTargetAddAndRemoveButtons();
}
示例#16
0
        foreach(Image * img, imageList)
        {
            QString jour = labelList.at(i - 1);
            QLabel * qlabel = new QLabel(jour);
            qlabel->setMargin(10);
            Glayout->addWidget(qlabel, i, 0);

            int j = 1;
            foreach(Image * img2, imageList)
            {
                double correlation = img->correlation(img2);
                QString stringCorr = (new QString())->number(correlation);

                QLabel * labelCorr = new QLabel(stringCorr);
                labelCorr->setMargin(10);
                Glayout->addWidget(labelCorr, i, j);

                j++;
            }
示例#17
0
void BrowserWindow::createToolBar()
{
    toolBar = new QToolBar(tr("Navigation"), this);
#ifdef Q_WS_MAC
    toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
#endif
    toolBar->addAction(webView->pageAction(QWebPage::Back));
    toolBar->addAction(webView->pageAction(QWebPage::Forward));
    toolBar->addAction(webView->pageAction(QWebPage::Reload));
    toolBar->addAction(webView->pageAction(QWebPage::Stop));
    toolBar->addSeparator();
    toolBar->addAction(zoomOutAction);
    toolBar->addAction(zoomInAction);
    toolBar->addSeparator();
    zoomSpinBox = new QSpinBox;
    zoomSpinBox->setSingleStep(ZoomStepSize);
    zoomSpinBox->setRange(25, 250);
    zoomSpinBox->setValue(100);
    zoomSpinBox->setSuffix(tr("%"));
    zoomSpinBox->setFocusPolicy(Qt::NoFocus);
    QLabel *zoomLabel = new QLabel(tr("Zoom"));
    zoomLabel->setMargin(4);
    progressBar = new QProgressBar;
    progressLabel = new QLabel(tr("Progress"));
    progressLabel->setMargin(4);
#ifndef Q_WS_MAC
    toolBar->addWidget(zoomLabel);
    toolBar->addWidget(zoomSpinBox);
    toolBar->addSeparator();
    toolBar->addAction(setUrlAction);
    toolBar->addAction(historyAction);
    toolBar->addWidget(progressLabel);
    toolBar->addWidget(progressBar);
#else
    QWidget *zoomWidget = new QWidget;
    QVBoxLayout *zoomLayout = new QVBoxLayout;
    zoomLayout->addWidget(zoomSpinBox);
    zoomLayout->addWidget(zoomLabel);
    zoomLayout->setAlignment(zoomLabel, Qt::AlignCenter);
    zoomWidget->setLayout(zoomLayout);
    toolBar->addWidget(zoomWidget);
    toolBar->addSeparator();
    toolBar->addAction(setUrlAction);
    toolBar->addAction(historyAction);
    QWidget *progressWidget = new QWidget;
    QVBoxLayout *progressLayout = new QVBoxLayout;
    progressLayout->setAlignment(Qt::AlignCenter);
    progressLayout->addWidget(progressBar);
    progressLayout->addWidget(progressLabel);
    progressLayout->setAlignment(progressLabel, Qt::AlignCenter);
    progressWidget->setLayout(progressLayout);
    toolBar->addWidget(progressWidget);
#endif
}
QLabel* CToolClass::explanationLabel(QWidget* parent, const QString& heading, const QString& text ) {
	QString br;
	if (!heading.isEmpty()) {
		br = QString::fromLatin1("<BR/>");
	}
	QLabel* label = new QLabel( QString::fromLatin1("<B>%1</B>%2%3").arg(heading).arg(br).arg(text),parent );	
	
	label->setWordWrap(true);
	label->setMargin(1);
	label->setFrameStyle(QFrame::Box | QFrame::Plain);
	return label;
}
示例#19
0
void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col, bool minimize)
{
  QLabel *label = new QLabel(this);
  label->setFrameShape(QFrame::Panel);
  label->setFrameShadow(QFrame::Raised);
  label->setMidLineWidth(0);
  label->setAlignment(Qt::AlignCenter);
  label->setMargin(5);
  label->setText(text);
  if (!minimize)
    label->setMinimumWidth(100);
  gridLayout->addWidget(label, 0, col, 1, 1);
}
示例#20
0
Speed::Speed(QWidget *parent): QWidget(parent)
{
	QHBoxLayout *layout = new QHBoxLayout();
	layout->setSpacing(0);
	layout->setMargin(0);
	
	setStyleSheet("padding: 0;");
	
		QVBoxLayout *contentLayout = new QVBoxLayout();
		contentLayout->setSpacing(2);
		contentLayout->setMargin(0);
		contentLayout->setContentsMargins(0, 2, 0, 0);
		
		QWidget *content = new QWidget();
		content->setLayout(contentLayout);
		content->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
			
			QStackedLayout *speedometerLayout = new QStackedLayout(contentLayout);
			speedometerLayout->setSpacing(2);
			speedometerLayout->setMargin(0);
			speedometerLayout->setContentsMargins(0, 2, 0, 0);
			speedometerLayout->setStackingMode(QStackedLayout::StackAll);
			
			speedometerNeedle = new RotatableImageView(":/resources/speedometer-needle_160x160.png");
			speedometerNeedle->rotate(-129);
			speedometerLayout->addWidget(speedometerNeedle);
			
			QLabel *speedometer = new QLabel();
			speedometer->setPixmap(QPixmap(":/resources/speedometer_160x160.png"));
			speedometer->setMargin(2);
			speedometerLayout->addWidget(speedometer);
			
			speedometerLabel = new QLabel("N/A");
			speedometerLabel->setAlignment(Qt::AlignCenter);
			speedometerLabel->setStyleSheet("font: 13pt; font-weight: bold;");
			contentLayout->addWidget(speedometerLabel);
		
		TitledBox *box = new TitledBox(tr("Speed"), content);
		layout->addWidget(box);
		
	QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect();
	dropShadow->setBlurRadius(6);
	dropShadow->setColor(QColor(0, 0, 0));
	dropShadow->setOffset(0, 0);
	
	setGraphicsEffect(dropShadow);
	
	setLayout(layout);
}
示例#21
0
/** Add the optional message in a light yellow box to the layout
 *
 * @param mainLay :: layout
 */
void AlgorithmDialog::addOptionalMessage(QVBoxLayout *mainLay) {
  QLabel *inputMessage = new QLabel(this);
  inputMessage->setFrameStyle(QFrame::Panel | QFrame::Sunken);
  QPalette pal = inputMessage->palette();
  pal.setColor(inputMessage->backgroundRole(),
               QColor(255, 255, 224)); // Light yellow
  pal.setColor(inputMessage->foregroundRole(), Qt::black);
  inputMessage->setPalette(pal);
  inputMessage->setAutoFillBackground(true);
  inputMessage->setWordWrap(true);
  inputMessage->setAlignment(Qt::AlignJustify);
  inputMessage->setMargin(3);
  inputMessage->setText(getOptionalMessage());
  QHBoxLayout *msgArea = new QHBoxLayout;
  msgArea->addWidget(inputMessage);
  mainLay->addLayout(msgArea, 0);
}
示例#22
0
DevStatus::DevStatus(QWidget *p)
 : QStatusBar(p)
{
	QLabel *l;
	
	for ( int p = DevQt::General; p < DevQt::None; p++ )
	{
		l = new QLabel;
		l->setIndent(2);
		l->setMargin(2);
		l->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
		l->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);
		l->setFixedWidth(fontMetrics().width("XXXXXXXXXXXXXXXXXXXXXXX"));
		addWidget(l);
		v.prepend(l);
	}
	
	connect(this, SIGNAL( messageChanged(const QString&) ),
			this, SLOT  ( clearMessage() ) );
}
示例#23
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QWidget *window = new QWidget;
    QVBoxLayout *layout = new QVBoxLayout(window);
    QLabel *title = new QLabel("Some items from the directory model", window);
    title->setBackgroundRole(QPalette::Base);
    title->setMargin(8);
    layout->addWidget(title);
    
//! [0]
    QFileSystemModel *model = new QFileSystemModel;
    QModelIndex parentIndex = model->index(QDir::currentPath());
    int numRows = model->rowCount(parentIndex);
//! [0]

//! [1]
    for (int row = 0; row < numRows; ++row) {
        QModelIndex index = model->index(row, 0, parentIndex);
//! [1]

//! [2]
        QString text = model->data(index, Qt::DisplayRole).toString();
        // Display the text in a widget.
//! [2]

        QLabel *label = new QLabel(text, window);
        layout->addWidget(label);
//! [3]
    }
//! [3]

    window->setWindowTitle("A simple model example");
    window->show();
    return app.exec();
}
示例#24
0
// ** New Widget Dialog
void BaulkInterfaceDialog::newWidgetDialogLoader() {
	newWidgetDialog = new BaulkDialog( parentWidget );

	BaulkControl *control = (BaulkControl*)parentWidget;

	// Window Title
	newWidgetDialog->setWindowTitle( tr("New Widget") );

	// Layout
	QVBoxLayout *layout = new QVBoxLayout;
	layout->setContentsMargins( 0,0,0,0 );
	newWidgetDialog->setLayout( layout );

	// Title
	QLabel *title = new QLabel( tr("<big><b>Select a widget to create:</b></big>") );
	title->setWordWrap( true );
	title->setMargin( 5 );
	layout->addWidget( title );

	// ListView
	newListView = new QListView;
	newListView->setEditTriggers( QAbstractItemView::NoEditTriggers );
	QStringList list = control->libraryList().name;
	list << tr("Close Menu");
	newListViewModel = new QStringListModel( list );
	newListView->setModel( newListViewModel );
	layout->addWidget( newListView );

	// Show Dialog
	newWidgetDialog->show();

	// Connections
	connect( newListView, SIGNAL( activated( QModelIndex ) ), 
		this, SLOT( newWidgetAccepted( QModelIndex ) ) );
	connect( this, SIGNAL( newWidget( LibraryLoader* ) ), 
		control, SLOT( loadMainWidget( LibraryLoader* ) ) );
}
示例#25
0
K3b::Splash::Splash( QWidget* parent )
    : KVBox( parent)
{
    setMargin( 0 );
    setSpacing( 0 );
    setAttribute( Qt::WA_DeleteOnClose );
    setWindowFlags(Qt::FramelessWindowHint|
                   Qt::SplashScreen|
                   Qt::WindowStaysOnTopHint|
                   Qt::X11BypassWindowManagerHint);

    QPalette pal( palette() );
    pal.setColor( QPalette::Window, Qt::black );
    pal.setColor( QPalette::WindowText, Qt::white );
    setPalette( pal );

    QLabel* copyrightLabel = new QLabel( KGlobal::mainComponent().aboutData()->copyrightStatement(), this );
    copyrightLabel->setMargin( 5 );
    copyrightLabel->setAlignment( Qt::AlignRight );

    QLabel* picLabel = new QLabel( this );
    if( K3b::Theme* theme = k3bappcore->themeManager()->currentTheme() ) {
        picLabel->setPalette( theme->palette() );
        picLabel->setPixmap( theme->pixmap( K3b::Theme::SPLASH ) );
    }

    m_infoBox = new QLabel( this );
    m_infoBox->setMargin( 5 );

    // Set geometry, with support for Xinerama systems
    QRect r;
    r.setSize(sizeHint());
    int ps = QApplication::desktop()->primaryScreen();
    r.moveCenter( QApplication::desktop()->screenGeometry(ps).center() );
    setGeometry(r);
}
MainWidget::MainWidget(QWidget* parent)
  :QWidget(parent),
   mp_glwidget(0),
   mp_box(0),
   mp_timer(0),
   m_tick_timer(),
   mp_fps_timer(0),
   m_current_fps(0),
   m_fps_counter(0)
{
  // build main window components and layout
  {
    // buttons setup
    {
      mp_buttons[0]    = new QPushButton(tr("Forward (W)" ));
      mp_buttons[1]    = new QPushButton(tr("Left (A)"    ));
      mp_buttons[2]    = new QPushButton(tr("Backward (S)"));
      mp_buttons[3]    = new QPushButton(tr("Right (D)"   ));

      m_button_keys[0] = Qt::Key_W;
      m_button_keys[1] = Qt::Key_A;
      m_button_keys[2] = Qt::Key_S;
      m_button_keys[3] = Qt::Key_D;

      for (int i=0; i<4; i++)
        mp_buttons[i]->setFocusPolicy(Qt::NoFocus);
    }

    // create main components
    mp_glwidget          = new GLDemoWidget;
    mp_box               = new QGroupBox;
    QBoxLayout*  box_l   = new QHBoxLayout(mp_box);
    QGridLayout* layout  = new QGridLayout;

    QLabel* label = new QLabel
      (QString(tr("Shaolin Sheep (c) 2006  Sylvain Bernier\n"))+
       QString(tr("< *****@*****.** >\n"))+
       QString(tr("Version %1\n")).arg(SS_VERSION)+
       QString(tr("This is free software, see the file COPYING.\n")));
    {
      label->setAlignment(Qt::AlignTop);
      label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
      label->setLineWidth(2);
      label->setMargin(2);
    }

    QLabel* label2 = new QLabel
      (tr(" Click on the scene to (des)activate camera control. Press [SpaceBar] to jump. Protect the sheep! (or try right clicking) "));
    {
      label2->setAlignment(Qt::AlignTop | Qt::AlignCenter);
      label2->setFrameStyle(QFrame::Box | QFrame::Sunken);
      label2->setLineWidth(1);
      label->setMargin(1);
    }

    // create main layout
    layout->addWidget(mp_box,        0, 0, 1, 4);
    layout->addWidget(mp_buttons[0], 1, 1      );
    layout->addWidget(mp_buttons[1], 2, 0      );
    layout->addWidget(mp_buttons[2], 2, 1      );
    layout->addWidget(mp_buttons[3], 2, 2      );
    layout->addWidget(label,         1, 3, 2, 1);
    layout->addWidget(label2,        3, 0, 1, 4);
    layout->setRowStretch(0, 1);
    layout->setRowMinimumHeight(0, 200);
    setLayout(layout);

    mp_box->setTitle(tr("Welcome! "));
    box_l->addWidget(mp_glwidget);
    resize(625, 550);
  }

  // initialize main application timer
  mp_timer = new QTimer;
  connect(mp_timer, SIGNAL(timeout()), this, SLOT(tick()));
  mp_timer->start(TICK_INTERVAL);
  m_tick_timer.start();

  // initialize 'frame per second' timer
  mp_fps_timer = new QTimer;
  connect(mp_fps_timer, SIGNAL(timeout()), this, SLOT(fps_tick()));
  mp_fps_timer->start(1000);
}
示例#27
0
SpiceDialog::SpiceDialog(SpiceFile *c, Schematic *d)
			: QDialog(d, 0, TRUE, Qt::WDestructiveClose)
{
  resize(400, 250);
  setCaption(tr("Edit SPICE Component Properties"));
  Comp = c;
  Doc  = d;

  all = new QVBoxLayout(this); // to provide neccessary size
  QWidget *myParent = this;

  Expr.setPattern("[^\"=]+");  // valid expression for property 'edit' etc
  Validator = new QRegExpValidator(Expr, this);
  Expr.setPattern("[\\w_]+");  // valid expression for property 'NameEdit' etc
  ValRestrict = new QRegExpValidator(Expr, this);


  // ...........................................................
  QGridLayout *topGrid = new QGridLayout(0, 4,3,3,3);
  all->addLayout(topGrid);

  topGrid->addWidget(new QLabel(tr("Name:"), myParent), 0,0);
  CompNameEdit = new QLineEdit(myParent);
  CompNameEdit->setValidator(ValRestrict);
  topGrid->addWidget(CompNameEdit, 0,1);
  connect(CompNameEdit, SIGNAL(returnPressed()), SLOT(slotButtOK()));

  topGrid->addWidget(new QLabel(tr("File:"), myParent), 1,0);
  FileEdit = new QLineEdit(myParent);
  FileEdit->setValidator(ValRestrict);
  topGrid->addWidget(FileEdit, 1,1);
  connect(FileEdit, SIGNAL(returnPressed()), SLOT(slotButtOK()));

  ButtBrowse = new QPushButton(tr("Browse"), myParent);
  topGrid->addWidget(ButtBrowse, 1,2);
  connect(ButtBrowse, SIGNAL(clicked()), SLOT(slotButtBrowse()));

  ButtEdit = new QPushButton(tr("Edit"), myParent);
  topGrid->addWidget(ButtEdit, 2,2);
  connect(ButtEdit, SIGNAL(clicked()), SLOT(slotButtEdit()));

  FileCheck = new QCheckBox(tr("show file name in schematic"), myParent);
  topGrid->addWidget(FileCheck, 2,1);

  SimCheck = new QCheckBox(tr("include SPICE simulations"), myParent);
  topGrid->addWidget(SimCheck, 3,1);

  QHBox *h1 = new QHBox(myParent);
  h1->setSpacing(5);
  PrepCombo = new QComboBox(h1);
  PrepCombo->insertItem("none");
  PrepCombo->insertItem("ps2sp");
  PrepCombo->insertItem("spicepp");
  PrepCombo->insertItem("spiceprm");
  QLabel * PrepLabel = new QLabel(tr("preprocessor"), h1);
  PrepLabel->setMargin(5);
  topGrid->addWidget(h1, 4,1);
  connect(PrepCombo, SIGNAL(activated(int)), SLOT(slotPrepChanged(int)));

  // ...........................................................
  QGridLayout *midGrid = new QGridLayout(0, 2,3,5,5);
  all->addLayout(midGrid);

  midGrid->addWidget(new QLabel(tr("SPICE net nodes:"), myParent), 0,0);
  NodesList = new QListBox(myParent);
  midGrid->addWidget(NodesList, 1,0);
  connect(NodesList, SIGNAL(doubleClicked(QListBoxItem*)),
	SLOT(slotAddPort(QListBoxItem*)));
  
  QVBox *v0 = new QVBox(myParent);
  v0->setSpacing(5);
  midGrid->addWidget(v0, 1,1);
  ButtAdd = new QPushButton(tr("Add >>"), v0);
  connect(ButtAdd, SIGNAL(clicked()), SLOT(slotButtAdd()));
  ButtRemove = new QPushButton(tr("<< Remove"), v0);
  connect(ButtRemove, SIGNAL(clicked()), SLOT(slotButtRemove()));
  v0->setStretchFactor(new QWidget(v0), 5); // stretchable placeholder

  midGrid->addWidget(new QLabel(tr("Component ports:"), myParent), 0,2);
  PortsList = new QListBox(myParent);
  midGrid->addWidget(PortsList, 1,2);
  connect(PortsList, SIGNAL(doubleClicked(QListBoxItem*)),
	SLOT(slotRemovePort(QListBoxItem*)));
  

  // ...........................................................
  QHBox *h0 = new QHBox(this);
  h0->setSpacing(5);
  all->addWidget(h0);
  connect(new QPushButton(tr("OK"),h0), SIGNAL(clicked()),
	  SLOT(slotButtOK()));
  connect(new QPushButton(tr("Apply"),h0), SIGNAL(clicked()),
	  SLOT(slotButtApply()));
  connect(new QPushButton(tr("Cancel"),h0), SIGNAL(clicked()),
	  SLOT(slotButtCancel()));

  // ------------------------------------------------------------
  CompNameEdit->setText(Comp->Name);
  changed = false;

  // insert all properties into the ListBox
  Property *pp = Comp->Props.first();
  FileEdit->setText(pp->Value);
  FileCheck->setChecked(pp->display);
  SimCheck->setChecked(Comp->Props.at(2)->Value == "yes");
  for(int i=0; i<PrepCombo->count(); i++) {
    if(PrepCombo->text(i) == Comp->Props.at(3)->Value) {
      PrepCombo->setCurrentItem(i);
      currentPrep = i;
      break;
    }
  }

  loadSpiceNetList(pp->Value);  // load netlist nodes
}
示例#28
0
void MonitorDmxMode::initToolBar(QToolBar* toolBar)
{
    QActionGroup* group;
    QAction* action;

    /* Font */
    toolBar->addAction(QIcon(":/fonts.png"), tr("Font"),
                       this, SLOT(slotChooseFont()));

    toolBar->addSeparator();

    /* Channel style */
    group = new QActionGroup(this);
    group->setExclusive(true);

    action = toolBar->addAction(tr("DMX Channels"));
    action->setToolTip(tr("Show absolute DMX channel numbers"));
    action->setCheckable(true);
    action->setData(MonitorProperties::DMXChannels);
    connect(action, SIGNAL(triggered(bool)),
            this, SLOT(slotChannelStyleTriggered()));
    toolBar->addAction(action);
    group->addAction(action);
    if (props()->channelStyle() == MonitorProperties::DMXChannels)
        action->setChecked(true);

    action = toolBar->addAction(tr("Relative Channels"));
    action->setToolTip(tr("Show channel numbers relative to fixture"));
    action->setCheckable(true);
    action->setData(MonitorProperties::RelativeChannels);
    connect(action, SIGNAL(triggered(bool)),
            this, SLOT(slotChannelStyleTriggered()));
    toolBar->addAction(action);
    group->addAction(action);
    if (props()->channelStyle() == MonitorProperties::RelativeChannels)
        action->setChecked(true);

    toolBar->addSeparator();

    /* Value display style */
    group = new QActionGroup(this);
    group->setExclusive(true);

    action = toolBar->addAction(tr("DMX Values"));
    action->setToolTip(tr("Show DMX values 0-255"));
    action->setCheckable(true);
    action->setData(MonitorProperties::DMXValues);
    connect(action, SIGNAL(triggered(bool)),
            this, SLOT(slotValueStyleTriggered()));
    toolBar->addAction(action);
    group->addAction(action);
    action->setChecked(true);
    if (props()->valueStyle() == MonitorProperties::DMXValues)
        action->setChecked(true);

    action = toolBar->addAction(tr("Percent Values"));
    action->setToolTip(tr("Show percentage values 0-100%"));
    action->setCheckable(true);
    action->setData(MonitorProperties::PercentageValues);
    connect(action, SIGNAL(triggered(bool)),
            this, SLOT(slotValueStyleTriggered()));
    toolBar->addAction(action);
    group->addAction(action);
    if (props()->valueStyle() == MonitorProperties::PercentageValues)
        action->setChecked(true);

    /* Universe combo box */
    toolBar->addSeparator();

    QLabel *uniLabel = new QLabel(tr("Universe"));
    uniLabel->setMargin(5);
    toolBar->addWidget(uniLabel);

    QComboBox *uniCombo = new QComboBox(monitor());
    uniCombo->addItem(tr("All universes"), Universe::invalid());
    for (quint32 i = 0; i < doc()->inputOutputMap()->universes(); i++)
    {
        quint32 uniID = doc()->inputOutputMap()->getUniverseID(i);
        uniCombo->addItem(doc()->inputOutputMap()->getUniverseNameByIndex(i), uniID);
    }
    connect(uniCombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(slotUniverseSelected(int)));
    toolBar->addWidget(uniCombo);
}
示例#29
0
NickServRuleEditor::NickServRuleEditor(QWidget * par,bool bUseServerMaskField)
: QDialog(par)
{
	setWindowTitle(__tr2qs_ctx("NickServ Authentication Rule - KVIrc","options"));

	QGridLayout * gl = new QGridLayout(this);//,bUseServerMaskField ? 7 : 6,4,10,5);

	QLabel * l = new QLabel(__tr2qs_ctx("Registered nickname:","options"),this);
	gl->addWidget(l,0,0);

	m_pRegisteredNickEdit = new QLineEdit(this);
	KviTalToolTip::add(m_pRegisteredNickEdit, __tr2qs_ctx("Put here the nickname that you have registered with NickServ","options"));
	gl->addWidget(m_pRegisteredNickEdit,0,1,1,3);
//	gl->addMultiCellWidget(m_pRegisteredNickEdit,0,0,1,3);

	l = new QLabel(__tr2qs_ctx("NickServ mask:","options"),this);
	gl->addWidget(l,1,0);

	m_pNickServMaskEdit = new QLineEdit(this);
	KviTalToolTip::add(m_pNickServMaskEdit,
		__tr2qs_ctx("This is the mask that NickServ must match to be correctly identified as the NickServ service. "  \
			"This usually will be something like <b>[email protected]</b>.<br>" \
			"You can use wildcards for this field, but generally it is a security flaw. " \
			"If you're 100%% sure that NO user on the network can use the nickname \"NickServ\", " \
			"the mask <b>NickServ!*@*</b> may be safe to use in this field.","options"));
	gl->addWidget(m_pNickServMaskEdit,1,1,1,3);
//	gl->addMultiCellWidget(m_pNickServMaskEdit,1,1,1,3);

	l = new QLabel(__tr2qs_ctx("Message regexp:","options"),this);
	gl->addWidget(l,2,0);

	m_pMessageRegexpEdit = new QLineEdit(this);
	gl->addWidget(m_pMessageRegexpEdit,2,1,1,3);
//	gl->addMultiCellWidget(m_pMessageRegexpEdit,2,2,1,3);

	KviTalToolTip::add(m_pMessageRegexpEdit,
		__tr2qs_ctx("This is the simple regular expression that the identification request message "  \
			"from NickServ must match in order to be correctly recognized.<br>" \
			"The message is usually something like \"To identify yourself please use /ns IDENTIFY password\" " \
			"and it is sent when the NickServ wants you to authenticate yourself. " \
			"You can use the * and ? wildcards.","options"));
	l = new QLabel(__tr2qs_ctx("Identify command:","options"),this);
	gl->addWidget(l,3,0);

	m_pIdentifyCommandEdit = new QLineEdit(this);
	KviTalToolTip::add(m_pIdentifyCommandEdit,
		__tr2qs_ctx("This is the command that will be executed when NickServ requests authentication " \
			"for the nickname described in this rule (if the both server and NickServ mask are matched). " \
			"This usually will be something like <b>msg NickServ identify &lt;yourpassword&gt;</b>.<br>" \
			"You can use <b>msg -q</b> if you don't want the password echoed on the screen. " \
			"Please note that there is no leading slash in this command.","options"));
	gl->addWidget(m_pIdentifyCommandEdit,3,1,1,3);
//	gl->addMultiCellWidget(m_pIdentifyCommandEdit,3,3,1,3);

	int iNextLine = 4;

	if(bUseServerMaskField)
	{
		l = new QLabel(__tr2qs_ctx("Server mask:","options"),this);
		gl->addWidget(l,4,0);

		m_pServerMaskEdit = new QLineEdit(this);
		KviTalToolTip::add(m_pServerMaskEdit,
			__tr2qs_ctx("This is the mask that the current server must match in order " \
			"for this rule to apply. It can contain * and ? wildcards.<br>Do NOT use simply \"*\" here...","options"));
		gl->addWidget(m_pServerMaskEdit,4,1,1,3);
//		gl->addMultiCellWidget(m_pServerMaskEdit,4,4,1,3);
		iNextLine++;
	} else {
		m_pServerMaskEdit = 0;
	}


	l = new QLabel(__tr2qs_ctx("Hint: Move the mouse cursor over the fields to get help","options"),this);
	l->setMargin(10);
	gl->addWidget(l,iNextLine,0,1,4);
//	gl->addMultiCellWidget(l,iNextLine,iNextLine,0,3);

	iNextLine++;

	QPushButton * p = new QPushButton(__tr2qs_ctx("Cancel","options"),this);
	p->setMinimumWidth(100);
	connect(p,SIGNAL(clicked()),this,SLOT(reject()));
	gl->addWidget(p,iNextLine,2);

	m_pOkButton = new QPushButton(__tr2qs_ctx("OK","options"),this);
	m_pOkButton->setMinimumWidth(100);
	m_pOkButton->setDefault(true);
	connect(m_pOkButton,SIGNAL(clicked()),this,SLOT(okPressed()));
	gl->addWidget(m_pOkButton,iNextLine,3);

	gl->setColumnStretch(1,1);
	gl->setRowStretch(bUseServerMaskField ? 5 : 4,1);

	setMinimumWidth(250);
}
示例#30
0
CursorView::CursorView()			// construct view
{
    struct List {
	CursorShape	shape;
	const char*	name;			// cursor name
    };
    static List list[] = {
	{ ArrowCursor,		"arrowCursor" },
	{ UpArrowCursor,	"upArrowCursor" },
	{ CrossCursor,		"crossCursor" },
	{ WaitCursor,		"waitCursor" },
	{ IbeamCursor,		"ibeamCursor" },
	{ SizeVerCursor,	"sizeVerCursor" },
	{ SizeHorCursor,	"sizeHorCursor" },
	{ SizeBDiagCursor,	"sizeBDiagCursor" },
	{ SizeFDiagCursor,	"sizeFDiagCursor" },
	{ SizeAllCursor,	"sizeAllCursor" },
	{ BlankCursor,		"blankCursor" },
	{ SplitVCursor,		"splitVCursor" },
	{ SplitHCursor,		"splitHCursor" },
	{ PointingHandCursor,	"pointingHandCursor" },
	{ ForbiddenCursor,	"forbiddenCursor" },
	{ WhatsThisCursor,	"whatsThisCursor" },
	{ BusyCursor,		"busyCursor" }
    };

    setCaption( "CursorView" );			// set window caption

    QGridLayout* grid = new QGridLayout( this, 5, 4, 20 );
    QLabel *label;

    int i=0;
    for ( int y=0; y<4; y++ ) {			// create the small labels
	for ( int x=0; x<4; x++ ) {
	    label = new QLabel( this );
	    label->setCursor( QCursor( list[i].shape ) );
	    label->setText( list[i].name );
	    label->setAlignment( AlignCenter );
	    label->setMargin( 10 );
	    label->setFrameStyle( QFrame::Box | QFrame::Raised );
	    grid->addWidget( label, x, y );
	    i++;
	}
    }


    label = new QLabel( this );
    label->setCursor( QCursor( list[i].shape ) );
    label->setText( list[i].name );
    label->setAlignment( AlignCenter );
    label->setMargin( 10 );
    label->setFrameStyle( QFrame::Box | QFrame::Raised );
    grid->addWidget( label, 4, 0 );


    
    QBitmap cb( cb_width, cb_height, cb_bits, TRUE );
    QBitmap cm( cm_width, cm_height, cm_bits, TRUE );
    QCursor custom( cb, cm );			// create bitmap cursor

    label = new QLabel( this );			// create the big label
    label->setCursor( custom );
    label->setText( "Custom bitmap cursor" );
    label->setAlignment( AlignCenter );
    label->setMargin( 10 );
    label->setFrameStyle( QFrame::Box | QFrame::Sunken );
    grid->addMultiCellWidget( label, 4, 4, 1, 3 );

}