当前位置: 首页>>代码示例>>C++>>正文


C++ QLCDNumber类代码示例

本文整理汇总了C++中QLCDNumber的典型用法代码示例。如果您正苦于以下问题:C++ QLCDNumber类的具体用法?C++ QLCDNumber怎么用?C++ QLCDNumber使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QLCDNumber类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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();
}
开发者ID:rymarchik,项目名称:QtLearning,代码行数:38,代码来源:main.cpp

示例2: 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);
}
开发者ID:navyzhou926,项目名称:qt-test,代码行数:23,代码来源:lcdrange.cpp

示例3: QLCDNumber

//! [2]
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);

    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);
}
开发者ID:dfizban,项目名称:remixos-usb-tool,代码行数:25,代码来源:lcdrange.cpp

示例4: main

int main(int argc, char **argv) {
  QApplication app(argc, argv);

  QDial *dial = new QDial();
  dial->show();

  QLCDNumber *lcdnumber = new QLCDNumber();
  lcdnumber->display(12345);
  lcdnumber->show();

  QSlider *slider = new QSlider(Qt::Horizontal);
  slider->show();
  
  QHBoxLayout *hbox = new QHBoxLayout();
  QPushButton *button = new QPushButton("Push Me");
  QLineEdit *input = new QLineEdit();
  hbox->addWidget(button);
  hbox->addWidget(input);
  QWidget *widget = new QWidget();
  widget->setLayout(hbox);
  widget->show();

  return app.exec();
}
开发者ID:ia96herz,项目名称:cpp_doc,代码行数:24,代码来源:main.cpp

示例5: 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();
}
开发者ID:bsmr-opengl,项目名称:voreen,代码行数:83,代码来源:fontpropertywidget.cpp

示例6: main

int main( int argc, char **argv )
{
    QApplication app( argc, argv );
#ifndef QSA_NO_EDITOR
    QWidget widget;
    QSProject project;
    QVBoxLayout *vboxLayout = new QVBoxLayout(&widget);

    // some help text
    QLabel *help = new QLabel("Right-click on any of the buttons to edit "
                              "its properties.");
    vboxLayout->addWidget(help);

    QWidget *hboxWidget = new QWidget;
    QHBoxLayout *hboxLayout = new QHBoxLayout(hboxWidget);
    vboxLayout->addWidget(hboxWidget);

    // create two sample widgets
    QGroupBox *lcdGroup = new QGroupBox( "lcd");
    hboxLayout->addWidget(lcdGroup);

    QVBoxLayout *lcdgroupLayout = new QVBoxLayout(lcdGroup);
    QLCDNumber *lcd = new QLCDNumber;
    lcd->setObjectName("lcd");
    lcdgroupLayout->addWidget(lcd);
    project.addObject(lcd);
    lcdgroupLayout->addWidget(new QLabel("Properties: <ul><li>value</li>"
                                         "<li>setHexMode()</li><li>...</li></ul>"));

    QGroupBox *editGroup = new QGroupBox( "edit");
    hboxLayout->addWidget(editGroup);

    QVBoxLayout *editgroupLayout = new QVBoxLayout(editGroup);
    QLineEdit *edit = new QLineEdit;
    edit->setObjectName("edit");
    edit->setText( "text" );
    editgroupLayout->addWidget(edit);
    project.addObject(edit);
    editgroupLayout->addWidget(new QLabel("Properties: <ul><li>text</li><li>maxLength</li>"
                                          "<li>clear()</li><li>...</li></ul>"));

    QWidget *buttonWidget = new QWidget;
    QVBoxLayout *buttonLayout = new QVBoxLayout(buttonWidget);
    hboxLayout->addWidget(buttonWidget);

    // add script buttons
    ScriptButton *button1 = new ScriptButton(&project, "Increase Counter", 0, "button1");
    buttonLayout->addWidget(button1);
    button1->setScriptCode( "Application.lcd.value++;" );

    ScriptButton *button2 = new ScriptButton(&project, "Reset Counter", 0, "button2");
    buttonLayout->addWidget(button2);
    button2->setScriptCode( "Application.lcd.value = 0;" );

    ScriptButton *button3 = new ScriptButton(&project, "Convert to uppercase", 0, "button3");
    buttonLayout->addWidget(button3);
    button3->setScriptCode( "Application.edit.text = Application.edit.text.upper();" );

    QPushButton *button4 = new QPushButton("&Quit");
    button4->setObjectName("button4");
    buttonLayout->addStretch(-1);
    buttonLayout->addWidget(button4);
    QObject::connect(button4, SIGNAL(clicked()), &app, SLOT(quit()));

    // teach interpreter about widgets
    project.interpreter()->addWrapperFactory( new WidgetWrapperFactory() );
    project.interpreter()->addObjectFactory( new QtNamespaceProvider() );

    widget.show();
#else
    QMessageBox::information( 0, "Disabled feature",
			      "QSA Editor has been disabled. Reconfigure to enable",
			      QMessageBox::Ok );
#endif

    return app.exec();
}
开发者ID:aschet,项目名称:qsaqt5,代码行数:77,代码来源:main.cpp

