From fa2574ad48acd3f0d70d359f02816ee9255a95d9 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Thu, 13 Sep 2018 17:48:40 -0500 Subject: [PATCH] Add cursor for 'shift' mode --- mainwindow.cpp | 27 ++++++--------------------- mainwindow.h | 1 - resources/icons/shift_cursor.ico | Bin 0 -> 4286 bytes resources/images.qrc | 1 + 4 files changed, 7 insertions(+), 22 deletions(-) create mode 100644 resources/icons/shift_cursor.ico diff --git a/mainwindow.cpp b/mainwindow.cpp index 7ffac85c..985f2831 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -37,7 +37,6 @@ MainWindow::MainWindow(QWidget *parent) : connect(ui->newEventToolButton, SIGNAL(newEventAdded(QString)), this, SLOT(addNewEvent(QString))); new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z), this, SLOT(redo())); - new QShortcut(Qt::Key_M, this, SLOT(toggleEditModeMove())); editor = new Editor(ui); connect(editor, SIGNAL(objectsChanged()), this, SLOT(updateSelectedObjects())); @@ -996,6 +995,12 @@ void MainWindow::on_toolButton_Move_clicked() void MainWindow::on_toolButton_Shift_clicked() { editor->map_edit_mode = "shift"; + editor->cursor = QCursor(QPixmap(":/icons/shift_cursor.ico"), 10, 10); + + ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); + ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + QScroller::ungrabGesture(ui->scrollArea); + checkToolButtons(); } @@ -1008,26 +1013,6 @@ void MainWindow::checkToolButtons() { ui->toolButton_Shift->setChecked(editor->map_edit_mode == "shift"); } -void MainWindow::toggleEditModeMove() { - if (editor->map_edit_mode == "move") { - if (editor->prev_edit_mode == "paint") { - on_toolButton_Paint_clicked(); - } else if (editor->prev_edit_mode == "fill") { - on_toolButton_Fill_clicked(); - } else if (editor->prev_edit_mode == "pick") { - on_toolButton_Dropper_clicked(); - } else if (editor->prev_edit_mode == "select") { - on_toolButton_Select_clicked(); - } else if (editor->prev_edit_mode == "shift") { - on_toolButton_Shift_clicked(); - } - } - else { - editor->prev_edit_mode = editor->map_edit_mode; - on_toolButton_Move_clicked(); - } -} - void MainWindow::onLoadMapRequested(QString mapName, QString fromMapName) { setMap(mapName); editor->setSelectedConnectionFromMap(fromMapName); diff --git a/mainwindow.h b/mainwindow.h index a9f9bf99..58380406 100755 --- a/mainwindow.h +++ b/mainwindow.h @@ -37,7 +37,6 @@ private slots: void undo(); void redo(); - void toggleEditModeMove(); void openInTextEditor(); void onLoadMapRequested(QString, QString); diff --git a/resources/icons/shift_cursor.ico b/resources/icons/shift_cursor.ico new file mode 100644 index 0000000000000000000000000000000000000000..0c8722c39f0e67ecdce4d49e3321bf0e7a554ef6 GIT binary patch literal 4286 zcmcJSe@t6d6vw}yVgI4Y3|ZFVDqRuhCKMwPHO~L|%f!v$7Pb}WF^(n5YRxlZ8PM!i-tiN>forY565K+7LFU!{128lCiZs&w1rR+rVP_R@44^Z z&pG$Kd(Q!gqCb@i{EG{Z0&xJ6NJxcONLasF5k(Q9$Y$%3{^19Vtqq03=D7#9UxM!O z?~tRq27Q7Jc^W&f{a8juMt?#=!mHGdDou96sQnS;&$>|g+$>H!KZlbq+<-A{JS5+l ze?&R#$0y!agTY{#pPv`Iy1JHBD%ES7@oQeX843RWfq{X0D=RCa+wB&+ySta-;^Ovi zZ-`)`x}kni*1Y%{d6LJ!lYAK>E0?{hbb z_Tf0$;3kgrJhL%h#BjvSD^&1g8oPfj9?xdwcJAJRXt7Y&PGeJHZfcHm}Eg=lCdW z4g8&E2hulMxyEHan<9vT{2roAZTcM=J{WJ5(h>PxesP$>4%nOoxXzskO+(P)g! z&eu#t`upG8+1dFwv$>Gp_ft|*BsSX^X(1mKRaI5?g@pwVvE6BDY0Qp}G}m{1;wg1H zoh>~*y^PuCs*gq7Z(lyQscd03w_Bn*}A0iRIC4S-rijt;LylV!A-9PyGFZ1Qsz*`cE_~tLU zDm&#+lMtS8dN-RloJz@Vmu!QdJ{9xppMmjvYSfAgA9X~QPj}rwH{BJ$KTC`g>5JK8J3`Yq4%^`G1PEwBxZyiTxnAYbmY9V~L6&q*tt)3#axZS}cmug{SrSnm2f4>j-BiQ>O3 zdr5Xs{}K9cVGCvK4~e2kvO;a{v!2KKIi5o~-kd0k@2-n`AC0JJglb>C^c<-I%YR{7 BErS36 literal 0 HcmV?d00001 diff --git a/resources/images.qrc b/resources/images.qrc index 2c0cf39d..2094922f 100755 --- a/resources/images.qrc +++ b/resources/images.qrc @@ -21,5 +21,6 @@ icons/pencil_cursor.ico icons/pipette_cursor.ico icons/shift.ico + icons/shift_cursor.ico