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();
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);
// setMinimumHeight(800);
@ -47,7 +48,7 @@ MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget
return;
}
read(file);
//ui->edStatus->setText(file);
// ui->edStatus->setText(file);
});
connect(ui->btnSearch, &QPushButton::clicked, this, [&]() { search(ui->edSearchKey->text()); });
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());
settings.endGroup();
//QFile qss_file("://qss/lightblue.css");
// QFile qss_file("://qss/flatgray.css");
// if (qss_file.open(QFile::ReadOnly)) {
// qApp->setStyleSheet(qss_file.readAll());
// }
// QFile qss_file("://qss/lightblue.css");
// QFile qss_file("://qss/flatgray.css");
// if (qss_file.open(QFile::ReadOnly)) {
// qApp->setStyleSheet(qss_file.readAll());
// }
init_menu();
@ -173,8 +174,7 @@ void MainWidget::show_custom_menu()
if (indexList.size() == 1) {
menu_simple_->exec(QCursor::pos());
}
else {
} else {
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) {
allow_max_with_ = 100;
}
else {
} else {
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);
}
QString sda(data);
int dwidth = metrics_->horizontalAdvance(sda) + blank_with_;
int need_set_width = dwidth > allow_max_with_ ? allow_max_with_ : dwidth;
int dwidth = metrics_->horizontalAdvance(sda) + blank_with_;
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];
wgItem->setText(sda);
tab_widget_->setItem(row, i, wgItem);
@ -650,17 +649,14 @@ void MainWidget::copy_multi_data()
return;
}
std::vector<OperElement*> vec;
if (ui->rbAllPage->isChecked()) {
get_related_elements(vec, AREA_ALL_PAGE);
}
else if (ui->rbReplaceSelect->isChecked()) {
} else if (ui->rbReplaceSelect->isChecked()) {
get_related_elements(vec, AREA_SELECT);
}
else if (ui->rbRepCurPage->isChecked()) {
} else if (ui->rbRepCurPage->isChecked()) {
get_related_elements(vec, AREA_CUR_PAGE);
}
else {
} else {
get_related_elements(vec, AREA_ALL);
}

View File

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