示例7: 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);
//.........这里部分代码省略.........
开发者ID:bobbaluba,项目名称:restit,代码行数:101,代码来源:tetriswindow.cpp

示例8: if

void CSensorView::addWidget(QString var_name, QPoint var_pos)
{

    bool isExist=false;
    int indExistant=0;
    for(int ind=0;ind<listeAddedSignals.size();ind++)
        if(listeAddedSignals.at(ind)->addedSignalName.compare(var_name)==0)
        {
            isExist=true;
            indExistant=ind;
        }


    QVariant property_value=m_application->m_data_center->getDataProperty(var_name,"Type");
    QString mime_property=property_value.toString();
    int type;

    if(mime_property.isEmpty())
        type=mime_default;
    else if(mime_property.compare("sensor_tor")==0)
        type=mime_sensor_tor;
    else if(mime_property.compare("computed_signal")==0)
        type=mime_computed_signal;
    else
        type=mime_default;

    QLed * newLed;
    QLCDNumber * newLCDNumber;

    switch(type)
    {
        case mime_default:
        case mime_computed_signal:
            newLCDNumber =new QLCDNumber(m_ihm.ui.viewWidget);
            newLCDNumber->setObjectName(var_name);
            newLCDNumber->move(var_pos);
            newLCDNumber->setVisible(true);
            if (isExist)
            {
                listeAddedSignals.at(indExistant)->addedLCDNumber=newLCDNumber;
                listeAddedSignals.at(indExistant)->addedSignalPosition.setX(var_pos.x());
                listeAddedSignals.at(indExistant)->addedSignalPosition.setY(var_pos.y());
            }
            else
                listeAddedSignals << new viewWidget(var_name,var_pos,type,newLCDNumber);
            //qDebug() << "LCDNumber" << var_name << "ajouté";
            break;
        case mime_sensor_tor:
            newLed = new QLed(m_ihm.ui.viewWidget);
            newLed->setObjectName(var_name);
            newLed->setMinimumSize(20,20);
            newLed->setMaximumSize(20,20);
            newLed->setValue(true);
            newLed->move(var_pos);
            newLed->setVisible(true);
            if (isExist)
            {
                listeAddedSignals.at(indExistant)->addedLed=newLed;
                listeAddedSignals.at(indExistant)->addedSignalPosition.setX(var_pos.x());
                listeAddedSignals.at(indExistant)->addedSignalPosition.setY(var_pos.y());
            }
            else
                listeAddedSignals << new viewWidget(var_name,var_pos,type,newLed);
            //qDebug() << "Led" << var_name << "ajouté";
            break;
        default:
            break;
    }

}
开发者ID:CRLG,项目名称:LABOTBOX,代码行数:70,代码来源:CSensorView.cpp

示例9: main

