コード例 #1
0
ファイル: AlarmWidget.cpp プロジェクト: MakSim345/QT-Dev
void AlarmWidget::initLayouts()
{
    mainVlayout =  new QVBoxLayout();
    radioTimeVlayout =  new QVBoxLayout();
    radioSoundVlayout =  new QVBoxLayout();
    textVlayout =  new QVBoxLayout();
    TimeInsVlayout =  new QVBoxLayout();
    hLayoutBtns  =  new QHBoxLayout();
    hLayoutTime  =  new QHBoxLayout();
    hLayoutRemainTime  =  new QHBoxLayout();
    hLayoutTimeShow  =  new QHBoxLayout();
    
    QGroupBox *groupBoxTime = new QGroupBox();

    radioTimeVlayout->addWidget(radioMin);
    radioTimeVlayout->addWidget(radioSec);
    groupBoxTime->setMaximumHeight(55);
    groupBoxTime->setFlat(true);
    //radioTimeVlayout->addStretch(1);    
    groupBoxTime->setLayout(radioTimeVlayout);
    
    QGroupBox *groupBoxSound = new QGroupBox();
    radioSoundVlayout->addWidget(radioSoundOn);
    radioSoundVlayout->addWidget(radioSoundOFF);
    groupBoxSound->setMaximumHeight(55);
    groupBoxSound->setFlat(true);
    groupBoxSound->setLayout(radioSoundVlayout);

    hLayoutTime->addWidget(timerValue);
    hLayoutTime->addWidget(groupBoxTime);//orig - radioTimeVlayout

    textVlayout->addWidget(lblSetTime);
    textVlayout->addWidget(lblRTime);

    hLayoutRemainTime->addWidget(txtRemain);    
    hLayoutRemainTime->addWidget(groupBoxSound);

    TimeInsVlayout->addLayout(hLayoutTime);
    TimeInsVlayout->addLayout(hLayoutRemainTime);    

    hLayoutTimeShow->addLayout(textVlayout);
    hLayoutTimeShow->addLayout(TimeInsVlayout);

    //set buttons to layout:
    hLayoutBtns->addWidget(btnStart);
    hLayoutBtns->addWidget(btnPause);
    hLayoutBtns->addWidget(btnQuit);

    mainVlayout->addLayout(hLayoutTimeShow);
    mainVlayout->addLayout(hLayoutBtns);

    mainVlayout->setMargin(0);
    //mainVlayout->setSpacing(0);
    

    setLayout(mainVlayout);
}
コード例 #2
0
ファイル: ratingwidget.cpp プロジェクト: teodorxxx/test
void RatingWidget::createWidget()
{
	createLineEditWidget();
	createLineEditWidgetRate();

	m_CustomPlot = new CustomPlot(m_Rate, this);
	m_CustomPlot->setFocusPolicy(Qt::ClickFocus);

	QPushButton	*buttonRate = new QPushButton(tr("Oceń"), this);
	buttonRate->setDefault(true);
	//button->setAutoDefault(true);
	buttonRate->setShortcut(QKeySequence(Qt::Key_Return));
	buttonRate->setStatusTip(tr("Oceń stan izolacji"));
	connect(buttonRate, SIGNAL(clicked()), this, SLOT(rate()));

	QPushButton	*buttonInitialValue = new QPushButton(tr("Wartości początkowe"), this);
	buttonInitialValue->setStatusTip(tr("Przywróć wartości początkowe"));
	connect(buttonInitialValue, SIGNAL(clicked()), this, SLOT(restoreInitialValue()));

	QPushButton	*buttonPlotValue = new QPushButton(tr("Wartości z wykresu"), this);
	buttonPlotValue->setStatusTip(tr("Ustaw wartości z wykresu"));
	connect(buttonPlotValue, SIGNAL(clicked()), this, SLOT(setPlotValue()));

	QHBoxLayout *bLay = new QHBoxLayout(this);
	bLay->addWidget(buttonRate);
	bLay->addWidget(buttonInitialValue);
	bLay->addWidget(buttonPlotValue);

	QGroupBox *buttonBox = new QGroupBox(this);
	buttonBox->setLayout(bLay);

	QGridLayout *gBox = new QGridLayout(this);
	gBox->addWidget(m_LineEdit, 0, 0);
	gBox->addWidget(m_LineEditRate, 0, 1);
	gBox->addWidget(buttonBox, 1, 0);

	QGroupBox *groupBox = new QGroupBox(this);
	groupBox->setLayout(gBox);
	groupBox->setMinimumHeight(260);
	groupBox->setMaximumHeight(260);

	m_MainBox = new QVBoxLayout(this);
	m_MainBox->addWidget(groupBox);
	m_MainBox->addWidget(m_CustomPlot);
}
コード例 #3
0
ファイル: AddDatabase.cpp プロジェクト: nmcle/baduK
//--------------------------------------------------------------------------
// PROGRESS PAGE
//--------------------------------------------------------------------------
ProgressPage::ProgressPage(AddDatabase* addDatabase, QWidget* parent) : QWidget(parent)
{
  addDatabase_ = addDatabase;
  labelInitializeGames = new QLabel("Initialize Games");
  labelDuplicateCheck = new QLabel("Duplicate Check");
  labelParseGames = new QLabel("Parsing Games");
  labelInitializePatterns = new QLabel("Generating Patterns");
  labelOverall = new QLabel("Overall");
  labelInitializeGames->setMaximumHeight(20);
  labelDuplicateCheck->setMaximumHeight(20);
  labelParseGames->setMaximumHeight(20);
  labelInitializePatterns->setMaximumHeight(20);
  labelOverall->setMaximumHeight(20);
  
  labelCurrentTime = new QLabel("Elapsed time");
  labelEstimateTime = new QLabel("Estimated time");
  labelTotalGames = new QLabel("Number of Games found");
  labelDuplicateGames = new QLabel("Duplicate Games found");
  
  labelCurrentTime->setMaximumHeight(20);
  labelEstimateTime->setMaximumHeight(20);
  labelTotalGames->setMaximumHeight(20);
  labelDuplicateGames->setMaximumHeight(20);
  
  labelCurrentTimeData = new QLabel;
  labelEstimateTimeData = new QLabel;
  labelTotalGamesData = new QLabel;
  labelDuplicateGamesData = new QLabel;
    
  labelCurrentTimeData->setMaximumHeight(20);
  labelEstimateTimeData->setMaximumHeight(20);
  labelTotalGamesData->setMaximumHeight(20);
  labelDuplicateGamesData->setMaximumHeight(20);
  
  progressBarInitializeGames = new QProgressBar;
  progressBarDuplicateCheck = new QProgressBar;
  progressBarParseGames = new QProgressBar;
  progressBarInitializePatterns = new QProgressBar;
  progressBarInitializeGames->setMaximumHeight(20);
  progressBarDuplicateCheck->setMaximumHeight(20);
  progressBarParseGames->setMaximumHeight(20);
  progressBarInitializePatterns->setMaximumHeight(20);
  
  cancelButton = new QPushButton("&Cancel", this);
  backButton = new QPushButton("< &Back", this);
  finishButton = new QPushButton("&Finish", this);
  
  QGridLayout *layout = new QGridLayout;
  
  QGroupBox *groupBoxProgress = new QGroupBox(tr("Progress"));
  QGridLayout *gridLayoutProgress = new QGridLayout;
  gridLayoutProgress->addWidget(labelInitializeGames, 0, 0);
  gridLayoutProgress->addWidget(progressBarInitializeGames, 0, 1, 1, 2);
  gridLayoutProgress->addWidget(labelDuplicateCheck, 1, 0);
  gridLayoutProgress->addWidget(progressBarDuplicateCheck, 1, 1, 1, 2);
  gridLayoutProgress->addWidget(labelParseGames, 2, 0);
  gridLayoutProgress->addWidget(progressBarParseGames, 2, 1, 1, 2);
  gridLayoutProgress->addWidget(labelInitializePatterns, 3, 0);
  gridLayoutProgress->addWidget(progressBarInitializePatterns, 3, 1, 1, 2);
  groupBoxProgress->setLayout(gridLayoutProgress);
  groupBoxProgress->setMaximumHeight(150);
  groupBoxProgress->setFlat(true);
  layout->addWidget(groupBoxProgress, 0, 0, 1, 3);
  
  QGroupBox *groupBoxDetails = new QGroupBox(tr("Details"));
  QGridLayout *gridLayoutDetails = new QGridLayout;
  gridLayoutDetails->addWidget(labelCurrentTime, 0, 0, 1, 2);
  gridLayoutDetails->addWidget(labelCurrentTimeData, 0, 2);
  gridLayoutDetails->addWidget(labelTotalGames, 2, 0, 1, 2);
  gridLayoutDetails->addWidget(labelTotalGamesData, 2, 2);
  gridLayoutDetails->addWidget(labelDuplicateGames, 3, 0, 1, 2);
  gridLayoutDetails->addWidget(labelDuplicateGamesData, 3, 2);
  groupBoxDetails->setLayout(gridLayoutDetails);
  groupBoxDetails->setFlat(true);
  groupBoxDetails->setMaximumHeight(100);
  layout->addWidget(groupBoxDetails, 1, 0 , 1, 3);
  
  QSpacerItem* spacerButtons = new QSpacerItem(0, 0);
  QGridLayout *layoutButtons = new QGridLayout;
  QSpacerItem* spacer = new QSpacerItem(0, 0);
  layoutButtons->addItem(spacer, 0, 0);
  layoutButtons->addWidget(cancelButton, 0, 1);
  layoutButtons->addWidget(backButton, 0, 2);
  layoutButtons->addWidget(finishButton, 0, 3);
  layoutButtons->setColumnStretch(0, 1);
  layout->addItem(spacerButtons, 2, 0, 1, 3);
  layout->addItem(layoutButtons, 3, 0, 1, 3);  
  layout->setOriginCorner(Qt::TopLeftCorner);
  
  layout->setColumnMinimumWidth(0,100);
  layout->setColumnMinimumWidth(1,100);
  layout->setColumnMinimumWidth(2,100);
  setLayout(layout);

  connect(cancelButton, SIGNAL(clicked()),
          this, SLOT(cancelClick()));
  connect(backButton, SIGNAL(clicked()),
          this, SLOT(backClick()));
  connect(finishButton, SIGNAL(clicked()),
          addDatabase_, SLOT(accept()));

  finishButton->setEnabled(false);
  hasCancelled_ = false;
  isBackClicked_ = false;
}
コード例 #4
0
LiveDataWidget::LiveDataWidget(QStringList &langList, QWidget *parent /* = 0 */)
    : QWidget (parent)
    , _langList(langList)
    , _shortNameListView(0)
    , _shortNameListModel(0)
    , _shortNameEdit(0)
    , _unitEdit(0)
    , _commandIDBox(0)
    , _algorithmIDBox(0)
    , _contentEdits()
    , _defEdits()
    , _catalogList()
    , _shortNameList()
    , _currentCatalog()
    , _isAddNew(false)
{
    QHBoxLayout *mainLayout = new QHBoxLayout(this);
    setLayout(mainLayout);

    _shortNameListView = new QListView(this);
    _shortNameListView->setMaximumWidth(240);

    _shortNameListModel = new QStringListModel();
    _shortNameListView->setModel(_shortNameListModel);

    mainLayout->addWidget(_shortNameListView);

    QVBoxLayout *editLayout = new QVBoxLayout(this);

    mainLayout->addLayout(editLayout);

    {
        QHBoxLayout *hlayout = new QHBoxLayout(this);
        editLayout->addLayout(hlayout);
        // Short Name edit, for add new item
        QGroupBox *box = new QGroupBox(this);
        box->setTitle(trUtf8("Short Name"));
        box->setMaximumHeight(50);
        QHBoxLayout *layout = new QHBoxLayout(box);
        _shortNameEdit = new QLineEdit(box);
        box->setLayout(layout);
        layout->addWidget(_shortNameEdit);

        hlayout->addWidget(box);

        // Unit
        box = new QGroupBox(this);
        box->setTitle(trUtf8("Unit"));
        box->setMaximumWidth(100);
        box->setMaximumHeight(50);
        layout = new QHBoxLayout(box);
        _unitEdit = new QLineEdit(box);
        box->setLayout(layout);
        layout->addWidget(_unitEdit);

        hlayout->addWidget(box);

        // Command ID.
        box = new QGroupBox(this);
        box->setTitle(trUtf8("Command ID"));
        box->setMaximumWidth(100);
        box->setMaximumHeight(50);
        layout = new QHBoxLayout(box);
        _commandIDBox = new QComboBox(box);
        box->setLayout(layout);
        layout->addWidget(_commandIDBox);

        hlayout->addWidget(box);

        // Algorithm ID.
        box = new QGroupBox(this);
        box->setTitle(trUtf8("Algorithm ID"));
        box->setMaximumWidth(100);
        box->setMaximumHeight(50);
        layout = new QHBoxLayout(box);
        _algorithmIDBox = new QComboBox(box);
        box->setLayout(layout);
        layout->addWidget(_algorithmIDBox);

        hlayout->addWidget(box);
    }

    connect(_unitEdit, SIGNAL(textChanged(QString)), this, SLOT(updateUnit(QString)));
    connect(_commandIDBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateCommboxID(QString)));
    connect(_algorithmIDBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(updateAlgorithmID(QString)));
    connect(_shortNameEdit, SIGNAL(textChanged(QString)), this, SLOT(changeAddNew()));

    for (int i = 0; i < _langList.size(); i++)
    {
        QGroupBox *box = new QGroupBox(this);
        box->setTitle(_langList[i]);
        editLayout->addWidget(box);

        QVBoxLayout *boxLayout = new QVBoxLayout(box);
        box->setLayout(boxLayout);

        // Defalut Value
        QGroupBox *defBox = new QGroupBox(box);
        defBox->setTitle(trUtf8("Default Value"));
        boxLayout->addWidget(defBox);
        QLineEdit *defEdit = new QLineEdit(defBox);
        defEdit->setObjectName(_langList[i]);
        QVBoxLayout *layout = new QVBoxLayout(defBox);
        defBox->setLayout(layout);
        layout->addWidget(defEdit);
        defBox->setMaximumHeight(50);
        
        _defEdits.insert(_langList[i], defEdit);

        // Content Edit
        QGroupBox *contentBox = new QGroupBox(box);
        contentBox->setTitle(trUtf8("Content"));
        boxLayout->addWidget(contentBox);
        QPlainTextEdit *contentEdit = new QPlainTextEdit(contentBox);
        contentEdit->setObjectName(_langList[i]);
        layout = new QVBoxLayout(contentBox);
        layout->addWidget(contentEdit);
        contentBox->setLayout(layout);

        _contentEdits.insert(_langList[i], contentEdit);

        connect(defEdit, SIGNAL(textChanged(QString)), this, SLOT(updateDefaultValue(QString)));
        connect(contentEdit, SIGNAL(textChanged()), this, SLOT(updateContent()));
    }

    connect(_shortNameListView, SIGNAL(clicked(QModelIndex)), this, SLOT(setCurrentShortName(QModelIndex)));
}