本文整理汇总了C++中QLCDNumber::setSegmentStyle方法的典型用法代码示例。如果您正苦于以下问题:C++ QLCDNumber::setSegmentStyle方法的具体用法?C++ QLCDNumber::setSegmentStyle怎么用?C++ QLCDNumber::setSegmentStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLCDNumber
的用法示例。
在下文中一共展示了QLCDNumber::setSegmentStyle方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
LCDRange::LCDRange( QWidget *parent, const char *name ): QWidget( parent, name )
{
//QLCDNumber *lcd = new QLCDNumber( 2, this, "lcd" );
QLCDNumber *lcd = new QLCDNumber( 2 );
lcd->setSegmentStyle(QLCDNumber::Filled);
//slider = new QSlider( Horizontal, this, "slider" );
slider = new QSlider( Horizontal);
slider->setRange( 0, 99 );
slider->setValue( 0 );
//设置滑块为焦点代理。当想要给LCDRange一个键盘焦点,滑块就会注意到它。
setFocusProxy( slider );
//这里把slider的valueChanged信号分别连接到display和自定义的valueChanged上面
connect( slider, SIGNAL(valueChanged(int)), lcd,
SLOT(display(int)) );
//这里两种方式实现信号的连接,利用标准信号发出自定义信号。
//connect( slider, SIGNAL(valueChanged(int)),
// SIGNAL(valueChanged(int)) );
connect( slider, SIGNAL(valueChanged(int)), this,
SIGNAL(valueChanged(int)) );
//这里利用另外的方式实现添加到VBox,而不用继承QVBox类
Q3VBoxLayout *layout = new Q3VBoxLayout;
layout->addWidget(lcd);
layout->addWidget(slider);
setLayout(layout);
}
示例2: QWidget
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
// QPushButton *quit = new QPushButton(tr("Quit"));
QToolButton *quit = new QToolButton();
quit->setText(tr("Quit"));
quit->setFont(QFont("Times", 18, QFont::Bold));
quit->setMinimumSize(150, 50);
QLCDNumber *lcd = new QLCDNumber(2);
lcd->setSegmentStyle(QLCDNumber::Filled);
lcd->setMinimumSize(150, 150);
QSlider *slider = new QSlider(Qt::Horizontal);
slider->setRange(0, 99);
slider->setValue(0);
connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));
connect(slider, SIGNAL(valueChanged(int)),
lcd, SLOT(display(int)));
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(lcd);
layout->addWidget(slider);
layout->addWidget(quit);
setLayout(layout);
}
示例3: init
void LCDRange::init()
{
QLCDNumber *lcd = new QLCDNumber(2);
lcd->setSegmentStyle(QLCDNumber::Filled);
slider = new QSlider(Qt::Horizontal);
slider->setRange(0, 99);
slider->setValue(0);
label = new QLabel;
label->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
connect(slider, SIGNAL(valueChanged(int)),
lcd, SLOT(display(int)));
connect(slider, SIGNAL(valueChanged(int)),
this, SIGNAL(valueChanged(int)));
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(lcd);
layout->addWidget(slider);
layout->addWidget(label);
setLayout(layout);
setFocusProxy(slider);
}
示例4: QWidget
MyWidget::MyWidget(QWidget *parent)
: QWidget(parent)
{
//setFixedSize(150, 200);
button_power = new QPower(this);
// aerobutton_test = new AeroButton("Test", this);
QPushButton *quit = new QPushButton(tr("Quit"));
QVBoxLayout *layout = new QVBoxLayout;
// QHBoxLayout *layout = new QHBoxLayout;
quit->setFont(QFont("Times", 25, QFont::Bold));
//aerobutton_test->setFont(QFont("Times", 12, QFont::Bold));
//aerobutton_quit->setGeometry(10, 20, 230, 40);
//aerobutton_test->setGeometry(10, 70, 230, 40);
/*
QGridLayout *grid = new QGridLayout;
for (int row = 0; row < 3; ++row)
{
for (int column = 0; column < 2; ++column)
{
LCDRange *lcdRange = new LCDRange;
grid->addWidget(lcdRange, row, column);
}
}
*/
QLCDNumber *lcd = new QLCDNumber(2);
lcd->setSegmentStyle(QLCDNumber::Filled);
QSlider *slider = new QSlider(Qt::Horizontal);
slider->setRange(0, 99);
slider->setValue(0);
//QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(lcd);
layout->addWidget(slider);
//setLayout(layout);
// layout->addWidget(aerobutton_test);
// layout->addLayout(grid);
layout->addWidget(button_power);
layout->addWidget(quit);
//layout->addWidget(slider);
setLayout(layout);
//QObject::connect(aerobutton_quit, SIGNAL(clicked()), &app, SLOT(quit()));
// connect(aerobutton_quit, SIGNAL(clicked()), qApp, SLOT(quit()));
// connect(aerobutton_quit, SIGNAL(clicked()), this, SLOT(closeApp() ));
//connect(aerobutton_test, SIGNAL(clicked()), this, SLOT(showMessageBox() ));
connect(quit, SIGNAL(clicked()), this, SLOT(closeApp() ));
connect(button_power, SIGNAL(clicked()), this, SLOT(showMessageBox() ));
connect(slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)));
//connect(quit, SIGNAL(clicked()), this, SLOT(close() ));
// connect(button_power, SIGNAL(mousePressEvent()), this, SLOT(close() ));
}
示例5: QWidget
LCDRange::LCDRange( QWidget* parent ) : QWidget( parent )
{
QLCDNumber* lcd = new QLCDNumber(2);
lcd->setSegmentStyle(QLCDNumber::Filled);
QSlider* slider = new QSlider(Qt::Horizontal);
slider->setRange( 0, 99 );
slider->setValue( 0 );
connect(slider, SIGNAL( valueChanged( int )), lcd, SLOT( display( int )));
QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget( lcd );
layout->addWidget( slider );
setLayout( layout );
}
示例6: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Progress prog;
QWidget wgt;
QLabel* lbl = new QLabel("&Decimal value:");
QSpinBox* box = new QSpinBox;
box->setMaximum(1000);
lbl->setBuddy(box);
QLCDNumber* lcd = new QLCDNumber(12);
lcd->setSegmentStyle(QLCDNumber::Flat);
lcd->setBinMode();
QLabel* lbl2 = new QLabel("Binary value:");
QObject::connect(box, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)));
QLabel* lblurl = new QLabel("<a href=\"http://img12.nnm.me/7/b/a/8/7/7ba875b7bd80980f79ac6cae68418e77_full.jpg\">Нажми-ка!</a>");
lblurl->setOpenExternalLinks(true);
QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget(lbl);
layout->addWidget(box);
layout->addWidget(lbl2);
layout->addWidget(lcd);
layout->addWidget(lblurl);
wgt.setLayout(layout);
QSplitter split(Qt::Horizontal);
split.addWidget(&prog);
split.addWidget(&wgt);
split.setGeometry(500,300,444,200);
split.show();
return a.exec();
}
示例7: QLCDNumber
LCDRange::LCDRange(QWidget *parent)
:QWidget(parent)
{
QLCDNumber *lcd = new QLCDNumber(2);
lcd->setSegmentStyle(QLCDNumber::Flat);
//lcd->setSegmentStyle(QLCDNumber::Filled);
lcd->setNumDigits(3);
lcd->display(5);
QSlider *slider = new QSlider(Qt::Horizontal);
slider->setRange(0, 199);
//slider->sizeHint();
//slider->minimumSizeHint();
slider->setValue(5);
connect(slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)));
connect(slider, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)));
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(lcd);
layout->addWidget(slider);
setLayout(layout);
}
示例8: QPropertyWidget
FontPropertyWidget::FontPropertyWidget(FontProperty* prop, QWidget* parent)
: QPropertyWidget(prop, parent)
, property_(prop)
{
groupBox_ = new QGroupBox(this);
addWidget(groupBox_);
QVBoxLayout* tgtFontLayout = new QVBoxLayout(groupBox_);
tgtFontLayout->setContentsMargins(2,2,2,2);
tgtFontType_ = new QComboBox();
tgtFontType_->addItem("Bitmap", (int)tgt::Font::BitmapFont);
tgtFontType_->addItem("Buffer", (int)tgt::Font::BufferFont);
tgtFontType_->addItem("Extrude", (int)tgt::Font::ExtrudeFont);
tgtFontType_->addItem("Outline", (int)tgt::Font::OutlineFont);
tgtFontType_->addItem("Pixmap", (int)tgt::Font::PixmapFont);
tgtFontType_->addItem("Polygon", (int)tgt::Font::PolygonFont);
tgtFontType_->addItem("Texture", (int)tgt::Font::TextureFont);
tgtFontLayout->addWidget(tgtFontType_);
tgtFontName_ = new QComboBox();
tgtFontName_->addItem("VeraMono", "VeraMono.ttf");
tgtFontName_->addItem("Vera", "Vera.ttf");
tgtFontLayout->addWidget(tgtFontName_);
QLabel* fontSizeLabel = new QLabel("Fontsize:");
tgtFontLayout->addWidget(fontSizeLabel);
QWidget* tgtFontSize = new QWidget();
QHBoxLayout* tgtFontSizeLayout = new QHBoxLayout(tgtFontSize);
tgtFontSizeLayout->setContentsMargins(0,0,0,0);
tgtFontSizeSlider_ = new QSlider(Qt::Horizontal);
tgtFontSizeLayout->addWidget(tgtFontSizeSlider_);
QLCDNumber* tgtFontSizeLCD = new QLCDNumber(2);
tgtFontSizeLayout->addWidget(tgtFontSizeLCD);
tgtFontLayout->addWidget(tgtFontSize);
QLabel* lineWidthLabel = new QLabel("Line width:");
tgtFontLayout->addWidget(lineWidthLabel);
QWidget* tgtLineWidth = new QWidget();
QHBoxLayout* tgtLineWidthLayout = new QHBoxLayout(tgtLineWidth);
tgtLineWidthLayout->setContentsMargins(0,0,0,0);
tgtLineWidthSlider_ = new QSlider(Qt::Horizontal);
tgtLineWidthLayout->addWidget(tgtLineWidthSlider_);
QLCDNumber* tgtLineWidthLCD = new QLCDNumber(3);
tgtLineWidthLayout->addWidget(tgtLineWidthLCD);
tgtFontLayout->addWidget(tgtLineWidth);
tgtTextAlign_ = new QComboBox();
tgtTextAlign_->addItem("Left", (int)tgt::Font::Left);
tgtTextAlign_->addItem("Center", (int)tgt::Font::Center);
tgtTextAlign_->addItem("Right", (int)tgt::Font::Right);
tgtFontLayout->addWidget(tgtTextAlign_);
tgtVerticalTextAlign_ = new QComboBox();
tgtVerticalTextAlign_->addItem("Top", (int)tgt::Font::Top);
tgtVerticalTextAlign_->addItem("Middle", (int)tgt::Font::Middle);
tgtVerticalTextAlign_->addItem("Bottom", (int)tgt::Font::Bottom);
tgtFontLayout->addWidget(tgtVerticalTextAlign_);
tgtFontSizeLCD->setSegmentStyle(QLCDNumber::Filled);
tgtLineWidthLCD->setSegmentStyle(QLCDNumber::Filled);
tgtFontSizeSlider_->setMinimum(6);
tgtFontSizeSlider_->setMaximum(36);
tgtLineWidthSlider_->setMinimum(10);
tgtLineWidthSlider_->setMaximum(999);
connect(tgtFontType_, SIGNAL(activated(int)), this, SLOT(updateProperty()));
connect(tgtFontName_, SIGNAL(activated(int)), this, SLOT(updateProperty()));
connect(tgtFontSizeSlider_, SIGNAL(valueChanged(int)), this, SLOT(updateProperty()));
connect(tgtFontSizeSlider_, SIGNAL(valueChanged(int)), tgtFontSizeLCD, SLOT(display(int)));
connect(tgtLineWidthSlider_, SIGNAL(valueChanged(int)), this, SLOT(updateProperty()));
connect(tgtLineWidthSlider_, SIGNAL(valueChanged(int)), tgtLineWidthLCD, SLOT(display(int)));
connect(tgtTextAlign_, SIGNAL(currentIndexChanged(int)), this, SLOT(updateProperty()));
connect(tgtVerticalTextAlign_,SIGNAL(currentIndexChanged(int)), this, SLOT(updateProperty()));
updateFromProperty();
addVisibilityControls();
}
示例9: QLCDNumber
TetrisWindow::TetrisWindow()
{
board = new TetrisBoard;
nextPieceLabel = new QLabel;
nextPieceLabel->setFrameStyle(QFrame::Box | QFrame::Raised);
nextPieceLabel->setAlignment(Qt::AlignCenter);
nextPieceLabel->setMinimumHeight(100);
board->setNextPieceLabel(nextPieceLabel);
levelLcd = new QLCDNumber(7);
levelLcd->setSegmentStyle(QLCDNumber::Filled);
linesLcd = new QLCDNumber(7);
linesLcd->setSegmentStyle(QLCDNumber::Filled);
QLCDNumber* tetrominoesPlayedLCD = new QLCDNumber(5);
tetrominoesPlayedLCD->setSegmentStyle(QLCDNumber::Filled);
DigitalClock* digitalClock = new DigitalClock();
startButton = new QPushButton(tr("&Start"));
startButton->setFocusPolicy(Qt::NoFocus);
quitButton = new QPushButton(tr("&Quit"));
quitButton->setFocusPolicy(Qt::NoFocus);
pauseButton = new QPushButton(tr("&Pause"));
pauseButton->setFocusPolicy(Qt::NoFocus);
pauseButton->setCheckable(true);
QGroupBox *aiSelector = new QGroupBox(tr("Select AI"));
QRadioButton *noneRadio = new QRadioButton(tr("None"));
QRadioButton *greedyRadio = new QRadioButton(tr("Greedy"));
QRadioButton *reinforcementRadio = new QRadioButton(tr("Reinforcement"));
reinforcementRadio->setChecked(true);
QCheckBox *autoPlayCheckBox = new QCheckBox(tr("Auto Play"));
QCheckBox *lineDownCheckBox = new QCheckBox(tr("Line Down Timeout"));
lineDownCheckBox->setChecked(true);
QCheckBox *invisiblePlayCheckBox = new QCheckBox(tr("Play without gui"));
QCheckBox *lookAheadCheckBox = new QCheckBox(tr("Use lookahead"));
lookAheadCheckBox->setChecked(true);
QCheckBox *autoStopCheckBox = new QCheckBox(tr("Auto stop after games:"));
QLineEdit *numGamesBox = new QLineEdit();
QSlider *speedSlider = new QSlider(Qt::Horizontal, 0);
speedSlider->setRange(0,100);
speedSlider->setValue(100);
QVBoxLayout *aiSelectorLayout = new QVBoxLayout;
aiSelectorLayout->addWidget(noneRadio);
aiSelectorLayout->addWidget(greedyRadio);
aiSelectorLayout->addWidget(reinforcementRadio);
aiSelectorLayout->addWidget(autoPlayCheckBox);
aiSelectorLayout->addWidget(invisiblePlayCheckBox);
aiSelectorLayout->addWidget(lineDownCheckBox);
aiSelectorLayout->addWidget(lookAheadCheckBox);
aiSelectorLayout->addWidget(autoStopCheckBox);
aiSelectorLayout->addWidget(numGamesBox);
aiSelectorLayout->addWidget(speedSlider);
//vbox->addStretch(1);
aiSelector->setLayout(aiSelectorLayout);
//statistics box
QGroupBox *aiStatistics = new QGroupBox(tr("Statistics"));
QLabel *numGamesDescription = new QLabel(tr("Games played"));
QLCDNumber *numGames = new QLCDNumber(7);
QLabel *totalMovesDescription = new QLabel(tr("Total moves"));
QLCDNumber *totalMoves = new QLCDNumber(7);
QLabel *maxLinesRemovedDescription = new QLabel(tr("Maximum lines removed"));
QLCDNumber *maxLinesRemoved = new QLCDNumber(7);
QLabel *avgLinesRemovedDescription = new QLabel(tr("Average lines removed"));
QLCDNumber *avgLinesRemoved = new QLCDNumber(7);
QLabel *movingAvgLinesRemovedDescription = new QLabel(tr("Moving average lines removed"));
QLCDNumber *movingAvgLinesRemoved = new QLCDNumber(7);
QGridLayout *aiStatisticsLayout = new QGridLayout;
aiStatisticsLayout->addWidget(numGamesDescription, 0, 0);
aiStatisticsLayout->addWidget(numGames, 0, 1);
aiStatisticsLayout->addWidget(totalMovesDescription, 1, 0);
aiStatisticsLayout->addWidget(totalMoves, 1, 1);
aiStatisticsLayout->addWidget(maxLinesRemovedDescription, 2, 0);
aiStatisticsLayout->addWidget(maxLinesRemoved, 2, 1);
aiStatisticsLayout->addWidget(avgLinesRemovedDescription, 3, 0);
aiStatisticsLayout->addWidget(avgLinesRemoved, 3, 1);
aiStatisticsLayout->addWidget(movingAvgLinesRemovedDescription, 4, 0);
aiStatisticsLayout->addWidget(movingAvgLinesRemoved, 4, 1);
aiStatistics->setLayout(aiStatisticsLayout);
//parameter loader
QLineEdit *paramView = new QLineEdit("test");
paramView->setReadOnly(true);
QLineEdit *paramEdit = new QLineEdit;
QGridLayout *paramBox = new QGridLayout;
paramBox->addWidget(paramView, 0, 0);
//.........这里部分代码省略.........
示例10: QLCDNumber
QLCDNumber * GameBoard::createLCD()
{
QLCDNumber * LCD = new QLCDNumber(2);
LCD->setSegmentStyle(QLCDNumber::Filled);
return LCD;
}
示例11: setupDisplay
void WifiWidget::setupDisplay()
{
const int numRowsPerInterface = 6;
const int numDigits = 4;
QGridLayout *globalLayout = new QGridLayout(this);
globalLayout->setColumnStretch(0,0);
globalLayout->setColumnStretch(1,1);
globalLayout->setColumnStretch(2,1);
for (unsigned int i=0; i<numInterfaces_; i++)
{
QLabel *interfaceLabel = new QLabel;
interfaceLabel->setFont(QFont("Helvetica", 12, QFont::Bold));
globalLayout->addWidget(interfaceLabel,numRowsPerInterface*i,0);
interfaceLabels_.push_back( interfaceLabel );
QLabel *accessPointLabel = new QLabel;
accessPointLabel->setFont(QFont("Helvetica", 12, QFont::Bold));
globalLayout->addWidget(accessPointLabel,numRowsPerInterface*i,1);
accessPointLabels_.push_back( accessPointLabel );
QLCDNumber *lcdSignalLevel = new QLCDNumber(numDigits, this);
lcdSignalLevel->setSegmentStyle(QLCDNumber::Filled);
lcdsSignal_.push_back(lcdSignalLevel);
QLCDNumber *lcdMaxSignalLevel = new QLCDNumber(numDigits, this);
lcdMaxSignalLevel->setSegmentStyle(QLCDNumber::Filled);
lcdsMaxSignal_.push_back(lcdMaxSignalLevel);
QLabel *signalLabel = new QLabel("Signal: ");
globalLayout->addWidget( signalLabel,numRowsPerInterface*i+1,0);
globalLayout->addWidget( lcdSignalLevel,numRowsPerInterface*i+1,1);
globalLayout->addWidget( lcdMaxSignalLevel,numRowsPerInterface*i+1,2);
QLCDNumber *lcdNoiseLevel = new QLCDNumber(numDigits, this);
lcdNoiseLevel->setSegmentStyle(QLCDNumber::Filled);
lcdsNoise_.push_back(lcdNoiseLevel);
QLCDNumber *lcdMaxNoiseLevel = new QLCDNumber(numDigits, this);
lcdMaxNoiseLevel->setSegmentStyle(QLCDNumber::Filled);
lcdsMaxNoise_.push_back(lcdMaxNoiseLevel);
QLabel *noiseLabel = new QLabel("Noise: ");
globalLayout->addWidget( noiseLabel,numRowsPerInterface*i+2,0);
globalLayout->addWidget( lcdNoiseLevel,numRowsPerInterface*i+2,1);
globalLayout->addWidget( lcdMaxNoiseLevel,numRowsPerInterface*i+2,2);
QLCDNumber *lcdLinkLevel = new QLCDNumber(numDigits, this);
lcdLinkLevel->setSegmentStyle(QLCDNumber::Filled);
lcdsLink_.push_back(lcdLinkLevel);
QLCDNumber *lcdMaxLinkLevel = new QLCDNumber(numDigits, this);
lcdMaxLinkLevel->setSegmentStyle(QLCDNumber::Filled);
lcdsMaxLink_.push_back(lcdMaxLinkLevel);
QLabel *linkLabel = new QLabel("Link quality: ");
globalLayout->addWidget( linkLabel,numRowsPerInterface*i+3,0);
globalLayout->addWidget( lcdLinkLevel,numRowsPerInterface*i+3,1);
globalLayout->addWidget( lcdMaxLinkLevel,numRowsPerInterface*i+3,2);
QLCDNumber *lcdBitrate = new QLCDNumber(numDigits, this);
lcdBitrate->setSegmentStyle(QLCDNumber::Filled);
lcdsBitrate_.push_back(lcdBitrate);
QLabel *bitRateLabel = new QLabel("Bit rate (Mb/s): ");
globalLayout->addWidget( bitRateLabel,numRowsPerInterface*i+4,0);
globalLayout->addWidget( lcdBitrate,numRowsPerInterface*i+4,1);
QProgressBar *overall = new QProgressBar;
overall->setMinimum(0);
overall->setMaximum(MAXIMUM_SNR);
progressBars_.push_back(overall);
QLabel *progressLabel = new QLabel("Overall signal level: ");
QLabel *overallSigLabel = new QLabel;
overallSigLabel->setFont(QFont("Helvetica", 12, QFont::Bold));
overallSigLabels_.push_back( overallSigLabel );
globalLayout->addWidget( progressLabel,numRowsPerInterface*i+5,0);
globalLayout->addWidget( overall,numRowsPerInterface*i+5,1);
globalLayout->addWidget( overallSigLabel,numRowsPerInterface*i+5,2);
}
setLayout(globalLayout);
}