int main(int argc, char *argv[]) {
	QApplication app(argc, argv);

	/* 常數們 */
	int boardSize = BOARD_SIZE;
	int stoneSize = STONE_SIZE;
	int boardWidth = stoneSize*boardSize;

	/* 新視窗 */
	QWidget *window = new QMouseEventWindow;
	window->setWindowTitle("ReversiGrid");
	window->setFixedSize(boardWidth+200, boardWidth);
	QWidget *board = new QWidget(window);
	board->setFixedSize(boardWidth, boardWidth);

	/* 載入棋子圖片 */
	QPixmap *stoneWPix = new QPixmap(":/img/stoneW.png");
	QPixmap *stoneWPixS = new QPixmap;
	*stoneWPixS = stoneWPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *stoneBPix = new QPixmap(":/img/stoneB.png");
	QPixmap *stoneBPixS = new QPixmap;
	*stoneBPixS = stoneBPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *stoneWaPix = new QPixmap(":/img/stoneWa.png");
	QPixmap *stoneWaPixS = new QPixmap;
	*stoneWaPixS = stoneWaPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *stoneBaPix = new QPixmap(":/img/stoneBa.png");
	QPixmap *stoneBaPixS = new QPixmap;
	*stoneBaPixS = stoneBaPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *stoneWsPix = new QPixmap(":/img/stoneWs.png");
	QPixmap *stoneWsPixS = new QPixmap;
	*stoneWsPixS = stoneWsPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *stoneBsPix = new QPixmap(":/img/stoneBs.png");
	QPixmap *stoneBsPixS = new QPixmap;
	*stoneBsPixS = stoneBsPix->scaled(stoneSize, stoneSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
	QPixmap *nullPix = new QPixmap(":/img/null.png");


	/* 棋盤網格排版 */
	QGridLayout *grid = new QGridLayout;
	grid->setSpacing(0);
	grid->setMargin(0);
	grid->setGeometry(QRect(0, 0, 10, 100));

	/* 構建棋盤 */
	QLabel *square[BOARD_SIZE*BOARD_SIZE];
	for (int i=0; i<boardSize; i++) {
		for (int j=0; j<boardSize; j++) {
			square[i*BOARD_SIZE+j] = new QLabel;
			square[i*BOARD_SIZE+j]->setFrameStyle(QFrame::Panel + QFrame::Sunken);
			square[i*BOARD_SIZE+j]->setAlignment(Qt::AlignCenter);
			square[i*BOARD_SIZE+j]->setAttribute(Qt::WA_TranslucentBackground);
			// square[i*BOARD_SIZE+j]->setPixmap();
			square[i*BOARD_SIZE+j]->setAttribute(Qt::WA_TransparentForMouseEvents, true);
			grid->addWidget(square[i*BOARD_SIZE+j], i, j);
		}
	}
	QLabel *turnT = new QLabel(window);
	turnT->setGeometry(boardWidth, 20, 200, 14);
	turnT->setText("<center>Next move:</center>");
	QLabel *turn = new QLabel(window);
	turn->setGeometry(boardWidth+100-(STONE_SIZE/2), 45, STONE_SIZE, STONE_SIZE);
	turn->setFrameStyle(QFrame::Sunken);

	/* 遊戲物件 */
	game = new Game(square, turn,
		stoneWPixS, stoneBPixS,
		stoneWaPixS, stoneBaPixS,
		stoneWsPixS, stoneBsPixS,
		nullPix);

	/* UI */
	QCheckBox *hintCheckBox = new QCheckBox("Show hints");
	hintCheckBox->setParent(window);
	hintCheckBox->setGeometry(boardWidth+50, 210, 100, 20);
	QObject::connect(hintCheckBox, SIGNAL(stateChanged(int)), game, SLOT(hintSwitch(int)));

	QLabel *bScore = new QLabel(window);
	bScore->setGeometry(boardWidth, 100, 200, 14);
	bScore->setText("<center>Black</center>");
	QLabel *wScore = new QLabel(window);
	wScore->setGeometry(boardWidth, 150, 200, 14);
	wScore->setText("<center>White</center>");
	QLCDNumber *lcdB = new QLCDNumber(window);
	QLCDNumber *lcdW = new QLCDNumber(window);
	lcdB->setGeometry(boardWidth+50, 120, 100, 24);
	lcdW->setGeometry(boardWidth+50, 170, 100, 24);
	QObject::connect(game, SIGNAL(updateBScore(int)), lcdB, SLOT(display(int)));
	QObject::connect(game, SIGNAL(updateWScore(int)), lcdW, SLOT(display(int)));

	QCheckBox *aiBCheckBox = new QCheckBox("AI");
	aiBCheckBox->setParent(window);
	aiBCheckBox->setGeometry(boardWidth+140, 100, 50, 14);
	QObject::connect(aiBCheckBox, SIGNAL(stateChanged(int)), game, SLOT(aiBSwitch(int)));

	QCheckBox *aiWCheckBox = new QCheckBox("AI");
	aiWCheckBox->setParent(window);
	aiWCheckBox->setGeometry(boardWidth+140, 150, 50, 14);
	QObject::connect(aiWCheckBox, SIGNAL(stateChanged(int)), game, SLOT(aiWSwitch(int)));

	/* 按鍵 */
//.........这里部分代码省略.........
开发者ID:Neson,项目名称:QtReversi,代码行数:101,代码来源:main.cpp

示例10: setupUi

    void setupUi(QMainWindow *Detection)
    {
        if (Detection->objectName().isEmpty())
            Detection->setObjectName(QString::fromUtf8("Detection"));
        Detection->resize(729, 480);
        actionE_xit = new QAction(Detection);
        actionE_xit->setObjectName(QString::fromUtf8("actionE_xit"));
        action_Load_Map = new QAction(Detection);
        action_Load_Map->setObjectName(QString::fromUtf8("action_Load_Map"));
        action_Connect = new QAction(Detection);
        action_Connect->setObjectName(QString::fromUtf8("action_Connect"));
        action_Disconnect = new QAction(Detection);
        action_Disconnect->setObjectName(QString::fromUtf8("action_Disconnect"));
        centralWidget = new QWidget(Detection);
        centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
        gridLayoutWidget = new QWidget(centralWidget);
        gridLayoutWidget->setObjectName(QString::fromUtf8("gridLayoutWidget"));
        gridLayoutWidget->setGeometry(QRect(0, 0, 721, 421));
        gridLayout = new QGridLayout(gridLayoutWidget);
        gridLayout->setSpacing(6);
        gridLayout->setContentsMargins(11, 11, 11, 11);
        gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
        gridLayout->setSizeConstraint(QLayout::SetNoConstraint);
        gridLayout->setVerticalSpacing(5);
        gridLayout->setContentsMargins(0, 0, 0, 0);
        ugvFeedLabel = new QLabel(gridLayoutWidget);
        ugvFeedLabel->setObjectName(QString::fromUtf8("ugvFeedLabel"));
        QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        sizePolicy.setHorizontalStretch(0);
        sizePolicy.setVerticalStretch(0);
        sizePolicy.setHeightForWidth(ugvFeedLabel->sizePolicy().hasHeightForWidth());
        ugvFeedLabel->setSizePolicy(sizePolicy);

        gridLayout->addWidget(ugvFeedLabel, 1, 2, 1, 1);

        connectionButton = new QCommandLinkButton(gridLayoutWidget);
        connectionButton->setObjectName(QString::fromUtf8("connectionButton"));

        gridLayout->addWidget(connectionButton, 0, 2, 1, 1);

        uavFeedLabel = new QLabel(gridLayoutWidget);
        uavFeedLabel->setObjectName(QString::fromUtf8("uavFeedLabel"));
        sizePolicy.setHeightForWidth(uavFeedLabel->sizePolicy().hasHeightForWidth());
        uavFeedLabel->setSizePolicy(sizePolicy);
        uavFeedLabel->setMaximumSize(QSize(16777215, 16777215));

        gridLayout->addWidget(uavFeedLabel, 1, 0, 1, 1);

        ugvMapLabel = new QLabel(gridLayoutWidget);
        ugvMapLabel->setObjectName(QString::fromUtf8("ugvMapLabel"));
        QSizePolicy sizePolicy1(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
        sizePolicy1.setHorizontalStretch(0);
        sizePolicy1.setVerticalStretch(0);
        sizePolicy1.setHeightForWidth(ugvMapLabel->sizePolicy().hasHeightForWidth());
        ugvMapLabel->setSizePolicy(sizePolicy1);

        gridLayout->addWidget(ugvMapLabel, 1, 3, 1, 1);

        horizontalLayout_4 = new QHBoxLayout();
        horizontalLayout_4->setSpacing(6);
        horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4"));
        label_2 = new QLabel(gridLayoutWidget);
        label_2->setObjectName(QString::fromUtf8("label_2"));

        horizontalLayout_4->addWidget(label_2);

        uavTakeoffLandButton = new QPushButton(gridLayoutWidget);
        uavTakeoffLandButton->setObjectName(QString::fromUtf8("uavTakeoffLandButton"));

        horizontalLayout_4->addWidget(uavTakeoffLandButton);


        gridLayout->addLayout(horizontalLayout_4, 2, 0, 1, 1);

        horizontalLayout_2 = new QHBoxLayout();
        horizontalLayout_2->setSpacing(6);
        horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
        label = new QLabel(gridLayoutWidget);
        label->setObjectName(QString::fromUtf8("label"));

        horizontalLayout_2->addWidget(label);

        ugvSpeedLCD = new QLCDNumber(gridLayoutWidget);
        ugvSpeedLCD->setObjectName(QString::fromUtf8("ugvSpeedLCD"));
        ugvSpeedLCD->setFrameShape(QFrame::Box);

        horizontalLayout_2->addWidget(ugvSpeedLCD);


        gridLayout->addLayout(horizontalLayout_2, 4, 2, 1, 1);

        horizontalLayout_6 = new QHBoxLayout();
        horizontalLayout_6->setSpacing(6);
        horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6"));
        label_3 = new QLabel(gridLayoutWidget);
        label_3->setObjectName(QString::fromUtf8("label_3"));

        horizontalLayout_6->addWidget(label_3);

        ugvSpeakerButton = new QPushButton(gridLayoutWidget);
//.........这里部分代码省略.........
开发者ID:sauver,项目名称:sauver_sys,代码行数:101,代码来源:ui_main_window.hpp

示例11: QLCDNumber

QLCDNumber * GameBoard::createLCD()
{
    QLCDNumber * LCD = new QLCDNumber(2);
    LCD->setSegmentStyle(QLCDNumber::Filled);
    return LCD;
}
开发者ID:unball,项目名称:ieee-very-small-2012,代码行数:6,代码来源:gameboard.cpp

示例12: QGridLayout

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);
}
开发者ID:mjs513,项目名称:orca-robotics,代码行数:76,代码来源:wifielement.cpp

示例13: QMainWindow

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    QMenu *file;
    QMenu *edit;
    QMenu *effect;
    QMenu *tools;
    QMenu *help;
    QAction *newa = new QAction(tr("&New"), this);
    QAction *open = new QAction(tr("&Open"), this);
    QAction *save = new QAction(tr("&Save"), this);
    QAction *saveas = new QAction(tr("&Save as"), this);
    QAction *import = new QAction(tr("&Import sample"), this);
    QAction *quit = new QAction(tr("&Quit"), this);
    QAction *play = new QAction(tr("&Play"), this);
    QAction *stop = new QAction(tr("&Stop"), this);
    QAction *pause = new QAction(tr("&Pause"), this);
    QAction *record= new QAction(tr("&Record"), this);
    QAction *zoomin  = new QAction(tr("Zoom in"), this);
    QAction *zoomout = new QAction(tr("Zoom out"), this);
    QAction *settings = new QAction(tr("&Settings"), this);
    QToolBar *toolbar = addToolBar("Main ToolBar");
    QLCDNumber *lcd = new QLCDNumber();
    QLabel * play_v = new QLabel(), * rec_v = new QLabel();
    QSlider * play_slider = new QSlider(Qt::Horizontal), * rec_slider = new QSlider(Qt::Horizontal);
    wave = new Wave();
    fileName = "";
    changed = false;
    newa->setIcon(QIcon::fromTheme("document-new"));
    newa->setShortcut(tr("CTRL+N"));
    open->setIcon(QIcon::fromTheme("document-open"));
    open->setShortcut(tr("CTRL+O"));
    save->setIcon(QIcon::fromTheme("document-save"));
    save->setShortcut(tr("CTRL+S"));
    saveas->setIcon(QIcon::fromTheme("document-save-as"));
    import->setIcon(QIcon::fromTheme("audio-x-generic"));
    zoomin->setIcon(QIcon::fromTheme("zoom-in"));
    zoomin->setShortcut(tr("CTRL+Up"));
    zoomout->setIcon(QIcon::fromTheme("zoom-out"));
    zoomout->setShortcut(tr("CTRL+Down"));
    play->setIcon(QIcon::fromTheme("media-playback-start"));
    play->setShortcut(tr("Space"));
    play->setCheckable(true);
    stop->setIcon(QIcon::fromTheme("media-playback-stop"));
    pause->setIcon(QIcon::fromTheme("media-playback-pause"));
    record->setIcon(QIcon::fromTheme("media-record"));
    record->setShortcut(tr("Ctrl+Space"));
    record->setCheckable(true);
    quit->setIcon(QIcon::fromTheme("application-exit"));
    quit->setShortcut(tr("CTRL+Q"));
    lcd->setDigitCount(8);
    lcd->display("00:00:00");
    lcd->setStyleSheet("background: black; color: #00FF00");
    lcd->setFixedSize(100, 30);
    play_v->setText(tr("Playback volume:"));
    rec_v->setText(tr("Record volume:"));
    play_slider->setMaximumWidth(50);
    play_slider->setRange(0, 100);
    rec_slider->setMaximumWidth(50);
    rec_slider->setRange(0, 100);
    file = menuBar()->addMenu(tr("&File"));
    file->addAction(newa);
    file->addAction(open);
    file->addAction(save);
    file->addAction(saveas);
    file->addSeparator();
    file->addAction(import);
    file->addSeparator();
    file->addAction(quit);
    edit = menuBar()->addMenu(tr("&Edit"));
    effect = menuBar()->addMenu(tr("&Effects"));
    tools = menuBar()->addMenu(tr("&Tools"));
    settings->setIcon(QIcon::fromTheme("multimedia-volume-control"));
    tools->addAction(settings);
    help = menuBar()->addMenu(tr("&Help"));

    toolbar->addAction(newa);
    toolbar->addAction(open);
    toolbar->addAction(save);
    toolbar->addSeparator();
    toolbar->addAction(import);
    toolbar->addAction(zoomin);
    toolbar->addAction(zoomout);
    toolbar->addSeparator();
    toolbar->addAction(stop);
    toolbar->addAction(pause);
    toolbar->addAction(play);
    toolbar->addAction(record);
    toolbar->addSeparator();
    toolbar->addWidget(play_v);
    toolbar->addWidget(play_slider);
    toolbar->addWidget(rec_v);
    toolbar->addWidget(rec_slider);
    toolbar->addWidget(lcd);
    connect(newa, SIGNAL(triggered()), this, SLOT(newFile()));
    connect(open, SIGNAL(triggered()), this, SLOT(openFile()));
    connect(save, SIGNAL(triggered()), this, SLOT(saveFile()));
    connect(saveas, SIGNAL(triggered()), this, SLOT(saveFileAs()));
    connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));

    connect(zoomin, SIGNAL(triggered()), this, SLOT(zoomIn()));
