fix: 修改了部分UI问题

Description: 修改了部分UI问题

Log: 修改了部分UI问题
Change-Id: I07a717ce36e54668ca901a5781369f4954453a94
This commit is contained in:
liuminghang 2021-07-01 13:53:19 +08:00
parent a8463c551f
commit e51af566e4
2 changed files with 30 additions and 4 deletions

View File

@ -92,7 +92,7 @@ void MainWidget::setupUi(QWidget *Widget)
mainWindow->titlebar()->setMenuVisible(false); mainWindow->titlebar()->setMenuVisible(false);
} }
m_mainGridLayout = new QGridLayout(Widget); m_mainGridLayout = new QGridLayout(Widget);
m_mainGridLayout->setSpacing(6); m_mainGridLayout->setSpacing(0);
m_mainGridLayout->setContentsMargins(0, 0, 0, 6); m_mainGridLayout->setContentsMargins(0, 0, 0, 6);
m_mainGridLayout->setObjectName(QStringLiteral("gridLayout")); m_mainGridLayout->setObjectName(QStringLiteral("gridLayout"));
@ -101,17 +101,22 @@ void MainWidget::setupUi(QWidget *Widget)
m_horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); m_horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
m_plainTextEdit = new ResultTextView(Widget); m_plainTextEdit = new ResultTextView(Widget);
m_plainTextEdit->setLineWidth(0);
// m_plainTextEdit->setWindowFlags(Qt::FramelessWindowHint);
// m_plainTextEdit->setStyleSheet("background:transparent;border:2px solid red;");
m_plainTextEdit->setObjectName(QStringLiteral("plainTextEdit")); m_plainTextEdit->setObjectName(QStringLiteral("plainTextEdit"));
if (!m_imageview) { if (!m_imageview) {
m_imageview = new ImageView(); m_imageview = new ImageView();
m_imageview->setLineWidth(0);
} }
m_resultWidget = new DStackedWidget(this); m_resultWidget = new DStackedWidget(this);
m_resultWidget->setFocusPolicy(Qt::NoFocus); m_resultWidget->setFocusPolicy(Qt::NoFocus);
m_resultWidget->setMinimumWidth(220); m_resultWidget->setMinimumWidth(220);
//宽度最大值为440
m_resultWidget->setMaximumWidth(440);
m_loadingOcr = new loadingWidget(this); m_loadingOcr = new loadingWidget(this);
@ -145,7 +150,7 @@ void MainWidget::setupUi(QWidget *Widget)
m_mainGridLayout->setColumnStretch(0, 1); m_mainGridLayout->setColumnStretch(0, 1);
m_buttonHorizontalLayout = new QHBoxLayout(Widget); m_buttonHorizontalLayout = new QHBoxLayout(Widget);
m_buttonHorizontalLayout->setContentsMargins(20, 0, 59, 0); //表示控件与窗体的左右边距 m_buttonHorizontalLayout->setContentsMargins(20, 3, 59, 3); //表示控件与窗体的左右边距
// m_buttonHorizontalLayout->setSpacing(30); // m_buttonHorizontalLayout->setSpacing(30);
@ -180,8 +185,12 @@ void MainWidget::setupUi(QWidget *Widget)
m_buttonHorizontalLayout->addWidget(m_exportBtn); m_buttonHorizontalLayout->addWidget(m_exportBtn);
m_line = new DHorizontalLine(this);
m_line->setObjectName(QStringLiteral("m_line"));
m_mainGridLayout->addLayout(m_buttonHorizontalLayout, 1, 0, 1, 1); m_mainGridLayout->addWidget(m_line, 1, 0, 1, 1);
m_mainGridLayout->addLayout(m_buttonHorizontalLayout, 2, 0, 1, 1);
retranslateUi(Widget); retranslateUi(Widget);
@ -513,6 +522,14 @@ void MainWidget::setIcons(DGuiApplicationHelper::ColorType themeType)
if (m_isLoading && m_imageview) { if (m_isLoading && m_imageview) {
m_imageview->setForegroundBrush(QColor(0, 0, 0, 150)); //设置场景的前景色,类似于遮罩 m_imageview->setForegroundBrush(QColor(0, 0, 0, 150)); //设置场景的前景色,类似于遮罩
} }
if (m_imageview) {
m_imageview->setBackgroundBrush(QColor(248, 248, 248));
QPalette pal;
pal.setColor(QPalette::Background, QColor(20, 248, 248));
// m_imageview->scene()->setAutoFillBackground(true);
m_imageview->scene()->setPalette(pal);
}
} else { } else {
QPalette pal; QPalette pal;
pal.setColor(QPalette::Background, QColor(255, 255, 255, 179)); pal.setColor(QPalette::Background, QColor(255, 255, 255, 179));
@ -547,5 +564,9 @@ void MainWidget::setIcons(DGuiApplicationHelper::ColorType themeType)
if (m_isLoading && m_imageview) { if (m_isLoading && m_imageview) {
m_imageview->setForegroundBrush(QColor(255, 255, 255, 150)); //设置场景的前景色,类似于遮罩 m_imageview->setForegroundBrush(QColor(255, 255, 255, 150)); //设置场景的前景色,类似于遮罩
} }
if (m_imageview) {
m_imageview->setBackgroundBrush(QColor(248, 248, 248));
}
} }
} // setupUi } // setupUi

View File

@ -7,6 +7,7 @@
#include <DLabel> #include <DLabel>
#include <DGuiApplicationHelper> #include <DGuiApplicationHelper>
#include <DStackedWidget> #include <DStackedWidget>
#include <DFrame>
#include <QMutex> #include <QMutex>
@ -70,7 +71,10 @@ private:
DToolButton *m_copyBtn{nullptr}; DToolButton *m_copyBtn{nullptr};
DToolButton *m_exportBtn{nullptr}; DToolButton *m_exportBtn{nullptr};
ImageView *m_imageview{nullptr}; ImageView *m_imageview{nullptr};
QHBoxLayout *m_frameLayout{nullptr};
QFrame *m_frame{nullptr};
DLabel *m_tipIconLabel{nullptr}; DLabel *m_tipIconLabel{nullptr};
DHorizontalLine *m_line{nullptr};
QString m_imgName; //当前图片绝对路径 QString m_imgName; //当前图片绝对路径
QWidget *m_pwidget{nullptr}; QWidget *m_pwidget{nullptr};
@ -89,6 +93,7 @@ private:
loadingWidget *m_loadingOcr{nullptr}; loadingWidget *m_loadingOcr{nullptr};
QShortcut *m_scAddView = nullptr; QShortcut *m_scAddView = nullptr;
QShortcut *m_scReduceView = nullptr; QShortcut *m_scReduceView = nullptr;
signals: signals:
void sigResult(const QString &); void sigResult(const QString &);