本文整理汇总了C++中QLabel::setFont方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setFont方法的具体用法?C++ QLabel::setFont怎么用?C++ QLabel::setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createView
GUI::GUI() {
mStreamingMode = STREAMING_MODE_STORE_ALL_FRAMES;
QScreen* screen = QGuiApplication::primaryScreen();
menuWidth = screen->geometry().width()*(1.0f/6.0f);
mPipelineWidget = nullptr;
mStreamer = ImageFileStreamer::New();
QVBoxLayout* viewLayout = new QVBoxLayout;
View* view = createView();
view->set2DMode();
view->setBackgroundColor(Color::Black());
setWidth(screen->geometry().width());
setHeight(screen->geometry().height());
enableMaximized();
setTitle("FAST - Viewer");
viewLayout->addWidget(view);
menuLayout = new QVBoxLayout;
menuLayout->setAlignment(Qt::AlignTop);
// Logo
QImage* image = new QImage;
image->load((Config::getDocumentationPath() + "images/FAST_logo_square.png").c_str());
QLabel* logo = new QLabel;
logo->setPixmap(QPixmap::fromImage(image->scaled(menuWidth, ((float)menuWidth/image->width())*image->height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation)));
logo->adjustSize();
menuLayout->addWidget(logo);
// Title label
QLabel* title = new QLabel;
title->setText("Viewer");
QFont font;
font.setPixelSize(24 * getScalingFactor());
font.setWeight(QFont::Bold);
title->setFont(font);
title->setAlignment(Qt::AlignCenter);
menuLayout->addWidget(title);
// Quit button
QPushButton* quitButton = new QPushButton;
quitButton->setText("Quit (q)");
quitButton->setStyleSheet("QPushButton { background-color: red; color: white; }");
quitButton->setFixedWidth(menuWidth);
menuLayout->addWidget(quitButton);
// Connect the clicked signal of the quit button to the stop method for the window
QObject::connect(quitButton, &QPushButton::clicked, std::bind(&Window::stop, this));
QLabel* inputListLabel = new QLabel;
//inputListLabel->setFixedHeight(24);
inputListLabel->setText("Input data");
inputListLabel->setStyleSheet("QLabel { font-weight: bold; }");
menuLayout->addWidget(inputListLabel);
mList = new QListWidget;
mList->setFixedWidth(menuWidth);
mList->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
mList->setFixedHeight(200);
mList->setSelectionMode(QAbstractItemView::ExtendedSelection); // Allow multiple items to be selected
QObject::connect(mList, &QListWidget::itemSelectionChanged, std::bind(&GUI::selectInputData, this));
menuLayout->addWidget(mList);
QPushButton* addButton = new QPushButton;
addButton->setText("Add input data");
addButton->setFixedWidth(menuWidth);
QObject::connect(addButton, &QPushButton::clicked, std::bind(&GUI::addInputData, this));
menuLayout->addWidget(addButton);
QLabel* selectPipelineLabel = new QLabel;
selectPipelineLabel->setText("Active pipeline");
selectPipelineLabel->setStyleSheet("QLabel { font-weight: bold; }");
//selectPipelineLabel->setFixedHeight(24);
menuLayout->addWidget(selectPipelineLabel);
mSelectPipeline = new QComboBox;
mSelectPipeline->setFixedWidth(menuWidth);
mPipelines = getAvailablePipelines();
int index = 0;
int counter = 0;
for(auto pipeline : mPipelines) {
mSelectPipeline->addItem((pipeline.getName() + " (" + pipeline.getDescription() + ")").c_str());
if(pipeline.getName() == "Image renderer") {
index = counter;
}
++counter;
}
mSelectPipeline->setCurrentIndex(index);
menuLayout->addWidget(mSelectPipeline);
QObject::connect(mSelectPipeline, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), std::bind(&GUI::selectPipeline, this));
QPushButton* refreshPipeline = new QPushButton;
refreshPipeline->setText("Refresh pipeline");
refreshPipeline->setStyleSheet("QPushButton { background-color: blue; color: white; }");
refreshPipeline->setFixedWidth(menuWidth);
QObject::connect(refreshPipeline, &QPushButton::clicked, std::bind(&GUI::selectPipeline, this));
menuLayout->addWidget(refreshPipeline);
//.........这里部分代码省略.........
示例2: if
AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
PrefsItemData * data ) :
QWidget( _parent ), p_intf( _p_intf )
{
/* Find our module */
module_t *p_module = NULL;
p_config = NULL;
if( data->i_type == PrefsItemData::TYPE_CATEGORY )
return;
else if( data->i_type == PrefsItemData::TYPE_MODULE )
p_module = data->p_module;
else
{
p_module = module_get_main();
assert( p_module );
}
unsigned confsize;
p_config = module_config_get( p_module, &confsize );
module_config_t *p_item = p_config,
*p_end = p_config + confsize;
if( data->i_type == PrefsItemData::TYPE_SUBCATEGORY ||
data->i_type == PrefsItemData::TYPE_CATSUBCAT )
{
while (p_item < p_end)
{
if( p_item->i_type == CONFIG_SUBCATEGORY &&
( ( data->i_type == PrefsItemData::TYPE_SUBCATEGORY &&
p_item->value.i == data->i_object_id ) ||
( data->i_type == PrefsItemData::TYPE_CATSUBCAT &&
p_item->value.i == data->i_subcat_id ) ) )
break;
p_item++;
}
}
/* Widgets now */
global_layout = new QVBoxLayout();
global_layout->setMargin( 2 );
QString head;
QString help;
help = QString( data->help );
if( data->i_type == PrefsItemData::TYPE_SUBCATEGORY ||
data->i_type == PrefsItemData::TYPE_CATSUBCAT )
{
head = QString( data->name );
p_item++; // Why that ?
}
else
{
head = QString( qtr( module_GetLongName( p_module ) ) );
}
QLabel *titleLabel = new QLabel( head );
QFont titleFont = QApplication::font();
titleFont.setPointSize( titleFont.pointSize() + 6 );
titleLabel->setFont( titleFont );
// Title <hr>
QFrame *title_line = new QFrame;
title_line->setFrameShape(QFrame::HLine);
title_line->setFrameShadow(QFrame::Sunken);
QLabel *helpLabel = new QLabel( help, this );
helpLabel->setWordWrap( true );
global_layout->addWidget( titleLabel );
global_layout->addWidget( title_line );
global_layout->addWidget( helpLabel );
QGroupBox *box = NULL;
QGridLayout *boxlayout = NULL;
QScrollArea *scroller= new QScrollArea;
scroller->setFrameStyle( QFrame::NoFrame );
QWidget *scrolled_area = new QWidget;
QGridLayout *layout = new QGridLayout();
int i_line = 0, i_boxline = 0;
bool has_hotkey = false;
if( p_item ) do
{
if( ( ( data->i_type == PrefsItemData::TYPE_SUBCATEGORY &&
p_item->value.i != data->i_object_id ) ||
( data->i_type == PrefsItemData::TYPE_CATSUBCAT &&
p_item->value.i != data->i_subcat_id ) ) &&
( p_item->i_type == CONFIG_CATEGORY ||
p_item->i_type == CONFIG_SUBCATEGORY ) )
break;
if( p_item->b_internal ) continue;
if( p_item->i_type == CONFIG_SECTION )
{
if( box )
{
box->setLayout( boxlayout );
//.........这里部分代码省略.........
示例3: QWidget
// Configuration widget
CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *cmakeRunConfiguration, QWidget *parent)
: QWidget(parent), m_ignoreChange(false), m_cmakeRunConfiguration(cmakeRunConfiguration)
{
QFormLayout *fl = new QFormLayout();
fl->setMargin(0);
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
QLineEdit *argumentsLineEdit = new QLineEdit();
argumentsLineEdit->setText(cmakeRunConfiguration->commandLineArguments());
connect(argumentsLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(setArguments(QString)));
fl->addRow(tr("Arguments:"), argumentsLineEdit);
m_workingDirectoryEdit = new Utils::PathChooser();
m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
m_workingDirectoryEdit->setBaseDirectory(m_cmakeRunConfiguration->target()->project()->projectDirectory());
m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->baseWorkingDirectory());
m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory"));
QToolButton *resetButton = new QToolButton();
resetButton->setToolTip(tr("Reset to default"));
resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET)));
QHBoxLayout *boxlayout = new QHBoxLayout();
boxlayout->addWidget(m_workingDirectoryEdit);
boxlayout->addWidget(resetButton);
fl->addRow(tr("Working directory:"), boxlayout);
QCheckBox *runInTerminal = new QCheckBox;
fl->addRow(tr("Run in Terminal"), runInTerminal);
m_detailsContainer = new Utils::DetailsWidget(this);
m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);
QWidget *m_details = new QWidget(m_detailsContainer);
m_detailsContainer->setWidget(m_details);
m_details->setLayout(fl);
QVBoxLayout *vbx = new QVBoxLayout(this);
vbx->setMargin(0);;
vbx->addWidget(m_detailsContainer);
QLabel *environmentLabel = new QLabel(this);
environmentLabel->setText(tr("Run Environment"));
QFont f = environmentLabel->font();
f.setBold(true);
f.setPointSizeF(f.pointSizeF() *1.2);
environmentLabel->setFont(f);
vbx->addWidget(environmentLabel);
QWidget *baseEnvironmentWidget = new QWidget;
QHBoxLayout *baseEnvironmentLayout = new QHBoxLayout(baseEnvironmentWidget);
baseEnvironmentLayout->setMargin(0);
QLabel *label = new QLabel(tr("Base environment for this runconfiguration:"), this);
baseEnvironmentLayout->addWidget(label);
m_baseEnvironmentComboBox = new QComboBox(this);
m_baseEnvironmentComboBox->addItems(QStringList()
<< tr("Clean Environment")
<< tr("System Environment")
<< tr("Build Environment"));
m_baseEnvironmentComboBox->setCurrentIndex(m_cmakeRunConfiguration->baseEnvironmentBase());
connect(m_baseEnvironmentComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(baseEnvironmentComboBoxChanged(int)));
baseEnvironmentLayout->addWidget(m_baseEnvironmentComboBox);
baseEnvironmentLayout->addStretch(10);
m_environmentWidget = new ProjectExplorer::EnvironmentWidget(this, baseEnvironmentWidget);
m_environmentWidget->setBaseEnvironment(m_cmakeRunConfiguration->baseEnvironment());
m_environmentWidget->setBaseEnvironmentText(m_cmakeRunConfiguration->baseEnvironmentText());
m_environmentWidget->setUserChanges(m_cmakeRunConfiguration->userEnvironmentChanges());
vbx->addWidget(m_environmentWidget);
connect(m_workingDirectoryEdit, SIGNAL(changed(QString)),
this, SLOT(setWorkingDirectory()));
connect(resetButton, SIGNAL(clicked()),
this, SLOT(resetWorkingDirectory()));
connect(runInTerminal, SIGNAL(toggled(bool)),
this, SLOT(runInTerminalToggled(bool)));
connect(m_environmentWidget, SIGNAL(userChangesChanged()),
this, SLOT(userChangesChanged()));
connect(m_cmakeRunConfiguration, SIGNAL(baseWorkingDirectoryChanged(QString)),
this, SLOT(workingDirectoryChanged(QString)));
connect(m_cmakeRunConfiguration, SIGNAL(baseEnvironmentChanged()),
this, SLOT(baseEnvironmentChanged()));
connect(m_cmakeRunConfiguration, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
this, SLOT(userEnvironmentChangesChanged()));
setEnabled(m_cmakeRunConfiguration->isEnabled());
}
示例4: QWidget
QWidget *MemcheckErrorDelegate::createDetailsWidget(const QModelIndex &errorIndex, QWidget *parent) const
{
QWidget *widget = new QWidget(parent);
QVBoxLayout *layout = new QVBoxLayout;
// code + white-space:pre so the padding (see below) works properly
// don't include frameName here as it should wrap if required and pre-line is not supported
// by Qt yet it seems
const QString displayTextTemplate = QString("<code style='white-space:pre'>%1:</code> %2");
QString relativeTo = relativeToPath();
const Error error = errorIndex.data(ErrorListModel::ErrorRole).value<Error>();
QLabel *errorLabel = new QLabel();
errorLabel->setWordWrap(true);
errorLabel->setContentsMargins(0, 0, 0, 0);
errorLabel->setMargin(0);
errorLabel->setIndent(0);
QPalette p = errorLabel->palette();
QColor lc = p.color(QPalette::Text);
QString linkStyle = QString("style=\"color:rgba(%1, %2, %3, %4);\"")
.arg(lc.red()).arg(lc.green()).arg(lc.blue()).arg(int(0.7 * 255));
p.setBrush(QPalette::Text, p.highlightedText());
errorLabel->setPalette(p);
errorLabel->setText(QString("%1 <span %4>%2</span>")
.arg(error.what(), errorLocation(errorIndex, error, true, linkStyle),
linkStyle));
connect(errorLabel, SIGNAL(linkActivated(QString)), SLOT(openLinkInEditor(QString)));
layout->addWidget(errorLabel);
const QVector<Stack> stacks = error.stacks();
for (int i = 0; i < stacks.count(); ++i) {
const Stack &stack = stacks.at(i);
// auxwhat for additional stacks
if (i > 0) {
QLabel *stackLabel = new QLabel(stack.auxWhat());
stackLabel->setWordWrap(true);
stackLabel->setContentsMargins(0, 0, 0, 0);
stackLabel->setMargin(0);
stackLabel->setIndent(0);
QPalette p = stackLabel->palette();
p.setBrush(QPalette::Text, p.highlightedText());
stackLabel->setPalette(p);
layout->addWidget(stackLabel);
}
int frameNr = 1;
foreach (const Frame &frame, stack.frames()) {
QString frameName = makeFrameName(frame, relativeTo);
QTC_ASSERT(!frameName.isEmpty(), qt_noop());
QLabel *frameLabel = new QLabel(widget);
frameLabel->setAutoFillBackground(true);
if (frameNr % 2 == 0) {
// alternating rows
QPalette p = frameLabel->palette();
p.setBrush(QPalette::Base, p.alternateBase());
frameLabel->setPalette(p);
}
frameLabel->setFont(QFont("monospace"));
connect(frameLabel, SIGNAL(linkActivated(QString)), SLOT(openLinkInEditor(QString)));
// pad frameNr to 2 chars since only 50 frames max are supported by valgrind
const QString displayText = displayTextTemplate
.arg(frameNr++, 2).arg(frameName);
frameLabel->setText(displayText);
frameLabel->setToolTip(Valgrind::XmlProtocol::toolTipForFrame(frame));
frameLabel->setWordWrap(true);
frameLabel->setContentsMargins(0, 0, 0, 0);
frameLabel->setMargin(0);
frameLabel->setIndent(10);
layout->addWidget(frameLabel);
}
}
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
widget->setLayout(layout);
return widget;
}
示例5: QShortcut
MainWindow::MainWindow( QWidget* parent )
: QMainWindow( parent ), ui( new Ui::MainWindow ),
mSyslog( this ),
mHide( false ),
mStartupIdle( false ),
mTerminating( false ),
mTerminated( false ),
mUpdateTimerID( 0 )
{
ui->setupUi(this);
this->setWindowFlags(
Qt::Window
| Qt::CustomizeWindowHint
| Qt::WindowTitleHint
| Qt::WindowSystemMenuHint
);
for( size_t i = 0; i < Preferences::numButtons; ++i )
{
QString idx;
idx.setNum( i + 1 );
mButtons[i] = findChild<QPushButton*>( "pushButton_Btn" + idx );
new QShortcut( QKeySequence( "F" + idx ), mButtons[i], SLOT(click()), SLOT(click()), Qt::ApplicationShortcut );
}
new QShortcut( QKeySequence( tr("Ctrl+W") ), this, SLOT(CloseTopmostWindow()), NULL, Qt::ApplicationShortcut );
// Avoid undesired side effects of key presses.
QList<QPushButton*> pushButtons = findChildren<QPushButton*>();
for( int i = 0; i < pushButtons.size(); ++i )
pushButtons[i]->setFocusPolicy( Qt::NoFocus );
ReadCommandLine();
if( gpPreferences == NULL )
gpPreferences = new Preferences;
if( gpConnectionInfo == NULL )
{
gpConnectionInfo = new ConnectionInfo( this );
gpConnectionInfo->setVisible( false );
}
QFont font = mButtons[0]->font();
int standardFontSize = QFontInfo( font ).pixelSize(),
standardWeight = QFontInfo( font ).weight();
font.setPixelSize( ( standardFontSize * 150 ) / 100 );
font.setWeight( QFont::DemiBold );
ui->pushButton_Config->setFont( font );
ui->pushButton_SetConfig->setFont( font );
ui->pushButton_RunSystem->setFont( font );
ui->pushButton_Quit->setFont( font );
font.setPixelSize( ( standardFontSize * 84 ) / 100 );
font.setWeight( standardWeight );
int nStatusLabels = sizeof( mpStatusLabels ) / sizeof( *mpStatusLabels );
for( int i = 0; i < nStatusLabels; ++i )
{
QLabel* pLabel = new QLabel( ui->statusBar );
#ifndef _WIN32
pLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
pLabel->setFont( font );
#endif
pLabel->setText( "N/A" );
ui->statusBar->addWidget( pLabel, 1 );
mpStatusLabels[i] = pLabel;
}
OperatorUtils::RestoreWidget( this );
BCI_Initialize();
BCI_SetCallback( BCI_OnSetConfig, BCI_Function( SetStartTime ), this );
BCI_SetCallback( BCI_OnStart, BCI_Function( SetStartTime ), this );
BCI_SetCallback( BCI_OnResume, BCI_Function( SetStartTime ), this );
BCI_SetCallback( BCI_OnSuspend, BCI_Function( SetStartTime ), this );
BCI_SetExternalCallback( BCI_OnQuitRequest, BCI_Function( OnQuitRequest ), this );
BCI_SetExternalCallback( BCI_OnInitializeVis, BCI_Function( OnInitializeVis ), this );
BCI_SetCallback( BCI_OnCoreInput, BCI_Function( OnCoreInput ), this );
BCI_SetCallback( BCI_OnDebugMessage, BCI_Function( OnDebugMessage ), this );
BCI_SetCallback( BCI_OnLogMessage, BCI_Function( OnLogMessage ), this );
BCI_SetCallback( BCI_OnWarningMessage, BCI_Function( OnWarningMessage ), this );
BCI_SetCallback( BCI_OnErrorMessage, BCI_Function( OnErrorMessage ), this );
BCI_SetCallback( BCI_OnParameter, BCI_Function( OnParameter ), this );
BCI_SetCallback( BCI_OnVisSignal, BCI_Function( OnVisSignal ), this );
BCI_SetCallback( BCI_OnVisMemo, BCI_Function( OnVisMemo ), this );
BCI_SetCallback( BCI_OnVisBitmap, BCI_Function( OnVisBitmap ), this );
BCI_SetExternalCallback( BCI_OnVisPropertyMessage, BCI_Function( OnVisPropertyMessage ), this );
BCI_SetExternalCallback( BCI_OnVisProperty, BCI_Function( OnVisProperty ), this );
BCI_SetCallback( BCI_OnUnknownCommand, BCI_Function( OnUnknownCommand ), this );
BCI_SetCallback( BCI_OnScriptHelp, BCI_Function( OnScriptHelp ), this );
BCI_SetCallback( BCI_OnScriptError, BCI_Function( OnScriptError ), this );
SetupScripts();
if( mTelnet.length() )
BCI_TelnetListen( mTelnet.toLocal8Bit().constData() );
if( !mStartupIdle )
//.........这里部分代码省略.........
示例6: QDialog
// ------------------------------------------------------
// CategoryDlg
CategoryDlg::CategoryDlg(QWidget *parent, QString name)
: QDialog(parent, name, TRUE)
{
QFont labelFont;
labelFont.setBold(true);
QBoxLayout* topLayout = new QVBoxLayout(this);
QBoxLayout* row4Layout = new QHBoxLayout(topLayout);
QBoxLayout* row3Layout = new QHBoxLayout(topLayout);
QBoxLayout* row2Layout = new QHBoxLayout(topLayout);
QBoxLayout* row1Layout = new QHBoxLayout(topLayout);
QBoxLayout* row0Layout = new QHBoxLayout(topLayout);
QLabel *colorLabel = new QLabel ("Color", this);
colorLabel->setFont(labelFont);
colorLabel->setAlignment(QLabel::AlignRight|QLabel::AlignVCenter);
row1Layout->addWidget(colorLabel, 0, AlignLeft);
m_Color = new QPushButton(this, "color");
m_Color->setText("...");
m_Color->setFont(labelFont);
connect(m_Color, SIGNAL(clicked()),
this, SLOT(select_color()));
row1Layout->addWidget(m_Color);
QLabel *nameLabel = new QLabel ("Name", this);
nameLabel->setFont(labelFont);
nameLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
row4Layout->addWidget(nameLabel);
m_Name = new QLineEdit(this, "Name");
m_Name->setFont(labelFont);
row4Layout->addWidget(m_Name);
QLabel *filterLabel = new QLabel ("Filter", this);
filterLabel->setFont(labelFont);
filterLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
row3Layout->addWidget(filterLabel);
m_Filter = new QLineEdit(this, "Filter");
m_Filter->setFont(labelFont);
row3Layout->addWidget(m_Filter);
QLabel *filteroutLabel = new QLabel ("FilterOut", this);
filteroutLabel->setFont(labelFont);
filteroutLabel->setAlignment(QLabel::AlignLeft|QLabel::AlignVCenter);
row2Layout->addWidget(filteroutLabel);
m_FilterOut = new QLineEdit(this, "FilterOut");
m_FilterOut->setFont(labelFont);
row2Layout->addWidget(m_FilterOut);
QPushButton *ok = new QPushButton("OK", this);
row0Layout->addWidget(ok, 0, AlignLeft);
QPushButton *cancel = new QPushButton("Cancel", this);
row0Layout->addWidget(cancel, 0, AlignRight);
// Hook on pressing the buttons
connect(ok, SIGNAL(clicked()), SLOT(accept()));
connect(cancel, SIGNAL(clicked()), SLOT(reject()));
}
示例7: f
MenuBarPopup::MenuBarPopup(Room* room)
: Dialog(TApp::instance()->getMainWindow(), true, false, "CustomizeMenuBar")
{
setWindowTitle(tr("Customize Menu Bar of Room \"%1\"").arg(room->getName()));
/*- get menubar setting file path -*/
std::string mbFileName = room->getPath().getName() + "_menubar.xml";
TFilePath mbPath = ToonzFolder::getMyModuleDir() + mbFileName;
m_commandListTree = new CommandListTree(this);
m_menuBarTree = new MenuBarTree(mbPath, this);
QPushButton *okBtn = new QPushButton(tr("OK"), this);
QPushButton *cancelBtn = new QPushButton(tr("Cancel"), this);
okBtn->setFocusPolicy(Qt::NoFocus);
cancelBtn->setFocusPolicy(Qt::NoFocus);
QLabel* menuBarLabel = new QLabel(tr("%1 Menu Bar").arg(room->getName()), this);
QLabel* menuItemListLabel = new QLabel(tr("Menu Items"), this);
QFont f("Arial", 15, QFont::Bold);
menuBarLabel->setFont(f);
menuItemListLabel->setFont(f);
QLabel* noticeLabel = new QLabel(tr("N.B. If you put unique title to submenu, it may not be translated to another language.\nN.B. Duplicated commands will be ignored. Only the last one will appear in the menu bar."),this);
QFont nf("Arial", 9, QFont::Normal);
nf.setItalic(true);
noticeLabel->setFont(nf);
//--- layout
QVBoxLayout* mainLay = new QVBoxLayout();
m_topLayout->setMargin(0);
m_topLayout->setSpacing(0);
{
QGridLayout* mainUILay = new QGridLayout();
mainUILay->setMargin(5);
mainUILay->setHorizontalSpacing(8);
mainUILay->setVerticalSpacing(5);
{
mainUILay->addWidget(menuBarLabel, 0, 0);
mainUILay->addWidget(menuItemListLabel, 0, 1);
mainUILay->addWidget(m_menuBarTree, 1, 0);
mainUILay->addWidget(m_commandListTree, 1, 1);
mainUILay->addWidget(noticeLabel, 2, 0, 1, 2);
}
mainUILay->setRowStretch(0, 0);
mainUILay->setRowStretch(1, 1);
mainUILay->setRowStretch(2, 0);
mainUILay->setColumnStretch(0, 1);
mainUILay->setColumnStretch(1, 1);
m_topLayout->addLayout(mainUILay, 1);
}
m_buttonLayout->setMargin(0);
m_buttonLayout->setSpacing(30);
{
m_buttonLayout->addStretch(1);
m_buttonLayout->addWidget(okBtn, 0);
m_buttonLayout->addWidget(cancelBtn, 0);
m_buttonLayout->addStretch(1);
}
//--- signal/slot connections
bool ret = connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkPressed()));
ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
assert(ret);
}
示例8: labelFont
KAstTopLevel::KAstTopLevel( QWidget *parent, const char *name )
: Q3MainWindow( parent, name, 0 )
{
QWidget *border = new QWidget( this );
border->setBackgroundColor( Qt::black );
setCentralWidget( border );
Q3VBoxLayout *borderLayout = new Q3VBoxLayout( border );
borderLayout->addStretch( 1 );
QWidget *mainWin = new QWidget( border );
mainWin->setFixedSize(640, 480);
borderLayout->addWidget( mainWin, 0, Qt::AlignHCenter );
borderLayout->addStretch( 1 );
view = new KAsteroidsView( mainWin );
view->setFocusPolicy( Qt::StrongFocus );
connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) );
connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) );
connect( view, SIGNAL( rocksRemoved() ), SLOT( slotRocksRemoved() ) );
connect( view, SIGNAL( updateVitals() ), SLOT( slotUpdateVitals() ) );
Q3VBoxLayout *vb = new Q3VBoxLayout( mainWin );
Q3HBoxLayout *hb = new Q3HBoxLayout;
Q3HBoxLayout *hbd = new Q3HBoxLayout;
vb->addLayout( hb );
QFont labelFont( "helvetica", 24 );
QColorGroup grp( Qt::darkGreen, Qt::black, QColor( 128, 128, 128 ),
QColor( 64, 64, 64 ), Qt::black, Qt::darkGreen, Qt::black );
QPalette pal( grp, grp, grp );
mainWin->setPalette( pal );
hb->addSpacing( 10 );
QLabel *label;
label = new QLabel( tr("Score"), mainWin );
label->setFont( labelFont );
label->setPalette( pal );
label->setFixedWidth( label->sizeHint().width() );
hb->addWidget( label );
scoreLCD = new QLCDNumber( 6, mainWin );
scoreLCD->setFrameStyle( Q3Frame::NoFrame );
scoreLCD->setSegmentStyle( QLCDNumber::Flat );
scoreLCD->setFixedWidth( 150 );
scoreLCD->setPalette( pal );
hb->addWidget( scoreLCD );
hb->addStretch( 10 );
label = new QLabel( tr("Level"), mainWin );
label->setFont( labelFont );
label->setPalette( pal );
label->setFixedWidth( label->sizeHint().width() );
hb->addWidget( label );
levelLCD = new QLCDNumber( 2, mainWin );
levelLCD->setFrameStyle( Q3Frame::NoFrame );
levelLCD->setSegmentStyle( QLCDNumber::Flat );
levelLCD->setFixedWidth( 70 );
levelLCD->setPalette( pal );
hb->addWidget( levelLCD );
hb->addStretch( 10 );
label = new QLabel( tr("Ships"), mainWin );
label->setFont( labelFont );
label->setFixedWidth( label->sizeHint().width() );
label->setPalette( pal );
hb->addWidget( label );
shipsLCD = new QLCDNumber( 1, mainWin );
shipsLCD->setFrameStyle( Q3Frame::NoFrame );
shipsLCD->setSegmentStyle( QLCDNumber::Flat );
shipsLCD->setFixedWidth( 40 );
shipsLCD->setPalette( pal );
hb->addWidget( shipsLCD );
hb->addStrut( 30 );
vb->addWidget( view, 10 );
// -- bottom layout:
vb->addLayout( hbd );
QFont smallFont( "helvetica", 14 );
hbd->addSpacing( 10 );
QString sprites_prefix = ":/trolltech/examples/graphicsview/portedasteroids/sprites/";
/*
label = new QLabel( tr( "T" ), mainWin );
label->setFont( smallFont );
label->setFixedWidth( label->sizeHint().width() );
label->setPalette( pal );
hbd->addWidget( label );
teleportsLCD = new QLCDNumber( 1, mainWin );
teleportsLCD->setFrameStyle( QFrame::NoFrame );
teleportsLCD->setSegmentStyle( QLCDNumber::Flat );
//.........这里部分代码省略.........
示例9: QWidget
FSBrowser::FSBrowser(QWidget *parent, FSBrowser::BrowseMode mode) : QWidget(parent)
{
QLabel *label = NULL;
_browseMode = mode;
_viewType = FSBrowser::IconView;
QGridLayout *layout = new QGridLayout(this);
layout->setContentsMargins(12, 12, 0, 0); //Position all file and folder elements asn recent file label
setLayout(layout);
switch(mode)
{
case FSBrowser::BrowseRecentFiles:
label = new QLabel("Recent Files");
break;
case FSBrowser::BrowseExamples:
label = new QLabel("Examples");
break;
case FSBrowser::BrowseCurrent:
layout->addWidget(new QLabel(QString("Double-click on the file below to synchronize or use ") + getShortCutKey() + "-Y"));
break;
default:
break;
}
if (label)
{
QFont f= QFont("SansSerif");
f.setPointSize(18);
label->setFont(f);
QSizePolicy sp = label->sizePolicy();
sp.setHorizontalStretch(1);
label->setSizePolicy(sp);
label->setContentsMargins(0, 0, 0, 0);
layout->addWidget(label);
}
_scrollArea = new VerticalScrollArea(this);
_scrollArea->setFrameShape(QScrollArea::NoFrame);
layout->addWidget(_scrollArea);
_scrollPane = new QWidget;
_scrollArea->setWidget(_scrollPane);
_scrollPaneLayout = new QVBoxLayout(_scrollPane);
_scrollPaneLayout->setSpacing(1);
_scrollPaneLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
_scrollPane->setLayout(_scrollPaneLayout);
_buttonGroup = new QButtonGroup(this);
_authWidget = new AuthWidget(this);
_authWidget->hide();
_processLabel = new QLabel(this);
_processLabel->setAlignment(Qt::AlignCenter);
_processLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
_processLabel->setMovie(new QMovie(":/icons/loading.gif", QByteArray(), _processLabel));
_processLabel->setHidden(true);
layout->addWidget(_processLabel);
connect(_authWidget, SIGNAL(loginRequested(QString,QString)), this, SLOT(loginRequested(QString,QString)));
}
示例10: not
//.........这里部分代码省略.........
QList<user> roles_list = users_repository::get_list();
QList<QString> assigned_roles = user::granted_roles(m_role_oid);
for (int ri=0; ri<roles_list.size(); ri++) {
const user& u = roles_list.at(ri);
if (!u.m_can_login && u.m_role_oid>0) {
// keep only entries from pg_roles without the LOGIN privilege
// they're supposed to be roles to assign rather than users
QListWidgetItem* item = new QListWidgetItem(u.m_db_login, m_qlist_roles);
item->setFlags(Qt::ItemIsUserCheckable|/*Qt::ItemIsSelectable|*/Qt::ItemIsEnabled);
item->setCheckState(assigned_roles.indexOf(u.m_db_login) >= 0 ?
Qt::Checked : Qt::Unchecked);
}
}
// m_case_sensitive = new QCheckBox;
m_custom1 = new custom_user_field;
m_custom2 = new custom_user_field;
m_custom3 = new custom_user_field;
if (u.m_is_superuser) {
QLabel* label = new QLabel(tr("<b>Superuser account: unrestricted permissions.</b>"));
layout->addRow(QString(), label);
}
layout->addRow(tr("Login <sup>(*)</sup>:"), m_login);
layout->addRow(tr("Password <sup>(*)</sup>:"), /*m_password*/ vlpassw);
layout->addRow(tr("Retype password <sup>(*)</sup>:"), m_password2);
/*
m_password2->resize(QSize(m_password->width(), m_password2->height()));
m_password2->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
*/
#ifdef PERM_LOGIN
add_field_with_help(layout,
tr("Active <sup>(*)</sup>:"),
m_perm_login,
tr("The database role has the LOGIN capability."));
#endif
add_field_with_help(layout,
tr("Can connect <sup>(**)</sup>:"),
m_perm_connect,
tr("The login has CONNECT permission on this database."));
add_field_with_help(layout,
tr("Registered <sup>(**)</sup>:"),
m_registered,
tr("The user account corresponds to an operator in this database."));
layout->addRow(tr("Operator name <sup>(*)</sup>:"), m_fullname);
layout->addRow(tr("Groups <sup>(*)</sup>:"), m_qlist_roles);
layout->addRow(tr("Custom field #1 <sup>(**)</sup>:"), m_custom1);
layout->addRow(tr("Custom field #2 <sup>(**)</sup>:"), m_custom2);
layout->addRow(tr("Custom field #3 <sup>(**)</sup>:"), m_custom3);
top_layout->addLayout(layout);
QLabel* lremark = new QLabel(tr("(*) Fields marked with <sup>(*)</sup> apply across all databases of this server.<br>(**) Fields marked with <sup>(**)</sup> apply only to the current database: <b>%1</b>.").arg(db.dbname().toHtmlEscaped()));
QFont smf = lremark->font();
smf.setPointSize((smf.pointSize()*8)/10);
lremark->setFont(smf);
top_layout->addWidget(lremark);
m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok |
QDialogButtonBox::Cancel);
top_layout->addWidget(m_buttons);
connect(m_buttons, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject()));
setLayout(top_layout);
m_user_id = 0;
if (role_oid!=0) {
/* set readOnly but not disabled because disabled is hard to read
and the login is the major information */
m_login->setReadOnly(true); //m_login->setEnabled(false);
// u is loaded (for an existing role) at the top of the function
m_user_id = u.m_user_id;
m_fullname->setText(u.m_fullname);
m_login->setText(u.m_login);
m_initial_login = u.m_login;
m_custom1->setPlainText(u.m_custom_field1);
m_custom2->setPlainText(u.m_custom_field2);
m_custom3->setPlainText(u.m_custom_field3);
#ifdef PERM_LOGIN
m_perm_login->setChecked(u.m_can_login);
#endif
m_perm_connect->setChecked(u.m_can_connect);
m_registered->setChecked(u.m_user_id!=0);
}
connect(m_registered, SIGNAL(clicked()), this, SLOT(enable_fields()));
enable_fields();
}
示例11: GenAdjustWidgetAppearanceToOS
void QtHelpers::GenAdjustWidgetAppearanceToOS(QWidget *rootWidget)
{
if (rootWidget == NULL)
return;
QObject *child = NULL;
QObjectList Containers;
QObject *container = NULL;
QStringList DoNotAffect;
// Make an exception list (Objects not to be affected)
DoNotAffect.append("aboutTitleLabel"); // about Dialog
DoNotAffect.append("aboutVersionLabel"); // about Dialog
DoNotAffect.append("aboutCopyrightLabel"); // about Dialog
DoNotAffect.append("aboutUrlLabel"); // about Dialog
DoNotAffect.append("aboutLicenseLabel"); // about Dialog
// Set sizes according to OS:
#ifdef __APPLE__
int ButtonHeight = 35;
int cmbxHeight = 30;
QFont cntrlFont("Myriad Pro", 14);
QFont txtFont("Myriad Pro", 14);
#elif _WIN32 // Win XP/7
int ButtonHeight = 24;
int cmbxHeight = 20;
QFont cntrlFont("MS Shell Dlg 2", 8);
QFont txtFont("MS Shell Dlg 2", 8);
#else
int ButtonHeight = 24;
int cmbxHeight = 24;
QFont cntrlFont("Ubuntu Condensed", 10);
QFont txtFont("Ubuntu", 10);
#endif
// Append root to containers
Containers.append(rootWidget);
while (!Containers.isEmpty())
{
container = Containers.takeFirst();
if (container != NULL)
{
for (int ChIdx=0; ChIdx < container->children().size(); ChIdx++)
{
child = container->children()[ChIdx];
if (!child->isWidgetType() || DoNotAffect.contains(child->objectName()))
continue;
// Append containers to Stack for recursion
if (child->children().size() > 0)
Containers.append(child);
else
{
// Cast child object to button and label
// (if the object is not of the correct type, it will be NULL)
QPushButton *button = qobject_cast<QPushButton *>(child);
QLabel *label = qobject_cast<QLabel *>(child);
QComboBox *cmbx = qobject_cast<QComboBox *>(child);
QLineEdit *ln = qobject_cast<QLineEdit *>(child);
QTreeWidget *tree = qobject_cast<QTreeWidget *>(child);
QPlainTextEdit *plain = qobject_cast<QPlainTextEdit *>(child);
QCheckBox *check = qobject_cast<QCheckBox *>(child);
if (button != NULL)
{
button->setMinimumHeight(ButtonHeight); // Win
button->setMaximumHeight(ButtonHeight); // Win
button->setFont(cntrlFont);
}
else if (cmbx != NULL)
{
cmbx->setFont(cntrlFont);
cmbx->setMaximumHeight(cmbxHeight);
}
else if (label != NULL)
label->setFont(txtFont);
else if (ln != NULL)
ln->setFont(txtFont);
else if (tree != NULL)
{
tree->header()->setFont(txtFont);
}
else if (plain != NULL)
plain->setFont(txtFont);
else if (check != NULL)
check->setFont(txtFont);
}
}
}
}
}
示例12: QWidget
/**
* First Panel - Meta Info
* All the usual MetaData are displayed and can be changed.
**/
MetaPanel::MetaPanel( QWidget *parent,
intf_thread_t *_p_intf )
: QWidget( parent ), p_intf( _p_intf )
{
QGridLayout *metaLayout = new QGridLayout( this );
metaLayout->setVerticalSpacing( 0 );
QFont smallFont = QApplication::font();
smallFont.setPointSize( smallFont.pointSize() - 1 );
smallFont.setBold( true );
int line = 0; /* Counter for GridLayout */
p_input = NULL;
QLabel *label;
#define ADD_META( string, widget, col, colspan ) { \
label = new QLabel( qtr( string ) ); label->setFont( smallFont ); \
label->setContentsMargins( 3, 2, 0, 0 ); \
metaLayout->addWidget( label, line++, col, 1, colspan ); \
widget = new QLineEdit; \
metaLayout->addWidget( widget, line, col, 1, colspan ); \
CONNECT( widget, textEdited( QString ), this, enterEditMode() ); \
}
/* Title, artist and album*/
ADD_META( VLC_META_TITLE, title_text, 0, 10 ); line++;
ADD_META( VLC_META_ARTIST, artist_text, 0, 10 ); line++;
ADD_META( VLC_META_ALBUM, collection_text, 0, 7 );
/* Date */
label = new QLabel( qtr( VLC_META_DATE ) );
label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 );
metaLayout->addWidget( label, line - 1, 7, 1, 2 );
/* Date (Should be in years) */
date_text = new QLineEdit;
date_text->setAlignment( Qt::AlignRight );
date_text->setInputMask("0000");
date_text->setMaximumWidth( 128 );
metaLayout->addWidget( date_text, line, 7, 1, -1 );
line++;
/* Genre Name */
/* TODO List id3genres.h is not includable yet ? */
ADD_META( VLC_META_GENRE, genre_text, 0, 7 );
/* Number - on the same line */
label = new QLabel( qtr( VLC_META_TRACK_NUMBER ) );
label->setFont( smallFont ); label->setContentsMargins( 3, 2, 0, 0 );
metaLayout->addWidget( label, line - 1, 7, 1, 3 );
tracknumber_text = new QLineEdit;
tracknumber_text->setAlignment( Qt::AlignRight );
tracknumber_text->setInputMask("0000/0000");
tracknumber_text->setMaximumWidth( 128 );
metaLayout->addWidget( tracknumber_text, line, 7, 1, -1 );
line++;
/* Rating - on the same line */
/*
metaLayout->addWidget( new QLabel( qtr( VLC_META_RATING ) ), line, 4, 1, 2 );
rating_text = new QSpinBox; setSpinBounds( rating_text );
metaLayout->addWidget( rating_text, line, 6, 1, 1 );
*/
/* Now Playing - Useful for live feeds (HTTP, DVB, ETC...) */
ADD_META( VLC_META_NOW_PLAYING, nowplaying_text, 0, 7 );
nowplaying_text->setReadOnly( true ); line--;
/* Language on the same line */
ADD_META( VLC_META_LANGUAGE, language_text, 7, -1 ); line++;
ADD_META( VLC_META_PUBLISHER, publisher_text, 0, 7 ); line++;
lblURL = new QLabel;
lblURL->setOpenExternalLinks( true );
lblURL->setTextFormat( Qt::RichText );
metaLayout->addWidget( lblURL, line -1, 7, 1, -1 );
ADD_META( VLC_META_COPYRIGHT, copyright_text, 0, 7 ); line++;
/* ART_URL */
art_cover = new CoverArtLabel( this, p_intf );
metaLayout->addWidget( art_cover, line, 7, 6, 3, Qt::AlignLeft );
ADD_META( VLC_META_ENCODED_BY, encodedby_text, 0, 7 ); line++;
label = new QLabel( qtr( N_("Comments") ) ); label->setFont( smallFont );
label->setContentsMargins( 3, 2, 0, 0 );
metaLayout->addWidget( label, line++, 0, 1, 7 );
description_text = new QTextEdit;
description_text->setAcceptRichText( false );
metaLayout->addWidget( description_text, line, 0, 1, 7 );
// CONNECT( description_text, textChanged(), this, enterEditMode() ); //FIXME
line++;
//.........这里部分代码省略.........
示例13: pal
PickerPopup::PickerPopup(DatePicker *picker)
: QFrame(NULL, "calendar", WType_Popup | WStyle_Customize | WStyle_Tool | WDestructiveClose)
{
m_picker = picker;
setFrameShape(PopupPanel);
setFrameShadow(Sunken);
setLineWidth(1);
QDate d = QDate::currentDate();
QLabel *lbl = new QLabel(this);
lbl->setBackgroundMode(PaletteBase);
QVBoxLayout *l = new QVBoxLayout(this);
QHBoxLayout *hLay = new QHBoxLayout(l);
hLay->setMargin(0);
hLay->setSpacing(4);
m_monthBox = new MonthSpinBox(this);
hLay->addWidget(m_monthBox);
m_yearBox = new QSpinBox(this);
m_yearBox->setMaxValue(d.year());
m_yearBox->setMinValue(d.year() - 200);
m_monthBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
hLay->addWidget(m_yearBox);
connect(m_monthBox, SIGNAL(valueChanged(int)), this, SLOT(monthChanged(int)));
connect(m_yearBox, SIGNAL(valueChanged(int)), this, SLOT(yearChanged(int)));
l->addWidget(lbl);
l->setMargin(6);
l->setSpacing(4);
QPalette pal(palette());
pal.setColor(QColorGroup::Text, QColor(127, 0, 0));
pal.setColor(QColorGroup::Foreground, QColor(255, 0, 0));
QFont f(font());
f.setBold(true);
m_labels = new QLabel*[7 * 6];
QGridLayout *lay = new QGridLayout(lbl, 7, 7);
lay->setMargin(6);
lay->setSpacing(4);
unsigned n = 0;
for (unsigned j = 0; j < 6; j++) {
for (unsigned i = 0; i < 7; i++) {
QLabel *l = new PickerLabel(lbl);
l->setFont(f);
l->setAlignment(AlignRight);
l->setText("99");
l->setMinimumSize(l->sizeHint());
l->setText(QString::number(n));
l->setBackgroundMode(PaletteBase);
lay->addWidget(l, i, j + 1);
m_labels[n++] = l;
if (i >= 5)
l->setPalette(pal);
connect(l, SIGNAL(clicked(PickerLabel*)), this, SLOT(dayClick(PickerLabel*)));
}
}
for (unsigned i = 0; i < 7; i++) {
QLabel *l = new QLabel(lbl);
l->setFont(f);
l->setText(i18n(day_name[i]));
l->setBackgroundMode(PaletteBase);
lay->addWidget(l, i, 0);
if (i >= 5)
l->setPalette(pal);
}
int month = m_picker->getDate().month();
int year = m_picker->getDate().year();
if ((month == 0) || (year == 0)) {
month = d.month();
year = d.year();
}
m_monthBox->setValue(month - 1);
m_yearBox->setValue(year);
monthChanged(month - 1);
yearChanged(year);
}
示例14: QWidget
SensorWindow::SensorWindow() : QWidget() {
QGridLayout *layout = new QGridLayout;
QLabel* sensorLabel = new QLabel("Sensor");
sensorLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
QLabel* rawLabel = new QLabel("Raw");
rawLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
QLabel* rawDeltaLabel = new QLabel(QString::fromWCharArray(L"Raw Δ"));
rawDeltaLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
QLabel* processedLabel = new QLabel("Proc");
processedLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
QLabel* processedDeltaLabel = new QLabel(QString::fromWCharArray(L"Proc Δ"));
processedDeltaLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
QLabel* visionLabel = new QLabel("Vis");
visionLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
QLabel* visionDeltaLabel = new QLabel(QString::fromWCharArray(L"Vis Δ"));
visionDeltaLabel->setFont( QFont( "Arial", 10, QFont::Bold ) );
layout->addWidget(sensorLabel,0,0);
layout->addWidget(rawLabel,0,1);
layout->addWidget(rawDeltaLabel,0,2);
layout->addWidget(processedLabel,0,3);
layout->addWidget(processedDeltaLabel,0,4);
layout->addWidget(visionLabel,0,5);
layout->addWidget(visionDeltaLabel,0,6);
sensorLabels = new QLabel[NUM_SENSORS];
rawLabels = new QLabel[NUM_SENSORS];
processedLabels = new QLabel[NUM_SENSORS];
visionLabels = new QLabel[NUM_SENSORS];
rawDeltaLabels = new QLabel[NUM_SENSORS];
processedDeltaLabels = new QLabel[NUM_SENSORS];
visionDeltaLabels = new QLabel[NUM_SENSORS];
numSonarValues = 1;
if (numSonarValues > NUM_SONAR_VALS)
numSonarValues = NUM_SONAR_VALS;
sensorLeftSonarLabels = new QLabel[numSonarValues];
sensorRightSonarLabels = new QLabel[numSonarValues];
rawLeftSonarLabels = new QLabel[numSonarValues];
rawRightSonarLabels = new QLabel[numSonarValues];
processedLeftSonarLabels = new QLabel[numSonarValues];
processedRightSonarLabels = new QLabel[numSonarValues];
visionLeftSonarLabels = new QLabel[numSonarValues];
visionRightSonarLabels = new QLabel[numSonarValues];
float maxWidth = 40.0f;
for(int i = 0; i < NUM_SENSORS; i++) {
rawLabels[i].setMaximumWidth(maxWidth);
processedLabels[i].setMaximumWidth(maxWidth);
visionLabels[i].setMaximumWidth(maxWidth);
rawDeltaLabels[i].setMaximumWidth(maxWidth);
processedDeltaLabels[i].setMaximumWidth(maxWidth);
visionDeltaLabels[i].setMaximumWidth(maxWidth);
}
for(int i = 0; i < numSonarValues; i++) {
sensorLeftSonarLabels->setMaximumWidth(maxWidth);
sensorRightSonarLabels->setMaximumWidth(maxWidth);
rawLeftSonarLabels->setMaximumWidth(maxWidth);
rawRightSonarLabels->setMaximumWidth(maxWidth);
processedLeftSonarLabels->setMaximumWidth(maxWidth);
processedRightSonarLabels->setMaximumWidth(maxWidth);
visionLeftSonarLabels->setMaximumWidth(maxWidth);
visionRightSonarLabels->setMaximumWidth(maxWidth);
}
int offset = 0;
// set joints
for (int i = 0; i < NUM_SENSORS; i++) {
sensorLabels[i].setText(getSensorString((Sensor)i));
rawLabels[i].setText(QString::number(0));
processedLabels[i].setText(QString::number(0));
visionLabels[i].setText(QString::number(0));
// add to layout
layout->addWidget(&sensorLabels[i], offset+i+1, 0);
layout->addWidget(&rawLabels[i], offset+i+1, 1);
layout->addWidget(&processedLabels[i], offset+i+1, 3);
layout->addWidget(&visionLabels[i], offset+i+1, 5);
if(i >= FIRST_ANGLE_SENSOR && i <= LAST_ANGLE_SENSOR) {
rawDeltaLabels[i].setText(QString::number(0));
processedDeltaLabels[i].setText(QString::number(0));
visionDeltaLabels[i].setText(QString::number(0));
layout->addWidget(&rawDeltaLabels[i], offset+i+1, 2);
layout->addWidget(&processedDeltaLabels[i], offset+i+1, 4);
layout->addWidget(&visionDeltaLabels[i], offset+i+1, 6);
}
}
//.........这里部分代码省略.........
示例15: font
InspectorNote::InspectorNote(QWidget* parent)
: InspectorBase(parent)
{
b.setupUi(addWidget());
n.setupUi(addWidget());
c.setupUi(addWidget());
s.setupUi(addWidget());
static const int heads[] = {
Note::HEAD_NORMAL,
Note::HEAD_CROSS,
Note::HEAD_DIAMOND,
Note::HEAD_TRIANGLE,
Note::HEAD_SLASH,
Note::HEAD_XCIRCLE,
Note::HEAD_DO,
Note::HEAD_RE,
Note::HEAD_MI,
Note::HEAD_FA,
Note::HEAD_SOL,
Note::HEAD_LA,
Note::HEAD_TI,
Note::HEAD_BREVIS_ALT
};
//
// fix order of note heads
//
for (int i = 0; i < Note::HEAD_GROUPS; ++i)
n.noteHeadGroup->setItemData(i, QVariant(heads[i]));
// noteHeadType starts at -1
for (int i = 0; i < 5; ++i)
n.noteHeadType->setItemData(i, i-1);
iList = {
{ P_COLOR, 0, 0, b.color, b.resetColor },
{ P_VISIBLE, 0, 0, b.visible, b.resetVisible },
{ P_USER_OFF, 0, 0, b.offsetX, b.resetX },
{ P_USER_OFF, 1, 0, b.offsetY, b.resetY },
{ P_SMALL, 0, 0, n.small, n.resetSmall },
{ P_HEAD_GROUP, 0, 0, n.noteHeadGroup, n.resetNoteHeadGroup },
{ P_HEAD_TYPE, 0, 0, n.noteHeadType, n.resetNoteHeadType },
{ P_MIRROR_HEAD, 0, 0, n.mirrorHead, n.resetMirrorHead },
{ P_DOT_POSITION, 0, 0, n.dotPosition, n.resetDotPosition },
{ P_TUNING, 0, 0, n.tuning, n.resetTuning },
{ P_VELO_TYPE, 0, 0, n.velocityType, n.resetVelocityType },
{ P_VELO_OFFSET, 0, 0, n.velocity, n.resetVelocity },
{ P_USER_OFF, 0, 1, c.offsetX, c.resetX },
{ P_USER_OFF, 1, 1, c.offsetY, c.resetY },
{ P_SMALL, 0, 1, c.small, c.resetSmall },
{ P_NO_STEM, 0, 1, c.stemless, c.resetStemless },
{ P_STEM_DIRECTION, 0, 1, c.stemDirection, c.resetStemDirection },
{ P_LEADING_SPACE, 0, 2, s.leadingSpace, s.resetLeadingSpace },
{ P_TRAILING_SPACE, 0, 2, s.trailingSpace, s.resetTrailingSpace }
};
mapSignals();
//
// Select
//
QLabel* l = new QLabel;
l->setText(tr("Select"));
QFont font(l->font());
font.setBold(true);
l->setFont(font);
l->setAlignment(Qt::AlignHCenter);
_layout->addWidget(l);
QFrame* f = new QFrame;
f->setFrameStyle(QFrame::HLine | QFrame::Raised);
f->setLineWidth(2);
_layout->addWidget(f);
QHBoxLayout* hbox = new QHBoxLayout;
dot1 = new QToolButton(this);
dot1->setText(tr("Dot1"));
dot1->setEnabled(false);
hbox->addWidget(dot1);
dot2 = new QToolButton(this);
dot2->setText(tr("Dot2"));
dot2->setEnabled(false);
hbox->addWidget(dot2);
dot3 = new QToolButton(this);
dot3->setText(tr("Dot3"));
dot3->setEnabled(false);
hbox->addWidget(dot3);
hook = new QToolButton(this);
hook->setText(tr("Hook"));
hook->setEnabled(false);
hbox->addWidget(hook);
_layout->addLayout(hbox);
hbox = new QHBoxLayout;
stem = new QToolButton(this);
stem->setText(tr("Stem"));
stem->setEnabled(false);
//.........这里部分代码省略.........