//.........这里部分代码省略.........
开发者ID:hzoli17,项目名称:ZSFEdit,代码行数:101,代码来源:mainwindow.cpp

示例14: switch

void DataWidget::setValue(double value)
{
    switch (_dataDescription->widget)
    {
    case DATA_WIDGET_PLOT:
	{
            QwtPlot *widget = qobject_cast<QwtPlot*> (_internalWidget);
            if (widget != 0)
            {
                _curveData->xData->append(_mainWindow->effectiveRunningTime());
                _curveData->yData->append(value);
#if QWT_VERSION >= 0x060000
                _curve->setRawSamples(_curveData->xData->data(),
                                      _curveData->yData->data(), _curveData->xData->size());
#else
#  warning Old version of qwt being used, data aggregator will not work.
#endif
                widget->replot();
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    case DATA_WIDGET_LCD:
	{
            QLCDNumber *widget = qobject_cast<QLCDNumber*> (_internalWidget);
            if (widget != 0)
            {
                widget->display(value);
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    case DATA_WIDGET_LEVEL:
	{
            QwtThermo *widget = qobject_cast<QwtThermo*> (_internalWidget);
            if (widget != 0)
            {
                widget->setValue(value);
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    case DATA_WIDGET_DIAL:
	{
            QwtDial *widget = qobject_cast<QwtDial*> (_internalWidget);
            if (widget != 0)
            {
                widget->setValue(value);
            }
            else
            {
                qDebug() << "Bad data widget cast (DataWidget::setValue()) !";
            }
            break;
	}

    default:
        ;
    }

    emit valueChanged(value, _dataDescription->id);
}
开发者ID:excess-project,项目名称:starpu-ex-1.2.0rc5,代码行数:74,代码来源:datawidget.cpp

示例15: resizeEvent

void LCDRange::resizeEvent( QResizeEvent * )
{
    sBar->setGeometry( 0, height() - 16, width(), 16 );
    lcd->resize( width(), sBar->y() - 5 );
}
开发者ID:kthxbyte,项目名称:Qt1.45-Linaro,代码行数:5,代码来源:main.cpp


注:本文中的QLCDNumber类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。