void SqlItemView::toNext() { int row = findUp(m_row); if (row != m_row) { setCurrentIndex(row, m_column); emit indexChanged(); } }
void SqlItemView::updateButtons(int row) { int rowcount = m_model->rowCount(); int notDeleted = 0; int adjRow = row; for (int i = 0; i < rowcount; ++i) { if (m_table->isRowHidden(i)) { if (i < row) { --adjRow; } } else { ++notDeleted; } } positionLabel->setText(tr("row %1 of %2").arg(adjRow + 1).arg(notDeleted)); previousButton->setEnabled(findDown(row) != row); firstButton->setEnabled(findUp(-1) != row); nextButton->setEnabled(findUp(row) != row); lastButton->setEnabled(findDown(rowcount) != row); }
void SmokeSource::setShaderMatrix(const glm::mat4& matrix) { SmokeShader* ss = (SmokeShader*) findUp(typeid(SmokeShader)); glm::mat4 p_matrix; glGetFloatv(GL_PROJECTION_MATRIX, glm::value_ptr(p_matrix)); glm::mat4 mvp_matrix = p_matrix * matrix; GLint mvp_location = glGetUniformLocation(ss->getProgram(), "mvp_matrix"); glUniformMatrix4fv(mvp_location, 1, GL_FALSE, glm::value_ptr(mvp_matrix)); }
bool SqlItemView::rowDeleted() { int row = findUp(m_row); if (row != m_row) { setCurrentIndex(row, m_column); emit indexChanged(); return false; } row = findDown(m_row); if (row != m_row) { setCurrentIndex(row, m_column); emit indexChanged(); return false; } return true; }
Points Drop::findOneWay(int x, int y) { Points points; auto xx = x, yy = y; for (int i=0; i<2*xCount; i++) { auto value = findUp(xx, yy); if (value == UnReachable) { value = findLeft(xx, yy); if (value == UnReachable) { value = findRight(xx, yy); if (value == UnReachable) { // 无法移动 break; } else { points.push_back(Vec2(xx-1, yy+1)); points.push_back(Vec2(xx, yy)); xx -= 1; yy += 1; } } else { points.push_back(Vec2(xx-1, yy-1)); points.push_back(Vec2(xx, yy)); xx -= 1; yy -= 1; } } else { points.push_back(Vec2(xx-1, yy)); points.push_back(Vec2(xx, yy)); xx -=1; } if (value == 1) break; } return points; }
void SmokeSource::setIntensity(GLfloat intensity) { SmokeShader* ss = (SmokeShader*) findUp(typeid(SmokeShader)); GLint location = glGetUniformLocation(ss->getProgram(), "intensity"); glUniform1f(location, intensity); }