本文整理汇总了C++中SyncDocument::setKeyFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ SyncDocument::setKeyFrame方法的具体用法?C++ SyncDocument::setKeyFrame怎么用?C++ SyncDocument::setKeyFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyncDocument
的用法示例。
在下文中一共展示了SyncDocument::setKeyFrame方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: editBiasValue
void TrackView::editBiasValue(float amount)
{
SyncDocument *doc = getDocument();
if (0 == getTrackCount()) {
QApplication::beep();
return;
}
QRect selection = getSelection();
doc->beginMacro("bias");
for (int track = selection.left(); track <= selection.right(); ++track) {
Q_ASSERT(track < getTrackCount());
SyncTrack *t = getTrack(track);
for (int row = selection.top(); row <= selection.bottom(); ++row) {
if (t->isKeyFrame(row)) {
SyncTrack::TrackKey k = t->getKeyFrame(row); // copy old key
k.value += amount; // modify value
// add sub-command
doc->setKeyFrame(t, k);
}
}
}
doc->endMacro();
dirtyCurrentValue();
}
示例2: editEnterValue
void TrackView::editEnterValue()
{
SyncDocument *doc = getDocument();
if (!lineEdit->isVisible())
return;
if (lineEdit->text().length() > 0 && editTrack < getTrackCount()) {
SyncTrack *t = getTrack(editTrack);
SyncTrack::TrackKey newKey;
newKey.type = SyncTrack::TrackKey::STEP;
newKey.row = editRow;
if (t->isKeyFrame(editRow))
newKey = t->getKeyFrame(editRow); // copy old key
QString text = lineEdit->text();
text.remove(lineEdit->validator()->locale().groupSeparator()); // workaround QTBUG-40456
newKey.value = lineEdit->validator()->locale().toFloat(text); // modify value
doc->setKeyFrame(t, newKey);
dirtyCurrentValue();
} else
QApplication::beep();
lineEdit->hide();
setFocus();
}
示例3: editToggleInterpolationType
void TrackView::editToggleInterpolationType()
{
SyncDocument *doc = getDocument();
if (editTrack < getTrackCount()) {
SyncTrack *t = getTrack(editTrack);
QMap<int, SyncTrack::TrackKey> keyMap = t->getKeyMap();
QMap<int, SyncTrack::TrackKey>::const_iterator it = keyMap.lowerBound(editRow);
if (it != keyMap.constBegin() && it.key() != editRow)
--it;
if (it.key() > editRow || it == keyMap.constEnd()) {
QApplication::beep();
return;
}
// copy and modify
SyncTrack::TrackKey newKey = *it;
newKey.type = (SyncTrack::TrackKey::KeyType)
((newKey.type + 1) % SyncTrack::TrackKey::KEY_TYPE_COUNT);
// apply change to data-set
doc->setKeyFrame(t, newKey);
// update user interface
dirtyCurrentValue();
} else
QApplication::beep();
}
示例4: editPaste
void TrackView::editPaste()
{
SyncDocument *doc = getDocument();
if (0 == getTrackCount()) {
QApplication::beep();
return;
}
const QMimeData *mimeData = QApplication::clipboard()->mimeData();
if (mimeData->hasFormat("application/x-gnu-rocket")) {
const QByteArray mimeDataBuffer = mimeData->data("application/x-gnu-rocket");
const char *clipbuf = mimeDataBuffer.data();
// copy data
int buffer_width, buffer_height, buffer_size;
memcpy(&buffer_width, clipbuf + 0, sizeof(int));
memcpy(&buffer_height, clipbuf + sizeof(int), sizeof(int));
memcpy(&buffer_size, clipbuf + 2 * sizeof(int), sizeof(int));
doc->beginMacro("paste");
for (int i = 0; i < buffer_width; ++i) {
int trackPos = editTrack + i;
if (trackPos >= getTrackCount()) continue;
SyncTrack *t = getTrack(trackPos);
for (int j = 0; j < buffer_height; ++j) {
int row = editRow + j;
if (t->isKeyFrame(row))
doc->deleteKeyFrame(t, row);
}
}
const char *src = clipbuf + 2 * sizeof(int) + sizeof(size_t);
for (int i = 0; i < buffer_size; ++i)
{
struct CopyEntry ce;
memcpy(&ce, src, sizeof(CopyEntry));
src += sizeof(CopyEntry);
Q_ASSERT(ce.track >= 0);
Q_ASSERT(ce.track < buffer_width);
Q_ASSERT(ce.keyFrame.row >= 0);
Q_ASSERT(ce.keyFrame.row < buffer_height);
int trackPos = editTrack + ce.track;
if (trackPos < getTrackCount()) {
SyncTrack::TrackKey key = ce.keyFrame;
key.row += editRow;
// since we deleted all keyframes in the edit-box already, we can just insert this one.
doc->setKeyFrame(getTrack(trackPos), key);
}
}
doc->endMacro();
dirtyCurrentValue();
clipbuf = NULL;
} else
QApplication::beep();
}