本文整理汇总了C++中QLabel::setMargin方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setMargin方法的具体用法?C++ QLabel::setMargin怎么用?C++ QLabel::setMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setMargin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
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()));
}
示例2: principal
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();
}
示例3: actionsDialogLoader
// 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();
}
示例4: QGridLayout
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++;
}
}
示例5: configurationDialogLoader
// ** 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();
}
示例6: QLabel
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;
}
示例7: QDialog
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()));
}
示例8: initView
/**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());
}
示例9: QStatusBar
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& ) ) );
}
示例10: QDialog
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);
}
示例11: foreach
foreach(QString label, labelList)
{
QLabel * qlabel = new QLabel(label);
qlabel->setMargin(10);
Glayout->addWidget(qlabel, 0, i);
i++;
}
示例12: QLabel
//! [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;
}
示例13: SLOT
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();
}
示例14: setupUi
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();
}
示例15: createToolBar
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
}