diff --git a/src/BackProcess/FileWatcher/convert_winid_to_desktop.cpp b/src/BackProcess/FileWatcher/convert_winid_to_desktop.cpp index cf17b36..f7bc939 100755 --- a/src/BackProcess/FileWatcher/convert_winid_to_desktop.cpp +++ b/src/BackProcess/FileWatcher/convert_winid_to_desktop.cpp @@ -18,7 +18,6 @@ #include "convert_winid_to_desktop.h" #include "utility.h" -#include #include #include #include diff --git a/src/UserInterface/ListView/klistview.cpp b/src/UserInterface/ListView/klistview.cpp index 3954bc9..fcf4480 100755 --- a/src/UserInterface/ListView/klistview.cpp +++ b/src/UserInterface/ListView/klistview.cpp @@ -69,14 +69,21 @@ void KListView::mouseMoveEvent(QMouseEvent *e) void KListView::mousePressEvent(QMouseEvent *event) { - if (!(this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) { - Q_EMIT sendHideMainWindowSignal(); - } else { + if ((this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) { pressApp = listmodel->data(this->indexAt(event->pos()), Qt::DisplayRole); } return QListView::mousePressEvent(event); } +void KListView::mouseReleaseEvent(QMouseEvent *e) +{ + if (!(this->indexAt(e->pos()).isValid()) && e->button() == Qt::LeftButton) { + Q_EMIT sendHideMainWindowSignal(); + } else { + return QListView::mouseReleaseEvent(e); + } +} + void KListView::rightClickedSlot(const QPoint &pos) { if (!(this->selectionModel()->selectedIndexes().isEmpty())) { diff --git a/src/UserInterface/ListView/klistview.h b/src/UserInterface/ListView/klistview.h index e932fd2..37359b7 100755 --- a/src/UserInterface/ListView/klistview.h +++ b/src/UserInterface/ListView/klistview.h @@ -24,6 +24,7 @@ protected: void paintEvent(QPaintEvent *e); void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); public: void addData(QStringList data); void updateData(QStringList data); diff --git a/src/UserInterface/Other/scrollarea.cpp b/src/UserInterface/Other/scrollarea.cpp index 65c26e5..2bb4d2d 100755 --- a/src/UserInterface/Other/scrollarea.cpp +++ b/src/UserInterface/Other/scrollarea.cpp @@ -74,23 +74,13 @@ void ScrollAreaWid::paintEvent(QPaintEvent *event) ScrollArea::ScrollArea() { - // this->verticalScrollBar()->setVisible(false); - // this->setFocusPolicy(Qt::NoFocus); - //// this->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - this->setFixedWidth(1330); - // this->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu); + this->setFocusPolicy(Qt::NoFocus); + this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); this->setFrameShape(QFrame::NoFrame); - // this->verticalScrollBar()->setProperty("drawScrollBarGroove",false); - // this->verticalScrollBar()->setAttribute(Qt::WA_TranslucentBackground, false); - this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); this->verticalScrollBar()->setVisible(false); - //滚动条设置 - QPalette p = this->verticalScrollBar()->palette(); - QColor color(255, 255, 255); - color.setAlphaF(0.25); - p.setColor(QPalette::Active, QPalette::Button, color); - this->verticalScrollBar()->setPalette(p); + this->horizontalScrollBar()->setVisible(false); + this->setStyleSheet("QWidget{background:transparent;}"); } void ScrollArea::setFocusToNextChild() diff --git a/src/UserInterface/Widget/full_commonuse_widget.cpp b/src/UserInterface/Widget/full_commonuse_widget.cpp index 26d86b5..c681eca 100755 --- a/src/UserInterface/Widget/full_commonuse_widget.cpp +++ b/src/UserInterface/Widget/full_commonuse_widget.cpp @@ -48,11 +48,11 @@ void FullCommonUseWidget::initUi() m_scrollArea = new ScrollArea(); m_scrollAreaWid = new ScrollAreaWid(this); m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground); - m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight); + m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight); m_scrollArea->setWidget(m_scrollAreaWid); + m_scrollArea->setAlignment(Qt::AlignCenter); m_scrollArea->setStyleSheet("QWidget{background:transparent;}"); m_scrollArea->setWidgetResizable(true); - m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_scrollAreaWidLayout = new QVBoxLayout(m_scrollAreaWid); m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0); m_scrollAreaWidLayout->setSpacing(10); @@ -146,7 +146,7 @@ void FullCommonUseWidget::initAppListWidget() m_listView = new FullListView(this, 0); m_listView->installEventFilter(this); m_scrollAreaWidLayout->addWidget(m_listView); - m_listView->setFixedWidth(m_scrollArea->width()); + m_listView->setFixedWidth(m_scrollAreaWid->width()); connect(m_listView, &FullListView::sendItemClickedSignal, this, &FullCommonUseWidget::execApplication); connect(m_listView, &FullListView::sendUpdateAppListSignal, this, &FullCommonUseWidget::updateListViewSlot); connect(m_listView, &FullListView::sendHideMainWindowSignal, this, &FullCommonUseWidget::sendHideMainWindowSignal); @@ -281,7 +281,7 @@ void FullCommonUseWidget::updateListView() void FullCommonUseWidget::repaintWidget() { - m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight); + m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight); m_scrollAreaWidLayout->removeWidget(m_listView); m_listView->setParent(nullptr); delete m_listView; diff --git a/src/UserInterface/Widget/full_function_widget.cpp b/src/UserInterface/Widget/full_function_widget.cpp index 7cc8464..68c3c26 100755 --- a/src/UserInterface/Widget/full_function_widget.cpp +++ b/src/UserInterface/Widget/full_function_widget.cpp @@ -45,7 +45,7 @@ void FullFunctionWidget::initUi() m_iconListWid = new QWidget(this); m_iconListWid->setAttribute(Qt::WA_TranslucentBackground); m_iconListWid->setAutoFillBackground(false); - m_applistWid->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight); + m_applistWid->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight); m_iconListWid->setFixedSize(Style::m_leftWidWidth, Style::m_applistWidHeight); m_verticalScrollBar = new QScrollBar(m_scrollArea); m_verticalScrollBar->installEventFilter(this); @@ -111,10 +111,10 @@ void FullFunctionWidget::initAppListWidget() layout->setContentsMargins(0, 0, 0, 0); m_applistWid->setLayout(layout); m_scrollArea = new ScrollArea; - m_scrollArea->setStyleSheet("background:transparent"); m_scrollAreaWid = new ScrollAreaWid(this); m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground); m_scrollArea->setFixedSize(m_applistWid->width(), m_applistWid->height()); + m_scrollAreaWid->adjustSize(); m_scrollArea->setWidget(m_scrollAreaWid); m_scrollArea->setWidgetResizable(true); m_scrollAreaWidLayout = new QVBoxLayout(m_scrollAreaWid); @@ -473,7 +473,7 @@ void FullFunctionWidget::setFunctionBtnGeometry() void FullFunctionWidget::repaintWidget() { - m_applistWid->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight); + m_applistWid->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight); m_iconListWid->setFixedSize(Style::m_leftWidWidth, Style::m_applistWidHeight); m_scrollArea->setFixedSize(m_applistWid->width(), m_applistWid->height()); updateAppListView(); diff --git a/src/UserInterface/Widget/full_letter_widget.cpp b/src/UserInterface/Widget/full_letter_widget.cpp index 1ebc2c5..a985098 100755 --- a/src/UserInterface/Widget/full_letter_widget.cpp +++ b/src/UserInterface/Widget/full_letter_widget.cpp @@ -77,12 +77,10 @@ void FullLetterWidget::initAppListWidget() // layout->setContentsMargins(0,0,0,0); // m_applistWid->setLayout(layout); m_scrollArea = new ScrollArea(); - m_scrollArea->setStyleSheet("background:transparent"); m_scrollAreaWid = new ScrollAreaWid(this); m_scrollArea->setWidget(m_scrollAreaWid); - m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight); - m_scrollArea->setWidgetResizable(true); - // m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + m_scrollAreaWid->setFixedWidth(Style::m_applistWidWidth); + m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight); m_scrollAreaWidLayout = new QVBoxLayout; m_scrollAreaWidLayout->setContentsMargins(0, 0, 0, 0); m_scrollAreaWidLayout->setSpacing(10); @@ -304,12 +302,12 @@ void FullLetterWidget::resizeScrollAreaControls() rowcount = listview->model()->rowCount() / dividend; } - listview->setFixedSize(m_scrollArea->width(), listview->gridSize().height()*rowcount); + listview->setFixedHeight(listview->gridSize().height()*rowcount); areaHeight += listview->height() + 50; row++; } - m_scrollArea->widget()->setFixedSize(m_scrollArea->width(), areaHeight - 10); + m_scrollArea->widget()->setFixedHeight(areaHeight - 10); } /** @@ -480,7 +478,8 @@ void FullLetterWidget::setLetterBtnGeometry() void FullLetterWidget::repaintWidget() { m_letterListWid->setFixedSize(Style::m_leftWidWidth, Style::m_applistWidHeight); - m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight); + m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight); + m_scrollAreaWid->setFixedWidth(Style::m_applistWidWidth); updateAppListView(); } diff --git a/src/UserInterface/Widget/full_searchresult_widget.cpp b/src/UserInterface/Widget/full_searchresult_widget.cpp index efdee49..79d26f2 100755 --- a/src/UserInterface/Widget/full_searchresult_widget.cpp +++ b/src/UserInterface/Widget/full_searchresult_widget.cpp @@ -47,7 +47,7 @@ void FullSearchResultWidget::initUi() m_scrollArea->setStyleSheet("background:transparent"); m_scrollAreaWid = new ScrollAreaWid(this); m_scrollAreaWid->setAttribute(Qt::WA_TranslucentBackground); - m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight); + m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight); m_scrollArea->setWidget(m_scrollAreaWid); m_scrollArea->setWidgetResizable(true); m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -228,7 +228,7 @@ void FullSearchResultWidget::selectFirstItemTab() void FullSearchResultWidget::repaintWidget() { - m_scrollArea->setFixedSize(Style::m_applistWidWidth, Style::m_applistWidHeight); + m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight); resizeScrollAreaControls(); m_scrollAreaWidHeight = m_scrollAreaWid->height() + 1; initVerticalScrollBar(); diff --git a/src/UserInterface/full_mainwindow.cpp b/src/UserInterface/full_mainwindow.cpp index dfd692f..7953741 100755 --- a/src/UserInterface/full_mainwindow.cpp +++ b/src/UserInterface/full_mainwindow.cpp @@ -511,10 +511,15 @@ void FullMainWindow::searchAppSlot(QString arg) void FullMainWindow::mousePressEvent(QMouseEvent *event) { resetEditline(); + return QMainWindow::mousePressEvent(event); +} + +void FullMainWindow::mouseReleaseEvent(QMouseEvent *event) +{ if (event->button() == Qt::LeftButton) { this->hide(); } - return QMainWindow::mousePressEvent(event); + return QMainWindow::mouseReleaseEvent(event); } void FullMainWindow::recvSearchResult(QVector arg) diff --git a/src/UserInterface/full_mainwindow.h b/src/UserInterface/full_mainwindow.h index 9592169..0bf7552 100755 --- a/src/UserInterface/full_mainwindow.h +++ b/src/UserInterface/full_mainwindow.h @@ -53,6 +53,7 @@ protected: bool event(QEvent *event); bool eventFilter(QObject *watched, QEvent *event); void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); void changeStyle(); void initConnect(); void initTabOrder(); diff --git a/src/UtilityFunction/Style/style.cpp b/src/UtilityFunction/Style/style.cpp index 53378bd..70198af 100755 --- a/src/UtilityFunction/Style/style.cpp +++ b/src/UtilityFunction/Style/style.cpp @@ -56,6 +56,7 @@ int Style::LeftSpaceIconText = 0; int Style::LeftSpaceBetweenItem = 0; //应用列表栏 int Style::m_applistWidWidth = 0; +int Style::m_applistAreaWidth = 0; int Style::m_applistWidHeight = 0; int Style::AppListIconSize = 0; int Style::AppListBigIconSize = 0; @@ -217,10 +218,11 @@ void Style::initWidStyle() rightViewHeight = 470; LeftSpaceIconText = 14; m_applistWidWidth = m_availableScreenWidth / 1.25; - m_applistWidWidth = m_applistWidWidth - (m_applistWidWidth % m_applistGridSizeWidth) + 1; + m_applistWidWidth = m_applistWidWidth - (m_applistWidWidth % m_applistGridSizeWidth) + 2; m_applistWidHeight = m_availableScreenHeight - 120; - m_applistWidHeight = m_applistWidHeight - (m_applistWidHeight % m_applistGridSizeWidth) + 1; + m_applistWidHeight = m_applistWidHeight - (m_applistWidHeight % m_applistGridSizeWidth); m_leftWidWidth = (m_availableScreenWidth - m_applistWidWidth) / 2 + 1; + m_applistAreaWidth = m_applistWidWidth + 20; } else { ScreenWidth = QApplication::primaryScreen()->geometry().width(); ScreenHeight = QApplication::primaryScreen()->geometry().height(); diff --git a/src/UtilityFunction/Style/style.h b/src/UtilityFunction/Style/style.h index a74e0da..547a072 100755 --- a/src/UtilityFunction/Style/style.h +++ b/src/UtilityFunction/Style/style.h @@ -111,6 +111,7 @@ public: static int LeftSpaceBetweenItem; //item间距 //应用列表栏 static int m_applistWidWidth; //宽度 + static int m_applistAreaWidth; static int m_applistWidHeight; //高度 static int AppListIconSize; //图标大小 static int AppListBigIconSize;