using different cursors is checkable and added to settings

This commit is contained in:
garak 2018-09-12 20:43:04 -04:00
parent 5b96af47db
commit ece612a865
4 changed files with 31 additions and 2 deletions

View file

@ -1484,11 +1484,15 @@ void MapPixmapItem::updateCurHoveredTile(QPointF pos) {
void MapPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { void MapPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
updateCurHoveredTile(event->pos()); updateCurHoveredTile(event->pos());
setCursor(editor->cursor); if (editor->ui->actionBetter_Cursors->isChecked()){
setCursor(editor->cursor);
}
} }
void MapPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { void MapPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) {
map->clearHoveredTile(); map->clearHoveredTile();
unsetCursor(); if (editor->ui->actionBetter_Cursors->isChecked()){
unsetCursor();
}
} }
void MapPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { void MapPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
QPointF pos = event->pos(); QPointF pos = event->pos();

View file

@ -54,6 +54,10 @@ MainWindow::MainWindow(QWidget *parent) :
openProject(default_dir); openProject(default_dir);
} }
} }
if (settings.contains("cursor_mode") && settings.value("cursor_mode") == "0") {
ui->actionBetter_Cursors->setChecked(false);
}
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -600,6 +604,11 @@ void MainWindow::on_actionZoom_Out_triggered() {
scaleMapView(-1); scaleMapView(-1);
} }
void MainWindow::on_actionBetter_Cursors_triggered() {
QSettings settings;
settings.setValue("cursor_mode", QString::number(ui->actionBetter_Cursors->isChecked()));
}
void MainWindow::scaleMapView(int s) { void MainWindow::scaleMapView(int s) {
editor->map->scale_exp += s; editor->map->scale_exp += s;

View file

@ -62,6 +62,7 @@ private slots:
void on_actionZoom_In_triggered(); void on_actionZoom_In_triggered();
void on_actionZoom_Out_triggered(); void on_actionZoom_Out_triggered();
void on_actionBetter_Cursors_triggered();
void on_toolButton_deleteObject_clicked(); void on_toolButton_deleteObject_clicked();

View file

@ -2076,6 +2076,7 @@
</property> </property>
<addaction name="actionZoom_In"/> <addaction name="actionZoom_In"/>
<addaction name="actionZoom_Out"/> <addaction name="actionZoom_Out"/>
<addaction name="actionBetter_Cursors"/>
</widget> </widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>
<addaction name="menuEdit"/> <addaction name="menuEdit"/>
@ -2154,6 +2155,20 @@
<string>-</string> <string>-</string>
</property> </property>
</action> </action>
<action name="actionBetter_Cursors">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Better Cursors</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use reticule-styled cursors with icon showing currently selected tool.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets> <customwidgets>