Skip to content

Commit 8a7eace

Browse files
committed
使用bs文件路径作为参数传入
1 parent 79a6cbc commit 8a7eace

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

BitmapStudio/main.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ int main(int argc, char *argv[])
1717
break;
1818
}
1919
}
20-
MainWindow w;
20+
21+
QString filePath = nullptr;
22+
if (argc >= 2)
23+
{
24+
filePath = QString::fromUtf8(argv[1]);
25+
}
26+
27+
MainWindow w(filePath);
2128
w.show();
2229
return a.exec();
2330
}

BitmapStudio/mainwindow.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@
2222
#include <QClipboard>
2323

2424

25-
MainWindow::MainWindow(QWidget *parent)
25+
MainWindow::MainWindow(const QString &filePath, QWidget *parent)
2626
: QMainWindow(parent)
2727
, ui(new Ui::MainWindow)
2828
{
2929
ui->setupUi(this);
3030
init();
31+
32+
if (filePath != nullptr)
33+
pm.on_OpenProjectUrl(filePath);
3134
}
3235

3336
MainWindow::~MainWindow()

BitmapStudio/mainwindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MainWindow : public QMainWindow
1818
Q_OBJECT
1919

2020
public:
21-
MainWindow(QWidget *parent = nullptr);
21+
MainWindow(const QString &filePath, QWidget *parent = nullptr);
2222
~MainWindow();
2323

2424

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
### [0.2.0] - 2024-06-23
3+
### [0.2.0] - 2024-06-24
44

55
#### Added
66

@@ -10,6 +10,7 @@
1010
- 组合图跳转到图片功能
1111
- 导出图片保存到本地添加默认名称
1212
- 新增设置导出图片的像素颜色(config.ini)
13+
- 可使用\*.bs文件路径作为参数传入(把Bitmap Studio.exe设置为\*.bs文件的默认打开方式后可直接打开\*.bs文件)
1314

1415
#### Fixed
1516

0 commit comments

Comments
 (0)