int MailTreeDelegate::DrawMessageActionIcons (QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index, int height) const { if (Mode_ != MailListMode::Normal) return 0; if (option.state & QStyle::State_MouseOver) return 0; const auto& actionsVar = index.data (MailModel::MailRole::MessageActions); if (actionsVar.isNull ()) return 0; auto actionInfos = actionsVar.value<QList<MessageListActionInfo>> (); if (actionInfos.isEmpty ()) return 0; std::reverse (actionInfos.begin (), actionInfos.end ()); if (ActionsHintsBalls_) height -= Padding * 2; painter->save (); painter->setRenderHint (QPainter::Antialiasing); painter->setPen (Qt::NoPen); auto rect = option.rect; rect.setLeft (rect.right () - height - Padding); rect.setSize ({ height, height }); rect.moveTop (rect.top () + Padding); for (const auto& item : actionInfos) { if (item.Flags_ & MessageListActionFlag::AlwaysPresent) continue; if (ActionsHintsBalls_) { QRadialGradient gradient; gradient.setCoordinateMode (QGradient::ObjectBoundingMode); gradient.setFocalPoint ({ 0.3, 0.3 }); gradient.setCenter ({ 0.5, 0.5 }); gradient.setRadius (0.5); gradient.setColorAt (0, item.ReprColor_.lighter (200)); gradient.setColorAt (1, item.ReprColor_.darker (120)); painter->setBrush (gradient); painter->drawEllipse (rect); } else item.Icon_.paint (painter, rect); rect.moveLeft (rect.left () - height - Padding); } painter->restore (); return option.rect.right () - rect.right (); }
QMap<int, QList<QRectF>> TextDocumentAdapter::GetTextPositions (const QString& text, Qt::CaseSensitivity cs) { const auto& pageSize = Doc_->pageSize (); const auto pageHeight = pageSize.height (); QTextEdit hackyEdit; hackyEdit.setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff); hackyEdit.setVerticalScrollBarPolicy (Qt::ScrollBarAlwaysOff); hackyEdit.setFixedSize (Doc_->pageSize ().toSize ()); hackyEdit.setDocument (Doc_.get ()); Doc_->setPageSize (pageSize); const auto tdFlags = cs == Qt::CaseSensitive ? QTextDocument::FindCaseSensitively : QTextDocument::FindFlags (); QMap<int, QList<QRectF>> result; auto cursor = Doc_->find (text, 0, tdFlags); while (!cursor.isNull ()) { auto endRect = hackyEdit.cursorRect (cursor); auto startCursor = cursor; startCursor.setPosition (cursor.selectionStart ()); auto rect = hackyEdit.cursorRect (startCursor); const int pageNum = rect.y () / pageHeight; rect.moveTop (rect.y () - pageHeight * pageNum); endRect.moveTop (endRect.y () - pageHeight * pageNum); if (rect.y () != endRect.y ()) { rect.setWidth (pageSize.width () - rect.x ()); endRect.setX (0); } auto bounding = rect | endRect; result [pageNum] << bounding; cursor = Doc_->find (text, cursor, tdFlags); } return result; }
ReorderDialog::ReorderDialog(QWidget *parent, SoundFileList *list) : QDialog(parent), ui(new Ui::ReorderDialog) { qDebug("Entering ReorderDialog::ReorderDialog()..."); ui->setupUi(this); this->list = list; fillWidget(0); connect(list, SIGNAL(moved(int)), this, SLOT(fillWidget(int))); connect(ui->bottom, SIGNAL(clicked()), this, SLOT(moveBottom())); connect(ui->down, SIGNAL(clicked()), this, SLOT(moveDown())); connect(ui->down10, SIGNAL(clicked()), this, SLOT(moveTenDown())); connect(ui->up10, SIGNAL(clicked()), this, SLOT(moveTenUp())); connect(ui->up, SIGNAL(clicked()), this, SLOT(moveUp())); connect(ui->top, SIGNAL(clicked()), this, SLOT(moveTop())); }
inline void Box<T>::moveTopRight(const Point<T> &p) { moveRight(p.getX()); moveTop(p.getY()); }
inline void Box<T>::moveTopLeft(const Point<T> &p) { moveLeft(p.getX()); moveTop(p.getY()); }
void QRect::moveTopRight( const QPoint &p ) { moveRight( p.x() ); moveTop( p.y() ); }
void QRect::moveTopLeft( const QPoint &p ) { moveLeft( p.x() ); moveTop( p.y() ); }
void readKeyboard(void) { struct dir_node *currentNode; unsigned char key; bool decision = false; key = toupper(cgetc()); switch((int)key) { case HK_FORMATTER: if(loadOverlay(7)) { formatDisk(selectedPanel); clrscr(); writeMenuBar(); reloadPanels(); } break; case HK_BASIC_VIEWER: if(loadOverlay(6)) { viewFileAsBASIC(selectedPanel); clrscr(); writeMenuBar(); reloadPanels(); } break; case HK_HEX_EDIT: if(loadOverlay(5)) { hexEditCurrentFile(selectedPanel); clrscr(); writeMenuBar(); reloadPanels(); } break; case CH_ENTER: currentNode = getSelectedNode(selectedPanel); if(isDirectory(selectedPanel)) { enterDirectory(selectedPanel); } else if(currentNode != NULL) { sprintf(filePath, "%s/%s", selectedPanel->path, currentNode->name); if(currentNode->type == 0x06 || currentNode->type == 0xFF) { saveScreen(); decision = writeYesNo("Confirm", quit_message, 1); retrieveScreen(); if(decision == true) { exec(filePath, NULL); } } else if(currentNode->type == 0xFC) { if(loadOverlay(6)) { viewFileAsBASIC(selectedPanel); clrscr(); writeMenuBar(); reloadPanels(); } } else { if(loadOverlay(1)) viewFile(filePath); } } break; case KEY_F4: rereadSelectedPanel(); break; case KEY_F3: selectDrive(selectedPanel); rereadSelectedPanel(); break; case HK_SELECT: selectCurrentFile(); break; #ifdef __APPLE2ENH__ case CH_CURS_UP: #else case CH_CURS_LEFT: #endif moveSelectorUp(selectedPanel); break; #ifdef __APPLE2ENH__ case CH_CURS_DOWN: #else case CH_CURS_RIGHT: #endif moveSelectorDown(selectedPanel); break; #ifdef __APPLE2ENH__ case CH_CURS_LEFT: if(selectedPanel == &rightPanelDrive && strlen(leftPanelDrive.path) > 0) { selectedPanel = &leftPanelDrive; writeSelectorPosition(&leftPanelDrive, '>'); writeSelectorPosition(&rightPanelDrive, ' '); writeCurrentFilename(selectedPanel); } break; case CH_CURS_RIGHT: if(selectedPanel == &leftPanelDrive && strlen(rightPanelDrive.path) > 0) { selectedPanel = &rightPanelDrive; writeSelectorPosition(&leftPanelDrive, ' '); writeSelectorPosition(&rightPanelDrive, '>'); writeCurrentFilename(selectedPanel); } break; #endif case HK_SWITCH_PANEL: if(selectedPanel == &leftPanelDrive && strlen(rightPanelDrive.path) > 0) { selectedPanel = &rightPanelDrive; writeSelectorPosition(&leftPanelDrive, ' '); writeSelectorPosition(&rightPanelDrive, '>'); writeCurrentFilename(selectedPanel); } else if(selectedPanel == &rightPanelDrive && strlen(leftPanelDrive.path) > 0) { selectedPanel = &leftPanelDrive; writeSelectorPosition(&leftPanelDrive, '>'); writeSelectorPosition(&rightPanelDrive, ' '); writeCurrentFilename(selectedPanel); } break; case KEY_SH_PLUS: enterDirectory(selectedPanel); break; case KEY_SH_MINUS: case CH_ESC: leaveDirectory(selectedPanel); break; //case 188: // C= C - Command Menu // writeMenu(command); // break; //case 182: // C= L - Left Menu // writeMenu(left); // break; //case 178: // C= R - Right Menu // writeMenu(right); // break; //case 187: // C= F - File Menu // writeMenu(file); // break; //case 185: // C= O - Options Menu // writeMenu(options); // break; case HK_REREAD_LEFT: rereadDrivePanel(left); break; case HK_REREAD_RIGHT: rereadDrivePanel(right); break; case HK_DRIVE_LEFT: writeDriveSelectionPanel(left); break; case HK_DRIVE_RIGHT: writeDriveSelectionPanel(right); break; case HK_SELECT_ALL: selectAllFiles(selectedPanel, true); break; case HK_DESELECT_ALL: selectAllFiles(selectedPanel, false); break; case KEY_F1: if(loadOverlay(1)) writeHelpPanel(); break; case KEY_F2: quit(); break; case KEY_F5: if(loadOverlay(4)) copyFiles(); break; case HK_RENAME: case KEY_F6: if(loadOverlay(4)) renameFile(); break; case HK_DELETE: case KEY_F8: if(loadOverlay(4)) deleteFiles(); break; //case KEY_AT: // inputCommand(); // break; case KEY_F7: if(loadOverlay(4)) makeDirectory(); break; case HK_TO_TOP: moveTop(selectedPanel); break; case HK_TO_BOTTOM: moveBottom(selectedPanel); break; case HK_PAGE_UP: movePageUp(selectedPanel); break; case HK_PAGE_DOWN: movePageDown(selectedPanel); break; case HK_WRITE_DISK_IMAGE: if(loadOverlay(3)) writeDiskImage(); break; case HK_CREATE_DISK_IMAGE: if(loadOverlay(3)) createDiskImage(); break; case HK_COPY_DISK: if(loadOverlay(2)) copyDisk(); break; default: //writeStatusBarf("%c", key); break; } }
void Showplan::moveItemTop() { if (getSize() == 0) return; if (!mIsItemSelected) return; moveTop(getItemByHash(mSelected)); }
//! moves left() to x and top() to y, leaving the size unchanged void QwtDoubleRect::moveTo(double x, double y) { moveLeft(x); moveTop(y); }
int aStar(tNodeQueue *root, int heuristica, int *answer) { tQueue *a = malloc(sizeof(tQueue)); tQueue *f = malloc(sizeof(tQueue)); *answer = -1; printf("%d\n",a); initialize(a); initialize(f); insertAtEnd(a, root); while (!isEmpty(a)) { tNodeQueue *v = removeMin(a); insertAtEnd(f, v); if (isFinalState(v->elem->matrix)) { *answer = v->elem->f; return 1; } else { tNodeQueue *top = malloc(sizeof (tNodeQueue)); tNodeBoard *topBoard = malloc(sizeof (tNodeBoard)); top->elem = topBoard; tNodeQueue *right = malloc(sizeof (tNodeQueue)); tNodeBoard *rightBoard = malloc(sizeof (tNodeBoard)); right->elem = rightBoard; tNodeQueue *bottom = malloc(sizeof (tNodeQueue)); tNodeBoard *bottomBoard = malloc(sizeof (tNodeBoard)); bottom->elem = bottomBoard; tNodeQueue *left = malloc(sizeof (tNodeQueue)); tNodeBoard *leftBoard = malloc(sizeof (tNodeBoard)); left->elem = leftBoard; int i; int j; findZeroPosition(v->elem->matrix, &i, &j); if (moveTop(v->elem->matrix, top->elem->matrix, i, j)) { validSuccessor(a, f, v, top, heuristica); } else { free(topBoard); free(top); } if (moveRight(v->elem->matrix, right->elem->matrix, i, j)) { validSuccessor(a, f, v, right, heuristica); } else { free(rightBoard); free(right); } if (moveBottom(v->elem->matrix, bottom->elem->matrix, i, j)) { validSuccessor(a, f, v, bottom, heuristica); } else { free(bottomBoard); free(bottom); } if (moveLeft(v->elem->matrix, left->elem->matrix, i, j)) { validSuccessor(a, f, v, left, heuristica); } else { free(leftBoard); free(left); } } } if (isEmpty(a)) { return 0; } }
void MythRect::moveTopLeft(const MythPoint &point) { moveLeft(point.getX()); moveTop(point.getY()); }