opti:修正初始尺寸显示。

This commit is contained in:
taynpg 2024-05-29 10:31:48 +08:00
parent 2f119e8273
commit 4320c57d8f
2 changed files with 19 additions and 23 deletions

View File

@ -21,8 +21,9 @@ MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget
QScreen* primaryScreen = QGuiApplication::primaryScreen(); QScreen* primaryScreen = QGuiApplication::primaryScreen();
QRect screenGeometry = primaryScreen->geometry(); QRect screenGeometry = primaryScreen->geometry();
setMinimumWidth(screenGeometry.width() * 0.5);
setMinimumHeight(screenGeometry.height() * 0.9); setBaseSize(screenGeometry.width() * 0.6, screenGeometry.height() * 0.9);
// setMinimumWidth(900); // setMinimumWidth(900);
// setMinimumHeight(800); // setMinimumHeight(800);
@ -47,7 +48,7 @@ MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget
return; return;
} }
read(file); read(file);
//ui->edStatus->setText(file); // ui->edStatus->setText(file);
}); });
connect(ui->btnSearch, &QPushButton::clicked, this, [&]() { search(ui->edSearchKey->text()); }); connect(ui->btnSearch, &QPushButton::clicked, this, [&]() { search(ui->edSearchKey->text()); });
connect(ui->btnBackup, &QPushButton::clicked, this, [&]() { backup_file(); }); connect(ui->btnBackup, &QPushButton::clicked, this, [&]() { backup_file(); });
@ -102,11 +103,11 @@ MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget
restoreGeometry(settings.value("geometry").toByteArray()); restoreGeometry(settings.value("geometry").toByteArray());
settings.endGroup(); settings.endGroup();
//QFile qss_file("://qss/lightblue.css"); // QFile qss_file("://qss/lightblue.css");
// QFile qss_file("://qss/flatgray.css"); // QFile qss_file("://qss/flatgray.css");
// if (qss_file.open(QFile::ReadOnly)) { // if (qss_file.open(QFile::ReadOnly)) {
// qApp->setStyleSheet(qss_file.readAll()); // qApp->setStyleSheet(qss_file.readAll());
// } // }
init_menu(); init_menu();
@ -173,8 +174,7 @@ void MainWidget::show_custom_menu()
if (indexList.size() == 1) { if (indexList.size() == 1) {
menu_simple_->exec(QCursor::pos()); menu_simple_->exec(QCursor::pos());
} } else {
else {
menu_multi_->exec(QCursor::pos()); menu_multi_->exec(QCursor::pos());
} }
} }
@ -302,8 +302,7 @@ void MainWidget::read(const QString& file_path)
if (base_.allow_max_width < 0 || base_.allow_max_width > 1000) { if (base_.allow_max_width < 0 || base_.allow_max_width > 1000) {
allow_max_with_ = 100; allow_max_with_ = 100;
} } else {
else {
allow_max_with_ = base_.allow_max_width; allow_max_with_ = base_.allow_max_width;
} }
@ -516,8 +515,8 @@ void MainWidget::insert_one_line(Element_t* ele, int row)
// wgItem->setCheckState(Qt::Checked); // wgItem->setCheckState(Qt::Checked);
} }
QString sda(data); QString sda(data);
int dwidth = metrics_->horizontalAdvance(sda) + blank_with_; int dwidth = metrics_->horizontalAdvance(sda) + blank_with_;
int need_set_width = dwidth > allow_max_with_ ? allow_max_with_ : dwidth; int need_set_width = dwidth > allow_max_with_ ? allow_max_with_ : dwidth;
col_with_[i] = col_with_[i] < need_set_width ? need_set_width : col_with_[i]; col_with_[i] = col_with_[i] < need_set_width ? need_set_width : col_with_[i];
wgItem->setText(sda); wgItem->setText(sda);
tab_widget_->setItem(row, i, wgItem); tab_widget_->setItem(row, i, wgItem);
@ -653,14 +652,11 @@ void MainWidget::copy_multi_data()
if (ui->rbAllPage->isChecked()) { if (ui->rbAllPage->isChecked()) {
get_related_elements(vec, AREA_ALL_PAGE); get_related_elements(vec, AREA_ALL_PAGE);
} } else if (ui->rbReplaceSelect->isChecked()) {
else if (ui->rbReplaceSelect->isChecked()) {
get_related_elements(vec, AREA_SELECT); get_related_elements(vec, AREA_SELECT);
} } else if (ui->rbRepCurPage->isChecked()) {
else if (ui->rbRepCurPage->isChecked()) {
get_related_elements(vec, AREA_CUR_PAGE); get_related_elements(vec, AREA_CUR_PAGE);
} } else {
else {
get_related_elements(vec, AREA_ALL); get_related_elements(vec, AREA_ALL);
} }

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1279</width> <width>1048</width>
<height>805</height> <height>682</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">