GofunListWidget::GofunListWidget(QWidget* parent) : QWidget(parent) { list = new QListView(this); list->addColumn(tr("Values")); list->setResizeMode(QListView::AllColumns); list->setSorting(-1); edit = new QLineEdit(this); edit->setEnabled(false); connect(edit,SIGNAL(textChanged(const QString&)),this,SLOT(updateValue(const QString&))); connect(list,SIGNAL(selectionChanged()),this,SLOT(updateEdit())); add_button = new QPushButton(tr("Add"),this); rem_button = new QPushButton(tr("Remove"),this); up_button = new QPushButton(tr("Up"),this); down_button = new QPushButton(tr("Down"),this); connect(add_button,SIGNAL(clicked()),this,SLOT(add())); connect(rem_button,SIGNAL(clicked()),this,SLOT(remove())); connect(up_button,SIGNAL(clicked()),this,SLOT(up())); connect(down_button,SIGNAL(clicked()),this,SLOT(down())); QGridLayout* grid = new QGridLayout(this,4,3); grid->addWidget(add_button,0,0); grid->addWidget(rem_button,0,1); grid->addMultiCellWidget(list,1,1,0,2); grid->addMultiCellWidget(edit,2,2,0,2); QGridLayout* right = new QGridLayout(4,1); grid->addMultiCellLayout(right,0,4,3,3); right->addWidget(up_button,1,0); right->addWidget(down_button,2,0); }
void PhysicHandler::update() { if (game_mode&GAME_MENU) { reset_time=true; } else if (game_mode&GAME_PAUSED ) { reset_time=true; updatePaused(); } else if (game_mode&GAME_PLAY) { if (reset_time) { Dfps=Dframes=currentfps=dt=0; minfps=1000; } else { dt=(SDL_GetTicks()-tcurrent); updateFPS(); } reset_time=false; tcurrent=SDL_GetTicks(); updateGame(); } else if (game_mode&GAME_EDIT_NOANIM) { } else if (game_mode&GAME_EDIT) { if (reset_time) { dt=0; } else { dt=(SDL_GetTicks()-tcurrent); } reset_time=false; tcurrent=SDL_GetTicks(); updateEdit(); } else { } }
void TimestampSpinBox::setValue(const pv::util::Timestamp& val) { if (val == value_) return; value_ = val; updateEdit(); Q_EMIT valueChanged(value_); }
TimestampSpinBox::TimestampSpinBox(QWidget* parent) : QAbstractSpinBox(parent) , precision_(9) , stepsize_("1e-6") { connect(this, SIGNAL(editingFinished()), this, SLOT(on_editingFinished())); updateEdit(); }
void gameController::update() { m_oMouseLocScreen.update(); m_oMouseLocWorld.loc.x = m_oMouseLocScreen.loc.x + m_pCamera.loc.x - CAM_OFFSET_X; m_oMouseLocWorld.loc.y = m_oMouseLocScreen.loc.y + m_pCamera.loc.y - CAM_OFFSET_Y; if ( m_bEditMode ) { updateEdit(); }else{ updateGame(); } }
void TimestampSpinBox::on_editingFinished() { if (!lineEdit()->isModified()) return; lineEdit()->setModified(false); QRegExp re(R"(\s*([-+]?)\s*([0-9]+\.?[0-9]*).*)"); if (re.exactMatch(text())) { QStringList captures = re.capturedTexts(); captures.removeFirst(); // remove entire match QString str = captures.join(""); setValue(pv::util::Timestamp(str.toStdString())); } else { // replace the malformed entered string with the old value updateEdit(); } }
void TimestampSpinBox::setPrecision(unsigned precision) { precision_ = precision; updateEdit(); }
void HiddenFileView::checkBoxClicked(QCheckBox* chkBox,KToggleAction* action,QLineEdit* edit, int column,QPtrList<QRegExp> & reqExpList,bool b) { // We don't save the old state so // disable the tristate mode chkBox->setTristate(false); action->setChecked(b); chkBox->setChecked(b); HiddenListViewItem* item; for (item = static_cast<HiddenListViewItem*>(_dlg->hiddenListView->firstChild());item; item = static_cast<HiddenListViewItem*>(item->nextSibling())) { if (!item->isSelected()) continue; if (b == item->isOn(column)) continue; if (!b) { QRegExp* rx = getRegExpListMatch(item->text(0),reqExpList); // Perhaps the file was hidden because it started with a dot if (!rx && item->text(0)[0]=='.' && _dlg->hideDotFilesChk->isChecked()) { int result = KMessageBox::questionYesNo(_dlg,i18n( "<qt>Some files you have selected are hidden because they start with a dot; " "do you want to uncheck all files starting with a dot?</qt>"),i18n("Files Starting With Dot"),i18n("Uncheck Hidden"), i18n("Keep Hidden")); if (result == KMessageBox::No) { QPtrList<HiddenListViewItem> lst = getMatchingItems(QRegExp(".*",false,true)); deselect(lst); } else { _dlg->hideDotFilesChk->setChecked(false); } continue; } else { if (rx) { // perhaps it is matched by a wildcard string QString p = rx->pattern(); if ( p.find("*") > -1 || p.find("?") > -1 ) { // TODO after message freeze: why show three times the wildcard string? Once should be enough. // TODO remove <b></b> and use <qt> instead int result = KMessageBox::questionYesNo(_dlg,i18n( "<b></b>Some files you have selected are matched by the wildcarded string <b>'%1'</b>; " "do you want to uncheck all files matching <b>'%1'</b>?").arg(rx->pattern()).arg(rx->pattern()).arg(rx->pattern()), i18n("Wildcarded String"),i18n("Uncheck Matches"),i18n("Keep Selected")); QPtrList<HiddenListViewItem> lst = getMatchingItems( *rx ); if (result == KMessageBox::No) { deselect(lst); } else { setState(lst,column,false); reqExpList.remove(rx); updateEdit(edit, reqExpList); } continue; } else { reqExpList.remove(rx); updateEdit(edit, reqExpList); } } } } else { reqExpList.append( new QRegExp(item->text(0)) ); updateEdit(edit, reqExpList); } item->setOn(column,b); } _dlg->hiddenListView->update(); }
//-------------------------------------------------------------- void testApp::update(){ updateEdit(); updateGraphics(); }